@@ -1155,7 +1155,7 @@ uint32_t PassiveStream::setDead(end_stream_status_t status) {
11551155 uint32_t unackedBytes = clearBuffer ();
11561156 LOG (EXTENSION_LOG_WARNING, " %s (vb %d) Setting stream to dead state,"
11571157 " last_seqno is %llu, unackedBytes is %u, status is %s" ,
1158- consumer->logHeader (), vb_, last_seqno, unackedBytes,
1158+ consumer->logHeader (), vb_, last_seqno. load () , unackedBytes,
11591159 getEndStreamStatusStr (status));
11601160 return unackedBytes;
11611161}
@@ -1189,7 +1189,7 @@ void PassiveStream::reconnectStream(RCPtr<VBucket> &vb,
11891189 start_seqno, end_seqno_, snap_start_seqno_, snap_end_seqno_);
11901190
11911191 LockHolder lh (streamMutex);
1192- last_seqno = start_seqno;
1192+ last_seqno. store ( start_seqno) ;
11931193 pushToReadyQ (new StreamRequest (vb_, new_opaque, flags_, start_seqno,
11941194 end_seqno_, vb_uuid_, snap_start_seqno_,
11951195 snap_end_seqno_));
@@ -1216,29 +1216,29 @@ ENGINE_ERROR_CODE PassiveStream::messageReceived(DcpResponse* resp) {
12161216 {
12171217 MutationResponse* m = static_cast <MutationResponse*>(resp);
12181218 uint64_t bySeqno = m->getBySeqno ();
1219- if (bySeqno <= last_seqno) {
1219+ if (bySeqno <= last_seqno. load () ) {
12201220 LOG (EXTENSION_LOG_WARNING, " %s (vb %d) Erroneous (out of "
12211221 " sequence) mutation received, with opaque: %ld, its "
12221222 " seqno (%llu) is not greater than last received seqno "
12231223 " (%llu); Dropping mutation!" , consumer->logHeader (),
1224- vb_, opaque_, bySeqno, last_seqno);
1224+ vb_, opaque_, bySeqno, last_seqno. load () );
12251225 delete m;
12261226 return ENGINE_ERANGE;
12271227 }
1228- last_seqno = bySeqno;
1228+ last_seqno. store ( bySeqno) ;
12291229 break ;
12301230 }
12311231 case DCP_SNAPSHOT_MARKER:
12321232 {
12331233 SnapshotMarker* s = static_cast <SnapshotMarker*>(resp);
12341234 uint64_t snapStart = s->getStartSeqno ();
12351235 uint64_t snapEnd = s->getEndSeqno ();
1236- if (snapStart < last_seqno && snapEnd <= last_seqno) {
1236+ if (snapStart < last_seqno. load () && snapEnd <= last_seqno. load () ) {
12371237 LOG (EXTENSION_LOG_WARNING, " %s (vb %d) Erroneous snapshot "
12381238 " marker received, with opaque: %ld, its start (%llu), and"
12391239 " end (%llu) are less than last received seqno (%llu); "
12401240 " Dropping marker!" , consumer->logHeader (), vb_, opaque_,
1241- snapStart, snapEnd, last_seqno);
1241+ snapStart, snapEnd, last_seqno. load () );
12421242 delete s;
12431243 return ENGINE_ERANGE;
12441244 }
@@ -1333,19 +1333,20 @@ ENGINE_ERROR_CODE PassiveStream::processMutation(MutationResponse* mutation) {
13331333 return ENGINE_NOT_MY_VBUCKET;
13341334 }
13351335
1336- if (mutation->getBySeqno () > cur_snapshot_end) {
1336+ if (mutation->getBySeqno () > cur_snapshot_end. load () ) {
13371337 LOG (EXTENSION_LOG_WARNING, " %s (vb %d) Erroneous mutation [sequence "
13381338 " number (%llu) greater than current snapshot end seqno (%llu)] "
13391339 " being processed; Dropping the mutation!" , consumer->logHeader (),
1340- vb_, mutation->getBySeqno (), cur_snapshot_end);
1340+ vb_, mutation->getBySeqno (), cur_snapshot_end. load () );
13411341 return ENGINE_ERANGE;
13421342 }
13431343
13441344 ENGINE_ERROR_CODE ret;
13451345 if (saveSnapshot) {
13461346 LockHolder lh = vb->getSnapshotLock ();
13471347 ret = commitMutation (mutation, vb->isBackfillPhase ());
1348- vb->setCurrentSnapshot_UNLOCKED (cur_snapshot_start, cur_snapshot_end);
1348+ vb->setCurrentSnapshot_UNLOCKED (cur_snapshot_start.load (),
1349+ cur_snapshot_end.load ());
13491350 saveSnapshot = false ;
13501351 lh.unlock ();
13511352 } else {
@@ -1385,19 +1386,20 @@ ENGINE_ERROR_CODE PassiveStream::processDeletion(MutationResponse* deletion) {
13851386 return ENGINE_NOT_MY_VBUCKET;
13861387 }
13871388
1388- if (deletion->getBySeqno () > cur_snapshot_end) {
1389+ if (deletion->getBySeqno () > cur_snapshot_end. load () ) {
13891390 LOG (EXTENSION_LOG_WARNING, " %s (vb %d) Erroneous deletion [sequence "
13901391 " number (%llu) greater than current snapshot end seqno (%llu)] "
13911392 " being processed; Dropping the deletion!" , consumer->logHeader (),
1392- vb_, deletion->getBySeqno (), cur_snapshot_end);
1393+ vb_, deletion->getBySeqno (), cur_snapshot_end. load () );
13931394 return ENGINE_ERANGE;
13941395 }
13951396
13961397 ENGINE_ERROR_CODE ret;
13971398 if (saveSnapshot) {
13981399 LockHolder lh = vb->getSnapshotLock ();
13991400 ret = commitDeletion (deletion, vb->isBackfillPhase ());
1400- vb->setCurrentSnapshot_UNLOCKED (cur_snapshot_start, cur_snapshot_end);
1401+ vb->setCurrentSnapshot_UNLOCKED (cur_snapshot_start.load (),
1402+ cur_snapshot_end.load ());
14011403 saveSnapshot = false ;
14021404 lh.unlock ();
14031405 } else {
@@ -1435,9 +1437,9 @@ ENGINE_ERROR_CODE PassiveStream::commitDeletion(MutationResponse* deletion,
14351437void PassiveStream::processMarker (SnapshotMarker* marker) {
14361438 RCPtr<VBucket> vb = engine->getVBucket (vb_);
14371439
1438- cur_snapshot_start = marker->getStartSeqno ();
1439- cur_snapshot_end = marker->getEndSeqno ();
1440- cur_snapshot_type = ( marker->getFlags () & MARKER_FLAG_DISK) ? disk : memory;
1440+ cur_snapshot_start. store ( marker->getStartSeqno () );
1441+ cur_snapshot_end. store ( marker->getEndSeqno () );
1442+ cur_snapshot_type. store (( marker->getFlags () & MARKER_FLAG_DISK) ? disk : memory) ;
14411443 saveSnapshot = true ;
14421444
14431445 if (vb) {
@@ -1474,8 +1476,8 @@ void PassiveStream::processSetVBucketState(SetVBucketState* state) {
14741476}
14751477
14761478void PassiveStream::handleSnapshotEnd (RCPtr<VBucket>& vb, uint64_t byseqno) {
1477- if (byseqno == cur_snapshot_end) {
1478- if (cur_snapshot_type == disk && vb->isBackfillPhase ()) {
1479+ if (byseqno == cur_snapshot_end. load () ) {
1480+ if (cur_snapshot_type. load () == disk && vb->isBackfillPhase ()) {
14791481 vb->setBackfillPhase (false );
14801482 uint64_t id = vb->checkpointManager .getOpenCheckpointId () + 1 ;
14811483 vb->checkpointManager .checkAndAddNewCheckpoint (id, vb);
@@ -1499,7 +1501,7 @@ void PassiveStream::handleSnapshotEnd(RCPtr<VBucket>& vb, uint64_t byseqno) {
14991501 }
15001502 cur_snapshot_ack = false ;
15011503 }
1502- cur_snapshot_type = none;
1504+ cur_snapshot_type. store ( none) ;
15031505 vb->setCurrentSnapshot (byseqno, byseqno);
15041506 }
15051507}
@@ -1523,18 +1525,18 @@ void PassiveStream::addStats(ADD_STAT add_stat, const void *c) {
15231525 snprintf (buf, bsize, " %s:stream_%d_items_ready" , name_.c_str (), vb_);
15241526 add_casted_stat (buf, itemsReady.load () ? " true" : " false" , add_stat, c);
15251527 snprintf (buf, bsize, " %s:stream_%d_last_received_seqno" , name_.c_str (), vb_);
1526- add_casted_stat (buf, last_seqno, add_stat, c);
1528+ add_casted_stat (buf, last_seqno. load () , add_stat, c);
15271529 snprintf (buf, bsize, " %s:stream_%d_ready_queue_memory" , name_.c_str (), vb_);
15281530 add_casted_stat (buf, getReadyQueueMemory (), add_stat, c);
15291531
15301532 snprintf (buf, bsize, " %s:stream_%d_cur_snapshot_type" , name_.c_str (), vb_);
1531- add_casted_stat (buf, snapshotTypeToString (cur_snapshot_type), add_stat, c);
1533+ add_casted_stat (buf, snapshotTypeToString (cur_snapshot_type. load () ), add_stat, c);
15321534
1533- if (cur_snapshot_type != none) {
1535+ if (cur_snapshot_type. load () != none) {
15341536 snprintf (buf, bsize, " %s:stream_%d_cur_snapshot_start" , name_.c_str (), vb_);
1535- add_casted_stat (buf, cur_snapshot_start, add_stat, c);
1537+ add_casted_stat (buf, cur_snapshot_start. load () , add_stat, c);
15361538 snprintf (buf, bsize, " %s:stream_%d_cur_snapshot_end" , name_.c_str (), vb_);
1537- add_casted_stat (buf, cur_snapshot_end, add_stat, c);
1539+ add_casted_stat (buf, cur_snapshot_end. load () , add_stat, c);
15381540 }
15391541}
15401542
0 commit comments