Closed EgusCpp closed 9 months ago
Update: nats CLI tool showing there is no keys (using "kv ls bucket_name"), while "kv info" shows there are still values in this bucket. Maybe it's a bug in the server itself?
Purge replace all the values for a key with a single delete marker, the key will remain but marked as deleted. You can later delete purged keys with nats kv compact
@ripienaar Thank you, seems I overlooked this function, as it seems to be missing for client library.
I believe only the go client has the compact function but might be wrong.
Hello @kozlovic ! Could we expect "kv compact" to be added to C client library in the near future?
I believe that this is what kvStore_PurgeDeletes
does (http://nats-io.github.io/nats.c/group__kv_group.html#ga34ab74b229ff88e64301ea53a274da69)
Yes, that's it, thank you! Got confused by naming, while description is not obvious when you didn't get familiar with internal structure yet.
Observed behavior
I am creating a bucket for key-value pairs, using FileStorage for persistence. Once I fill storage with values using
kvStore_CreateString
, I am able to verify keys and values withkvStore_Get
, and all of them are good. However, if I want to delete all usingkvStore_Purge
, keys and values are still sitting in the storage, despitekvStore_Purge
returns NATS_OK. Calling any ofkvStore_Status
andkvStore_Keys
I can check number of records remaining the same as I put there before deletion.Expected behavior
According to documentation, kvStore_Purge is expected to delete key and all revisions. As I am not using revisions, I would expect kvStore_Delete to do the same.
Server and client version
NATS windows server v.2.10.6 nats.c client library 3.7.1-beta
Host environment
OS:
Hardware:
Steps to reproduce
1) create bucket
2) put KV to storage
3) erase keys
4) check keys number
NOTE: if I pass options to
kvStore_Purge
filled asthen it changes nothing, i.e. records are still not removed