Fix batch_operate for multi-node cluster #136
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What
That PR fixes an issue of missing records when the
client.batch_operate
is used with multipleBatchRead
on a multi-node setup.Why
With 2+ nodes,
batch_operate
with more than oneBatchRead
record will only update records with results from the first node. Or it updates records with wrong results (from other records).To demonstrate, the following existing specs will fail when run on a multi-node cluster, but they're OK on a single-node run:
Notes
However, I'm not entirely sure the fix is correct, since I don't know what was the original purpose of having all
records
andbatch.records
available inBatchOperateCommand
. I can see both are used to write the data offset.aerospike-client-ruby/lib/aerospike/command/batch_operate_command.rb
Lines 53 to 55 in fb54d1d
aerospike-client-ruby/lib/aerospike/command/batch_operate_command.rb
Line 81 in fb54d1d
At the same time,
BatchOperateCommand
is created per each batch node:aerospike-client-ruby/lib/aerospike/client.rb
Lines 1002 to 1007 in fb54d1d
So, feedback is appreciated.
But as it stands right now,
batch_operate
cannot be used to read multiple records in a multi-node setup. It might be also a good idea to run tests in multi-node setup in the github workflow.