When a new cluster is created, it is possible that the \xFF/metadataVersion system key is not yet present.
I’m adding a bunch of API to return the value of that field as a versionstamp, and was wondering what should be the default value if the key is not present?
Previously, I was returning the bytes as-is, so the value was “null”. I’m considering returning the empty versionstamp (10 zero-bytes) instead. Is this a good default value?
Bonus question: is it ok to expect the value of the metadata version key to always to a valid versionstamp (10 and only 10 bytes) or can it be something else?
Yes but the code does not seem to check the offset of the versionstamp? Could I write a 100-byte value with a versionstamp at offset 42 with a SetVersionstampedValue and still succeed the check?
I’m unsure if I can safely change the signature of accessing the metadataVersion in my binding to return a VersionStamp, instead of returning a byte buffer and only rely on binary ordering to compare it to the previously cached value.
By the way, if SetVersionstampedValue with offset non-zero is allowed for this key, won’t this break cache layers which rely on ordering, since the leading bytes could be whatever ?
This means I have to change some things in my binding because the spot occupied by a versionstamp could be any bytes, while here I have to force it to all-zeroes
So the good news is that I can safely change the API to expose the metadata version as a parsed versionstamp (with value “0” if missing), instead of a byte buffer.