aerospike/aerospike-client-ruby

ResultCode 21

ook opened this issue · 6 comments

ook commented

I met this exception:

/home/ook/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/aerospike-1.0.1/lib/aerospike/command/write_command.rb:52:in `parse_result': ResultCode 21 unknown in the client. Please file a github issue. (Aerospike::Exceptions::Aerospike)
    from /home/ook/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/aerospike-1.0.1/lib/aerospike/command/command.rb:458:in `execute'
    from /home/ook/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/aerospike-1.0.1/lib/aerospike/client.rb:105:in `put'

What means that ResultCode 21?

Status code 21 is AEROSPIKE_ERR_BIN_NAME, which means you've been trying to write a bin with a name longer than 14 characters. See the FAQ.

ook commented

Thanks for your answer @rbotzer . Maybe I'm missing something, but I try to write a key which bin's name is a formatted date (8 chars YYYYMMDD). Here the key generation and inspect output:

@key = Aerospike::Key.new(@namespace, 'teleinfo', Time.now.strftime('%Y%m%d'))
=> #<Aerospike::Key:0xb7ec7150 @namespace="sweethome", @set_name="teleinfo", @user_key=#<Aerospike::StringValue:0xb7ec70f0 @value="20150428">, @digest="\xF6\xCB\xD7\xB0\x86\bh\x02T\f\xD4a\x19PHK\xDD!\x89\xEF">

This code worked for 20 days straight and suddenly raise StatusCode 21. I don't get it.

ook commented

Oh!

186      *  Sent too-long bin name (should be impossible in this client) or exceeded
187      *  namespace's bin name quota.

The name quota part seems far more interesting, since I wasn't deleting bin's keys. Not impossible I hit the 32K bins limit. Will train my as-cli -foo to check it.

ook commented

Annoying to have to cold restart the server to reclaim some bin's names…
So, I convert this entry to explicit the Error 21 :) (PR incoming)

Ah, you were generating bins on the fly based on datetime. Yes, the 32K bin limit is quite real, and reclaiming bin names is an active topic internally.

For now you should probably use a 'day' bin and have a map of values in it YYYYMMDD => value.

khaf commented

Fixed and Released.