Skip to content

Commit 6e4b5df

Browse files
committed
[BP] MB-55535: Fix SnapshotMarker check in CollectionsSeqnoAdvanced tests
And re-enable the check in all testsuite tests. Change-Id: If07043475a743bf0088e57567b856468d8e41368 Reviewed-on: https://review.couchbase.org/c/kv_engine/+/200040 Reviewed-by: Trond Norbye <[email protected]> Tested-by: Paolo Cocchi <[email protected]> Well-Formed: Restriction Checker
1 parent 86b57db commit 6e4b5df

File tree

2 files changed

+15
-24
lines changed

2 files changed

+15
-24
lines changed

engines/ep/src/dcp/response.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,9 @@ uint32_t MutationConsumerMessage::getMessageSize() const {
149149
}
150150

151151
std::ostream& operator<<(std::ostream& os, const DcpResponse& r) {
152-
os << "DcpResponse[" << &r << "] with"
153-
<< " event:" << r.to_string();
152+
os << "DcpResponse[" << &r << "]"
153+
<< " event:" << r.to_string() << " seqno:"
154+
<< (r.getBySeqno() ? std::to_string(*r.getBySeqno()) : "nullopt");
154155
return os;
155156
}
156157

engines/ep/tests/module_tests/collections/collections_seqno_advance.cc

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ class CollectionsSeqnoAdvanced
9191
IncludeXattrs::Yes,
9292
IncludeDeletedUserXattrs::No,
9393
R"({"collections":["9"]})");
94+
95+
// Always queue an initial checkpoint_start item for making the final
96+
// SnapshotMarker's flags easily predictable.
97+
// The test-suites stresses extra operations at the end of each test
98+
// (see ::TearDown()), so this step doesn't invalidate any test.
99+
queueCPStart();
94100
}
95101

96102
void TearDown() override {
@@ -106,25 +112,8 @@ class CollectionsSeqnoAdvanced
106112
for (const auto& e : expected.responses) {
107113
auto rsp = stream->public_nextQueuedItem(
108114
static_cast<DcpProducer&>(*producer));
109-
// Note
110-
// All the markers generated by generateExpectedResponses() are
111-
// flagged by just MARKER_FLAG_MEMORY. That was correctly mirroring
112-
// a bug that we fixed in MB-55465, ie we fix a case in the
113-
// SeqnoAdvance code where a marker is generated with a missing CHK
114-
// flag set.
115-
// Problem now in this testsuite is that is more difficult to
116-
// predict the marker flag that is being generated by ActiveStream.
117-
// Sometimes the CHK is set, other times it's not, depending on
118-
// whether the stream jumps onto new checkpoints.
119-
// For that, for now we exclude SnapshotMarker in the full check.
120-
// @todo MB-55535: Try to re-enable full SnapshotMarker verification
121115
if (rsp) {
122-
if (rsp->getEvent() == DcpResponse::Event::SnapshotMarker) {
123-
EXPECT_EQ(DcpResponse::Event::SnapshotMarker,
124-
e->getEvent());
125-
} else {
126-
EXPECT_EQ(*e, *rsp);
127-
}
116+
EXPECT_EQ(*e, *rsp);
128117
}
129118
EXPECT_TRUE(rsp) << "DCP response expected:" << e->to_string();
130119
}
@@ -206,7 +195,6 @@ class CollectionsSeqnoAdvanced
206195
StoredDocKey key(to_string(checkpoint_op), CollectionID::System);
207196
queued_item qi(new Item(key, vbid, checkpoint_op, 1, currentSeqno + 1));
208197
input.items.emplace_back(qi);
209-
checkStart = currentSeqno + 1;
210198
input.ranges.push_back({{currentSeqno + 1, currentSeqno + 1}, {}, {}});
211199
}
212200

@@ -229,8 +217,6 @@ class CollectionsSeqnoAdvanced
229217

230218
// Starting seqno, each operation will increment this
231219
uint64_t currentSeqno{1};
232-
uint64_t checkStart{1};
233-
uint64_t checkEnd{1};
234220

235221
std::shared_ptr<MockDcpProducer> producer;
236222
std::shared_ptr<MockActiveStream> stream;
@@ -342,7 +328,11 @@ void CollectionsSeqnoAdvanced::generateExpectedResponses() {
342328
} else {
343329
// else a snapshot will be seen (this is pushed to the front of the
344330
// expected responses)
345-
expected.snapshot(0, myHighCollectionSeqno.value(), MARKER_FLAG_MEMORY);
331+
// Note: At setup we always queue an initial checkpoint_start item, so
332+
// the CHK flag is set too in the marker
333+
expected.snapshot(0,
334+
myHighCollectionSeqno.value(),
335+
MARKER_FLAG_MEMORY | MARKER_FLAG_CHK);
346336
}
347337
}
348338

0 commit comments

Comments
 (0)