summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/storage_interface_impl.cpp
diff options
context:
space:
mode:
authorMaria van Keulen <maria@mongodb.com>2017-10-09 14:49:55 -0400
committerMaria van Keulen <maria@mongodb.com>2017-10-09 19:13:46 -0400
commit9e8cce334f74d4e70661bcb3921e069c9a0b248b (patch)
tree8f89f64db6c911142ace54816f81a8d655efa589 /src/mongo/db/repl/storage_interface_impl.cpp
parent3b6b64fdef7bb65853b54e05b59e30c8d2cab695 (diff)
downloadmongo-9e8cce334f74d4e70661bcb3921e069c9a0b248b.tar.gz
SERVER-30131 Ensure collections on local have UUIDs
Diffstat (limited to 'src/mongo/db/repl/storage_interface_impl.cpp')
-rw-r--r--src/mongo/db/repl/storage_interface_impl.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/mongo/db/repl/storage_interface_impl.cpp b/src/mongo/db/repl/storage_interface_impl.cpp
index 47f2fd8d92f..2e048f66c3f 100644
--- a/src/mongo/db/repl/storage_interface_impl.cpp
+++ b/src/mongo/db/repl/storage_interface_impl.cpp
@@ -43,6 +43,7 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/auth/authorization_manager.h"
+#include "mongo/db/catalog/coll_mod.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/collection_catalog_entry.h"
#include "mongo/db/catalog/database.h"
@@ -922,6 +923,23 @@ StatusWith<StorageInterface::CollectionCount> StorageInterfaceImpl::getCollectio
return collection->numRecords(opCtx);
}
+StatusWith<OptionalCollectionUUID> StorageInterfaceImpl::getCollectionUUID(
+ OperationContext* opCtx, const NamespaceString& nss) {
+ AutoGetCollectionForRead autoColl(opCtx, nss);
+
+ auto collectionResult = getCollection(
+ autoColl, nss, str::stream() << "Unable to get UUID of " << nss.ns() << " collection.");
+ if (!collectionResult.isOK()) {
+ return collectionResult.getStatus();
+ }
+ auto collection = collectionResult.getValue();
+ return collection->uuid();
+}
+
+Status StorageInterfaceImpl::upgradeUUIDSchemaVersionNonReplicated(OperationContext* opCtx) {
+ return updateUUIDSchemaVersionNonReplicated(opCtx, true);
+}
+
void StorageInterfaceImpl::setStableTimestamp(ServiceContext* serviceCtx,
SnapshotName snapshotName) {
serviceCtx->getGlobalStorageEngine()->setStableTimestamp(snapshotName);