summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/validate_state.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/catalog/validate_state.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/catalog/validate_state.cpp')
-rw-r--r--src/mongo/db/catalog/validate_state.cpp35
1 files changed, 10 insertions, 25 deletions
diff --git a/src/mongo/db/catalog/validate_state.cpp b/src/mongo/db/catalog/validate_state.cpp
index 01f80ac61cc..434950b9540 100644
--- a/src/mongo/db/catalog/validate_state.cpp
+++ b/src/mongo/db/catalog/validate_state.cpp
@@ -54,13 +54,12 @@ ValidateState::ValidateState(OperationContext* opCtx,
const NamespaceString& nss,
ValidateMode mode,
RepairMode repairMode,
- const AdditionalOptions& additionalOptions,
- bool logDiagnostics)
+ bool turnOnExtraLoggingForTest)
: _nss(nss),
_mode(mode),
_repairMode(repairMode),
_dataThrottle(opCtx),
- _logDiagnostics(logDiagnostics) {
+ _extraLoggingForTest(turnOnExtraLoggingForTest) {
// Subsequent re-locks will use the UUID when 'background' is true.
if (isBackground()) {
@@ -81,26 +80,13 @@ ValidateState::ValidateState(OperationContext* opCtx,
_collection = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, _nss);
if (!_collection) {
- auto view = CollectionCatalog::get(opCtx)->lookupView(opCtx, _nss);
- if (!view) {
- uasserted(ErrorCodes::NamespaceNotFound,
- str::stream() << "Collection '" << _nss << "' does not exist to validate.");
- } else {
- // Uses the bucket collection in place of the time-series collection view.
- if (!view->timeseries()) {
- uasserted(ErrorCodes::CommandNotSupportedOnView, "Cannot validate a view");
- }
- _nss = _nss.makeTimeseriesBucketsNamespace();
- if (isBackground()) {
- _collectionLock.emplace(opCtx, _nss, MODE_IS);
- } else {
- _collectionLock.emplace(opCtx, _nss, MODE_X);
- }
- _collection = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, _nss);
+ if (CollectionCatalog::get(opCtx)->lookupView(opCtx, _nss)) {
+ uasserted(ErrorCodes::CommandNotSupportedOnView, "Cannot validate a view");
}
- }
- _validationVersion = additionalOptions.validationVersion;
+ uasserted(ErrorCodes::NamespaceNotFound,
+ str::stream() << "Collection '" << _nss << "' does not exist to validate.");
+ }
// RepairMode is incompatible with the ValidateModes kBackground and
// kForegroundFullEnforceFastCount.
@@ -252,16 +238,15 @@ void ValidateState::initializeCursors(OperationContext* opCtx) {
const IndexCatalog* indexCatalog = _collection->getIndexCatalog();
// The index iterator for ready indexes is timestamp-aware and will only return indexes that
// are visible at our read time.
- const auto it = indexCatalog->getIndexIterator(opCtx, IndexCatalog::InclusionPolicy::kReady);
+ const std::unique_ptr<IndexCatalog::IndexIterator> it =
+ indexCatalog->getIndexIterator(opCtx, /*includeUnfinished*/ false);
while (it->more()) {
const IndexCatalogEntry* entry = it->next();
const IndexDescriptor* desc = entry->descriptor();
auto iam = entry->accessMethod()->asSortedData();
- if (!iam) {
- _skippedIndexes.emplace(desc->indexName());
+ if (!iam)
continue;
- }
_indexCursors.emplace(
desc->indexName(),