I’m trying to add support for Versionstamps to the third party FDBSwift bindings, but I’m running into a bit of an issue: every few runs, calling fdb_future_get_value() on the future from fdb_transaction_get_versionstamp() will return 0 bytes (out_present is also 0). For all I know, I believe that my versionstamped key has been written to the database successfully and there are no other errors, so I’m open to any ideas anyone might have regarding why I’m seeing this behavior.
To be clear, this works fine nine times out of ten — it just fails to return a useful value every so often, so I’m concerned I’m doing something fundamentally wrong.
I can confirm I’m no longer getting erratic behavior when using fdb_future_get_key()! Thank you @andrew.noyes, you have saved many of my future brain cells!
I presume it’s because, as it often happens with such sophisticated systems AND low-level interfaces, calling fdb_future_get_value instead of fdb_future_get_key in this case results in undefined behaviour, and adding checks would make all database operations slower.