diff options
author | Geert Bosch <geert@mongodb.com> | 2018-04-16 16:19:13 -0400 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2018-04-17 17:34:41 -0400 |
commit | c45a62c24761110505161ce4ecc263f4bfce9c59 (patch) | |
tree | 5cbd14a1a06a96c085619f1ab0c4616b6b8e2fb1 /src/mongo/db/catalog/catalog_control.cpp | |
parent | 366f5aea022ea2eccbce5c253e813c1151d53fc1 (diff) | |
download | mongo-c45a62c24761110505161ce4ecc263f4bfce9c59.tar.gz |
SERVER-33632 UUIDCatalog queries fall back to pre-close state
While the UUIDCatalog is closed for reloading during rollback and catalog reload,
queries by UUID may need to resolve the NSS for authorization purposes before taking
locks. Use a shadow catalog to allow such name resolution.
Diffstat (limited to 'src/mongo/db/catalog/catalog_control.cpp')
-rw-r--r-- | src/mongo/db/catalog/catalog_control.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/mongo/db/catalog/catalog_control.cpp b/src/mongo/db/catalog/catalog_control.cpp index ea06eb9df67..684862b6a9f 100644 --- a/src/mongo/db/catalog/catalog_control.cpp +++ b/src/mongo/db/catalog/catalog_control.cpp @@ -46,6 +46,13 @@ namespace catalog { void closeCatalog(OperationContext* opCtx) { invariant(opCtx->lockState()->isW()); + // Closing UUID Catalog: only lookupNSSByUUID will fall back to using pre-closing state to + // allow authorization for currently unknown UUIDs. This is needed because authorization needs + // to work before acquiring locks, and might otherwise spuriously regard a UUID as unknown + // while reloading the catalog. + UUIDCatalog::get(opCtx).onCloseCatalog(); + LOG(1) << "closeCatalog: closing UUID catalog"; + // Close all databases. log() << "closeCatalog: closing all databases"; constexpr auto reason = "closing databases for closeCatalog"; @@ -166,6 +173,10 @@ void openCatalog(OperationContext* opCtx) { } } } + // Opening UUID Catalog: The UUID catalog is now in sync with the storage engine catalog. Clear + // the pre-closing state. + UUIDCatalog::get(opCtx).onOpenCatalog(); + LOG(1) << "openCatalog: finished reloading UUID catalog"; } } // namespace catalog } // namespace mongo |