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-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/catalog/validate_state.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/catalog/validate_state.cpp')
-rw-r--r--src/mongo/db/catalog/validate_state.cpp24
1 files changed, 17 insertions, 7 deletions
diff --git a/src/mongo/db/catalog/validate_state.cpp b/src/mongo/db/catalog/validate_state.cpp
index f40ebe0062e..01f80ac61cc 100644
--- a/src/mongo/db/catalog/validate_state.cpp
+++ b/src/mongo/db/catalog/validate_state.cpp
@@ -81,16 +81,26 @@ ValidateState::ValidateState(OperationContext* opCtx,
_collection = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, _nss);
if (!_collection) {
- if (CollectionCatalog::get(opCtx)->lookupView(opCtx, _nss)) {
- uasserted(ErrorCodes::CommandNotSupportedOnView, "Cannot validate a view");
+ 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);
}
-
- uasserted(ErrorCodes::NamespaceNotFound,
- str::stream() << "Collection '" << _nss << "' does not exist to validate.");
}
- // Return warnings instead of errors on schema validation failures.
- _warnOnSchemaValidation = additionalOptions.warnOnSchemaValidation;
+ _validationVersion = additionalOptions.validationVersion;
// RepairMode is incompatible with the ValidateModes kBackground and
// kForegroundFullEnforceFastCount.