Skip to content

Commit ee356e6

Browse files
BenHuddlestondaverigby
authored andcommitted
MB-34017: Correct Disk snapshot marker to not send 0 value
A Disk snapshot will now send a HCS value from the active node to the replica node. This value could be 0 if no SyncWrites have been completed. If this is the case, we should not send a 0 HCS as there is no need and it will cause a pre-condition to fail in the flusher on the replica. Change-Id: Ic0708ee4df90d2b1d2fe9f6879fb58838738255f Reviewed-on: http://review.couchbase.org/113492 Reviewed-by: Dave Rigby <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent eae119e commit ee356e6

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

daemon/protocol/mcbp/dcp_snapshot_marker_executor.cc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ void dcp_snapshot_marker_executor(Cookie& cookie) {
4040
const auto* v2Payload =
4141
reinterpret_cast<const DcpSnapshotMarkerV2Payload*>(
4242
extra.data());
43+
44+
// HCS should never be sent as 0 or a pre-condition will throw in
45+
// the replicas flusher
46+
if (v2Payload->getHighCompletedSeqno() == 0) {
47+
// Not success so just disconnect
48+
connection.setState(StateMachine::State::closing);
49+
return;
50+
}
4351
hcs = v2Payload->getHighCompletedSeqno();
4452
}
4553

engines/ep/src/dcp/active_stream.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -295,14 +295,16 @@ void ActiveStream::markDiskSnapshot(
295295
startSeqno,
296296
endSeqno);
297297
// If the stream supports SyncRep then send the HCS in the
298-
// SnapshotMarker
298+
// SnapshotMarker if it is not 0
299+
auto sendHCS = supportSyncReplication() && highCompletedSeqno &&
300+
*highCompletedSeqno != 0;
299301
pushToReadyQ(std::make_unique<SnapshotMarker>(
300302
opaque_,
301303
vb_,
302304
startSeqno,
303305
endSeqno,
304306
MARKER_FLAG_DISK | MARKER_FLAG_CHK,
305-
supportSyncReplication() ? highCompletedSeqno : boost::none,
307+
sendHCS ? highCompletedSeqno : boost::none,
306308
sid));
307309
lastSentSnapEndSeqno.store(endSeqno, std::memory_order_relaxed);
308310

0 commit comments

Comments
 (0)