Skip to content

Commit

Permalink
SERVER-31428 correctly check collVersion epoch when short-circuiting …
Browse files Browse the repository at this point in the history
…metadata refresh
  • Loading branch information
devkev committed Oct 18, 2017
1 parent c00aaae commit 998863e
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/mongo/db/s/sharding_state.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,9 @@ ChunkVersion ShardingState::_refreshMetadata(OperationContext* txn, const Namesp
auto css = CollectionShardingState::get(txn, nss);

// We already have newer version
if (css->getMetadata() && css->getMetadata()->getCollVersion() >= cm->getVersion()) {
if (css->getMetadata() &&
css->getMetadata()->getCollVersion().epoch() == cm->getVersion().epoch() &&
css->getMetadata()->getCollVersion() >= cm->getVersion()) {
LOG(1) << "Skipping refresh of metadata for " << nss << " "
<< css->getMetadata()->getCollVersion() << " with an older " << cm->getVersion();
return css->getMetadata()->getShardVersion();
Expand All @@ -664,7 +666,9 @@ ChunkVersion ShardingState::_refreshMetadata(OperationContext* txn, const Namesp
auto css = CollectionShardingState::get(txn, nss);

// We already have newer version
if (css->getMetadata() && css->getMetadata()->getCollVersion() >= cm->getVersion()) {
if (css->getMetadata() &&
css->getMetadata()->getCollVersion().epoch() == cm->getVersion().epoch() &&
css->getMetadata()->getCollVersion() >= cm->getVersion()) {
LOG(1) << "Skipping refresh of metadata for " << nss << " "
<< css->getMetadata()->getCollVersion() << " with an older " << cm->getVersion();
return css->getMetadata()->getShardVersion();
Expand Down

0 comments on commit 998863e

Please sign in to comment.