Merge remote-tracking branch 'couchbase/3.0.x' into sherlock 28/65328/2
authorDave Rigby <daver@couchbase.com>
Wed, 29 Jun 2016 09:17:13 +0000 (10:17 +0100)
committerDave Rigby <daver@couchbase.com>
Wed, 29 Jun 2016 09:47:05 +0000 (10:47 +0100)
* couchbase/3.0.x:
  MB-19359: [2] Address lock inversion with vb's state lock and snapshot lock
  MB-19359: [1] Address lock inversion with vb's state lock and snapshot lock

Change-Id: Ia068af9b26e8a4b980bf22341fa43ac5452aca60

src/ep_engine.cc

index d481f99..ea997ef 100644 (file)
@@ -4323,7 +4323,8 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::doSeqnoStats(const void *cookie,
 
         uint64_t relHighSeqno = vb->getHighSeqno();
 
-        ReaderLockHolder rlh(vb->getStateLock());
+        // An atomic read of vbucket state without acquiring the
+        // reader lock for state should suffice here.
         if (vb->getState() != vbucket_state_active) {
             snapshot_info_t info = vb->checkpointManager.getSnapshotInfo();
             relHighSeqno = info.range.end;
@@ -4348,7 +4349,9 @@ ENGINE_ERROR_CODE EventuallyPersistentEngine::doSeqnoStats(const void *cookie,
         RCPtr<VBucket> vb = getVBucket(*itr);
         if (vb) {
             uint64_t relHighSeqno = vb->getHighSeqno();
-            ReaderLockHolder rlh(vb->getStateLock());
+
+            // An atomic read of vbucket state without acquiring the
+            // reader lock for state should suffice here.
             if (vb->getState() != vbucket_state_active) {
                 snapshot_info_t info = vb->checkpointManager.getSnapshotInfo();
                 relHighSeqno = info.range.end;