chore(rdb): move object creation during loading to shard threads. (#188)

Related to #159. Before this change, rdb loading thread has been creating all the redis objects as well.
Now we separate rdb file parsing and objects creation. File parsing phase produces a load trace of one or more binary blobs.
Those blobs are then passed to the threads that are responsible to manage the objects.
The second phase is object creation based on the trace that was passed. Finally those binary blobs are destroyed.
As a result, each thread creates objects using the memory allocator it owns and memory stats become consistent.

Signed-off-by: Roman Gershman <roman@dragonflydb.io>
This commit is contained in:
Roman Gershman 2022-07-04 19:08:13 +03:00 committed by GitHub
parent 8cb486a690
commit 55389d9be5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 760 additions and 395 deletions

View file

@ -97,6 +97,9 @@ TEST_F(RdbTest, LoadSmall6) {
EXPECT_THAT(StrArray(resp.GetVec()[1]),
UnorderedElementsAre("list1", "hset_zl", "list2", "zset_sl", "intset", "set1",
"zset_zl", "hset_ht", "intkey", "strkey"));
EXPECT_THAT(Run({"get", "intkey"}), "1234567");
EXPECT_THAT(Run({"get", "strkey"}), "abcdefghjjjjjjjjjj");
resp = Run({"smembers", "intset"});
ASSERT_THAT(resp, ArgType(RespExpr::ARRAY));
EXPECT_THAT(resp.GetVec(),