Skip to content

Commit

Permalink
Handle lack of key digests in BatchExists command
Browse files Browse the repository at this point in the history
  • Loading branch information
khaf committed May 27, 2021
1 parent a9ff5cd commit 70d0cbb
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions batch_command_exists.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
package aerospike

import (
"bytes"

"github.com/aerospike/aerospike-client-go/v5/types"
Buffer "github.com/aerospike/aerospike-client-go/v5/utils/buffer"
)
Expand Down Expand Up @@ -97,19 +95,13 @@ func (cmd *batchCommandExists) parseRecordResults(ifc command, receiveSize int)
return false, newCustomNodeError(cmd.node, types.PARSE_ERROR, "Received bins that were not requested!")
}

key, err := cmd.parseKey(fieldCount)
_, err := cmd.parseKey(fieldCount)
if err != nil {
return false, err
}

if bytes.Equal(key.digest[:], cmd.keys[batchIndex].digest[:]) {
// only set the results to true; as a result, no synchronization is needed
if resultCode == 0 {
cmd.existsArray[batchIndex] = true
}
} else {
return false, newCustomNodeError(cmd.node, types.PARSE_ERROR, "Unexpected batch key returned: "+key.namespace+","+Buffer.BytesToHexString(key.digest[:])+". Expected: "+Buffer.BytesToHexString(cmd.keys[batchIndex].digest[:]))
}
// only set the results to true; as a result, no synchronization is needed
cmd.existsArray[batchIndex] = resultCode == 0
}
return true, nil
}
Expand Down

0 comments on commit 70d0cbb

Please sign in to comment.