summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/rename_collection_test.cpp
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2018-03-01 16:40:51 -0500
committerADAM David Alan Martin <adam.martin@10gen.com>2018-03-01 16:40:51 -0500
commit296fde1259d29e081069fde1c69bb9ae083932b1 (patch)
tree0e0973b0e6e642e09822f59be220be3a8c036466 /src/mongo/db/catalog/rename_collection_test.cpp
parent22b2b828a922a7459b4e1c75860a11c7eb3db630 (diff)
downloadmongo-296fde1259d29e081069fde1c69bb9ae083932b1.tar.gz
SERVER-32843 Allow multiple times in OpObservers
The OpObserverRegistry was introduced as an abstraction to allow decoupling making data modifications from the side effects, which need to happen as a result of these modifications, such as op log writes, retryable writes, etc. Some of the OpObserver's methods currently return the OpTime which resulted from logging the operation to the replication oplog. In addition, in certain cases, the OpTime resulting from an earlier OpObserver might be needed by a later one, which is the case with retryable writes. In order to support these requirements, the OpObserver(s) chain should have access to some common per-operation structure, where runtime information could be persisted.
Diffstat (limited to 'src/mongo/db/catalog/rename_collection_test.cpp')
-rw-r--r--src/mongo/db/catalog/rename_collection_test.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/catalog/rename_collection_test.cpp b/src/mongo/db/catalog/rename_collection_test.cpp
index b3a919fc8a2..7802ccffdab 100644
--- a/src/mongo/db/catalog/rename_collection_test.cpp
+++ b/src/mongo/db/catalog/rename_collection_test.cpp
@@ -162,7 +162,9 @@ repl::OpTime OpObserverMock::onDropCollection(OperationContext* opCtx,
const NamespaceString& collectionName,
OptionalCollectionUUID uuid) {
_logOp(opCtx, collectionName, "drop");
- return OpObserverNoop::onDropCollection(opCtx, collectionName, uuid);
+ OpObserver::Times::get(opCtx).reservedOpTimes.push_back(
+ OpObserverNoop::onDropCollection(opCtx, collectionName, uuid));
+ return {};
}
repl::OpTime OpObserverMock::onRenameCollection(OperationContext* opCtx,
@@ -173,10 +175,11 @@ repl::OpTime OpObserverMock::onRenameCollection(OperationContext* opCtx,
OptionalCollectionUUID dropTargetUUID,
bool stayTemp) {
_logOp(opCtx, fromCollection, "rename");
+ OpObserver::Times::get(opCtx).reservedOpTimes.push_back(renameOpTime);
OpObserverNoop::onRenameCollection(
opCtx, fromCollection, toCollection, uuid, dropTarget, dropTargetUUID, stayTemp);
onRenameCollectionCalled = true;
- return renameOpTime;
+ return {};
}
void OpObserverMock::_logOp(OperationContext* opCtx,