Skip to content

Commit 675007e

Browse files
paolococchidaverigby
authored andcommitted
MB-42780: Expand tests and improve comments
+ Verify that Disk->Disk snapshot always creates new checkpoint at replica (regardless of MARKER_FLAG_CHK being sent or not) Change-Id: Ic0a1741aff10d57c0ec7be2929bba136b37f9e5a Reviewed-on: http://review.couchbase.org/c/kv_engine/+/140643 Well-Formed: Build Bot <[email protected]> Tested-by: Build Bot <[email protected]> Reviewed-by: Dave Rigby <[email protected]>
1 parent c4454a5 commit 675007e

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

engines/ep/src/dcp/passive_stream.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,11 +996,12 @@ void PassiveStream::processMarker(SnapshotMarker* marker) {
996996
// MB-42780: In general we cannot merge multiple snapshots into
997997
// the same checkpoint. The only exception is for when replica
998998
// receives multiple Memory checkpoints in a row.
999+
// Since 6.5.0 the Active behaves correctly with regard to that
1000+
// (ie, the Active always sets the MARKER_FLAG_CHK in a snapshot
1001+
// transition tha involves Disk snapshots), but older Producers
1002+
// may still miss the MARKER_FLAG_CHK.
9991003
if (prevSnapType == Snapshot::Memory &&
10001004
cur_snapshot_type == Snapshot::Memory) {
1001-
// If we are reconnecting then we need to update the snap
1002-
// end and potentially the checkpoint type as We do not send
1003-
// the CHK snapshot marker flag for disk snapshots.
10041005
ckptMgr.updateCurrentSnapshot(cur_snapshot_end.load(),
10051006
visibleSeq,
10061007
checkpointType);

engines/ep/tests/module_tests/dcp_stream_test.cc

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2646,24 +2646,34 @@ TEST_P(SingleThreadedPassiveStreamTest, ReplicaNeverMergesDiskSnapshot) {
26462646
CheckpointType::Disk /*expectedOpenCkptType*/);
26472647
}
26482648

2649-
// Memory snap but previous snap is Disk -> no merge
2649+
// From Disk to Disk + we miss the MARKER_FLAG_CHK, still not merged
26502650
{
26512651
SCOPED_TRACE("");
26522652
receiveSnapshot(5 /*snapStart*/,
26532653
5 /*snapEnd*/,
2654-
dcp_marker_flag_t::MARKER_FLAG_MEMORY,
2654+
dcp_marker_flag_t::MARKER_FLAG_DISK,
26552655
4 /*expectedNumCheckpoint*/,
2656-
CheckpointType::Memory /*expectedOpenCkptType*/);
2656+
CheckpointType::Disk /*expectedOpenCkptType*/);
26572657
}
26582658

2659+
// Memory snap but previous snap is Disk -> no merge
26592660
{
26602661
SCOPED_TRACE("");
26612662
receiveSnapshot(6 /*snapStart*/,
26622663
6 /*snapEnd*/,
2663-
dcp_marker_flag_t::MARKER_FLAG_MEMORY | MARKER_FLAG_CHK,
2664+
dcp_marker_flag_t::MARKER_FLAG_MEMORY,
26642665
5 /*expectedNumCheckpoint*/,
26652666
CheckpointType::Memory /*expectedOpenCkptType*/);
26662667
}
2668+
2669+
{
2670+
SCOPED_TRACE("");
2671+
receiveSnapshot(7 /*snapStart*/,
2672+
7 /*snapEnd*/,
2673+
dcp_marker_flag_t::MARKER_FLAG_MEMORY | MARKER_FLAG_CHK,
2674+
6 /*expectedNumCheckpoint*/,
2675+
CheckpointType::Memory /*expectedOpenCkptType*/);
2676+
}
26672677
}
26682678

26692679
TEST_P(SingleThreadedActiveStreamTest,

0 commit comments

Comments
 (0)