#466
BatchGetComplex doesn't work with ReadAllBins set to true
Aerospike server version: 7.2.0.6_1 Aerospike client (golang) version: v7.8.0
Below code fails with ResultCode: PARAMETER_ERROR, Iteration: 0, InDoubt: false, Node: BB9060012AC4202 [::1]:3000: No operations were passed. when it calls BatchGetComplex(...).
package main
import (
"fmt"
"net"
"strconv"
"github.com/aerospike/aerospike-client-go/v7"
)
func p(err any) {
if err != nil {
panic(err)
}
}
func createAerospikeClient(addr string) *aerospike.Client {
host, portStr, err := net.SplitHostPort(addr)
p(err)
port, err := strconv.Atoi(portStr)
p(err)
client, err := aerospike.NewClient(host, port)
p(err)
return client
}
func main() {
client := createAerospikeClient("localhost:3000")
key, err := aerospike.NewKey("namespace", "set", "key")
p(err)
rec, err := client.Get(nil, key)
p(err)
fmt.Printf("Get() record: %+v\n", rec)
read := aerospike.NewBatchRead(nil, key, nil)
read.ReadAllBins = true
// read := aerospike.NewBatchReadOps(nil, key, aerospike.GetOp())
reads := []*aerospike.BatchRead{read}
policy := aerospike.NewBatchPolicy()
p(client.BatchGetComplex(policy, reads))
fmt.Printf("BatchGetComplex() record: %+v\n", read.Record)
}But if we replace
read := aerospike.NewBatchRead(nil, key, nil)
read.ReadAllBins = truewith
read := aerospike.NewBatchReadOps(nil, key, aerospike.GetOp())then BatchGetComplex(...) works.
Activity
3I am upgrading the aerospike client in an existing app.
I'm experiencing the same issue after upgrading from v6 to v7 (currently on v7.10.2). The proposed fix (using aerospike.NewBatchReadOps(nil, key, aerospike.GetOp())) worked for me, but the latency of calls increased by 0.2ms on our shared clusters. I'm not sure whether the slowdown is due to aerospike.NewBatchReadOps() itself or to BatchGetComplex()
I cannot reproduce this issue in
v8of the client. Are you trying to use this in an existing app or a new app?