diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-03-07 14:22:47 -0500 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-03-16 18:53:09 -0400 |
commit | ee5fbdd8540d93d2e0d6fa19ba9a5595bb1829cb (patch) | |
tree | 2ff83a961d227161d6171708162b595cf35ab7bd /src/mongo/db/db_raii.cpp | |
parent | 28399f947dda32a33509ddaebc650b0aa95fa0dd (diff) | |
download | mongo-ee5fbdd8540d93d2e0d6fa19ba9a5595bb1829cb.tar.gz |
SERVER-22997 Unify wait for migrate critical section and metadata refresh
This change gets rid of commands explicitly waiting for critical section
establishment and instead makes all operations when they encounter stale
version to install a wait object on the OperationContext, which can be
used to wait for critical section outside of lock. It also makes refresh
to happen outside of lock.
Diffstat (limited to 'src/mongo/db/db_raii.cpp')
-rw-r--r-- | src/mongo/db/db_raii.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/src/mongo/db/db_raii.cpp b/src/mongo/db/db_raii.cpp index 162017fc0f4..8075c940b1a 100644 --- a/src/mongo/db/db_raii.cpp +++ b/src/mongo/db/db_raii.cpp @@ -102,9 +102,7 @@ AutoGetCollectionForRead::AutoGetCollectionForRead(OperationContext* txn, // We have both the DB and collection locked, which is the prerequisite to do a stable shard // version check, but we'd like to do the check after we have a satisfactory snapshot. auto css = CollectionShardingState::get(txn, nss); - if (css) { - css->checkShardVersionOrThrow(txn); - } + css->checkShardVersionOrThrow(txn); } AutoGetCollectionForRead::~AutoGetCollectionForRead() { @@ -196,9 +194,7 @@ void OldClientContext::_checkNotStale() const { break; default: auto css = CollectionShardingState::get(_txn, _ns); - if (css) { - css->checkShardVersionOrThrow(_txn); - } + css->checkShardVersionOrThrow(_txn); } } |