Commit 11151dcb authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

Prevent crash when DEL is ran on a lease key

parent c5d6a409
Pipeline #1473204 failed with stages
in 48 minutes and 52 seconds
......@@ -2,6 +2,11 @@
## Unreleased
### Bug fixes
- Running ``DEL`` on a lease key would cause all nodes in a cluster to crash
with an assertion. ``DEL`` will now simply release the given lease, as if
``lease-release`` had been called.
### New features
- Implement command ``quarkdb-verify-checksum`` for manually running a full checksum scan.
- Addition of ``quarkdb-validate-checkpoint`` tool for ensuring that a given
......
......@@ -1732,6 +1732,9 @@ rocksdb::Status StateMachine::del(StagingArea &stagingArea, const ReqIterator &s
remove_all_with_prefix(indexLocator.toView(), count, stagingArea);
if(count != keyInfo.getSize()) qdb_throw("mismatch between keyInfo counter and number of elements deleted by remove_all_with_prefix: " << count << " vs " << keyInfo.getSize());
}
else if(keyInfo.getKeyType() == KeyType::kLease) {
THROW_ON_ERROR(lease_release(stagingArea, it->sv(), 0u));
}
else {
qdb_throw("DEL called on unknown keytype - should never happen");
}
......
......@@ -774,13 +774,13 @@ TEST_F(Raft_e2e, test_many_redis_commands) {
std::future<redisReplyPtr> l11 = tunnel(leaderID)->exec("lease-acquire", "mykey", "holder2", "10000");
std::future<redisReplyPtr> l12 = tunnel(leaderID)->exec("lease-acquire", "mykey", "holder2", "10000");
std::future<redisReplyPtr> l13 = tunnel(leaderID)->exec("lease-release", "mykey");
std::future<redisReplyPtr> l13 = tunnel(leaderID)->exec("del", "mykey");
std::future<redisReplyPtr> l14 = tunnel(leaderID)->exec("lease-acquire", "mykey", "holder2", "10000");
std::future<redisReplyPtr> l15 = tunnel(leaderID)->exec("lease-get-pending-expiration-events");
ASSERT_REPLY(l11, "ACQUIRED");
ASSERT_REPLY(l12, "RENEWED");
ASSERT_REPLY(l13, "OK");
ASSERT_REPLY(l13, 1);
ASSERT_REPLY(l14, "ACQUIRED");
l15.get(); // ignore for now..
......
Markdown is supported
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