SERVER-79349 Rename ShardVersion UNSHARDED to UNTRACKED (#43461)

GitOrigin-RevId: 65d23b6e5e6f0141e9fb0f797d7fb2df12969d59
This commit is contained in:
Allison Easton 2025-11-11 11:24:08 +01:00 committed by MongoDB Bot
parent a9fdc8b599
commit f8b1fae477
141 changed files with 445 additions and 444 deletions

View File

@ -48,8 +48,8 @@ s1.getDB(dbName).MyColl.find({x: 0}).readPref("secondary").toArray();
// router0: Empty
// router1: Empty
// shard0: primary=UNSHARDED, secondary=UNSHARDED
// shard1: primary=UNSHARDED, secondary=UNSHARDED
// shard0: primary=UNTRACKED, secondary=UNTRACKED
// shard1: primary=UNTRACKED, secondary=UNTRACKED
assert.commandWorked(s0.adminCommand({shardCollection: collNs, key: {y: 1}}));
assert.commandWorked(s0.getDB(dbName).MyColl.insert({y: 42}));
@ -57,7 +57,7 @@ assert.commandWorked(s0.getDB(dbName).MyColl.insert({y: 42}));
// router0: SV1
// router1: Empty
// shard0: primary=SV1, secondary=UNKNOWN
// shard1: primary=UNSHARDED, secondary=UNSHARDED
// shard1: primary=UNTRACKED, secondary=UNTRACKED
// This should reset shard1's shard version to be UNKNOWN on all nodes.
assert.commandWorked(s0.adminCommand({movePrimary: dbName, to: st.shard1.shardName}));
@ -67,7 +67,7 @@ assert.commandWorked(s0.adminCommand({movePrimary: dbName, to: st.shard1.shardNa
// shard0: primary=SV1, secondary=UNKNOWN
// shard1: primary=UNKNOWN, secondary=UNKNOWN
// If this were to equal 0 it would mean that s1 sent an UNSHARDED version to a stale secondary on
// If this were to equal 0 it would mean that s1 sent an UNTRACKED version to a stale secondary on
// the new dbPrimary shard1. Being 1 means we're doing the correct thing here.
assert.eq(s1.getDB(dbName).MyColl.find({}).readPref("secondary").itcount(), 1);
assert.eq(s0.getDB(dbName).MyColl.find({}).itcount(), 1);

View File

@ -96,7 +96,7 @@ namespace {
// +---------+-------------------------+-------------+---------------+---------------+
// | Db Name | Coll Name | Sharded? | Db Version | Shard Version |
// +---------+-------------------------+-------------+---------------+---------------+
// | testDB1 | unsharded.radiohead | NO | dbV1 | UNSHARDED() |
// | testDB1 | unsharded.radiohead | NO | dbV1 | UNTRACKED() |
// | testDB1 | sharded.porcupine.tree | YES | dbV1 | sV1 |
// | testDB2 | sharded.oasis | YES | dbV2 | sV2 |
// +---------+-------------------------+-------------+---------------+---------------+
@ -135,11 +135,11 @@ protected:
CollectionGeneration{OID::gen(), Timestamp(12, 0)}, CollectionPlacement(10, 1)));
};
void installUnshardedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss) {
const auto unshardedCollectionMetadata = CollectionMetadata::UNTRACKED();
void installUntrackedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss) {
const auto untrackedCollectionMetadata = CollectionMetadata::UNTRACKED();
AutoGetCollection coll(opCtx, nss, MODE_IX);
CollectionShardingRuntime::assertCollectionLockedAndAcquireExclusive(opCtx, nss)
->setFilteringMetadata(opCtx, unshardedCollectionMetadata);
->setFilteringMetadata(opCtx, untrackedCollectionMetadata);
}
void installShardedCollectionMetadata(OperationContext* opCtx,
@ -196,7 +196,7 @@ void BulkWriteShardTest::setUp() {
// Create nssUnshardedCollection1
createTestCollection(opCtx(), nssUnshardedCollection1);
installUnshardedCollectionMetadata(opCtx(), nssUnshardedCollection1);
installUntrackedCollectionMetadata(opCtx(), nssUnshardedCollection1);
// Create nssShardedCollection1
createTestCollection(opCtx(), nssShardedCollection1);
@ -240,7 +240,7 @@ TEST_F(BulkWriteShardTest, ThreeSuccessfulInsertsOrdered) {
BulkWriteInsertOp(2, BSON("x" << -1))},
{
nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNSHARDED()),
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNTRACKED()),
nsInfoWithShardDatabaseVersions(
nssShardedCollection1, dbVersionTestDb1, shardVersionShardedCollection1),
nsInfoWithShardDatabaseVersions(
@ -267,7 +267,7 @@ TEST_F(BulkWriteShardTest, OneFailingShardedOneSkippedUnshardedSuccessInsertOrde
{nsInfoWithShardDatabaseVersions(
nssShardedCollection1, dbVersionTestDb1, incorrectShardVersion),
nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNSHARDED())});
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNTRACKED())});
const auto& [replyItems, retriedStmtIds, summaryFields] =
bulk_write::performWrites(opCtx(), request);
@ -372,7 +372,7 @@ TEST_F(BulkWriteShardTest, InsertsAndUpdatesSuccessOrdered) {
nsInfoWithShardDatabaseVersions(
nssShardedCollection2, dbVersionTestDb2, shardVersionShardedCollection2),
nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNSHARDED())});
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNTRACKED())});
const auto& [replyItems, retriedStmtIds, summaryFields] =
bulk_write::performWrites(opCtx(), request);
@ -398,7 +398,7 @@ TEST_F(BulkWriteShardTest, InsertsAndUpdatesSuccessUnordered) {
nsInfoWithShardDatabaseVersions(
nssShardedCollection2, dbVersionTestDb2, shardVersionShardedCollection2),
nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNSHARDED())});
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNTRACKED())});
request.setOrdered(false);
@ -426,7 +426,7 @@ TEST_F(BulkWriteShardTest, InsertsAndUpdatesFailUnordered) {
nsInfoWithShardDatabaseVersions(
nssShardedCollection2, dbVersionTestDb2, shardVersionShardedCollection2),
nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNSHARDED())});
nssUnshardedCollection1, dbVersionTestDb1, ShardVersion::UNTRACKED())});
request.setOrdered(false);
@ -534,7 +534,7 @@ TEST_F(BulkWriteShardTest, FirstFailsRestSkippedStaleDbVersionUnordered) {
BulkWriteInsertOp(0, BSON("x" << -1)),
BulkWriteInsertOp(1, BSON("x" << -2))},
{nsInfoWithShardDatabaseVersions(
nssUnshardedCollection1, incorrectDatabaseVersion, ShardVersion::UNSHARDED()),
nssUnshardedCollection1, incorrectDatabaseVersion, ShardVersion::UNTRACKED()),
nsInfoWithShardDatabaseVersions(
nssShardedCollection2, dbVersionTestDb2, shardVersionShardedCollection2)});

View File

@ -59,7 +59,7 @@ void insertDirectlyToPreImagesCollection(OperationContext* opCtx,
const auto preImagesAcq = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kChangeStreamPreImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -204,7 +204,7 @@ CollectionAcquisition acquirePreImagesCollectionForRead(OperationContext* opCtx)
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kChangeStreamPreImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -132,7 +132,7 @@ void ChangeStreamPreImagesCollectionManager::insertPreImage(OperationContext* op
const auto changeStreamPreImagesCollection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(preImagesCollectionNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kUnreplicatedWrite),
MODE_IX);

View File

@ -53,7 +53,7 @@ auto acquirePreImagesCollectionForRead(OperationContext* opCtx, const UUID& uuid
opCtx,
CollectionAcquisitionRequest(
NamespaceStringOrUUID{NamespaceString::kChangeStreamPreImagesNamespace.dbName(), uuid},
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -63,7 +63,7 @@ auto acquirePreImagesCollectionForWrite(OperationContext* opCtx, const UUID& uui
opCtx,
CollectionAcquisitionRequest(
NamespaceStringOrUUID{NamespaceString::kChangeStreamPreImagesNamespace.dbName(), uuid},
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kUnreplicatedWrite),
MODE_IX);

View File

@ -162,7 +162,7 @@ std::shared_ptr<PreImagesTenantMarkers> PreImagesTruncateManager::_createAndInst
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kChangeStreamPreImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -81,7 +81,7 @@ protected:
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(std::move(nssOrUUID),
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -90,7 +90,7 @@ void ClusterServerParameterInitializer::synchronizeAllParametersFromDisk(Operati
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::makeClusterParametersNSS(tenantId),
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -92,7 +92,7 @@ public:
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::makeClusterParametersNSS(tenantId),
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -198,7 +198,7 @@ void ClusterServerParameterOpObserver::onReplicationRollback(OperationContext* o
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::makeClusterParametersNSS(nss.tenantId()),
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -133,7 +133,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -144,7 +144,7 @@ CollectionAcquisition acquireCollForReadLockFree(OperationContext* opCtx,
return acquireCollectionMaybeLockFree(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead));
}

View File

@ -114,7 +114,7 @@ bool collectionExists(OperationContext* opCtx, const NamespaceString& nss) {
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -128,7 +128,7 @@ CollectionOptions getCollectionOptions(OperationContext* opCtx, const NamespaceS
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -700,7 +700,7 @@ ScopedSetShardRole ResolvedViewAggExState::setShardRole(const CollectionRoutingI
return ScopedSetShardRole(
_opCtx, underlyingNss, sv /*shardVersion*/, boost::none /*databaseVersion*/);
} else {
auto sv = ShardVersion::UNSHARDED();
auto sv = ShardVersion::UNTRACKED();
if (optPlacementConflictTimestamp) {
sv.setPlacementConflictTime(*optPlacementConflictTimestamp);
}

View File

@ -413,7 +413,7 @@ TEST_F(AggregationExecutionStateTest, CreateDefaultAggCatalogStateWithSecondaryS
// Add at least 1 shard version to the opCtx to simulate a router request. This is necessary
// to correctly set the isAnySecondaryNamespaceAViewOrNotFullyLocal.
ScopedSetShardRole setShardRole(
operationContext(), mainNss, ShardVersion::UNSHARDED(), getDbVersion());
operationContext(), mainNss, ShardVersion::UNTRACKED(), getDbVersion());
std::unique_ptr<AggExState> aggExState =
createDefaultAggExStateWithSecondaryCollections(main, secondaryColl);

View File

@ -1393,7 +1393,7 @@ private:
opCtx,
CollectionAcquisitionRequest(
NamespaceString::kServerConfigurationNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
LockMode::MODE_IS);
@ -1600,7 +1600,7 @@ private:
opCtx,
CollectionAcquisitionRequest{
NamespaceString::kAdminUsersNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead});
hasUserDocs = Helpers::findOne(opCtx, userColl, BSONObj(), userDoc);
@ -1611,7 +1611,7 @@ private:
opCtx,
CollectionAcquisitionRequest{
NamespaceString::kAdminRolesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead});
hasRoleDocs = Helpers::findOne(opCtx, rolesColl, BSONObj(), roleDoc);

View File

@ -292,7 +292,7 @@ void GraphLookUpStage::performSearch() {
// sharded, throw a custom exception.
if (auto staleInfo = ex.extraInfo<StaleConfigInfo>(); staleInfo &&
staleInfo->getVersionWanted() &&
staleInfo->getVersionWanted() != ShardVersion::UNSHARDED()) {
staleInfo->getVersionWanted() != ShardVersion::UNTRACKED()) {
uassert(3904801,
"Cannot run $graphLookup with a sharded foreign collection in a transaction",
foreignShardedGraphLookupAllowed());
@ -320,14 +320,14 @@ void GraphLookUpStage::spillDuringVisitedUnwinding() {
void GraphLookUpStage::doBreadthFirstSearch() {
while (!_queue.empty()) {
std::unique_ptr<MongoProcessInterface::ScopedExpectUnshardedCollection>
expectUnshardedCollectionInScope;
std::unique_ptr<MongoProcessInterface::ScopedExpectUntrackedCollection>
expectUntrackedCollectionInScope;
const auto allowForeignSharded = foreignShardedGraphLookupAllowed();
if (!allowForeignSharded && !_fromExpCtx->getInRouter()) {
// Enforce that the foreign collection must be unsharded for $graphLookup.
expectUnshardedCollectionInScope =
_fromExpCtx->getMongoProcessInterface()->expectUnshardedCollectionInScope(
expectUntrackedCollectionInScope =
_fromExpCtx->getMongoProcessInterface()->expectUntrackedCollectionInScope(
_fromExpCtx->getOperationContext(),
_fromExpCtx->getNamespaceString(),
boost::none);

View File

@ -263,7 +263,7 @@ GetNextResult LookUpStage::doGetNext() {
// throw a custom exception.
if (auto staleInfo = ex.extraInfo<StaleConfigInfo>(); staleInfo &&
staleInfo->getVersionWanted() &&
staleInfo->getVersionWanted() != ShardVersion::UNSHARDED()) {
staleInfo->getVersionWanted() != ShardVersion::UNTRACKED()) {
uassert(3904800,
"Cannot run $lookup with a sharded foreign collection in a transaction",
foreignShardedLookupAllowed());
@ -399,7 +399,7 @@ void LookUpStage::prepareStateToBuildPipeline(
if (!foreignShardedLookupAllowed() && !fromExpCtx->getInRouter()) {
// Enforce that the foreign collection must be unsharded for lookup.
fromExpCtx->getMongoProcessInterface()->expectUnshardedCollectionInScope(
fromExpCtx->getMongoProcessInterface()->expectUntrackedCollectionInScope(
fromExpCtx->getOperationContext(), fromExpCtx->getNamespaceString(), boost::none);
}
}

View File

@ -348,7 +348,7 @@ TEST_F(RecordIdDeduplicatorCatalogTest, canSpillWithAcquiredCollection) {
auto acquisition = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(kNss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -180,7 +180,7 @@ public:
return acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -825,12 +825,12 @@ CatalogCache::CollectionCache::LookupResult CatalogCache::CollectionCache::_look
// This object will define the new time of the routing info obtained by this refresh
auto newComparableVersion =
ComparableChunkVersion::makeComparableChunkVersion(ChunkVersion::UNSHARDED());
ComparableChunkVersion::makeComparableChunkVersion(ChunkVersion::UNTRACKED());
Timer t{};
try {
auto lookupVersion =
isIncremental ? existingHistory->optRt->getVersion() : ChunkVersion::UNSHARDED();
isIncremental ? existingHistory->optRt->getVersion() : ChunkVersion::UNTRACKED();
LOGV2_FOR_CATALOG_REFRESH(4619900,
1,

View File

@ -115,7 +115,7 @@ void dropChunksIfEpochChanged(OperationContext* opCtx,
const ChunkVersion& maxLoaderVersion,
const OID& currentEpoch,
const NamespaceString& nss) {
if (maxLoaderVersion == ChunkVersion::UNSHARDED() || maxLoaderVersion.epoch() == currentEpoch) {
if (maxLoaderVersion == ChunkVersion::UNTRACKED() || maxLoaderVersion.epoch() == currentEpoch) {
return;
}
@ -211,7 +211,7 @@ Status persistDbVersion(OperationContext* opCtx, const DatabaseType& dbt) {
*
* Retrieves the persisted max chunk version for 'nss', if there are any persisted chunks. If there
* are none -- meaning there's no persisted metadata for 'nss' --, returns a
* ChunkVersion::UNSHARDED() version.
* ChunkVersion::UNTRACKED() version.
*
* It is unsafe to call this when a task for 'nss' is running concurrently because the collection
* could be dropped and recreated or have its shard key refined between reading the collection epoch
@ -223,7 +223,7 @@ ChunkVersion getPersistedMaxChunkVersion(OperationContext* opCtx, const Namespac
auto statusWithCollection = readShardCollectionsEntry(opCtx, nss);
if (statusWithCollection == ErrorCodes::NamespaceNotFound) {
// There is no persisted metadata.
return ChunkVersion::UNSHARDED();
return ChunkVersion::UNTRACKED();
}
uassertStatusOKWithContext(statusWithCollection,
@ -240,7 +240,7 @@ ChunkVersion getPersistedMaxChunkVersion(OperationContext* opCtx, const Namespac
// Therefore, we have no choice but to just throw away the cache and start from scratch.
uassertStatusOK(dropChunksAndDeleteCollectionsEntry(opCtx, nss));
return ChunkVersion::UNSHARDED();
return ChunkVersion::UNTRACKED();
}
auto statusWithChunk = readShardChunks(opCtx,
@ -255,7 +255,7 @@ ChunkVersion getPersistedMaxChunkVersion(OperationContext* opCtx, const Namespac
str::stream() << "Failed to read highest version persisted chunk for collection '"
<< nss.toStringForErrorMsg() << "'.");
return statusWithChunk.getValue().empty() ? ChunkVersion::UNSHARDED()
return statusWithChunk.getValue().empty() ? ChunkVersion::UNTRACKED()
: statusWithChunk.getValue().front().getVersion();
}
@ -807,7 +807,7 @@ ShardServerCatalogCacheLoaderImpl::_schedulePrimaryGetChunksSince(
"error"_attr = redact(parseError.toStatus()),
logAttrs(nss));
uassertStatusOK(dropChunksAndDeleteCollectionsEntry(opCtx, nss));
return ChunkVersion::UNSHARDED();
return ChunkVersion::UNTRACKED();
}
}();
@ -1469,7 +1469,7 @@ ShardServerCatalogCacheLoaderImpl::CollAndChunkTask::CollAndChunkTask(
statusWithCollectionAndChangedChunks.getStatus().toString()),
statusWithCollectionAndChangedChunks == ErrorCodes::NamespaceNotFound);
dropped = true;
maxQueryVersion = ChunkVersion::UNSHARDED();
maxQueryVersion = ChunkVersion::UNTRACKED();
}
}

View File

@ -120,7 +120,7 @@ private:
* 'collectionAndChangedChunks' is only initialized if 'dropped' is false.
* 'minimumQueryVersion' sets 'minQueryVersion'.
* 'maxQueryVersion' is either set to the highest chunk version in
* 'collectionAndChangedChunks' or ChunkVersion::UNSHARDED().
* 'collectionAndChangedChunks' or ChunkVersion::UNTRACKED().
*/
CollAndChunkTask(
StatusWith<CollectionAndChangedChunks> statusWithCollectionAndChangedChunks,
@ -173,7 +173,7 @@ private:
*
* or applying a complete update from the minumum version, where
*
* minQueryVersion == ChunkVersion::UNSHARDED().
* minQueryVersion == ChunkVersion::UNTRACKED().
*/
class CollAndChunkTaskList {
public:

View File

@ -307,7 +307,7 @@ ShardServerCatalogCacheLoaderTest::setUpChunkLoaderWithFiveChunks() {
_remoteLoaderMock->setChunkRefreshReturnValue(chunks);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT_EQUALS(collAndChunksRes.epoch, collectionType.getEpoch());
ASSERT_EQUALS(collAndChunksRes.changedChunks.size(), 5UL);
@ -332,7 +332,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, PrimaryLoadFromUnshardedToUnsharded) {
_remoteLoaderMock->setCollectionRefreshReturnValue(errorStatus);
ASSERT_THROWS_CODE_AND_WHAT(
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED()),
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED()),
DBException,
errorStatus.code(),
errorStatus.reason());
@ -394,7 +394,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, PrimaryLoadFromShardedAndFindNoDiffReq
_remoteLoaderMock->setChunkRefreshReturnValue(lastChunk);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT_EQUALS(collAndChunksRes.epoch, chunks.back().getVersion().epoch());
ASSERT_EQUALS(collAndChunksRes.changedChunks.size(), 5UL);
for (unsigned int i = 0; i < collAndChunksRes.changedChunks.size(); ++i) {
@ -458,7 +458,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, PrimaryLoadFromShardedAndFindDiffReque
makeCombinedOriginalFiveChunksAndThreeNewChunksDiff(chunks, updatedChunksDiff);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT_EQUALS(collAndChunksRes.epoch,
completeRoutingTableWithDiffApplied.front().getVersion().epoch());
ASSERT_EQUALS(collAndChunksRes.changedChunks.size(), 5UL);
@ -549,7 +549,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, PrimaryLoadFromShardedAndFindMixedChun
_remoteLoaderMock->setChunkRefreshReturnValue(lastChunkWithNewEpoch);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT_EQUALS(collAndChunksRes.epoch, collectionTypeWithNewEpoch.getEpoch());
ASSERT_EQUALS(collAndChunksRes.changedChunks.size(), 5UL);
for (unsigned int i = 0; i < collAndChunksRes.changedChunks.size(); ++i) {
@ -625,7 +625,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, TimeseriesFieldsAreProperlyPropagatedO
_remoteLoaderMock->setChunkRefreshReturnValue(chunks);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT(collAndChunksRes.timeseriesFields.has_value());
ASSERT(collAndChunksRes.timeseriesFields->getGranularity() ==
BucketGranularityEnum::Seconds);
@ -663,7 +663,7 @@ void ShardServerCatalogCacheLoaderTest::refreshCollectionEpochOnRemoteLoader() {
TEST_F(ShardServerCatalogCacheLoaderTest, CollAndChunkTasksConsistency) {
// Put some metadata in the persisted cache (config.cache.chunks.*)
refreshCollectionEpochOnRemoteLoader();
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
_shardLoader->waitForCollectionFlush(operationContext(), kNss);
// Pause the thread processing the pending updates on metadata
@ -671,7 +671,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, CollAndChunkTasksConsistency) {
// Put a first task in the list of pending updates on metadata (in-memory)
refreshCollectionEpochOnRemoteLoader();
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
// Bump the shard's term
_shardLoader->onStepUp();
@ -679,7 +679,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, CollAndChunkTasksConsistency) {
// Putting a second task causes a verification of the contiguous versions in the list pending
// updates on metadata
refreshCollectionEpochOnRemoteLoader();
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
}
/**
@ -766,7 +766,7 @@ TEST_F(ShardServerCatalogCacheLoaderTest, UnsplittableFieldIsPropagatedOnSSCCL)
_remoteLoaderMock->setChunkRefreshReturnValue(chunk);
auto collAndChunksRes =
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNSHARDED());
retryableGetChunksSince(_shardLoader.get(), kNss, ChunkVersion::UNTRACKED());
ASSERT(collAndChunksRes.unsplittable);
}
} // namespace

View File

@ -1106,9 +1106,9 @@ ShardEndpoint::ShardEndpoint(const ShardId& shardName,
shardVersion(std::move(shardVersionParam)),
databaseVersion(std::move(dbVersionParam)) {
if (databaseVersion)
invariant(shardVersion && *shardVersion == ShardVersion::UNSHARDED());
invariant(shardVersion && *shardVersion == ShardVersion::UNTRACKED());
else if (shardVersion)
invariant(*shardVersion != ShardVersion::UNSHARDED());
invariant(*shardVersion != ShardVersion::UNTRACKED());
else
invariant(shardName == ShardId::kConfigServerId);
}

View File

@ -47,7 +47,7 @@ in itself cannot forbid the following anomalies:
that is newer than the one in the shard's snapshot. This could occur, for instance, when the
collection's namespace is recreated on the shard after the transaction has established a snapshot.
- **Collection incarnation anomaly:** Similar to the collection generation anomaly, but concerning
the local catalog. The router forwards a request with ShardVersion::UNSHARDED, bypassing collection
the local catalog. The router forwards a request with ShardVersion::UNTRACKED, bypassing collection
generation checks. The request might be for a namespace that was sharded when the transaction
established the snapshot. Processing this request would incorrectly return partial data for the
collection as the router only targeted the primary shard.
@ -84,13 +84,13 @@ Notes:
For **untracked** collections, the protocol is as follows:
1. The router forwards statements using the latest database version, and targets its primary shard.
ShardVersion::UNSHARDED is attached in addition to the DatabaseVersion.
ShardVersion::UNTRACKED is attached in addition to the DatabaseVersion.
1. The targeted shard checks the attached metadata. All the following conditions must be
met for the request to be considered valid:
1. The received database version must match the current (latest) database version.
1. The received `atClusterTime` must not be earlier than the latest database version's [timestamp field](https://github.com/mongodb/mongo/blob/eeef1763cb0ff77757bb60eabb8ad1233c990786/src/mongo/db/s/README_versioning_protocols.md#database-version) known by the shard.
This field represents the commit timestamp of the latest reincarnation (drop/create) or movePrimary operation for this database.
1. The received placement version is UNSHARDED, and the shard checks the latest version matches.
1. The received placement version is UNTRACKED, and the shard checks the latest version matches.
1. The collection in the snapshot must be the same incarnation (same UUID) as in the latest CollectionCatalog.
Notes:
@ -102,10 +102,10 @@ Notes:
database primary shard knowledge, but this decision might not be valid at the specified cluster time.
E.g. if the shard was not the primary shard for the database at that point in time.
- (2.iii) ensures that the collection generation anomaly is detected for cases where an untracked
collection becomes tracked. There will be a mismatch between the attached ShardVersion::UNSHARDED
collection becomes tracked. There will be a mismatch between the attached ShardVersion::UNTRACKED
and the actual placement version on the shard.
- (2.iv) ensures that the collection incarnation anomaly is detected by the primary shard after a
sharded collection is reincarnated as unsharded (by definition, ShardVersion::UNSHARDED always conforms with 2.ii).
sharded collection is reincarnated as unsharded (by definition, ShardVersion::UNTRACKED always conforms with 2.ii).
## Transactions with readConcern="local" or "majority"
@ -162,14 +162,14 @@ For **untracked** collections, the protocol is as follows:
1. For each statement, the router uses the latest database version.
1. For each statement, the router sends the command to the database primary shard. It attaches the database
version as usual, and additionally attaches the selected `placementConflictTime`. It also
attaches an `afterClusterTime` = `placementConflictTime`, and ShardVersion::UNSHARDED.
attaches an `afterClusterTime` = `placementConflictTime`, and ShardVersion::UNTRACKED.
1. The targeted shard will open its storage snapshot with a timestamp at least `afterClusterTime`.
1. The targeted shard checks the attached metadata. All the following conditions must be
met for the request to be considered valid:
1. The received database version must match the current (latest) database version.
1. `placementConflictTime` must not be earlier than the database version's [timestamp field](https://github.com/mongodb/mongo/blob/eeef1763cb0ff77757bb60eabb8ad1233c990786/src/mongo/db/s/README_versioning_protocols.md#database-version).
This field represents the commit timestamp of the latest reincarnation (drop/create) or movePrimary operation for this database.
1. The received placement version is UNSHARDED, and the shard checks the latest version matches.
1. The received placement version is UNTRACKED, and the shard checks the latest version matches.
1. The collection in the snapshot must be the same incarnation (same UUID) as in the latest CollectionCatalog.
Notes:
@ -181,7 +181,7 @@ Notes:
database primary shard knowledge, but this decision might not be valid at for snapshots opened at
a timestamp before the reincarnation.
- (4.iii) ensures that the collection generation anomaly is detected for cases where an untracked
collection becomes tracked. There will be a mismatch between the attached ShardVersion::UNSHARDED
collection becomes tracked. There will be a mismatch between the attached ShardVersion::UNTRACKED
and the actual placement version on the shard.
- (4.iv) ensures that the collection incarnation anomaly is detected by the primary shard after a
sharded collection is reincarnated unsharded.

View File

@ -239,9 +239,9 @@ void doAnchorCleanupWithUpdatedCollectionState(OperationContext* opCtx,
uassertStatusOK(
FilteringMetadataCache::get(opCtx)->onCollectionPlacementVersionMismatch(
innerOpCtx, escNss, ChunkVersion::UNSHARDED()));
innerOpCtx, escNss, ChunkVersion::UNTRACKED()));
ScopedSetShardRole escShardRole(
innerOpCtx, escNss, ShardVersion::UNSHARDED(), innerCri.getDbVersion());
innerOpCtx, escNss, ShardVersion::UNTRACKED(), innerCri.getDbVersion());
cleanupESCAnchors(innerOpCtx, escNss, pq, tagsPerDelete, escStats);
});

View File

@ -74,10 +74,10 @@ namespace {
MONGO_FAIL_POINT_DEFINE(createUnshardedCollectionRandomizeDataShard);
MONGO_FAIL_POINT_DEFINE(hangCreateUnshardedCollection);
std::vector<AsyncRequestsSender::Request> buildUnshardedRequestsForAllShards(
std::vector<AsyncRequestsSender::Request> buildUntrackedRequestsForAllShards(
OperationContext* opCtx, std::vector<ShardId> shardIds, const BSONObj& cmdObj) {
auto cmdToSend = cmdObj;
appendShardVersion(cmdToSend, ShardVersion::UNSHARDED());
appendShardVersion(cmdToSend, ShardVersion::UNTRACKED());
std::vector<AsyncRequestsSender::Request> requests;
requests.reserve(shardIds.size());
@ -106,7 +106,7 @@ AsyncRequestsSender::Response executeCommandAgainstFirstShard(OperationContext*
nss,
readPref,
retryPolicy,
buildUnshardedRequestsForAllShards(
buildUntrackedRequestsForAllShards(
opCtx, {shardId}, appendDbVersionIfPresent(cmdObj, dbInfo)));
return std::move(responses.front());
}

View File

@ -206,7 +206,7 @@ public:
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kConfigsvrRestoreNamespace,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -249,7 +249,7 @@ public:
acquireCollection(opCtx,
CollectionAcquisitionRequest(
nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -350,7 +350,7 @@ public:
opCtx,
CollectionAcquisitionRequest(
nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -930,9 +930,9 @@ boost::optional<CreateCollectionResponse> checkIfCollectionExistsWithSameOptions
BSON("_id" << NamespaceStringUtil::serialize(
*optTargetNss, SerializationContext::stateDefault())));
if (isTemporaryCollection) {
// Return UNSHARDED version for the coordinator to gracefully terminate without
// Return UNTRACKED version for the coordinator to gracefully terminate without
// registering the collection
return CreateCollectionResponse{ShardVersion::UNSHARDED()};
return CreateCollectionResponse{ShardVersion::UNTRACKED()};
}
}

View File

@ -98,7 +98,7 @@ void DropIndexesCoordinator::_dropIndexes(OperationContext* opCtx,
}
} else {
shardIdsToShardVersions[ShardingState::get(opCtx)->shardId()] =
ShardVersion::UNSHARDED();
ShardVersion::UNTRACKED();
}
const auto session = getNewSession(opCtx);

View File

@ -1217,7 +1217,7 @@ ExecutorFuture<void> RenameCollectionCoordinator::_runImpl(
Grid::get(opCtx)->catalogCache()->getCollectionPlacementInfoWithRefresh(
opCtx, _request.getTo()));
auto placementVersion =
cm.hasRoutingTable() ? cm.getVersion() : ChunkVersion::UNSHARDED();
cm.hasRoutingTable() ? cm.getVersion() : ChunkVersion::UNTRACKED();
_response = RenameCollectionResponse(
ShardVersionFactory::make(std::move(placementVersion)));

View File

@ -147,7 +147,7 @@ void SessionsCollectionConfigServer::_generateIndexesIfNeeded(OperationContext*
// valid routing table.
uassert(StaleConfigInfo(nss,
cri.getCollectionVersion() /* receivedVersion */,
ShardVersion::UNSHARDED() /* wantedVersion */,
ShardVersion::UNTRACKED() /* wantedVersion */,
ShardingState::get(opCtx)->shardId()),
str::stream() << "Collection " << nss.toStringForErrorMsg()
<< " is not sharded",

View File

@ -203,7 +203,7 @@ public:
auto cmd = create_collection_util::makeCreateCommand(
opCtx, ns(), request().getShardsvrCreateCollectionRequest());
runCreateCommandDirectClient(opCtx, ns(), cmd);
return CreateCollectionResponse{ShardVersion::UNSHARDED()};
return CreateCollectionResponse{ShardVersion::UNTRACKED()};
}
tassert(ErrorCodes::InvalidOptions,
@ -354,7 +354,7 @@ public:
auto cmd = create_collection_util::makeCreateCommand(
opCtx, ns(), request().getShardsvrCreateCollectionRequest());
runCreateCommandDirectClient(opCtx, ns(), cmd);
return CreateCollectionResponse{ShardVersion::UNSHARDED()};
return CreateCollectionResponse{ShardVersion::UNTRACKED()};
}
// TODO (SERVER-100309): remove once 9.0 becomes last LTS.

View File

@ -113,7 +113,7 @@ bool checkMetadataForSuccessfulSplitChunk(OperationContext* opCtx,
metadataAfterSplit);
uassert(StaleConfigInfo(nss,
ShardVersionPlacementIgnored() /* receivedVersion */,
ShardVersion::UNSHARDED() /* wantedVersion */,
ShardVersion::UNTRACKED() /* wantedVersion */,
shardId),
str::stream() << "Collection " << nss.toStringForErrorMsg() << " is not sharded",
metadataAfterSplit->isSharded());

View File

@ -239,7 +239,7 @@ public:
dbInfo->getVersion());
// Attach db and shard version;
if (!dbInfo->getVersion().isFixed())
shardsvrRequest.setShardVersion(ShardVersion::UNSHARDED());
shardsvrRequest.setShardVersion(ShardVersion::UNTRACKED());
return _establishCursors(
opCtx, nss, {{dbInfo->getPrimary(), shardsvrRequest.toBSON()}});
});

View File

@ -275,7 +275,7 @@ AsyncRequestsSender::Request buildDatabaseVersionedRequest(
nss.toStringForErrorMsg()),
shardId == cri.getDbPrimaryShardId());
BSONObj versionedCmd = appendShardVersion(cmdObj, ShardVersion::UNSHARDED());
BSONObj versionedCmd = appendShardVersion(cmdObj, ShardVersion::UNTRACKED());
versionedCmd = appendDbVersionIfPresent(versionedCmd, cri.getDbVersion());
const auto targetedSampleId = eligibleForSampling
@ -1129,9 +1129,9 @@ StatusWith<Shard::QueryResponse> loadIndexesFromAuthoritativeShard(OperationCont
appendShardVersion(cmdNoVersion, cri.getShardVersion(minKeyShardId))};
} else {
// For a collection without routing table, the primary shard will have correct indexes.
// Attach dbVersion + shardVersion: UNSHARDED.
// Attach dbVersion + shardVersion: UNTRACKED.
const auto cmdObjWithShardVersion = !cri.getDbVersion().isFixed()
? appendShardVersion(cmdNoVersion, ShardVersion::UNSHARDED())
? appendShardVersion(cmdNoVersion, ShardVersion::UNTRACKED())
: cmdNoVersion;
return {uassertStatusOK(Grid::get(opCtx)->shardRegistry()->getShard(
opCtx, cri.getDbPrimaryShardId())),

View File

@ -161,12 +161,12 @@ ShardEndpoint targetUnshardedCollection(const NamespaceString& nss,
const auto shardId = cri.getChunkManager().getMinKeyShardIdWithSimpleCollation();
return ShardEndpoint(shardId, cri.getShardVersion(shardId), boost::none);
} else {
// Target the db-primary shard. Attach 'dbVersion: X, shardVersion: UNSHARDED'.
// Target the db-primary shard. Attach 'dbVersion: X, shardVersion: UNTRACKED'.
// TODO (SERVER-51070): Remove the boost::none when the config server can support
// shardVersion in commands
return ShardEndpoint(
cri.getDbPrimaryShardId(),
nss.isOnInternalDb() ? boost::optional<ShardVersion>() : ShardVersion::UNSHARDED(),
nss.isOnInternalDb() ? boost::optional<ShardVersion>() : ShardVersion::UNTRACKED(),
nss.isOnInternalDb() ? boost::optional<DatabaseVersion>() : cri.getDbVersion());
}
}

View File

@ -667,7 +667,7 @@ TEST_F(CollectionRoutingInfoTargeterUntrackedTest, InsertIsTargetedToDbPrimarySh
const auto shardEndpoint = targeter.targetInsert(operationContext(), BSON("x" << 10));
ASSERT_EQ(primaryShard, shardEndpoint.shardName);
ASSERT_EQ(dbVersion, shardEndpoint.databaseVersion);
ASSERT_EQ(ChunkVersion::UNSHARDED(), shardEndpoint.shardVersion->placementVersion());
ASSERT_EQ(ChunkVersion::UNTRACKED(), shardEndpoint.shardVersion->placementVersion());
}
TEST_F(CollectionRoutingInfoTargeterUntrackedTest, UpdateIsTargetedToDbPrimaryShard) {
@ -680,7 +680,7 @@ TEST_F(CollectionRoutingInfoTargeterUntrackedTest, UpdateIsTargetedToDbPrimarySh
const auto& shardEndpoint = shardEndpoints.front();
ASSERT_EQ(primaryShard, shardEndpoint.shardName);
ASSERT_EQ(dbVersion, shardEndpoint.databaseVersion);
ASSERT_EQ(ChunkVersion::UNSHARDED(), shardEndpoint.shardVersion->placementVersion());
ASSERT_EQ(ChunkVersion::UNTRACKED(), shardEndpoint.shardVersion->placementVersion());
}
TEST_F(CollectionRoutingInfoTargeterUntrackedTest, DeleteIsTargetedToDbPrimaryShard) {
@ -693,7 +693,7 @@ TEST_F(CollectionRoutingInfoTargeterUntrackedTest, DeleteIsTargetedToDbPrimarySh
const auto& shardEndpoint = shardEndpoints.front();
ASSERT_EQ(primaryShard, shardEndpoint.shardName);
ASSERT_EQ(dbVersion, shardEndpoint.databaseVersion);
ASSERT_EQ(ChunkVersion::UNSHARDED(), shardEndpoint.shardVersion->placementVersion());
ASSERT_EQ(ChunkVersion::UNTRACKED(), shardEndpoint.shardVersion->placementVersion());
}
/**
@ -847,11 +847,11 @@ protected:
TEST_F(CollectionRoutingInfoTargeterTimeseriesTest, TargetWritesToUntrackedTimeseries) {
// Expect all operations to be targeted to the db-primary shard, with 'databaseVersion' attached
// and 'shardVersion=UNSHARDED.
// and 'shardVersion=UNTRACKED.
auto checkEndpoint = [&](const ShardEndpoint& shardEndpoint) {
ASSERT_EQ(_dbPrimaryShard, shardEndpoint.shardName);
ASSERT_EQ(_dbVersion, shardEndpoint.databaseVersion);
ASSERT_EQ(ChunkVersion::UNSHARDED(), shardEndpoint.shardVersion->placementVersion());
ASSERT_EQ(ChunkVersion::UNTRACKED(), shardEndpoint.shardVersion->placementVersion());
};
CollectionRoutingInfoTargeter cri(operationContext(), _untrackedTimeseriesNss);
@ -1028,7 +1028,7 @@ TEST_F(CollectionRoutingInfoTargeterTimeseriesTest, RefreshOnStaleResponse) {
ASSERT_EQ(false, cri.isTrackedTimeSeriesBucketsNamespace());
ASSERT_FALSE(cri.timeseriesNamespaceNeedsRewrite(nss));
auto sci = StaleConfigInfo(bucketsNss, ShardVersion::UNSHARDED(), boost::none, _shard0);
auto sci = StaleConfigInfo(bucketsNss, ShardVersion::UNTRACKED(), boost::none, _shard0);
// No need to refresh when no stale info or targeting error is present.
ASSERT_FALSE(cri.refreshIfNeeded(operationContext()));
@ -1087,7 +1087,7 @@ TEST_F(ShardingTestFixtureWithMockCatalogCache, TestRefreshIfNeededAgainstUntrac
getCatalogCacheMock()->setDatabaseReturnValue(
dbName, CatalogCacheMock::makeDatabaseInfo(dbName, primaryShard, dbVersion));
const StaleConfigInfo dummyStaleConfigInfo(nss, ShardVersion::UNSHARDED(), boost::none, shard0);
const StaleConfigInfo dummyStaleConfigInfo(nss, ShardVersion::UNTRACKED(), boost::none, shard0);
// Install metadata for an untracked collection - then verify against:
const auto initialCollVersion =
@ -1138,7 +1138,7 @@ TEST_F(ShardingTestFixtureWithMockCatalogCache, TestRefreshIfNeededAgainstTracke
getCatalogCacheMock()->setDatabaseReturnValue(
dbName, CatalogCacheMock::makeDatabaseInfo(dbName, primaryShard, dbVersion));
const StaleConfigInfo dummyStaleConfigInfo(nss, ShardVersion::UNSHARDED(), boost::none, shard0);
const StaleConfigInfo dummyStaleConfigInfo(nss, ShardVersion::UNTRACKED(), boost::none, shard0);
// Install metadata for a tracked collection - then verify against:
const auto initialCollVersion = CatalogCacheMock::makeCollectionRoutingInfoUnsplittable(

View File

@ -87,7 +87,7 @@ void DBPrimaryRouter::appendCRUDUnshardedRoutingTokenToCommand(const ShardId& sh
BSONObjBuilder dbvBuilder(builder->subobjStart(DatabaseVersion::kDatabaseVersionField));
dbVersion.serialize(&dbvBuilder);
}
appendShardVersion(*builder, ShardVersion::UNSHARDED());
appendShardVersion(*builder, ShardVersion::UNTRACKED());
}
CachedDatabaseInfo DBPrimaryRouter::_getRoutingInfo(OperationContext* opCtx) const {
@ -278,7 +278,7 @@ CollectionRoutingInfo CollectionRouterCommon::_getRoutingInfo(OperationContext*
void CollectionRouterCommon::appendCRUDRoutingTokenToCommand(const ShardId& shardId,
const CollectionRoutingInfo& cri,
BSONObjBuilder* builder) {
if (cri.getShardVersion(shardId) == ShardVersion::UNSHARDED()) {
if (cri.getShardVersion(shardId) == ShardVersion::UNTRACKED()) {
// Need to add the database version as well.
const auto& dbVersion = cri.getDbVersion();
if (!dbVersion.isFixed()) {

View File

@ -97,7 +97,7 @@ Status upsert(OperationContext* opCtx, const IndexBuildEntry& indexBuildEntry) {
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kIndexBuildEntryNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -159,7 +159,7 @@ Status upsert(OperationContext* opCtx, const BSONObj& filter, const BSONObj& upd
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kIndexBuildEntryNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -193,7 +193,7 @@ Status update(OperationContext* opCtx, const BSONObj& filter, const BSONObj& upd
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kIndexBuildEntryNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -279,7 +279,7 @@ Status addIndexBuildEntry(OperationContext* opCtx, const IndexBuildEntry& indexB
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kIndexBuildEntryNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -357,7 +357,7 @@ StatusWith<IndexBuildEntry> getIndexBuildEntry(OperationContext* opCtx, UUID ind
const auto indexBuildsCollection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kIndexBuildEntryNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -75,7 +75,7 @@ repl::OpTime storeExternalClusterTimeKeyDocs(OperationContext* opCtx,
auto collection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -372,8 +372,8 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx,
checkCollectionUUIDMismatch(opCtx, *catalog, _resolvedNss, _coll, options._expectedUUID);
if (receivedShardVersion && *receivedShardVersion == ShardVersion::UNSHARDED()) {
shard_role_details::checkLocalCatalogIsValidForUnshardedShardVersion(
if (receivedShardVersion && *receivedShardVersion == ShardVersion::UNTRACKED()) {
shard_role_details::checkLocalCatalogIsValidForUntrackedShardVersion(
opCtx, *catalog, _coll, _resolvedNss);
}
@ -385,8 +385,8 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx,
return;
}
if (receivedShardVersion && *receivedShardVersion == ShardVersion::UNSHARDED()) {
shard_role_details::checkLocalCatalogIsValidForUnshardedShardVersion(
if (receivedShardVersion && *receivedShardVersion == ShardVersion::UNTRACKED()) {
shard_role_details::checkLocalCatalogIsValidForUntrackedShardVersion(
opCtx, *catalog, _coll, _resolvedNss);
}
@ -407,19 +407,19 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx,
uassert(StaleConfigInfo(_resolvedNss,
*receivedShardVersion,
ShardVersion::UNSHARDED() /* wantedVersion */,
ShardVersion::UNTRACKED() /* wantedVersion */,
ShardingState::get(opCtx)->shardId()),
str::stream() << "Namespace " << _resolvedNss.toStringForErrorMsg()
<< " is a view therefore the shard "
<< "version attached to the request must be unset or UNSHARDED",
!receivedShardVersion || *receivedShardVersion == ShardVersion::UNSHARDED());
<< "version attached to the request must be unset or UNTRACKED",
!receivedShardVersion || *receivedShardVersion == ShardVersion::UNTRACKED());
return;
}
}
// There is neither a collection nor a view for the namespace, so if we reached to this point
// there are the following possibilities depending on the received shard version:
// 1. ShardVersion::UNSHARDED: The request comes from a router and the operation entails the
// 1. ShardVersion::UNTRACKED: The request comes from a router and the operation entails the
// implicit creation of an unsharded collection. We can continue.
// 2. ChunkVersion::IGNORED: The request comes from a router that broadcasted the same to all
// shards, but this shard doesn't own any chunks for the collection. We can continue.
@ -435,8 +435,8 @@ AutoGetCollection::AutoGetCollection(OperationContext* opCtx,
ShardingState::get(opCtx)->shardId()),
str::stream() << "No metadata for namespace " << _resolvedNss.toStringForErrorMsg()
<< " therefore the shard "
<< "version attached to the request must be unset, UNSHARDED or IGNORED",
!receivedShardVersion || *receivedShardVersion == ShardVersion::UNSHARDED() ||
<< "version attached to the request must be unset, UNTRACKED or IGNORED",
!receivedShardVersion || *receivedShardVersion == ShardVersion::UNTRACKED() ||
ShardVersion::isPlacementVersionIgnored(*receivedShardVersion));
checkCollectionUUIDMismatch(opCtx, *catalog, _resolvedNss, _coll, options._expectedUUID);

View File

@ -169,7 +169,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -115,7 +115,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -165,7 +165,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -498,7 +498,7 @@ TEST_F(CreateCollectionTest, ValidationDisabledForTemporaryReshardingCollection)
const auto collection = acquireCollection(
opCtx.get(),
CollectionAcquisitionRequest(reshardingNss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx.get()),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -211,7 +211,7 @@ void _createCollection(OperationContext* opCtx, const NamespaceString& nss) {
ASSERT_TRUE(acquireCollection(opCtx,
CollectionAcquisitionRequest(
nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS)

View File

@ -74,7 +74,7 @@ StatusWith<int> moveRecordToLostAndFound(OperationContext* opCtx,
auto localCollection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(lostAndFoundNss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -458,7 +458,7 @@ bool _collectionExists(OperationContext* opCtx, const NamespaceString& nss) {
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -512,7 +512,7 @@ CollectionOptions _getCollectionOptions(OperationContext* opCtx, const Namespace
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -195,7 +195,7 @@ void BM_acquireCollectionLockFreeFunc(benchmark::State& state,
// this in the benchmark.
CollectionAcquisitionRequest request{
nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
readConcern,
AcquisitionPrerequisites::kRead};
auto acquisition = acquireCollectionMaybeLockFree(opCtx, request);
@ -216,7 +216,7 @@ void BM_acquireCollectionFunc(benchmark::State& state, CollectionAcquisitionBenc
// this in the benchmark.
CollectionAcquisitionRequest request{
nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
readConcern,
AcquisitionPrerequisites::kRead};
auto acquisition = acquireCollection(opCtx, request, MODE_IS);
@ -239,11 +239,11 @@ void BM_acquireMultiCollectionFunc(benchmark::State& state,
// this in the benchmark.
auto requests = {
CollectionAcquisitionRequest{nss1,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
readConcern,
AcquisitionPrerequisites::kRead},
CollectionAcquisitionRequest{nss2,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
readConcern,
AcquisitionPrerequisites::kRead}};
auto acquisitions = acquireCollections(opCtx, requests, MODE_IX);

View File

@ -140,7 +140,7 @@ void validateResolvedCollectionByUUID(OperationContext* opCtx,
str::stream() << "Collection " << ar.nssOrUUID.dbName().toStringForErrorMsg() << ":"
<< ar.nssOrUUID.uuid()
<< " acquired by UUID has a ShardVersion attached.",
!shardVersion || shardVersion == ShardVersion::UNSHARDED());
!shardVersion || shardVersion == ShardVersion::UNTRACKED());
uassert(ErrorCodes::NamespaceNotFound,
str::stream() << "Database name mismatch for "
<< ar.nssOrUUID.dbName().toStringForErrorMsg() << ":"
@ -327,10 +327,10 @@ void assertPlacementConflictTimePresentWhenRequired(
const boost::optional<ShardVersion>& receivedShardVersion) {
bool isShardVersionIgnored =
receivedShardVersion && ShardVersion::isPlacementVersionIgnored(*receivedShardVersion);
bool isShardVersionUnsharded =
receivedShardVersion && *receivedShardVersion == ShardVersion::UNSHARDED();
bool isRoutedVersion = (receivedDbVersion && isShardVersionUnsharded) ||
(receivedShardVersion && !isShardVersionIgnored && !isShardVersionUnsharded);
bool isShardVersionUntracked =
receivedShardVersion && *receivedShardVersion == ShardVersion::UNTRACKED();
bool isRoutedVersion = (receivedDbVersion && isShardVersionUntracked) ||
(receivedShardVersion && !isShardVersionIgnored && !isShardVersionUntracked);
if (isRoutedVersion && opCtx->inMultiDocumentTransaction() &&
OperationShardingState::isComingFromRouter(opCtx) &&
@ -517,8 +517,8 @@ CollectionOrViewAcquisitions acquireResolvedCollectionsOrViewsWithoutTakingLocks
holds_alternative<PlacementConcern>(prerequisites.placementConcern)
? get<PlacementConcern>(prerequisites.placementConcern).getDbVersion()
: boost::none;
if (placementConcernShardVersion == ShardVersion::UNSHARDED()) {
shard_role_details::checkLocalCatalogIsValidForUnshardedShardVersion(
if (placementConcernShardVersion == ShardVersion::UNTRACKED()) {
shard_role_details::checkLocalCatalogIsValidForUntrackedShardVersion(
opCtx,
catalog,
isCollection ? get<CollectionPtr>(snapshotedServices.collectionPtrOrView)
@ -2350,7 +2350,7 @@ void HandleTransactionResourcesFromStasher::dismissRestoredResources() {
_stasher = nullptr;
}
void shard_role_details::checkLocalCatalogIsValidForUnshardedShardVersion(
void shard_role_details::checkLocalCatalogIsValidForUntrackedShardVersion(
OperationContext* opCtx,
const CollectionCatalog& stashedCatalog,
const CollectionPtr& collectionPtr,
@ -2403,7 +2403,7 @@ void shard_role_details::checkShardingAndLocalCatalogCollectionUUIDMatch(
// corresponds to this shard not own any chunk. Also skip the check if the router attached
// ShardVersion::IGNORED, since in this case the router broadcasts request to shards that may
// not even own the collection at all (so they won't have any uuid on their local catalog).
if (requestedShardVersion == ShardVersion::UNSHARDED() ||
if (requestedShardVersion == ShardVersion::UNTRACKED() ||
!requestedShardVersion.placementVersion().isSet() ||
ShardVersion::isPlacementVersionIgnored(requestedShardVersion)) {
return;

View File

@ -708,7 +708,7 @@ private:
* Checks that, when in multi-document transaction, local catalog stashed by the transaction and the
* CollectionPtr it obtained are valid to be used for a request that attached
*/
void checkLocalCatalogIsValidForUnshardedShardVersion(OperationContext* opCtx,
void checkLocalCatalogIsValidForUntrackedShardVersion(OperationContext* opCtx,
const CollectionCatalog& stashedCatalog,
const CollectionPtr& collectionPtr,
const NamespaceString& nss);

View File

@ -348,16 +348,16 @@ TEST_F(ShardRoleLoopTest, handleStaleConfigExceptionNonComparableVersions) {
const auto shardVersionShardedNoChunks =
ShardVersionFactory::make(ChunkVersion(collectionGeneration, {0, 0}));
// UNSHARDED vs ShardVersion(x, y). Router was right. Expect shard retry.
testFn(ShardVersion::UNSHARDED(), shardVersionSharded, shardVersionSharded, true);
// UNTRACKED vs ShardVersion(x, y). Router was right. Expect shard retry.
testFn(ShardVersion::UNTRACKED(), shardVersionSharded, shardVersionSharded, true);
// UNSHARDED vs ShardVersion(x, y). Shard was right. Expect no shard retry.
testFn(ShardVersion::UNSHARDED(), shardVersionSharded, ShardVersion::UNSHARDED(), false);
// UNTRACKED vs ShardVersion(x, y). Shard was right. Expect no shard retry.
testFn(ShardVersion::UNTRACKED(), shardVersionSharded, ShardVersion::UNTRACKED(), false);
// ShardVersion(gen, 0, 0) vs ShardVersion(gen, x, y). Router was right. Expect shard retry.
testFn(shardVersionShardedNoChunks, shardVersionSharded, shardVersionSharded, true);
// UNSHARDED vs ShardVersion(x, y). Shard was right. Expect no shard retry.
// UNTRACKED vs ShardVersion(x, y). Shard was right. Expect no shard retry.
testFn(shardVersionShardedNoChunks, shardVersionSharded, shardVersionShardedNoChunks, false);
}
@ -586,7 +586,7 @@ TEST_F(ShardRoleLoopTest, LoopFnThrowsStaleConfigNonComparable_RouterActuallySta
std::queue<Status> statuses;
statuses.push(
{Status{StaleConfigInfo(kTestNss, ShardVersion::UNSHARDED(), shardedSV, kTestShardId),
{Status{StaleConfigInfo(kTestNss, ShardVersion::UNTRACKED(), shardedSV, kTestShardId),
"non comparable"}});
_staleShardExceptionHandlerMock->_handleStaleShardVersionExceptionRet =
shardedSV.placementVersion();
@ -605,12 +605,12 @@ TEST_F(ShardRoleLoopTest, LoopFnThrowsStaleConfigNonComparable_ShardActuallyStal
std::queue<Status> statuses;
statuses.push(
{Status{StaleConfigInfo(kTestNss, ShardVersion::UNSHARDED(), shardedSV, kTestShardId),
{Status{StaleConfigInfo(kTestNss, ShardVersion::UNTRACKED(), shardedSV, kTestShardId),
"non comparable"}});
statuses.push(
Status::OK()); // After refresh, the shard is not stale anymore so the fn succeeds.
_staleShardExceptionHandlerMock->_handleStaleShardVersionExceptionRet =
ShardVersion::UNSHARDED().placementVersion();
ShardVersion::UNTRACKED().placementVersion();
MockFn fn(statuses);
// The router was right, so retry. The shard must refresh and retry.
ASSERT_DOES_NOT_THROW(withStaleShardRetry(_opCtx, fn));
@ -663,7 +663,7 @@ TEST_F(ShardRoleLoopTest, LoopExhaustRetryAttempts) {
boost::none),
"shard is stale"});
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNSHARDED(), boost::none, kTestShardId),
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNTRACKED(), boost::none, kTestShardId),
"shard is stale"});
_catalogCacheMock->setCollectionReturnValue(
@ -693,7 +693,7 @@ TEST_F(ShardRoleLoopTest, LoopFnDoesNotRetryWhenLocksHeldHigherUp) {
DatabaseVersion(UUID::gen(), Timestamp(1, 0)),
boost::none),
"stale db reason"});
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNSHARDED(), boost::none, kTestShardId),
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNTRACKED(), boost::none, kTestShardId),
"unknown collection metadata"});
testFn(
Status{ShardCannotRefreshDueToLocksHeldInfo(kTestNss), "cannot refresh due to locks held"});
@ -718,7 +718,7 @@ TEST_F(ShardRoleLoopTest, LoopFnDoesNotRetryWhenInDbDirectClient) {
DatabaseVersion(UUID::gen(), Timestamp(1, 0)),
boost::none),
"stale db reason"});
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNSHARDED(), boost::none, kTestShardId),
testFn(Status{StaleConfigInfo(kTestNss, ShardVersion::UNTRACKED(), boost::none, kTestShardId),
"unknown collection metadata"});
testFn(
Status{ShardCannotRefreshDueToLocksHeldInfo(kTestNss), "cannot refresh due to locks held"});

View File

@ -106,7 +106,7 @@ class ShardRoleTest : public ShardServerTestFixture {
protected:
void setUp() override;
void installUnshardedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss);
void installUntrackedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss);
void installShardedCollectionMetadata(
OperationContext* opCtx,
const NamespaceString& nss,
@ -168,7 +168,7 @@ void ShardRoleTest::setUp() {
// Create nssUnshardedCollection1
createTestCollection(operationContext(), nssUnshardedCollection1);
installUnshardedCollectionMetadata(operationContext(), nssUnshardedCollection1);
installUntrackedCollectionMetadata(operationContext(), nssUnshardedCollection1);
// Create nssShardedCollection1
createTestCollection(operationContext(), nssShardedCollection1);
@ -185,10 +185,10 @@ void ShardRoleTest::setUp() {
// Setup nssView
createTestView(operationContext(), nssView, nssUnshardedCollection1, viewPipeline);
installUnshardedCollectionMetadata(operationContext(), nssView);
installUntrackedCollectionMetadata(operationContext(), nssView);
}
void ShardRoleTest::installUnshardedCollectionMetadata(OperationContext* opCtx,
void ShardRoleTest::installUntrackedCollectionMetadata(OperationContext* opCtx,
const NamespaceString& nss) {
AutoGetCollection coll(
opCtx,
@ -257,7 +257,7 @@ TEST_F(ShardRoleTest, NamespaceOrViewAcquisitionRequestWithOpCtxTakesPlacementFr
const NamespaceString anotherCollection =
NamespaceString::createNamespaceString_forTest("test2.foo");
ScopedSetShardRole setShardRole(
operationContext(), anotherCollection, ShardVersion::UNSHARDED(), dbVersionTestDb);
operationContext(), anotherCollection, ShardVersion::UNTRACKED(), dbVersionTestDb);
auto acquisition = CollectionOrViewAcquisitionRequest::fromOpCtx(
operationContext(), nss, AcquisitionPrerequisites::kWrite);
ASSERT_EQ(boost::none, acquisition.placementConcern.getDbVersion());
@ -276,7 +276,7 @@ TEST_F(ShardRoleTest, NamespaceOrViewAcquisitionRequestWithOpCtxTakesPlacementFr
{
const auto dbVersion = dbVersionTestDb;
const auto shardVersion = ShardVersion::UNSHARDED();
const auto shardVersion = ShardVersion::UNTRACKED();
ScopedSetShardRole setShardRole(operationContext(), nss, shardVersion, dbVersion);
auto acquisition = CollectionOrViewAcquisitionRequest::fromOpCtx(
operationContext(), nss, AcquisitionPrerequisites::kWrite);
@ -356,7 +356,7 @@ TEST_F(ShardRoleTest, AcquisitionWithInvalidNamespaceFails) {
// Placement checks when acquiring unsharded collections
TEST_F(ShardRoleTest, AcquireUnshardedCollWithCorrectPlacementVersion) {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto validateAcquisition = [&](auto& acquisition) {
ASSERT_EQ(nssUnshardedCollection1, acquisition.nss());
@ -404,7 +404,7 @@ TEST_F(ShardRoleTest, AcquireUnshardedCollWithCorrectPlacementVersion) {
TEST_F(ShardRoleTest, AcquireUnshardedCollWithIncorrectPlacementVersionThrows) {
const auto incorrectDbVersion = DatabaseVersion(UUID::gen(), Timestamp(50, 0));
PlacementConcern placementConcern{incorrectDbVersion, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{incorrectDbVersion, ShardVersion::UNTRACKED()};
{
auto scopedDss = DatabaseShardingStateMock::acquire(operationContext(), dbNameTestDb);
@ -462,7 +462,7 @@ TEST_F(ShardRoleTest, AcquireUnshardedCollWhenShardDoesNotKnowThePlacementVersio
ASSERT_FALSE(exInfo->getCriticalSectionSignal().is_initialized());
};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
ASSERT_THROWS_WITH_CHECK(acquireCollection(operationContext(),
{nssUnshardedCollection1,
placementConcern,
@ -492,7 +492,7 @@ TEST_F(ShardRoleTest, AcquireUnshardedCollWhenCriticalSectionIsActiveThrows) {
}
{
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto validateException = [&](const DBException& ex) {
const auto exInfo = ex.extraInfo<StaleDbRoutingVersion>();
@ -654,12 +654,12 @@ TEST_F(ShardRoleTest, AcquireShardedCollWithCorrectPlacementVersion) {
}
TEST_F(ShardRoleTest, AcquireShardedCollWithIncorrectPlacementVersionThrows) {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto validateException = [&](const DBException& ex) {
const auto exInfo = ex.extraInfo<StaleConfigInfo>();
ASSERT_EQ(nssShardedCollection1, exInfo->getNss());
ASSERT_EQ(ShardVersion::UNSHARDED(), exInfo->getVersionReceived());
ASSERT_EQ(ShardVersion::UNTRACKED(), exInfo->getVersionReceived());
ASSERT_EQ(shardVersionShardedCollection1, exInfo->getVersionWanted());
ASSERT_EQ(kMyShardName, exInfo->getShardId());
ASSERT_FALSE(exInfo->getCriticalSectionSignal().is_initialized());
@ -788,11 +788,11 @@ TEST_F(ShardRoleTest, AcquireShardedCollWithoutSpecifyingPlacementVersion) {
TEST_F(ShardRoleTest, AcquireInMultiDocumentTransactionMustCheckForPlacementConflictTime_NoThrow) {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
OperationContext* opCtx = operationContext();
// Simulate a routed request, this necessary for the check to throw.
ScopedSetShardRole setShardRole(
opCtx, nssUnshardedCollection1, ShardVersion::UNSHARDED(), dbVersionTestDb);
opCtx, nssUnshardedCollection1, ShardVersion::UNTRACKED(), dbVersionTestDb);
// Never throw if we are not a multi-document transaction.
ASSERT_DOES_NOT_THROW(
@ -810,7 +810,7 @@ TEST_F(ShardRoleTest, AcquireInMultiDocumentTransactionMustCheckForPlacementConf
auto dbVersionDbWithPlacementConflictTime = dbVersionTestDb;
dbVersionDbWithPlacementConflictTime.setPlacementConflictTime(LogicalTime(Timestamp{0, 0}));
placementConcern =
PlacementConcern{dbVersionDbWithPlacementConflictTime, ShardVersion::UNSHARDED()};
PlacementConcern{dbVersionDbWithPlacementConflictTime, ShardVersion::UNTRACKED()};
ASSERT_DOES_NOT_THROW(
acquireCollection(opCtx,
@ -821,7 +821,7 @@ TEST_F(ShardRoleTest, AcquireInMultiDocumentTransactionMustCheckForPlacementConf
MODE_IS));
// The PlacementConflictTime can also be set on the shardVersion
auto shardVersionWithPlacementConflictTime = ShardVersion::UNSHARDED();
auto shardVersionWithPlacementConflictTime = ShardVersion::UNTRACKED();
shardVersionWithPlacementConflictTime.setPlacementConflictTime(LogicalTime(Timestamp{0, 0}));
placementConcern = PlacementConcern{dbVersionTestDb, shardVersionWithPlacementConflictTime};
ASSERT_DOES_NOT_THROW(
@ -840,7 +840,7 @@ TEST_F(ShardRoleTest,
// Do not throw for unrouted operations
{
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
ScopedSetShardRole setShardRole(opCtx, nssUnshardedCollection1, boost::none, boost::none);
ASSERT_DOES_NOT_THROW(
acquireCollection(opCtx,
@ -853,9 +853,9 @@ TEST_F(ShardRoleTest,
// Do not throw for (boost::none, unsharded)
{
PlacementConcern placementConcern{boost::none, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{boost::none, ShardVersion::UNTRACKED()};
ScopedSetShardRole setShardRole(
opCtx, nssUnshardedCollection1, ShardVersion::UNSHARDED(), dbVersionTestDb);
opCtx, nssUnshardedCollection1, ShardVersion::UNTRACKED(), dbVersionTestDb);
ASSERT_DOES_NOT_THROW(
acquireCollection(opCtx,
CollectionAcquisitionRequest(nssUnshardedCollection1,
@ -869,7 +869,7 @@ TEST_F(ShardRoleTest,
{
PlacementConcern placementConcern{boost::none, shardVersionIgnore};
ScopedSetShardRole setShardRole(
opCtx, nssUnshardedCollection1, ShardVersion::UNSHARDED(), dbVersionTestDb);
opCtx, nssUnshardedCollection1, ShardVersion::UNTRACKED(), dbVersionTestDb);
ASSERT_DOES_NOT_THROW(
acquireCollection(opCtx,
CollectionAcquisitionRequest(nssUnshardedCollection1,
@ -883,11 +883,11 @@ TEST_F(ShardRoleTest,
DEATH_TEST_REGEX_F(ShardRoleTest,
AcquireInMultiDocumentTransactionMissingPlacementConflictTime_version_unsharded,
"Tripwire assertion.*10206300") {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
OperationContext* opCtx = operationContext();
// Simulate a routed request, this necessary for the check to throw.
ScopedSetShardRole setShardRole(
opCtx, nssUnshardedCollection1, ShardVersion::UNSHARDED(), dbVersionTestDb);
opCtx, nssUnshardedCollection1, ShardVersion::UNTRACKED(), dbVersionTestDb);
// Setting the operation context in multi-document transaction requires the version to include
// the PlacementConflictTime
opCtx->setInMultiDocumentTransaction();
@ -1072,10 +1072,10 @@ TEST_F(ShardRoleTest, ConflictIsThrownWhenShardVersionUnshardedButStashedCatalog
}
// Try to acquire the now-dropped collection, with declared placement concern
// ShardVersion::UNSHARDED. Expect a conflict to be detected.
// ShardVersion::UNTRACKED. Expect a conflict to be detected.
{
ScopedSetShardRole setShardRole(
operationContext(), nssUnshardedCollection1, ShardVersion::UNSHARDED(), boost::none);
operationContext(), nssUnshardedCollection1, ShardVersion::UNTRACKED(), boost::none);
ASSERT_THROWS_CODE(
acquireCollectionOrView(
operationContext(),
@ -1101,7 +1101,7 @@ TEST_F(ShardRoleTest, NoExceptionIsThrownWhenShardVersionUnshardedButStashedIsEq
// snapshot points to a different object than the one kept by the catalog.
{
ScopedSetShardRole setShardRole(
operationContext(), nssUnshardedCollection1, ShardVersion::UNSHARDED(), boost::none);
operationContext(), nssUnshardedCollection1, ShardVersion::UNTRACKED(), boost::none);
auto acquisition = acquireCollectionOrView(
operationContext(),
CollectionOrViewAcquisitionRequest::fromOpCtx(
@ -1121,7 +1121,7 @@ TEST_F(ShardRoleTest, AcquireCollectionMaybeLockFreeTakesLocksWhenInMultiDocTran
const auto acquisition = acquireCollectionMaybeLockFree(
operationContext(),
{nssUnshardedCollection1,
{dbVersionDbWithPlacementConflictTime, ShardVersion::UNSHARDED()},
{dbVersionDbWithPlacementConflictTime, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kRead});
ASSERT_TRUE(shard_role_details::getLocker(operationContext())
@ -1132,7 +1132,7 @@ TEST_F(ShardRoleTest, AcquireCollectionMaybeLockFreeDoesNotTakeLocksWhenNotInMul
const auto acquisition =
acquireCollectionMaybeLockFree(operationContext(),
{nssUnshardedCollection1,
{dbVersionTestDb, ShardVersion::UNSHARDED()},
{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kRead});
ASSERT_FALSE(
@ -1145,7 +1145,7 @@ DEATH_TEST_REGEX_F(ShardRoleTest,
"Tripwire assertion") {
ASSERT_THROWS_CODE(acquireCollectionMaybeLockFree(operationContext(),
{nssUnshardedCollection1,
{dbVersionTestDb, ShardVersion::UNSHARDED()},
{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kWrite}),
DBException,
@ -1159,7 +1159,7 @@ TEST_F(ShardRoleTest, AcquireMultipleCollectionsAllWithCorrectPlacementConcern)
const auto acquisitions = makeAcquisitionMap(
acquireCollections(operationContext(),
{{nssUnshardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kWrite},
{nssShardedCollection1,
@ -1193,11 +1193,11 @@ TEST_F(ShardRoleTest, AcquireMultipleCollectionsWithIncorrectPlacementConcernThr
ASSERT_THROWS_WITH_CHECK(
acquireCollections(operationContext(),
{{nssUnshardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kWrite},
{nssShardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kWrite}},
MODE_IX),
@ -1205,7 +1205,7 @@ TEST_F(ShardRoleTest, AcquireMultipleCollectionsWithIncorrectPlacementConcernThr
[&](const DBException& ex) {
const auto exInfo = ex.extraInfo<StaleConfigInfo>();
ASSERT_EQ(nssShardedCollection1, exInfo->getNss());
ASSERT_EQ(ShardVersion::UNSHARDED(), exInfo->getVersionReceived());
ASSERT_EQ(ShardVersion::UNTRACKED(), exInfo->getVersionReceived());
ASSERT_EQ(shardVersionShardedCollection1, exInfo->getVersionWanted());
ASSERT_EQ(kMyShardName, exInfo->getShardId());
ASSERT_FALSE(exInfo->getCriticalSectionSignal().is_initialized());
@ -1237,7 +1237,7 @@ TEST_F(ShardRoleTest, AcquireCollectionByUUID) {
const auto acquisition =
acquireCollection(operationContext(),
{NamespaceStringOrUUID(dbNameTestDb, uuid),
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kWrite},
MODE_IX);
@ -1435,7 +1435,7 @@ TEST_F(ShardRoleTest, AcquireCollectionByUUIDWithShardVersionAttachedThrows) {
const auto shardVersion = shardVersionShardedCollection1;
ScopedSetShardRole setShardRole(
operationContext(), nssShardedCollection1, shardVersion, dbVersion);
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
ASSERT_THROWS_CODE(acquireCollection(operationContext(),
{NamespaceStringOrUUID(dbNameTestDb, uuid),
placementConcern,
@ -1567,7 +1567,7 @@ TEST_F(ShardRoleTest, AcquireCollectionOrView) {
TEST_F(ShardRoleTest, YieldAndRestoreAcquisitionWithLocks) {
const auto nss = nssUnshardedCollection1;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition = acquireCollection(operationContext(),
{
nss,
@ -1604,7 +1604,7 @@ TEST_F(ShardRoleTest, YieldAndRestoreAcquisitionWithLocks) {
TEST_F(ShardRoleTest, YieldAndRestoreAcquisitionWithoutLocks) {
const auto nss = nssUnshardedCollection1;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisitions = makeAcquisitionMap(
acquireCollectionsOrViewsMaybeLockFree(operationContext(),
{{
@ -1645,7 +1645,7 @@ TEST_F(ShardRoleTest, YieldAndRestoreViewAcquisitionWithLocks) {
const auto opCtx = operationContext();
const auto nss = nssView;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition = acquireCollectionOrView(opCtx,
{
nss,
@ -1695,7 +1695,7 @@ TEST_F(ShardRoleTest, YieldAndRestoreViewAcquisitionWithoutLocks) {
const auto opCtx = operationContext();
const auto nss = nssView;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition =
acquireCollectionOrViewMaybeLockFree(opCtx,
{
@ -2120,7 +2120,7 @@ void ShardRoleTest::testRestoreFailsIfCollectionRenamed(
AcquisitionPrerequisites::OperationType operationType) {
const auto nss = nssUnshardedCollection1;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition =
acquireCollection(operationContext(),
{nss, placementConcern, repl::ReadConcernArgs(), operationType},
@ -2165,7 +2165,7 @@ void ShardRoleTest::testRestoreFailsIfCollectionDroppedAndRecreated(
AcquisitionPrerequisites::OperationType operationType) {
const auto nss = nssUnshardedCollection1;
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition =
acquireCollection(operationContext(),
{nss, placementConcern, repl::ReadConcernArgs(), operationType},
@ -2260,7 +2260,7 @@ TEST_F(ShardRoleTest, RestoreForReadSucceedsEvenIfPlacementHasChanged) {
void ShardRoleTest::testRestoreFailsIfCollectionIsNowAView(
AcquisitionPrerequisites::OperationType operationType) {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition = acquireCollection(
operationContext(),
@ -2310,7 +2310,7 @@ TEST_F(ShardRoleTest, ReadSourceDoesNotChangeOnSecondary) {
const auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -2338,7 +2338,7 @@ TEST_F(ShardRoleTest, WriteAcquisitionsDontChangeReadSourceToLastApplied) {
acquireCollection(operationContext(),
{
nssUnshardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kUnreplicatedWrite,
},
@ -2380,7 +2380,7 @@ TEST_F(ShardRoleTest, ReadAcquisitionsChangeReadSourceToLastApplied) {
? acquireCollection(operationContext(),
{
nssUnshardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kRead,
},
@ -2389,7 +2389,7 @@ TEST_F(ShardRoleTest, ReadAcquisitionsChangeReadSourceToLastApplied) {
operationContext(),
{
nssUnshardedCollection1,
PlacementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()},
PlacementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs(),
AcquisitionPrerequisites::kRead,
});
@ -2426,7 +2426,7 @@ TEST_F(ShardRoleTest, RestoreChangesReadSourceAfterStepUp) {
RecoveryUnit::ReadSource::kNoTimestamp,
shard_role_details::getRecoveryUnit(operationContext())->getTimestampReadSource());
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
[[maybe_unused]] const auto acquisitions =
acquireCollectionsOrViewsMaybeLockFree(operationContext(),
{{
@ -2525,7 +2525,7 @@ TEST_F(ShardRoleTest,
TEST_F(ShardRoleTest, YieldAndRestoreCursor) {
const auto& nss = nssUnshardedCollection1;
auto cursorId = [&] {
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
const auto acquisition = acquireCollection(operationContext(),
{nssUnshardedCollection1,
@ -3113,9 +3113,9 @@ TEST_F(ShardRoleTest, StashTransactionResourcesForMultiDocumentTransactionCompre
operationContext()->setInMultiDocumentTransaction();
// Acquire multiple collections
PlacementConcern unshardedConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern unshardedConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
PlacementConcern shardedConcern{{}, shardVersionShardedCollection1};
PlacementConcern viewConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern viewConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto acquisition1 = acquireCollection(operationContext(),
{nssUnshardedCollection1,
@ -3171,7 +3171,7 @@ TEST_F(ShardRoleTest, StashTransactionResourcesForMultiDocumentTransactionRestor
operationContext()->setInMultiDocumentTransaction();
// Acquire a collection to have some transaction resources
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto acquisition = acquireCollection(
operationContext(),
{nss, placementConcern, repl::ReadConcernArgs(), AcquisitionPrerequisites::kRead},
@ -3217,7 +3217,7 @@ TEST_F(ShardRoleTest, StashTransactionResourcesForMultiDocumentTransactionDouble
operationContext()->setInMultiDocumentTransaction();
// Acquire a collection
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNSHARDED()};
PlacementConcern placementConcern{dbVersionTestDb, ShardVersion::UNTRACKED()};
auto acquisition = acquireCollection(
operationContext(),
{nss, placementConcern, repl::ReadConcernArgs(), AcquisitionPrerequisites::kRead},

View File

@ -121,11 +121,11 @@ public:
void throwIfReshardingInProgress(NamespaceString const& nss) const;
/**
* Returns the current shard's placement version for the collection or UNSHARDED if it is not
* sharded.
* Returns the current shard's placement version for the collection or UNTRACKED if it does not
* have a routing table.
*/
ChunkVersion getShardPlacementVersion() const {
return (hasRoutingTable() ? _cm->getVersion(_thisShardId) : ChunkVersion::UNSHARDED());
return (hasRoutingTable() ? _cm->getVersion(_thisShardId) : ChunkVersion::UNTRACKED());
}
/**
@ -139,8 +139,8 @@ public:
}
/**
* Returns the current shard's placement version for the collection or UNSHARDED if it is not
* sharded.
* Returns the current shard's placement version for the collection or UNTRACKED if it does not
* have a routing table.
*
* Will not throw an exception if _thisShardId is marked as stale by the CollectionMetadata's
* current chunk manager. Only use this function when logging the returned ChunkVersion. If the
@ -149,14 +149,15 @@ public:
*/
ChunkVersion getShardPlacementVersionForLogging() const {
return (hasRoutingTable() ? _cm->getVersionForLogging(_thisShardId)
: ChunkVersion::UNSHARDED());
: ChunkVersion::UNTRACKED());
}
/**
* Returns the current collection placement version or UNSHARDED if it is not sharded.
* Returns the current collection placement version or UNTRACKED if it does not have a routing
* table.
*/
ChunkVersion getCollPlacementVersion() const {
return (hasRoutingTable() ? _cm->getVersion() : ChunkVersion::UNSHARDED());
return (hasRoutingTable() ? _cm->getVersion() : ChunkVersion::UNTRACKED());
}
/**
@ -319,11 +320,11 @@ public:
}
private:
// The full routing table for the collection or boost::none if the collection is not sharded
// The full routing table for the collection or boost::none if the collection is not tracked
boost::optional<ChunkManager> _cm;
// The identity of this shard, for the purpose of answering "key belongs to me" queries. If the
// collection is not sharded (_cm is boost::none), then this value will be empty.
// collection is not tracked (_cm is boost::none), then this value will be empty.
ShardId _thisShardId;
};

View File

@ -185,7 +185,7 @@ TEST_F(
const auto optCurrMetadata = csr.getCurrentMetadataIfKnown();
ASSERT_TRUE(optCurrMetadata);
ASSERT_FALSE(optCurrMetadata->isSharded());
ASSERT_EQ(optCurrMetadata->getShardPlacementVersion(), ChunkVersion::UNSHARDED());
ASSERT_EQ(optCurrMetadata->getShardPlacementVersion(), ChunkVersion::UNTRACKED());
}
TEST_F(
@ -507,12 +507,12 @@ TEST_F(CollectionShardingRuntimeTest, InvalidateRangePreserversOlderThanUnsharde
ASSERT_TRUE(ownershipFilter.isRangePreserverStillValid());
// Test that the trackers will be invalidated with version ChunkVersion::UNSHARDED().
// Test is prepared for the case when UNSHARDED metadata will be started to be tracked. In this
// case ownershipFilter::shardPlacementVersion = UNSHARDED. Currently it's not possible to test
// Test that the trackers will be invalidated with version ChunkVersion::UNTRACKED().
// Test is prepared for the case when UNTRACKED metadata will be started to be tracked. In this
// case ownershipFilter::shardPlacementVersion = UNTRACKED. Currently it's not possible to test
// as in this case metadataManager is not created for unsharded collection. When it will be
// changed it will be possible to test against a current version.
csr.invalidateRangePreserversOlderThanShardVersion(opCtx, ChunkVersion::UNSHARDED());
csr.invalidateRangePreserversOlderThanShardVersion(opCtx, ChunkVersion::UNTRACKED());
ASSERT_FALSE(ownershipFilter.isRangePreserverStillValid());
}

View File

@ -153,7 +153,7 @@ public:
* If the shard currently doesn't know whether the collection is sharded or not, it will throw a
* StaleConfig error.
*
* If the request doesn't have a shard version all collections will be treated as UNSHARDED.
* If the request doesn't have a shard version all collections will be treated as UNTRACKED.
*/
virtual ScopedCollectionDescription getCollectionDescription(OperationContext* opCtx) const = 0;
@ -181,7 +181,7 @@ public:
* operations that don't have a shard version.
* If the request doesn't have a shard version:
* - this function will invariant if !supportNonVersionedOperations (default value)
* - the collection will be treated as UNSHARDED otherwise.
* - the collection will be treated as UNTRACKED otherwise.
*
* Use 'getCollectionDescription' for other cases, like obtaining information about
* sharding-related properties of the collection are necessary that won't change under
@ -203,7 +203,7 @@ public:
* version of the collection and if not, throws StaleConfig error populated with the received
* and wanted versions.
*
* If the request is not versioned all collections will be treated as UNSHARDED.
* If the request is not versioned all collections will be treated as UNTRACKED.
*/
virtual void checkShardVersionOrThrow(OperationContext* opCtx) const = 0;

View File

@ -247,7 +247,7 @@ TEST_F(DocumentKeyStateTest, CheckDBVersion) {
AutoGetCollection autoColl(opCtx, kUnshardedNss, MODE_IX);
WriteUnitOfWork wuow(opCtx);
const bool fromMigrate = false;
auto shardVersion = ShardVersion::UNSHARDED();
auto shardVersion = ShardVersion::UNTRACKED();
// Insert parameters
std::vector<InsertStatement> toInsert;

View File

@ -90,7 +90,7 @@ void OperationShardingState::setShardRole(OperationContext* opCtx,
const boost::optional<DatabaseVersion>& databaseVersion) {
auto& oss = OperationShardingState::get(opCtx);
if (shardVersion && shardVersion != ShardVersion::UNSHARDED()) {
if (shardVersion && shardVersion != ShardVersion::UNTRACKED()) {
tassert(
6300900, "Attaching a shard version requires a non db-only namespace", !nss.isDbOnly());
}
@ -258,7 +258,7 @@ ScopedSetShardRole::ScopedSetShardRole(OperationContext* opCtx,
uassert(7331300,
"A 'fixed' dbVersion should only be used with an unsharded shard version or none "
"at all",
!_shardVersion || _shardVersion == ShardVersion::UNSHARDED());
!_shardVersion || _shardVersion == ShardVersion::UNTRACKED());
_databaseVersion.reset();
_shardVersion.reset();
}

View File

@ -130,7 +130,7 @@ public:
* is allowed to create a collection with the specified namespace (or the equivalent bucket
* namespace) in this context and that the caller will be responsible for notifying the shard
* Sharding subsystem of the collection creation. Note that in most of cases the
* CollectionShardingRuntime associated to that nss will be set as UNSHARDED. However, there are
* CollectionShardingRuntime associated to that nss will be set as UNTRACKED. However, there are
* some scenarios in which it is required to set is as UNKNOWN: that's the reason why the
* constructor has the 'forceCSRAsUnknownAfterCollectionCreation' parameter. You can find more
* information about how the CSR is modified in ShardServerOpObserver::onCreateCollection.

View File

@ -117,9 +117,9 @@ TEST_F(OperationShardingStateTest, ScopedSetShardRoleIgnoresFixedDbVersion) {
TEST_F(OperationShardingStateTest, ScopedSetShardRoleAllowedShardVersionsWithFixedDbVersion) {
{
// The UNSHARDED version can be passed with a fixed dbVersion.
// The UNTRACKED version can be passed with a fixed dbVersion.
DatabaseVersion dbv{DatabaseVersion::makeFixed()};
ShardVersion sv{ShardVersion::UNSHARDED()};
ShardVersion sv{ShardVersion::UNTRACKED()};
ScopedSetShardRole scopedSetShardRole0(operationContext(), kNss, sv, dbv);
}

View File

@ -162,7 +162,7 @@ public:
// collections are always unsharded (untracked) and therefore on the primary shard.
{
auto dbVersion = OperationShardingState::get(opCtx).getDbVersion(nss.dbName());
auto pc = PlacementConcern(dbVersion, ShardVersion::UNSHARDED());
auto pc = PlacementConcern(dbVersion, ShardVersion::UNTRACKED());
CollectionAcquisitionRequests requests = {
CollectionAcquisitionRequest(namespaces.ecocNss,
pc,

View File

@ -163,7 +163,7 @@ public:
// collections are always unsharded (untracked) and therefore on the primary shard.
{
auto dbVersion = OperationShardingState::get(opCtx).getDbVersion(nss.dbName());
auto pc = PlacementConcern(dbVersion, ShardVersion::UNSHARDED());
auto pc = PlacementConcern(dbVersion, ShardVersion::UNTRACKED());
CollectionAcquisitionRequests requests = {
CollectionAcquisitionRequest(namespaces.ecocNss,
pc,

View File

@ -244,17 +244,17 @@ void NamespaceString::serializeCollectionName(BSONObjBuilder* builder, StringDat
}
bool NamespaceString::isNamespaceAlwaysUntracked() const {
// Local and admin never have sharded collections
// Local and admin never have tracked collections
if (isLocalDB() || isAdminDB())
return true;
// Config can only have the system.sessions as sharded
// Config can only have the system.sessions as tracked
if (isConfigDB())
return *this != NamespaceString::kLogicalSessionsNamespace;
if (isSystem()) {
// Only some system collections (<DB>.system.<COLL>) can be sharded,
// all the others are always unsharded.
// Only some system collections (<DB>.system.<COLL>) can be tracked,
// all the others are always untracked.
// This list does not contain 'config.system.sessions' because we already check it above
return !isTemporaryReshardingCollection() && !isTimeseriesBucketsCollection();
}

View File

@ -60,9 +60,9 @@ public:
constexpr static size_t MaxUserNsCollectionLen = 255;
constexpr static size_t MaxInternalNsCollectionLen = 511;
// The maximum namespace length of sharded collections is less than that of unsharded ones since
// The maximum namespace length of tracked collections is less than that of untracked ones since
// the namespace of the cached chunks metadata, local to each shard, is composed by the
// namespace of the related sharded collection (i.e., config.cache.chunks.<ns>).
// namespace of the related tracked collection (i.e., config.cache.chunks.<ns>).
constexpr static size_t MaxUserNsShardedCollectionLen =
235; // 255 - len(ChunkType::ShardNSPrefix)

View File

@ -83,7 +83,7 @@ void writeToImageCollection(OperationContext* opCtx, OpStateAccumulator* opAccum
auto collection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -366,7 +366,7 @@ protected:
auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -382,7 +382,7 @@ protected:
auto sideCollection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -400,7 +400,7 @@ protected:
auto configTransactions = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kSessionTransactionsTableNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -427,7 +427,7 @@ protected:
auto preImagesCollection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kChangeStreamPreImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -58,7 +58,7 @@ inline std::vector<ScopedSetShardRole> createScopedShardRoles(
bool isTracked = nssCri->second.hasRoutingTable();
auto shardVersion = [&] {
auto sv =
isTracked ? nssCri->second.getShardVersion(myShardId) : ShardVersion::UNSHARDED();
isTracked ? nssCri->second.getShardVersion(myShardId) : ShardVersion::UNTRACKED();
if (auto txnRouter = TransactionRouter::get(opCtx);
txnRouter && opCtx->inMultiDocumentTransaction()) {

View File

@ -534,7 +534,7 @@ std::deque<BSONObj> CommonMongodProcessInterface::listCatalog(OperationContext*
[opCtx](const NamespaceStringOrUUID& nsOrUuid) {
return CollectionAcquisitionRequest(
nsOrUuid,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead);
});

View File

@ -695,13 +695,13 @@ public:
bool addPrimaryShard = false) = 0;
/**
* Used to enforce the constraint that the foreign collection must be unsharded.
* Used to enforce the constraint that the foreign collection must be untracked.
*/
class ScopedExpectUnshardedCollection {
class ScopedExpectUntrackedCollection {
public:
virtual ~ScopedExpectUnshardedCollection() = default;
virtual ~ScopedExpectUntrackedCollection() = default;
};
virtual std::unique_ptr<ScopedExpectUnshardedCollection> expectUnshardedCollectionInScope(
virtual std::unique_ptr<ScopedExpectUntrackedCollection> expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) = 0;

View File

@ -355,7 +355,7 @@ public:
MONGO_UNREACHABLE;
}
std::unique_ptr<ScopedExpectUnshardedCollection> expectUnshardedCollectionInScope(
std::unique_ptr<ScopedExpectUntrackedCollection> expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) override {

View File

@ -186,16 +186,16 @@ public:
const NamespaceString& ns,
const std::vector<BSONObj>& indexSpecs) override;
std::unique_ptr<ScopedExpectUnshardedCollection> expectUnshardedCollectionInScope(
std::unique_ptr<ScopedExpectUntrackedCollection> expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) override {
class ScopedExpectUnshardedCollectionNoop : public ScopedExpectUnshardedCollection {
class ScopedExpectUntrackedCollectionNoop : public ScopedExpectUntrackedCollection {
public:
ScopedExpectUnshardedCollectionNoop() = default;
ScopedExpectUntrackedCollectionNoop() = default;
};
return std::make_unique<ScopedExpectUnshardedCollectionNoop>();
return std::make_unique<ScopedExpectUntrackedCollectionNoop>();
}
protected:

View File

@ -171,7 +171,7 @@ void ShardServerProcessInterface::checkRoutingInfoEpochOrThrow(
catalogCache->getCollectionRoutingInfo(expCtx->getOperationContext(), nss));
auto foundVersion = routingInfo.hasRoutingTable()
? routingInfo.getCollectionVersion().placementVersion()
: ChunkVersion::UNSHARDED();
: ChunkVersion::UNTRACKED();
auto ignoreIndexVersion = ShardVersionFactory::make(foundVersion);
return ignoreIndexVersion;
@ -690,23 +690,23 @@ std::unique_ptr<Pipeline> ShardServerProcessInterface::preparePipelineForExecuti
shouldUseCollectionDefaultCollator);
}
std::unique_ptr<MongoProcessInterface::ScopedExpectUnshardedCollection>
ShardServerProcessInterface::expectUnshardedCollectionInScope(
std::unique_ptr<MongoProcessInterface::ScopedExpectUntrackedCollection>
ShardServerProcessInterface::expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) {
class ScopedExpectUnshardedCollectionImpl : public ScopedExpectUnshardedCollection {
class ScopedExpectUntrackedCollectionImpl : public ScopedExpectUntrackedCollection {
public:
ScopedExpectUnshardedCollectionImpl(OperationContext* opCtx,
ScopedExpectUntrackedCollectionImpl(OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion)
: _expectUnsharded(opCtx, nss, ShardVersion::UNSHARDED(), dbVersion) {}
: _expectUntracked(opCtx, nss, ShardVersion::UNTRACKED(), dbVersion) {}
private:
ScopedSetShardRole _expectUnsharded;
ScopedSetShardRole _expectUntracked;
};
return std::make_unique<ScopedExpectUnshardedCollectionImpl>(opCtx, nss, dbVersion);
return std::make_unique<ScopedExpectUntrackedCollectionImpl>(opCtx, nss, dbVersion);
}
} // namespace mongo

View File

@ -193,7 +193,7 @@ public:
boost::optional<BSONObj> readConcern = boost::none,
bool shouldUseCollectionDefaultCollator = false) final;
std::unique_ptr<ScopedExpectUnshardedCollection> expectUnshardedCollectionInScope(
std::unique_ptr<ScopedExpectUntrackedCollection> expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) override;

View File

@ -86,11 +86,11 @@ protected:
return _expCtx;
}
void installUnshardedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss) {
const auto unshardedCollectionMetadata = CollectionMetadata::UNTRACKED();
void installUntrackedCollectionMetadata(OperationContext* opCtx, const NamespaceString& nss) {
const auto untrackedCollectionMetadata = CollectionMetadata::UNTRACKED();
AutoGetCollection coll(opCtx, nss, MODE_IX);
CollectionShardingRuntime::assertCollectionLockedAndAcquireExclusive(opCtx, nss)
->setFilteringMetadata(opCtx, unshardedCollectionMetadata);
->setFilteringMetadata(opCtx, untrackedCollectionMetadata);
}
void setUp() override {
@ -110,7 +110,7 @@ protected:
underlyingNss = viewDefinition->viewOn();
}
installUnshardedCollectionMetadata(opCtx(), underlyingNss);
installUntrackedCollectionMetadata(opCtx(), underlyingNss);
}
auto makeProcessInterface() {

View File

@ -407,16 +407,16 @@ public:
return {*fieldPaths, targetCollectionPlacementVersion, SupportingUniqueIndex::Full};
}
std::unique_ptr<ScopedExpectUnshardedCollection> expectUnshardedCollectionInScope(
std::unique_ptr<ScopedExpectUntrackedCollection> expectUntrackedCollectionInScope(
OperationContext* opCtx,
const NamespaceString& nss,
const boost::optional<DatabaseVersion>& dbVersion) override {
class ScopedExpectUnshardedCollectionNoop : public ScopedExpectUnshardedCollection {
class ScopedExpectUntrackedCollectionNoop : public ScopedExpectUntrackedCollection {
public:
ScopedExpectUnshardedCollectionNoop() = default;
ScopedExpectUntrackedCollectionNoop() = default;
};
return std::make_unique<ScopedExpectUnshardedCollectionNoop>();
return std::make_unique<ScopedExpectUntrackedCollectionNoop>();
}
std::unique_ptr<SpillTable> createSpillTable(

View File

@ -553,7 +553,7 @@ std::unique_ptr<Pipeline> tryAttachCursorSourceForLocalRead(
try {
auto shardVersion = [&] {
auto sv = targetingCri.hasRoutingTable() ? targetingCri.getShardVersion(localShardId)
: ShardVersion::UNSHARDED();
: ShardVersion::UNTRACKED();
if (auto txnRouter = TransactionRouter::get(opCtx);
txnRouter && opCtx->inMultiDocumentTransaction()) {
if (auto optOriginalPlacementConflictTime = txnRouter.getPlacementConflictTime()) {

View File

@ -174,7 +174,7 @@ void profile(OperationContext* opCtx, NetworkOp op) {
acquireCollection(newCtx.get(),
CollectionAcquisitionRequest(
dbProfilingNS,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(newCtx.get()),
AcquisitionPrerequisites::kUnreplicatedWrite),
MODE_IX));

View File

@ -79,7 +79,7 @@ void SamplingEstimatorTest::insertDocuments(const NamespaceString& nss,
const auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -123,7 +123,7 @@ void SamplingEstimatorTest::createIndex(const BSONObj& spec) {
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(_kTestNss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_X);
@ -214,7 +214,7 @@ void createCollAndInsertDocuments(OperationContext* opCtx,
auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -74,7 +74,7 @@ const QuerySolution* pickBestPlan(CanonicalQuery* cq,
const auto collection = acquireCollection(
&opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(&opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -127,7 +127,7 @@ const QuerySolution* bestCBRPlan(CanonicalQuery* cq,
const auto collection = acquireCollection(
&opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(&opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -71,7 +71,7 @@ void StatsCacheLoaderTest::createStatsCollection(NamespaceString nss) {
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -124,7 +124,7 @@ TEST_F(StatsCacheLoaderTest, VerifyStatsLoadsScalar) {
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(statsNss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -199,7 +199,7 @@ TEST_F(StatsCacheLoaderTest, VerifyStatsLoadsArray) {
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(statsNss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -152,7 +152,7 @@ void MultipleCollectionAccessorTest::installShardedCollectionMetadata(
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -188,7 +188,7 @@ void MultipleCollectionAccessorTest::installShardedCollectionMetadata(
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -125,7 +125,7 @@ void SbeStageBuilderTestFixture::insertDocuments(const NamespaceString& nss,
auto coll = acquireCollection(
operationContext(),
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(operationContext()),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -73,7 +73,7 @@ protected:
return acquireCollectionOrView(_opCtx,
CollectionOrViewAcquisitionRequest(
nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -550,7 +550,7 @@ TEST_F(ApplyOpsTest, ApplyOpsCmdStaleConfigSetsShardingOperationFailedStatus) {
OpStateAccumulator* opAccumulator = nullptr) override {
// Throw a staleConfig error.
uasserted(StaleConfigInfo(
coll->ns(), ShardVersion::UNSHARDED(), boost::none, ShardId{"shardId"}),
coll->ns(), ShardVersion::UNTRACKED(), boost::none, ShardId{"shardId"}),
"stale shard");
}
};

View File

@ -100,7 +100,7 @@ StatusWith<CollectionAcquisition> DeferredWriter::_getCollection(OperationContex
acquireCollection(opCtx,
CollectionAcquisitionRequest(
_nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -139,7 +139,7 @@ BSONObj RandomizedIdempotencyTest::getDoc() {
auto coll = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(_nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -362,7 +362,7 @@ CollectionAcquisition getCollectionForRead(OperationContext* opCtx, const Namesp
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
mongo::AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -426,7 +426,7 @@ void writeToImageCollection(OperationContext* opCtx,
auto collection = acquireCollection(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);
@ -1217,7 +1217,7 @@ const StringMap<ApplyOpMetadata> kOpsMap = {
acquireCollection(opCtx,
CollectionAcquisitionRequest(
ns,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -137,7 +137,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -870,7 +870,7 @@ TEST_F(OplogApplierImplTest, applyOplogEntryToInvalidateChangeStreamPreImages) {
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -898,7 +898,7 @@ TEST_F(OplogApplierImplTest, applyOplogEntryToInvalidateChangeStreamPreImages) {
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -939,7 +939,7 @@ TEST_F(OplogApplierImplTest, applyOplogEntryToInvalidateNonModPreImages) {
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -974,7 +974,7 @@ TEST_F(OplogApplierImplTest, applyOplogEntryToInvalidateNonModPreImages) {
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -1019,7 +1019,7 @@ TEST_F(OplogApplierImplTest, ImageCollectionInvalidationInInitialSyncHandlesConf
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -1050,7 +1050,7 @@ TEST_F(OplogApplierImplTest, ImageCollectionInvalidationInInitialSyncHandlesConf
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);
@ -1083,7 +1083,7 @@ TEST_F(OplogApplierImplTest, ImageCollectionInvalidationInInitialSyncHandlesConf
auto sideCollection = acquireCollection(
_opCtx.get(),
CollectionAcquisitionRequest(NamespaceString::kConfigImagesNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(_opCtx.get()),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -144,7 +144,7 @@ CollectionAcquisition getCollectionForRead(OperationContext* opCtx, const Namesp
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
mongo::AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -72,7 +72,7 @@ OplogIteratorLocal::OplogIteratorLocal(OperationContext* opCtx)
: _oplogRead(acquireCollectionMaybeLockFree(
opCtx,
CollectionAcquisitionRequest(NamespaceString::kRsOplogNamespace,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead))),
_tracker(opCtx,

View File

@ -534,7 +534,7 @@ Status ReplicationCoordinatorExternalStateImpl::initializeReplSetStorage(Operati
opCtx,
CollectionAcquisitionRequest(
NamespaceString::kSystemReplSetNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_X);
@ -739,7 +739,7 @@ Status ReplicationCoordinatorExternalStateImpl::storeLocalConfigDocument(Operati
opCtx,
CollectionAcquisitionRequest(
NamespaceString::kSystemReplSetNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_X);
@ -775,7 +775,7 @@ Status ReplicationCoordinatorExternalStateImpl::replaceLocalConfigDocument(
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kSystemReplSetNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_X);
@ -809,7 +809,7 @@ Status ReplicationCoordinatorExternalStateImpl::createLocalLastVoteCollection(
opCtx,
CollectionAcquisitionRequest(
NamespaceString::kLastVoteNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_X);
@ -878,7 +878,7 @@ Status ReplicationCoordinatorExternalStateImpl::storeLocalLastVoteDocument(
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kLastVoteNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -769,7 +769,7 @@ CollectionAcquisition getCollectionForRead(OperationContext* opCtx, const Namesp
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
mongo::AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -606,7 +606,7 @@ void RollbackImpl::_restoreTxnsTableEntryFromRetryableWrites(OperationContext* o
acquireCollection(opCtx,
CollectionAcquisitionRequest(
nss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kUnreplicatedWrite),
MODE_IX);

View File

@ -257,7 +257,7 @@ CollectionAcquisition getCollectionForRead(OperationContext* opCtx, const Namesp
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
mongo::AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -254,7 +254,7 @@ CollectionAcquisition acquireCollForRead(OperationContext* opCtx, const Namespac
return acquireCollection(
opCtx,
CollectionAcquisitionRequest(nss,
PlacementConcern(boost::none, ShardVersion::UNSHARDED()),
PlacementConcern(boost::none, ShardVersion::UNTRACKED()),
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead),
MODE_IS);

View File

@ -179,7 +179,7 @@ boost::optional<std::pair<NamespaceString, ChunkType>> getRandomUntrackedCollect
auto& collectionUUID = coll.second.getInfo()->getUuid().get();
ChunkType dummyChunk{collectionUUID,
ChunkRange(BSON("_id" << MINKEY), BSON("_id" << MAXKEY)),
ChunkVersion::UNSHARDED(),
ChunkVersion::UNTRACKED(),
shardId};
return std::make_pair(std::move(coll.first), dummyChunk);
}

View File

@ -474,7 +474,7 @@ public:
const auto coordinatorColl = acquireCollection(
opCtx,
CollectionAcquisitionRequest{NamespaceString::kConfigReshardingOperationsNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead},
MODE_IS);

View File

@ -248,7 +248,7 @@ void deleteRecipientResumeData(OperationContext* opCtx, const UUID& reshardingUU
acquireCollection(opCtx,
CollectionAcquisitionRequest(
NamespaceString::kRecipientReshardingResumeDataNamespace,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kWrite),
MODE_IX);

View File

@ -550,7 +550,7 @@ ReshardingDonorOplogId ReshardingDataReplication::getOplogFetcherResumeId(
const auto coll = acquireCollection(
opCtx,
CollectionAcquisitionRequest{oplogBufferNss,
PlacementConcern{boost::none, ShardVersion::UNSHARDED()},
PlacementConcern{boost::none, ShardVersion::UNTRACKED()},
repl::ReadConcernArgs::get(opCtx),
AcquisitionPrerequisites::kRead},
MODE_IS);

Some files were not shown because too many files have changed in this diff Show More