Setting the metadata version key

When I try to set the metadata version key using the SetVersionstampedValue atomic operation, the transaction always returns with the error code 2000 (“Invalid API call”). I’m trying to set a value where the first 10 bytes are the versionstamp and the last 8 bytes are a 64-bit uint (18 bytes in total). I’m doing this via the golang client:

// 10 bytes for the version stamp, 8 bytes
// for my data, 4 bytes for the offset.
key := fdb.Key(append([]byte{0xff}, []byte("/metadataVersion")...)
param := make([]byte, 10+8+4)
for i := 0; i < 8; i++ {
  param[10+i] = myData[i]
}
transaction.SetVersionstampedValue(key, param)

I noticed the Go bindings have a test for this function, but it’s using API version 400. I change the MustAPIVersion() call to use 610 (which is the version I’m using) then the set transaction begins to error out.

How do I use the SetVersionstampedValue operation on API version 610?

It unfortunately appears this feature isn’t documented at all and the error here isn’t particularly helpful. The reason this is happening is because setting the metadata version key requires a very specific value for the operand: 14 consecutive null bytes (\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00). The last 4 bytes are to indicate an offset of 0, and while I guess there’s no technical reason that the first 10 bytes be anything specific, it is enforcing that too.

The result of this is that the value written to this key will be only the 10-byte versionstamp. It does not support attaching arbitrary additional data to the value.

If you try it with param set as I’ve described, are you able to complete this operation successfully?