summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2014-04-01 23:12:33 -0400
committerEliot Horowitz <eliot@10gen.com>2014-04-01 23:51:28 -0400
commit91e679c2102b2870cfc0b2eeb31035eabc234deb (patch)
tree2c7b7f6e73febeb9c47d547c7e214db0bc96273e
parentf93d14738c1abaa31b44a0af87700e72fd3979d3 (diff)
downloadmongo-91e679c2102b2870cfc0b2eeb31035eabc234deb.tar.gz
SERVER-12550: use Context instead of ReadContext and don't check shard version
this happens later
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp3
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.cpp22
-rw-r--r--src/mongo/db/instance.cpp11
3 files changed, 7 insertions, 29 deletions
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index 98af09d95eb..c2561597700 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -121,6 +121,9 @@ namespace mongo {
}
_magic = INDEX_CATALOG_INIT;
+
+ GeneratorHolder::getInstance()->reset( _collection );
+
return Status::OK();
}
diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp
index 48743cc8090..25aa02746f1 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.cpp
+++ b/src/mongo/db/commands/write_commands/batch_executor.cpp
@@ -777,25 +777,9 @@ namespace mongo {
insertDoc = normalInsert.getValue();
pregen->push_back( PregeneratedKeys() );
- bool hasEntry = GeneratorHolder::getInstance()->prepare( request.getTargetingNS(),
- insertDoc,
- &pregen->back() );
-
- if ( !hasEntry && i == 0 ) {
- string ns = request.getTargetingNS();
- try {
- Client::ReadContext ctx(ns);
- Database* db = ctx.ctx().db();
- Collection * c = db->getCollection( ns );
- if ( c ) {
- GeneratorHolder::getInstance()->reset( c );
- }
- }
- catch ( DBException& e ) {
- log() << "normalizeInserts failde to pregen keys: " << e;
- }
- }
-
+ GeneratorHolder::getInstance()->prepare( request.getTargetingNS(),
+ insertDoc,
+ &pregen->back() );
}
}
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index a7451fd95a8..f5919f3b9ee 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -899,16 +899,7 @@ namespace mongo {
if ( !fixed.getValue().isEmpty() )
multi[0] = fixed.getValue();
- bool hasEntry = GeneratorHolder::getInstance()->prepare( ns, multi[0], &tempHack );
- if ( !hasEntry ) {
- // lets load!
- Client::ReadContext ctx(ns);
- Database* db = ctx.ctx().db();
- Collection * c = db->getCollection( ns );
- if ( c ) {
- GeneratorHolder::getInstance()->reset( c );
- }
- }
+ GeneratorHolder::getInstance()->prepare( ns, multi[0], &tempHack );
}
PageFaultRetryableSection s;