diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-03-13 06:35:51 -0400 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-04-09 10:57:16 -0400 |
commit | 1725d76f448323a2bbaa11ffd37fd7b10cd6a64b (patch) | |
tree | be35489fd99d5b0040f27d86b731cfcae1e4479a /src/mongo/db/dbhelpers.cpp | |
parent | acc7a72194990f35ff706bdcab7ec443c39fb0d5 (diff) | |
download | mongo-1725d76f448323a2bbaa11ffd37fd7b10cd6a64b.tar.gz |
SERVER-17573 move OpObserver calls into the datalayer as much as possible and eliminate repl bools
Diffstat (limited to 'src/mongo/db/dbhelpers.cpp')
-rw-r--r-- | src/mongo/db/dbhelpers.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp index f9fb4f0d33a..22ac295e4a0 100644 --- a/src/mongo/db/dbhelpers.cpp +++ b/src/mongo/db/dbhelpers.cpp @@ -48,7 +48,6 @@ #include "mongo/db/json.h" #include "mongo/db/keypattern.h" #include "mongo/db/op_observer.h" -#include "mongo/db/operation_context_impl.h" #include "mongo/db/ops/delete.h" #include "mongo/db/ops/update.h" #include "mongo/db/ops/update_lifecycle_impl.h" @@ -66,6 +65,7 @@ #include "mongo/s/d_state.h" #include "mongo/s/shard_key_pattern.h" #include "mongo/util/log.h" +#include "mongo/util/scopeguard.h" namespace mongo { @@ -247,7 +247,6 @@ namespace mongo { request.setQuery(id); request.setUpdates(o); request.setUpsert(); - request.setUpdateOpLog(); request.setFromMigration(fromMigrate); UpdateLifecycleImpl updateLifecycle(true, requestNs); request.setLifecycle(&updateLifecycle); @@ -264,7 +263,6 @@ namespace mongo { request.setUpdates(obj); request.setUpsert(); - request.setUpdateOpLog(); UpdateLifecycleImpl updateLifecycle(true, requestNs); request.setLifecycle(&updateLifecycle); @@ -449,8 +447,6 @@ namespace mongo { BSONObj deletedId; collection->deleteDocument( txn, rloc, false, false, &deletedId ); - // The above throws on failure, and so is not logged - getGlobalServiceContext()->getOpObserver()->onDelete(txn, ns, deletedId, fromMigrate); wuow.commit(); numDeleted++; } @@ -582,6 +578,9 @@ namespace mongo { void Helpers::emptyCollection(OperationContext* txn, const char *ns) { OldClientContext context(txn, ns); + bool shouldReplicateWrites = txn->writesAreReplicated(); + txn->setReplicatedWrites(false); + ON_BLOCK_EXIT(&OperationContext::setReplicatedWrites, txn, shouldReplicateWrites); deleteObjects(txn, context.db(), ns, BSONObj(), PlanExecutor::YIELD_MANUAL, false); } |