lakeFS
lakeFS copied to clipboard
KV Store: Change DELETE interface to provide indication on deleted item
In KV, Delete item is an idempotent operation, which succeeds whether the item existed in the store or not. In DB we relied on the postgres DELETE command which failed if the item didn't exist. To simulate this behavior in KV we perform a GET before DELETE and return the relevant error in case the item doesn't exist. In some places, such as the StagingManager's DropKey, it breaks the atomicity of the operation and exposes us to a race.
The suggestion is to provide indication for whether the item was actually deleted either by:
- Returning an error if the item does not exist
- Return an indication on the deleted item (or number of item that have been actually deleted)
This functionality is supported both in postgres and in dynamodb.