Java client read throws "Error Code -2: Unexpected batch key returned: null,,0"

I am seeing an Aerospike Java client read error when reading a record from Aerospike Enterprise server.

Aerospike Java client: 4.0.4 (I agree this is an old version. I will upgrade to later version, but I still want to understand this error, since there is a topic on how the clients are backward compatible - Java client and server compatibility matrix).

Aerospike server: Enterprise Edition 5.7

The record I write into the server has the key - "tl:null:t034001118454:4d7dcd9166211b445fc6890aad2b28192d7b42f8".

I verified that the record is added to the server (it is a fresh installation, so there is only one record).

aql> set output json
OUTPUT = JSON
aql> set record_print_metadata true
RECORD_PRINT_METADATA = true
aql> select * from tl;

[
    [
        {
          "edigest": "TX3NkWYhG0RfxokKrSsoGS17Qvg=",
          "ttl": 172395,
          "gen": 5,
          "bins": {
            "": "78 9C 63 64 60 60 60 34 36 D1 33 30 D8 A8 6B 68 68 A1 67 62 BA A5 29 1D 2C 66 64 50 61 BA 01 C4 32 00 01 C3 78 30 B5 11 85 C3 C0 C0 74 18 A2 0E 00 F5 C5 0F 91"
          }
        }
    ],
    [
        {
          "Status": 0
        }
    ]
]

When I read the record with the Java client (same application, 4.0.4 version client), I get the following error:

2022-02-14 18:10:56.006	ERROR	com.cache.AerospikeService	Error Code -2: Unexpected batch key returned: null,,0
com.aerospike.client.AerospikeException$Parse: Error Code -2: Unexpected batch key returned: null,,0
	at com.aerospike.client.command.Batch$GetArrayCommand.parseRow(Batch.java:109)
	at com.aerospike.client.command.MultiCommand.parseGroup(MultiCommand.java:107)
	at com.aerospike.client.command.MultiCommand.parseResult(MultiCommand.java:64)
	at com.aerospike.client.command.SyncCommand.execute(SyncCommand.java:83)
	at com.aerospike.client.command.BatchExecutor.execute(BatchExecutor.java:51)
	at com.aerospike.client.AerospikeClient.get(AerospikeClient.java:1023)
	at com.cache.AerospikeService.find(AerospikeService.java:179)

What is the reason for this error? I verified the same key is used for the read and write operation.

It should be because the server is not returning the digests anymore for batch transactions. So you would have explicitly configure the client as per the 5.7 server release notes:

“The configuration parameter batch-without-digests , now defaults to true, is deprecated and will be removed in six months. Customers using clients older than a year (around the time of Server 4.9 which introduced batch-without-digests ) will now have to explicitly set the batch-without-digests configuration item to false.”

1 Like

@meher thanks for the reply. So even if I enable the configuration parameter batch-without-digests , I still need to upgrade the Java client to 4.4.5, since this option only works with 4.4.5. Is that correct?

From the docs:

Note: To use batch-without-digests , the minimum client versions required are as follows:

  • Java client version 4.4.5

Oh, yes, good catch. You would indeed have to upgrade the client.

1 Like

This topic was automatically closed 84 days after the last reply. New replies are no longer allowed.