feat(rdb_load): add support for loading huge lists (#3850)

* feat(rdb_load): add support for loading huge lists

* feat(rdb_load): add EnsureObjEncoding
This commit is contained in:
Andy Dunstall 2024-10-02 13:24:39 +01:00 committed by GitHub
parent a01dfcb5b6
commit a066579930
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 99 additions and 56 deletions

View file

@ -624,4 +624,24 @@ TEST_F(RdbTest, LoadHugeZSet) {
ASSERT_EQ(100000, CheckedInt({"zcard", "test:1"}));
}
// Tests loading a huge list, where the list is loaded in multiple partial
// reads.
TEST_F(RdbTest, LoadHugeList) {
// Add 2 lists with 100k elements each (note must have more than 512*8Kb
// elements to test partial reads).
Run({"debug", "populate", "2", "test", "100", "rand", "type", "list", "elements", "100000"});
ASSERT_EQ(100000, CheckedInt({"llen", "test:0"}));
ASSERT_EQ(100000, CheckedInt({"llen", "test:1"}));
RespExpr resp = Run({"save", "df"});
ASSERT_EQ(resp, "OK");
auto save_info = service_->server_family().GetLastSaveInfo();
resp = Run({"dfly", "load", save_info.file_name});
ASSERT_EQ(resp, "OK");
ASSERT_EQ(100000, CheckedInt({"llen", "test:0"}));
ASSERT_EQ(100000, CheckedInt({"llen", "test:1"}));
}
} // namespace dfly