@@ -271,7 +271,8 @@ ActiveStream::ActiveStream(EventuallyPersistentEngine* e,
271271 includeValue(includeVal),
272272 includeXattributes(includeXattrs),
273273 includeDeleteTime(includeDeleteTime),
274- filter(filter, manifest) {
274+ filter(filter, manifest),
275+ cursorName(n + std::to_string(cursorUID.fetch_add(1 ))) {
275276 const char * type = " " ;
276277 if (flags_ & DCP_ADD_STREAM_FLAG_TAKEOVER) {
277278 type = " takeover " ;
@@ -376,7 +377,7 @@ void ActiveStream::registerCursor(CheckpointManager& chkptmgr,
376377 uint64_t lastProcessedSeqno) {
377378 try {
378379 CursorRegResult result = chkptmgr.registerCursorBySeqno (
379- name_ , lastProcessedSeqno, MustSendCheckpointEnd::NO);
380+ cursorName , lastProcessedSeqno, MustSendCheckpointEnd::NO);
380381 /*
381382 * MB-22960: Due to cursor dropping we re-register the replication
382383 * cursor only during backfill when we mark the disk snapshot. However
@@ -885,8 +886,9 @@ void ActiveStream::addTakeoverStats(ADD_STAT add_stat, const void *cookie,
885886
886887 size_t vb_items = vb.getNumItems ();
887888 size_t chk_items =
888- vb_items > 0 ? vb.checkpointManager ->getNumItemsForCursor (name_)
889- : 0 ;
889+ vb_items > 0
890+ ? vb.checkpointManager ->getNumItemsForCursor (cursorName)
891+ : 0 ;
890892
891893 size_t del_items = 0 ;
892894 try {
@@ -945,7 +947,7 @@ std::unique_ptr<DcpResponse> ActiveStream::nextQueuedItem() {
945947bool ActiveStream::nextCheckpointItem () {
946948 VBucketPtr vbucket = engine->getVBucket (vb_);
947949 if (vbucket &&
948- vbucket->checkpointManager ->getNumItemsForCursor (name_ ) > 0 ) {
950+ vbucket->checkpointManager ->getNumItemsForCursor (cursorName ) > 0 ) {
949951 // schedule this stream to build the next checkpoint
950952 auto producer = producerPtr.lock ();
951953 if (!producer) {
@@ -1092,7 +1094,7 @@ std::vector<queued_item> ActiveStream::getOutstandingItems(VBucket& vb) {
10921094 chkptItemsExtractionInProgress.store (true );
10931095
10941096 auto _begin_ = ProcessClock::now ();
1095- vb.checkpointManager ->getAllItemsForCursor (name_ , items);
1097+ vb.checkpointManager ->getAllItemsForCursor (cursorName , items);
10961098 engine->getEpStats ().dcpCursorsGetItemsHisto .add (
10971099 std::chrono::duration_cast<std::chrono::microseconds>(
10981100 ProcessClock::now () - _begin_));
@@ -1451,7 +1453,7 @@ void ActiveStream::scheduleBackfill_UNLOCKED(bool reschedule) {
14511453 try {
14521454 std::tie (curChkSeqno, tryBackfill) =
14531455 vbucket->checkpointManager ->registerCursorBySeqno (
1454- name_ ,
1456+ cursorName ,
14551457 lastReadSeqno.load (),
14561458 MustSendCheckpointEnd::NO);
14571459 } catch (std::exception& error) {
@@ -1553,7 +1555,7 @@ void ActiveStream::scheduleBackfill_UNLOCKED(bool reschedule) {
15531555 try {
15541556 CursorRegResult result =
15551557 vbucket->checkpointManager ->registerCursorBySeqno (
1556- name_ ,
1558+ cursorName ,
15571559 lastReadSeqno.load (),
15581560 MustSendCheckpointEnd::NO);
15591561
@@ -1777,7 +1779,7 @@ size_t ActiveStream::getItemsRemaining() {
17771779 // Items remaining is the sum of:
17781780 // (a) Items outstanding in checkpoints
17791781 // (b) Items pending in our readyQ, excluding any meta items.
1780- return vbucket->checkpointManager ->getNumItemsForCursor (name_ ) +
1782+ return vbucket->checkpointManager ->getNumItemsForCursor (cursorName ) +
17811783 readyQ_non_meta_items;
17821784}
17831785
@@ -1826,7 +1828,7 @@ bool ActiveStream::dropCheckpointCursor_UNLOCKED() {
18261828 notifyStreamReady ();
18271829 }
18281830 /* Drop the existing cursor */
1829- return vbucket->checkpointManager ->removeCursor (name_ );
1831+ return vbucket->checkpointManager ->removeCursor (cursorName );
18301832}
18311833
18321834EXTENSION_LOG_LEVEL ActiveStream::getTransitionStateLogLevel (
@@ -1864,10 +1866,12 @@ void ActiveStream::notifyStreamReady(bool force) {
18641866void ActiveStream::removeCheckpointCursor () {
18651867 VBucketPtr vb = engine->getVBucket (vb_);
18661868 if (vb) {
1867- vb->checkpointManager ->removeCursor (name_ );
1869+ vb->checkpointManager ->removeCursor (cursorName );
18681870 }
18691871}
18701872
1873+ std::atomic<uint64_t > ActiveStream::cursorUID;
1874+
18711875NotifierStream::NotifierStream (EventuallyPersistentEngine* e,
18721876 std::shared_ptr<DcpProducer> p,
18731877 const std::string& name,
0 commit comments