aerospike / aerospike-client-go

Aerospike Client Go
Apache License 2.0
430 stars 199 forks source link

Reference to issue number - #388 , #394

Closed artman92 closed 1 year ago

artman92 commented 1 year ago
asKey, err := aerospike.NewKey(asNamespace, set, key)
listPolicy := aerospike.NewListPolicy(aerospike.ListOrderUnordered, aerospike.ListWriteFlagsAddUnique|aerospike.ListWriteFlagsNoFail)   

ops := []*aerospike.Operation{
        aerospike.AddOp(aerospike.NewBin(count, 1)),
        aerospike.AddOp(aerospike.NewBin(points, points)),
        aerospike.ListAppendWithPolicyOp(listPolicy, ids, id),
        aerospike.MapIncrementOp(aerospike.DefaultMapPolicy(), mapId, count, 1),
        aerospike.MapIncrementOp(aerospike.DefaultMapPolicy(), mapId, points, points),
                aerospike.GetOp()
    }

wp := as.NewWritePolicy(0, 0)
wp.RespondPerEachOp = false
record, err := asClient.Operate(wp, asKey, ops...)
fmt.Println("result->:", record, ",", err)

// output - error is coming as parameter error, Error is not coming after removing aerospike.GetOp() Can you please help with this?

As you told write_master: read-all op can't have respond-all-ops flag error is coming in this , but still same error is coming

khaf commented 1 year ago

This is a complex situation. Regardless of what you pass for RespondPerEachOp in the policy, the write operations will turn it to true (that's a server limitation). In this case, GetOp() (getting bacl all the bins in the record) is not supported. You should ask bins one by one with their names:

ops := []*aerospike.Operation{
        aerospike.AddOp(aerospike.NewBin(count, 1)),
        aerospike.AddOp(aerospike.NewBin(points, points)),
        aerospike.ListAppendWithPolicyOp(listPolicy, ids, id),
        aerospike.MapIncrementOp(aerospike.DefaultMapPolicy(), mapId, count, 1),
        aerospike.MapIncrementOp(aerospike.DefaultMapPolicy(), mapId, points, points),
                aerospike.GetBinOp(points),
                aerospike.GetBinOp(MapId),
                aerospike.GetBinOp(ids),
    }
khaf commented 1 year ago

I'm closing this issue. Feel free to open new tickets if you had any further questions.