summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorGregory Wlodarek <gregory.wlodarek@mongodb.com>2018-09-07 13:30:43 -0400
committerGregory Wlodarek <gregory.wlodarek@mongodb.com>2018-09-07 13:30:43 -0400
commit4c4c76ec1be5edb1d7560aecfe4ac7f5ada7ba00 (patch)
treee73893dbd30897bb74c10fb2295c0d279b6e10cc /src/mongo/db
parentcbfd82be9efa5e0f6dd45d974d7fc729b989cb9c (diff)
downloadmongo-4c4c76ec1be5edb1d7560aecfe4ac7f5ada7ba00.tar.gz
SERVER-36472 Convert OptionalCollectionUUID in OpObserver::onCreateIndex to CollectionUUID
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/catalog/rename_collection.cpp2
-rw-r--r--src/mongo/db/catalog/rename_collection_test.cpp4
-rw-r--r--src/mongo/db/catalog/uuid_catalog.h2
-rw-r--r--src/mongo/db/cloner.cpp2
-rw-r--r--src/mongo/db/commands/create_indexes.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp2
-rw-r--r--src/mongo/db/free_mon/free_mon_op_observer.h2
-rw-r--r--src/mongo/db/op_observer.h2
-rw-r--r--src/mongo/db/op_observer_impl.cpp4
-rw-r--r--src/mongo/db/op_observer_impl.h2
-rw-r--r--src/mongo/db/op_observer_noop.h2
-rw-r--r--src/mongo/db/op_observer_registry.h2
-rw-r--r--src/mongo/db/repl/oplog.cpp2
-rw-r--r--src/mongo/db/s/config_server_op_observer.h2
-rw-r--r--src/mongo/db/s/migration_destination_manager.cpp7
-rw-r--r--src/mongo/db/s/shard_server_op_observer.h2
-rw-r--r--src/mongo/db/system_index.cpp4
17 files changed, 23 insertions, 22 deletions
diff --git a/src/mongo/db/catalog/rename_collection.cpp b/src/mongo/db/catalog/rename_collection.cpp
index 4a9c2ae0336..7787aead9ab 100644
--- a/src/mongo/db/catalog/rename_collection.cpp
+++ b/src/mongo/db/catalog/rename_collection.cpp
@@ -415,7 +415,7 @@ Status renameCollectionCommon(OperationContext* opCtx,
WriteUnitOfWork wunit(opCtx);
indexer.commit([opCtx, &tmpName, tmpColl](const BSONObj& spec) {
opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, tmpName, tmpColl->uuid(), spec, false);
+ opCtx, tmpName, *(tmpColl->uuid()), spec, false);
});
wunit.commit();
});
diff --git a/src/mongo/db/catalog/rename_collection_test.cpp b/src/mongo/db/catalog/rename_collection_test.cpp
index 943fd3506ca..e74ae6ed833 100644
--- a/src/mongo/db/catalog/rename_collection_test.cpp
+++ b/src/mongo/db/catalog/rename_collection_test.cpp
@@ -73,7 +73,7 @@ class OpObserverMock : public OpObserverNoop {
public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override;
@@ -136,7 +136,7 @@ private:
void OpObserverMock::onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) {
_logOp(opCtx, nss, "index");
diff --git a/src/mongo/db/catalog/uuid_catalog.h b/src/mongo/db/catalog/uuid_catalog.h
index b561e1d1a3d..098d8533f5d 100644
--- a/src/mongo/db/catalog/uuid_catalog.h
+++ b/src/mongo/db/catalog/uuid_catalog.h
@@ -45,7 +45,7 @@ class UUIDCatalogObserver : public OpObserver {
public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override {}
void onInserts(OperationContext* opCtx,
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index e42aabc4f7b..742b42026ca 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -415,7 +415,7 @@ void Cloner::copyIndexes(OperationContext* opCtx,
if (opCtx->writesAreReplicated()) {
for (auto&& infoObj : indexInfoObjs) {
getGlobalServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, collection->ns(), collection->uuid(), infoObj, false);
+ opCtx, collection->ns(), *(collection->uuid()), infoObj, false);
}
}
wunit.commit();
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 3c4845b5951..940454d6d8e 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -395,7 +395,7 @@ public:
indexer.commit([opCtx, &ns, collection](const BSONObj& spec) {
opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, ns, collection->uuid(), spec, false);
+ opCtx, ns, *(collection->uuid()), spec, false);
});
wunit.commit();
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 7f93d336b76..7ee2f397779 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -590,7 +590,7 @@ void State::prepTempCollection() {
// Log the createIndex operation.
_opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
- _opCtx, _config.tempNamespace, tempColl->uuid(), indexToInsert, false);
+ _opCtx, _config.tempNamespace, *(tempColl->uuid()), indexToInsert, false);
}
wuow.commit();
});
diff --git a/src/mongo/db/free_mon/free_mon_op_observer.h b/src/mongo/db/free_mon/free_mon_op_observer.h
index 7b4d5861a2d..0ce2dd98d60 100644
--- a/src/mongo/db/free_mon/free_mon_op_observer.h
+++ b/src/mongo/db/free_mon/free_mon_op_observer.h
@@ -46,7 +46,7 @@ public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) final {}
diff --git a/src/mongo/db/op_observer.h b/src/mongo/db/op_observer.h
index 953c52c6743..61e93182d7e 100644
--- a/src/mongo/db/op_observer.h
+++ b/src/mongo/db/op_observer.h
@@ -81,7 +81,7 @@ public:
virtual ~OpObserver() = default;
virtual void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) = 0;
virtual void onInserts(OperationContext* opCtx,
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp
index 77d0e1bfcf4..df2c4418f59 100644
--- a/src/mongo/db/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer_impl.cpp
@@ -323,11 +323,9 @@ OpTimeBundle replLogApplyOps(OperationContext* opCtx,
void OpObserverImpl::onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) {
- // TODO: uuid should no longer be optional (SERVER-36472).
- invariant(uuid);
BSONObjBuilder builder;
builder.append("createIndexes", nss.coll());
diff --git a/src/mongo/db/op_observer_impl.h b/src/mongo/db/op_observer_impl.h
index 1fa7e076eb4..3051cfb63cb 100644
--- a/src/mongo/db/op_observer_impl.h
+++ b/src/mongo/db/op_observer_impl.h
@@ -41,7 +41,7 @@ public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override;
void onInserts(OperationContext* opCtx,
diff --git a/src/mongo/db/op_observer_noop.h b/src/mongo/db/op_observer_noop.h
index 98be250f0cf..41830293f12 100644
--- a/src/mongo/db/op_observer_noop.h
+++ b/src/mongo/db/op_observer_noop.h
@@ -36,7 +36,7 @@ class OpObserverNoop : public OpObserver {
public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override {}
void onInserts(OperationContext* opCtx,
diff --git a/src/mongo/db/op_observer_registry.h b/src/mongo/db/op_observer_registry.h
index a89950d81cd..d9536348d0e 100644
--- a/src/mongo/db/op_observer_registry.h
+++ b/src/mongo/db/op_observer_registry.h
@@ -58,7 +58,7 @@ public:
void onCreateIndex(OperationContext* const opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override {
ReservedTimes times{opCtx};
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index adc3a13c3ad..247608b2a6a 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -278,7 +278,7 @@ void createIndexForApplyOps(OperationContext* opCtx,
incrementOpsAppliedStats();
}
getGlobalServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, indexNss, indexCollection->uuid(), indexSpec, false);
+ opCtx, indexNss, *(indexCollection->uuid()), indexSpec, false);
}
namespace {
diff --git a/src/mongo/db/s/config_server_op_observer.h b/src/mongo/db/s/config_server_op_observer.h
index ebed73cce59..1b55ee05d01 100644
--- a/src/mongo/db/s/config_server_op_observer.h
+++ b/src/mongo/db/s/config_server_op_observer.h
@@ -46,7 +46,7 @@ public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override {}
diff --git a/src/mongo/db/s/migration_destination_manager.cpp b/src/mongo/db/s/migration_destination_manager.cpp
index f0574084861..a24e3e5bc56 100644
--- a/src/mongo/db/s/migration_destination_manager.cpp
+++ b/src/mongo/db/s/migration_destination_manager.cpp
@@ -658,8 +658,11 @@ void MigrationDestinationManager::cloneCollectionIndexesAndOptions(OperationCont
for (auto&& infoObj : indexInfoObjs.getValue()) {
// make sure to create index on secondaries as well
- serviceContext->getOpObserver()->onCreateIndex(
- opCtx, collection->ns(), collection->uuid(), infoObj, true /* fromMigrate */);
+ serviceContext->getOpObserver()->onCreateIndex(opCtx,
+ collection->ns(),
+ *(collection->uuid()),
+ infoObj,
+ true /* fromMigrate */);
}
wunit.commit();
diff --git a/src/mongo/db/s/shard_server_op_observer.h b/src/mongo/db/s/shard_server_op_observer.h
index 9edc8da25fa..d5737d584e4 100644
--- a/src/mongo/db/s/shard_server_op_observer.h
+++ b/src/mongo/db/s/shard_server_op_observer.h
@@ -47,7 +47,7 @@ public:
void onCreateIndex(OperationContext* opCtx,
const NamespaceString& nss,
- OptionalCollectionUUID uuid,
+ CollectionUUID uuid,
BSONObj indexDoc,
bool fromMigrate) override {}
diff --git a/src/mongo/db/system_index.cpp b/src/mongo/db/system_index.cpp
index bc71d2a28c3..ca5aa8329cf 100644
--- a/src/mongo/db/system_index.cpp
+++ b/src/mongo/db/system_index.cpp
@@ -136,7 +136,7 @@ void generateSystemIndexForExistingCollection(OperationContext* opCtx,
indexer.commit([opCtx, &ns, collection](const BSONObj& spec) {
opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, ns, collection->uuid(), spec, false /* fromMigrate */);
+ opCtx, ns, *(collection->uuid()), spec, false /* fromMigrate */);
});
wunit.commit();
@@ -235,7 +235,7 @@ void createSystemIndexes(OperationContext* opCtx, Collection* collection) {
}
if (!indexSpec.isEmpty()) {
opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
- opCtx, ns, collection->uuid(), indexSpec, false /* fromMigrate */);
+ opCtx, ns, *(collection->uuid()), indexSpec, false /* fromMigrate */);
// Note that the opObserver is called prior to creating the index. This ensures the index
// write gets the same storage timestamp as the oplog entry.
fassert(40456,