Skip to content

Commit 115a3fa

Browse files
authored
fix(server): fix serialization on move with big values (#5390)
* fix server: fix serialization on move with big values Signed-off-by: adi_holden <[email protected]>
1 parent f94e786 commit 115a3fa

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/server/snapshot.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ bool SliceSnapshot::IsPositionSerialized(DbIndex id, PrimeTable::Cursor cursor)
446446
}
447447

448448
void SliceSnapshot::OnMoved(DbIndex id, const DbSlice::MovedItemsVec& items) {
449+
std::lock_guard barrier(big_value_mu_);
449450
DCHECK(!use_snapshot_version_);
450451
for (const auto& item_cursors : items) {
451452
// If item was moved from a bucket that was serialized to a bucket that was not serialized

tests/dragonfly/replication_test.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3201,7 +3201,7 @@ async def test_bug_5221(df_factory):
32013201

32023202
@pytest.mark.parametrize("proactors", [1, 4, 6])
32033203
@pytest.mark.parametrize("backlog_len", [1, 256, 1024, 1300])
3204-
async def test_partial_sync(df_factory, df_seeder_factory, proactors, backlog_len):
3204+
async def test_partial_sync(df_factory, proactors, backlog_len):
32053205
keys = 5_000
32063206
if proactors > 1:
32073207
keys = 10_000
@@ -3335,8 +3335,11 @@ async def state_transitioned_stable(
33353335

33363336

33373337
@pytest.mark.slow
3338-
async def test_replicaiton_onmove_flow(df_factory):
3339-
master = df_factory.create(proactor_threads=2, cache_mode=True)
3338+
@pytest.mark.parametrize("serialization_max_size", [1, 64000])
3339+
async def test_replication_onmove_flow(df_factory, serialization_max_size):
3340+
master = df_factory.create(
3341+
proactor_threads=2, cache_mode=True, serialization_max_chunk_size=serialization_max_size
3342+
)
33403343
replica = df_factory.create(proactor_threads=2)
33413344

33423345
df_factory.start_all([master, replica])
@@ -3345,7 +3348,7 @@ async def test_replicaiton_onmove_flow(df_factory):
33453348

33463349
key_target = 100000
33473350
# Fill master with test data
3348-
await c_master.execute_command(f"DEBUG POPULATE {key_target} key 1048 RAND")
3351+
await c_master.execute_command(f"DEBUG POPULATE {key_target} key 32 RAND TYPE hash ELEMENTS 10")
33493352
logging.debug("finished populate")
33503353

33513354
stop_event = asyncio.Event()
@@ -3355,7 +3358,7 @@ async def get_keys():
33553358
pipe = c_master.pipeline(transaction=False)
33563359
for _ in range(50):
33573360
id = random.randint(0, key_target)
3358-
pipe.get(f"key:{id}")
3361+
pipe.hlen(f"key:{id}")
33593362
await pipe.execute()
33603363

33613364
get_task = asyncio.create_task(get_keys())

0 commit comments

Comments
 (0)