Commit a64f3beb authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Correctly handle the case of lease-release called on non-existing key

parent 57a22892
Pipeline #425441 passed with stages
in 31 minutes and 24 seconds
......@@ -1153,6 +1153,11 @@ rocksdb::Status StateMachine::lease_release(StagingArea &stagingArea, const std:
WriteOperation operation(stagingArea, key, KeyType::kLease);
if(!operation.valid()) return wrong_type();
if(!operation.keyExists()) {
operation.finalize(0u);
return rocksdb::Status::NotFound();
}
KeyDescriptor &descriptor = operation.descriptor();
ExpirationEventLocator event(descriptor.getEndIndex(), key);
......
......@@ -769,6 +769,8 @@ TEST_F(State_Machine, Leases) {
ASSERT_OK(stateMachine()->exists(keys.begin(), keys.end(), count) );
ASSERT_EQ(count, 0);
ASSERT_NOTFOUND(stateMachine()->lease_release("not-existing"));
{
StagingArea stagingArea(*stateMachine());
DescriptorLocator locator("my-lease");
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment