aerospike-client-go: PARAMETER_ERROR using expressions and batch write

Trying to implement conditional update via expressions using versioning for records. BatchOperate doesn’t return any error, but the data is not written to aerospike.

UPD: i’ve noticed that the record has ResultCode: PARAMETER_ERROR inside after the BatchOperate is called.

Is it not possible to do batch writes with expressions? Or maybe there should be some better error? Removing the filter expression makes the record being written. Chaning filter expression to any other doesn’t help as well. Here’s the example of code i’m using

acc := Account{
	Pubkey: 	"test123",
	Data:       []byte{1, 2, 3},
	Version:	1,
}

key, err := aero.NewKey(namespace, set, acc.Pubkey)
if err != nil {
	return err
}

// Create the policy
writePolicy := aero.NewBatchWritePolicy()
writePolicy.FilterExpression = aero.ExpLess(aero.ExpIntBin(binVersion), aero.ExpIntVal(acc.Version))

// Create write operation
record := aero.NewBatchWrite(writePolicy, key,
	aero.PutOp(aero.NewBin(binData, acc.Data)),
	aero.PutOp(aero.NewBin(binVersion, acc.Version)),
)

records := []aero.BatchRecordIfc{record}
err := s.conn.BatchOperate(nil, records)

fmt.Println(err, records)

The result is: nil, [Key test:accounts:test123:d1 02 ed d3 9d bd 5b a9 7e 97 e2 45 8f b6 15 49 54 40 e6 d1 , Record: <nil>, ResultCode: PARAMETER_ERROR, InDoubt: false, Err: <nil>]

The setup i’m using:

  • ubuntu 20.04
  • aerospike-server-community 6.2.0.3
  • golang 1.19
  • aerspike-client v6@v6.10.0

Thanks

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 21

Most upvoted comments

I am actively working on it. I had to develop a complex testing scheme to be able to reliably reproduce the issue. But now that I have, I’m trying to find out what’s causing it. It only happens under certain complex conditions (which you have hit!). I’ll try to push the fix out tomorrow, or latest Monday. Sorry for the inconvenience and the slow pace of progress, but I promise this time to test it well enough to make sure the thing works as expected.

Sorry I’ve been horizontal this past week. I’ll release the fix on Monday.

@wedancedalot I expect it to work. Sorry I’ve been distracted a bit, will take care of this tomorrow.

I usually use context any debug myself.

Your code seems to be ok. To see the actual error, you need to take a look at the server logs.