diff options
author | Mathias Stearn <mathias@10gen.com> | 2011-08-31 11:14:51 -0400 |
---|---|---|
committer | Mathias Stearn <mathias@10gen.com> | 2011-08-31 11:14:51 -0400 |
commit | 8f2b751b77d1f948deb3f902b8213308004f1df1 (patch) | |
tree | 19f12c2a5c2712a7c0acb42ff20b0caa2a167fea | |
parent | 640fc155cd9c0527fa29cfff84ec916932e89095 (diff) | |
download | mongo-8f2b751b77d1f948deb3f902b8213308004f1df1.tar.gz |
Do objcheck for single inserts outside of writelock. SERVER-3724
Fix for bulk inserts after 2.0
-rw-r--r-- | db/instance.cpp | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/db/instance.cpp b/db/instance.cpp index 971cd2e7b38..565b8cb39f9 100644 --- a/db/instance.cpp +++ b/db/instance.cpp @@ -604,7 +604,7 @@ namespace mongo { } if( !d.moreJSObjs() ) break; - js = d.nextJsObj(); + js = d.nextJsObj(); // TODO: refactor to do objcheck outside of writelock } } @@ -613,6 +613,12 @@ namespace mongo { const char *ns = d.getns(); op.debug().ns = ns; + if( !d.moreJSObjs() ) { + // strange. should we complain? + return; + } + BSONObj js = d.nextJsObj(); + writelock lk(ns); // writelock is used to synchronize stepdowns w/ writes @@ -623,11 +629,6 @@ namespace mongo { Client::Context ctx(ns); - if( !d.moreJSObjs() ) { - // strange. should we complain? - return; - } - BSONObj js = d.nextJsObj(); if( d.moreJSObjs() ) { insertMulti(d, ns, js); return; |