diff options
| author | Benety Goh <benety@mongodb.com> | 2017-07-11 13:09:35 -0400 |
|---|---|---|
| committer | Benety Goh <benety@mongodb.com> | 2017-07-12 18:57:47 -0400 |
| commit | 9bd5e1f1de06b7d6f97030036a2d03424399b5d0 (patch) | |
| tree | 3d77ba78b1e489a0b4beaace2378ada57ec496ec /src/mongo/db/catalog/database_impl.cpp | |
| parent | 32ce928cb3275bb3de7c1e1ccc99d3c1e57cdc72 (diff) | |
SERVER-29373 relax index name constraint when doing two phase collection drops under non-mmapv1 storage enginesr3.5.10
Diffstat (limited to 'src/mongo/db/catalog/database_impl.cpp')
| -rw-r--r-- | src/mongo/db/catalog/database_impl.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/mongo/db/catalog/database_impl.cpp b/src/mongo/db/catalog/database_impl.cpp index e96bd7325d6..1141dab3c72 100644 --- a/src/mongo/db/catalog/database_impl.cpp +++ b/src/mongo/db/catalog/database_impl.cpp @@ -511,16 +511,21 @@ Status DatabaseImpl::dropCollectionEvenIfSystem(OperationContext* opCtx, } } - // Check if drop-pending namespace is too long for the index names in the collection. auto dpns = fullns.makeDropPendingNamespace(dropOpTime); - auto status = - dpns.checkLengthForRename(collection->getIndexCatalog()->getLongestIndexNameLength(opCtx)); - if (!status.isOK()) { - log() << "dropCollection: " << fullns - << " - cannot proceed with collection rename for pending-drop: " << status - << ". Dropping collection immediately."; - fassertStatusOK(40463, _finishDropCollection(opCtx, fullns, collection)); - return Status::OK(); + + // MMAPv1 requires that index namespaces are subject to the same length constraints as indexes + // in collections that are not in a drop-pending state. Therefore, we check if the drop-pending + // namespace is too long for the index names in the collection. + if (opCtx->getServiceContext()->getGlobalStorageEngine()->isMmapV1()) { + auto status = dpns.checkLengthForRename( + collection->getIndexCatalog()->getLongestIndexNameLength(opCtx)); + if (!status.isOK()) { + log() << "dropCollection: " << fullns + << " - cannot proceed with collection rename for pending-drop: " << status + << ". Dropping collection immediately."; + fassertStatusOK(40463, _finishDropCollection(opCtx, fullns, collection)); + return Status::OK(); + } } // Rename collection using drop-pending namespace generated from drop optime. |
