Aerospike: how do I get record key?

后端 未结 2 598
青春惊慌失措
青春惊慌失措 2020-12-18 23:40

Aerospike client has scanAll method for reading all rows from it\'s store. I use it in the folowing code:

ScanPolicy policy = new ScanPolicy();
policy.concur         


        
相关标签:
2条回答
  • 2020-12-19 00:15

    I too have faced this problem even at the time of writing we were setting the WritePolicy.sendkeys=true.

    After 2-3 days debugging found that there were some issue with aerospike client version. Initially i were using 3.0.25 but after upgrading it to 3.0.35 it started working fine.

    0 讨论(0)
  • 2020-12-19 00:20

    Aerospike uses key and set name to generate unique digest, So it stores only digest.

    While inserting one record if you set writePolicy.sendKey = true then key will be stored as metadata of record. If one record is inserted with writePolicy.sendKey = true then only you will get key in scanCallback().

    By default writePolicy.sendKey is false, so by default scanCallback() gets null as key. Thats why your key.userKey.toLong() gives NullPointerException.

    0 讨论(0)
提交回复
热议问题