1

I am processing an avro file with a list of records and doing a client.put for each record to my local Aerospike store.

For some reason, put for a certain number of records is succeeding and it's not for the rest. I am doing this -

client.put(writePolicy, recordKey, bins);

The related values for the failed call are -

namespace = test

setname = test_set

userkey = some_string

write policy = null

Bins -

is_user:1

prof_loc:530049,530046,530032,530031,530017,530016,500046

rfm:Platinum

store_browsed:some_string

store_purch:some_string

city_id:null

Log Snippet -

com.aerospike.client.AerospikeException: Error Code 4: Parameter error at com.aerospike.client.command.WriteCommand.parseResult(WriteCommand.java:72) at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:56) at com.aerospike.client.AerospikeClient.put(AerospikeClient.java:338)

What could possibly be the issue?

2
  • 1
    Any hint in server-side log file (/var/log/aerospike/aerospike.log) ? Also, you can check where that error is raised from the Github repo: github.com/aerospike/aerospike-server/… Commented Dec 29, 2015 at 18:21
  • @ManuelArwedSchmidt Thanks for the input. I finally resolved the issue. Check the answer. Commented Dec 30, 2015 at 11:00

2 Answers 2

5

Finally. Resolved!

I was using the REPLACE RecordsExistsAction in this case. Any bin with null value will fail in this configuration. Aerospike treats a null value in a bin as equivalent to removing that bin value from the record for a key. Thus REPLACE configuration doesn't make sense for such an operation, and hence a parameter error - Invalid DB operation.

UPDATE config on the other hand will work perfectly fine.

Sign up to request clarification or add additional context in comments.

2 Comments

Glad you were able to solve it. Hint: Once you 'accept' your own answer (green tick), this question will be visibly closed and people won't get here when searching for questions they can answer.
Did that. I had to wait for 24 hours
0

Aerospike allows reading and writing with great flexibility. For developers to harness this functionality, Aerospike exposes great number of variables on both Policy and WritePolicy, which at times can be intimidating and error prone to beginners. Parameter error simply means that some of the configurations are not in coherence. An easy start would be to use the default read or write policy, which can be obtained by passing null as the policy. Eg:

aeroClient.put(null, key, new Bin("binName", object));

Below is aerospike put method code snippet

    public final void put(WritePolicy policy, Key key, Bin... bins) throws AerospikeException {
    if (policy == null) {
        policy = writePolicyDefault;
    }
    WriteCommand command = new WriteCommand(cluster, policy, key, bins, Operation.Type.WRITE);
    command.execute();
}

I recently got this error, because the expiration value that I was using in writePolicy was more than the default expiration time for the cache

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.