Remove check-fail in ExpireIfNeeded and introduce DFLY LOAD (#2699)

* chore: prevent crashing upon inconsistent expiry table

Also, introduce "DFLY LOAD <filename>" command in addition to "DEBUG LOAD"
as an official command to load snapshots into the running server.


---------

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2024-03-12 16:54:13 +02:00 committed by GitHub
parent 8a5ed442d1
commit 954780edd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 44 additions and 21 deletions

View file

@ -260,9 +260,13 @@ TEST_F(RdbTest, ReloadTtl) {
TEST_F(RdbTest, ReloadExpired) {
Run({"set", "key", "val"});
Run({"expire", "key", "2"});
sleep(2);
Run({"debug", "reload"});
auto resp = Run({"get", "key"});
RespExpr resp = Run({"save", "df"});
ASSERT_EQ(resp, "OK");
auto save_info = service_->server_family().GetLastSaveInfo();
AdvanceTime(2000);
resp = Run({"debug", "load", save_info.file_name});
ASSERT_EQ(resp, "OK");
resp = Run({"get", "key"});
ASSERT_THAT(resp, ArgType(RespExpr::NIL));
}