Skip to content

Commit 417f820

Browse files
committed
MB-44877: Introduce ActiveStream::lastSentSeqnoAdvance
Useful info on stream-filtering for understanding whether lastSentSeqno is a mutation or a seqno-advance. Change-Id: Ib134373ff482889b00b0dafc8f8895ddfddb99ba Reviewed-on: http://review.couchbase.org/c/kv_engine/+/151111 Reviewed-by: Richard de Mellow <[email protected]> Tested-by: Build Bot <[email protected]>
1 parent 103f44a commit 417f820

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

engines/ep/src/dcp/active_stream.cc

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ ActiveStream::ActiveStream(EventuallyPersistentEngine* e,
5656
includeDeletedUserXattrs(includeDeletedUserXattrs),
5757
lastReadSeqnoUnSnapshotted(st_seqno),
5858
lastSentSeqno(st_seqno),
59+
lastSentSeqnoAdvance(0),
5960
curChkSeqno(st_seqno),
6061
takeoverState(vbucket_state_pending),
6162
itemsFromMemoryPhase(0),
@@ -825,6 +826,14 @@ void ActiveStream::addStats(const AddStatFn& add_stat, const void* c) {
825826
name_.c_str(),
826827
vb_.get());
827828
add_casted_stat(buffer, lastSentSeqno.load(), add_stat, c);
829+
830+
checked_snprintf(buffer,
831+
bsize,
832+
"%s:stream_%d_last_sent_seqno_advance",
833+
name_.c_str(),
834+
vb_.get());
835+
add_casted_stat(buffer, lastSentSeqnoAdvance.load(), add_stat, c);
836+
828837
checked_snprintf(buffer,
829838
bsize,
830839
"%s:stream_%d_last_sent_snap_end_seqno",
@@ -2178,8 +2187,9 @@ std::unique_ptr<DcpResponse> ActiveStream::makeEndStreamResponse(
21782187
}
21792188

21802189
void ActiveStream::queueSeqnoAdvanced() {
2181-
pushToReadyQ(std::make_unique<SeqnoAdvanced>(
2182-
opaque_, vb_, sid, lastSentSnapEndSeqno.load()));
2190+
const auto seqno = lastSentSnapEndSeqno.load();
2191+
pushToReadyQ(std::make_unique<SeqnoAdvanced>(opaque_, vb_, sid, seqno));
2192+
lastSentSeqnoAdvance.store(seqno);
21832193
}
21842194

21852195
bool ActiveStream::isDiskOnly() const {

engines/ep/src/dcp/active_stream.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,9 @@ class ActiveStream : public Stream,
677677
//! The last sequence number sent to the network layer
678678
std::atomic<uint64_t> lastSentSeqno;
679679

680+
//! The seqno of the last SeqnoAdvance sent
681+
std::atomic<uint64_t> lastSentSeqnoAdvance;
682+
680683
//! The last known seqno pointed to by the checkpoint cursor
681684
std::atomic<uint64_t> curChkSeqno;
682685

0 commit comments

Comments
 (0)