summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/validate_state.cpp
diff options
context:
space:
mode:
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(),