Apurva Mayank
Apurva Mayank

Reputation: 747

How to resolve Aerospike::Exceptions::Aerospike: Unsupported Server Feature for Ruby Client?

While I am trying to write into aerospike using ruby client I am getting the following exception:-

Aerospike::Exceptions::Aerospike: Unsupported Server Feature

Details:-

Aerospike version:- 4.3
Client: [Ruby] aerospike - 2.4.0
namespaces: NS1, NS2, NS3 

Note: NS2 and NS3 have single-bin true data-in-index true

Code(which causes the exception):-

client = Aerospike::Client.new('aerospike:3000')
key = Aerospike::Key.new('NS2', 'set name', 'this is the key')
data = { 'record'  => 1 }
client.put(key, data) # this line raises the exception
Aerospike::Exceptions::Aerospike: Unsupported Server Feature

The exception is not raised if I change NS2 in the key to NS1.

Upvotes: 1

Views: 958

Answers (1)

Jan Hecking
Jan Hecking

Reputation: 949

The "Unsupported Server Feature" error you are getting is because the Ruby client is sending the user key to the server by default, but the Aerospike server does not support storing the user key for the data-in-memory & single-bin setup. You should see an error message like this in your server logs:

Sep 13 2018 02:42:20 GMT: WARNING (rw): (rw_utils.c:153) {sbin} can't store key if data-in-memory & single-bin

You'll need to disable sending the key as part of the put request by setting the send_key write policy setting to false:

$ bundle exec irb
2.5.0 :001 > require 'aerospike'; include Aerospike;
 => Object
2.5.0 :002 > client = Client.new; key = Key.new('sbin', 'test', 'foo'); nil
 => nil
2.5.0 :003 > client.put(key, Bin.new('', 42), send_key: false)
 => nil
2.5.0 :004 > client.get(key).bins['']
 => 42

Upvotes: 5

Related Questions