summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Milkie <milkie@10gen.com>2014-02-12 17:28:05 -0500
committerEric Milkie <milkie@10gen.com>2014-02-12 17:28:05 -0500
commit2f3bd6fc8f3b50bf4802f4477c55660355cff9fe (patch)
tree17fefcf3ace8df28833b65fe60f265de8d96ca1c
parentb0971060b10d57588759b56fcaff380c7909f219 (diff)
downloadmongo-2f3bd6fc8f3b50bf4802f4477c55660355cff9fe.tar.gz
SERVER-12662 do not logOp inserts that have no associated diskloc (such as index-already-exists)
-rw-r--r--src/mongo/db/instance.cpp23
-rw-r--r--src/mongo/db/pdfile.cpp6
2 files changed, 17 insertions, 12 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 926cdeecdb6..b95bcb1bfea 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -792,16 +792,19 @@ namespace mongo {
}
}
- theDataFileMgr.insertWithObjMod(ns,
- // May be modified in the call to add an _id field.
- js,
- // Only permit interrupting an (index build) insert if the
- // insert comes from a socket client request rather than a
- // parent operation using the client interface. The parent
- // operation might not support interrupts.
- cc().curop()->parent() == NULL,
- false);
- logOp("i", ns, js);
+ DiskLoc dl = theDataFileMgr.
+ insertWithObjMod(ns,
+ // May be modified in the call to add an _id field.
+ js,
+ // Only permit interrupting an (index build) insert if the
+ // insert comes from a socket client request rather than a
+ // parent operation using the client interface. The parent
+ // operation might not support interrupts.
+ cc().curop()->parent() == NULL,
+ false);
+ if (!dl.isNull()) {
+ logOp("i", ns, js);
+ }
}
NOINLINE_DECL void insertMulti(bool keepGoing, const char *ns, vector<BSONObj>& objs, CurOp& op) {
diff --git a/src/mongo/db/pdfile.cpp b/src/mongo/db/pdfile.cpp
index b397061c397..7aaa24a9fbc 100644
--- a/src/mongo/db/pdfile.cpp
+++ b/src/mongo/db/pdfile.cpp
@@ -1316,8 +1316,10 @@ namespace mongo {
void DataFileMgr::insertAndLog( const char *ns, const BSONObj &o, bool god, bool fromMigrate ) {
BSONObj tmp = o;
- insertWithObjMod( ns, tmp, false, god );
- logOp( "i", ns, tmp, 0, 0, fromMigrate );
+ DiskLoc loc = insertWithObjMod( ns, tmp, false, god );
+ if (!loc.isNull()) {
+ logOp( "i", ns, tmp, 0, 0, fromMigrate );
+ }
}
/** @param o the object to insert. can be modified to add _id and thus be an in/out param