summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Schwerin <schwerin@mongodb.com>2015-04-02 15:48:57 -0400
committerAndy Schwerin <schwerin@mongodb.com>2015-04-03 15:13:55 -0400
commit789ad901737cfed9f383e467464c23943c94ecf4 (patch)
treeabda24f89ace5793aad5212c1cfde9b57e4f2c9a
parent78aa03b4eda2784ae67eba32d6b103166f1c57ad (diff)
downloadmongo-789ad901737cfed9f383e467464c23943c94ecf4.tar.gz
SERVER-17878 Rename GlobalEnvironmentExperiment to ServiceContext.
-rw-r--r--src/mongo/SConscript18
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_d.cpp2
-rw-r--r--src/mongo/db/catalog/cursor_manager.cpp2
-rw-r--r--src/mongo/db/catalog/database.cpp14
-rw-r--r--src/mongo/db/catalog/database_holder.cpp8
-rw-r--r--src/mongo/db/catalog/index_catalog.cpp6
-rw-r--r--src/mongo/db/catalog/index_catalog_entry.cpp4
-rw-r--r--src/mongo/db/clientlistplugin.cpp2
-rw-r--r--src/mongo/db/cloner.cpp14
-rw-r--r--src/mongo/db/commands/apply_ops.cpp4
-rw-r--r--src/mongo/db/commands/collection_to_capped.cpp6
-rw-r--r--src/mongo/db/commands/create_indexes.cpp6
-rw-r--r--src/mongo/db/commands/drop_indexes.cpp4
-rw-r--r--src/mongo/db/commands/find_and_modify.cpp4
-rw-r--r--src/mongo/db/commands/find_cmd.cpp4
-rw-r--r--src/mongo/db/commands/fsync.cpp6
-rw-r--r--src/mongo/db/commands/getmore_cmd.cpp4
-rw-r--r--src/mongo/db/commands/list_collections.cpp2
-rw-r--r--src/mongo/db/commands/list_databases.cpp4
-rw-r--r--src/mongo/db/commands/list_indexes.cpp2
-rw-r--r--src/mongo/db/commands/mr.cpp8
-rw-r--r--src/mongo/db/commands/oplog_note.cpp4
-rw-r--r--src/mongo/db/commands/pipeline_command.cpp4
-rw-r--r--src/mongo/db/commands/rename_collection.cpp6
-rw-r--r--src/mongo/db/commands/test_commands.cpp4
-rw-r--r--src/mongo/db/commands/write_commands/batch_executor.cpp6
-rw-r--r--src/mongo/db/concurrency/SConscript4
-rw-r--r--src/mongo/db/concurrency/d_concurrency.cpp2
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp2
-rw-r--r--src/mongo/db/curop.cpp2
-rw-r--r--src/mongo/db/db.cpp14
-rw-r--r--src/mongo/db/dbcommands.cpp12
-rw-r--r--src/mongo/db/dbhelpers.cpp4
-rw-r--r--src/mongo/db/dbwebserver.cpp4
-rw-r--r--src/mongo/db/exec/delete.cpp4
-rw-r--r--src/mongo/db/exec/update.cpp6
-rw-r--r--src/mongo/db/exec/working_set_common.cpp4
-rw-r--r--src/mongo/db/index_rebuilder.cpp4
-rw-r--r--src/mongo/db/instance.cpp14
-rw-r--r--src/mongo/db/op_observer.cpp2
-rw-r--r--src/mongo/db/operation_context_impl.cpp6
-rw-r--r--src/mongo/db/ops/update.cpp4
-rw-r--r--src/mongo/db/query/find.cpp6
-rw-r--r--src/mongo/db/query/get_executor.cpp8
-rw-r--r--src/mongo/db/query/plan_executor.cpp2
-rw-r--r--src/mongo/db/range_deleter.cpp4
-rw-r--r--src/mongo/db/range_deleter.h2
-rw-r--r--src/mongo/db/range_deleter_mock_env.cpp7
-rw-r--r--src/mongo/db/repl/SConscript5
-rw-r--r--src/mongo/db/repl/master_slave.cpp4
-rw-r--r--src/mongo/db/repl/oplog.cpp6
-rw-r--r--src/mongo/db/repl/replication_coordinator_external_state_impl.cpp8
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.h2
-rw-r--r--src/mongo/db/repl/replset_commands.cpp6
-rw-r--r--src/mongo/db/repl/rs_initialsync.cpp2
-rw-r--r--src/mongo/db/repl/sync_tail.cpp6
-rw-r--r--src/mongo/db/service_context.cpp (renamed from src/mongo/db/global_environment_experiment.cpp)27
-rw-r--r--src/mongo/db/service_context.h (renamed from src/mongo/db/global_environment_experiment.h)28
-rw-r--r--src/mongo/db/service_context_d.cpp (renamed from src/mongo/db/global_environment_d.cpp)47
-rw-r--r--src/mongo/db/service_context_d.h (renamed from src/mongo/db/global_environment_d.h)10
-rw-r--r--src/mongo/db/service_context_noop.cpp (renamed from src/mongo/db/global_environment_noop.cpp)34
-rw-r--r--src/mongo/db/service_context_noop.h (renamed from src/mongo/db/global_environment_noop.h)4
-rw-r--r--src/mongo/db/storage/devnull/devnull_init.cpp6
-rw-r--r--src/mongo/db/storage/in_memory/in_memory_init.cpp4
-rw-r--r--src/mongo/db/storage/kv/kv_database_catalog_entry_test.cpp7
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file_sync.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp4
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp6
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp8
-rw-r--r--src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp4
-rw-r--r--src/mongo/db/write_concern.cpp6
-rw-r--r--src/mongo/dbtests/dbtests.cpp7
-rw-r--r--src/mongo/dbtests/executor_registry.cpp2
-rw-r--r--src/mongo/dbtests/framework.cpp6
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp28
-rw-r--r--src/mongo/dbtests/mmaptests.cpp4
-rw-r--r--src/mongo/dbtests/oplogstarttests.cpp4
-rw-r--r--src/mongo/dbtests/querytests.cpp12
-rw-r--r--src/mongo/s/d_migrate.cpp4
-rw-r--r--src/mongo/s/server.cpp7
-rw-r--r--src/mongo/scripting/engine.cpp2
-rw-r--r--src/mongo/scripting/engine.h2
-rw-r--r--src/mongo/scripting/engine_v8-3.25.cpp6
-rw-r--r--src/mongo/scripting/engine_v8.cpp6
-rw-r--r--src/mongo/util/version_reporting.cpp7
87 files changed, 309 insertions, 303 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript
index 833834c735c..6601b088db4 100644
--- a/src/mongo/SConscript
+++ b/src/mongo/SConscript
@@ -480,7 +480,7 @@ env.Library('mongocommon', commonFiles,
'clientdriver',
'fail_point',
'foundation',
- 'global_environment_experiment',
+ 'service_context',
'lasterror',
'md5',
'mongohasher',
@@ -696,10 +696,14 @@ else:
env.Library('update_index_data', [ 'db/update_index_data.cpp' ], LIBDEPS=[ 'db/common' ])
-# Global Configuration. Used by both mongos and mongod.
-env.Library('global_environment_experiment',
- [ 'db/global_environment_experiment.cpp',
- 'db/global_environment_noop.cpp' ])
+env.Library(
+ target='service_context',
+ source=[
+ 'db/service_context.cpp',
+ 'db/service_context_noop.cpp',
+ ],
+ LIBDEPS=[
+ ])
# Memory-mapped files support. Used by mongod and some tools.
env.Library('mmap', ['util/mmap.cpp', 'util/mmap_${TARGET_OS_FAMILY}.cpp'], LIBDEPS=['foundation'])
@@ -773,7 +777,7 @@ serverOnlyFiles = [ "db/background.cpp",
"db/dbhelpers.cpp",
"db/driverHelpers.cpp",
"db/geo/haystack.cpp",
- "db/global_environment_d.cpp",
+ "db/service_context_d.cpp",
"db/index/2d_access_method.cpp",
"db/index/btree_access_method.cpp",
"db/index/fts_access_method.cpp",
@@ -1029,7 +1033,7 @@ env.Library('range_deleter',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_global',
'base/base',
'bson',
- 'global_environment_experiment',
+ 'service_context',
'range_arithmetic',
'synchronization'
])
diff --git a/src/mongo/db/auth/authz_manager_external_state_d.cpp b/src/mongo/db/auth/authz_manager_external_state_d.cpp
index dfb37502332..2ff2b933fce 100644
--- a/src/mongo/db/auth/authz_manager_external_state_d.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_d.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/storage/storage_engine.h"
diff --git a/src/mongo/db/catalog/cursor_manager.cpp b/src/mongo/db/catalog/cursor_manager.cpp
index e1a7c1193b3..f68c6cbc1ab 100644
--- a/src/mongo/db/catalog/cursor_manager.cpp
+++ b/src/mongo/db/catalog/cursor_manager.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/query/plan_executor.h"
#include "mongo/platform/random.h"
diff --git a/src/mongo/db/catalog/database.cpp b/src/mongo/db/catalog/database.cpp
index 9252d6417ab..814184ef694 100644
--- a/src/mongo/db/catalog/database.cpp
+++ b/src/mongo/db/catalog/database.cpp
@@ -48,8 +48,8 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
-#include "mongo/db/global_environment_d.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_d.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
@@ -221,7 +221,7 @@ namespace mongo {
}
vector<string> others;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases(&others);
set<string> allShortNames;
@@ -272,7 +272,7 @@ namespace mongo {
continue;
}
- getGlobalEnvironment()->getOpObserver()->onDropCollection(
+ getGlobalServiceContext()->getOpObserver()->onDropCollection(
txn, NamespaceString(ns));
wunit.commit();
}
@@ -549,7 +549,7 @@ namespace mongo {
Lock::GlobalWrite lk(txn->lockState());
vector<string> n;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases(&n);
if( n.size() == 0 ) return;
@@ -581,7 +581,7 @@ namespace mongo {
dbHolder().close( txn, name );
db = NULL; // d is now deleted
- getGlobalEnvironment()->getGlobalStorageEngine()->dropDatabase( txn, name );
+ getGlobalServiceContext()->getGlobalStorageEngine()->dropDatabase( txn, name );
}
/** { ..., capped: true, size: ..., max: ... }
@@ -622,7 +622,7 @@ namespace mongo {
invariant( db->createCollection( txn, ns, collectionOptions, true, createDefaultIndexes ) );
if ( logForReplication ) {
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(txn,
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(txn,
NamespaceString(ns),
collectionOptions);
}
diff --git a/src/mongo/db/catalog/database_holder.cpp b/src/mongo/db/catalog/database_holder.cpp
index 68aca767abd..e8bb0138d88 100644
--- a/src/mongo/db/catalog/database_holder.cpp
+++ b/src/mongo/db/catalog/database_holder.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/catalog/database.h"
#include "mongo/db/catalog/database_catalog_entry.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/util/file_allocator.h"
@@ -122,7 +122,7 @@ namespace {
uasserted(DatabaseDifferCaseCode, ss.str());
}
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
invariant(storageEngine);
DatabaseCatalogEntry* entry = storageEngine->getDatabaseCatalogEntry(txn, dbname);
@@ -166,7 +166,7 @@ namespace {
delete it->second;
_dbs.erase(it);
- getGlobalEnvironment()->getGlobalStorageEngine()->closeDatabase(txn, dbName.toString());
+ getGlobalServiceContext()->getGlobalStorageEngine()->closeDatabase(txn, dbName.toString());
}
bool DatabaseHolder::closeAll(OperationContext* txn, BSONObjBuilder& result, bool force) {
@@ -200,7 +200,7 @@ namespace {
_dbs.erase( name );
- getGlobalEnvironment()->getGlobalStorageEngine()->closeDatabase( txn, name );
+ getGlobalServiceContext()->getGlobalStorageEngine()->closeDatabase( txn, name );
bb.append( name );
}
diff --git a/src/mongo/db/catalog/index_catalog.cpp b/src/mongo/db/catalog/index_catalog.cpp
index cc8748cd279..647f9b8e17a 100644
--- a/src/mongo/db/catalog/index_catalog.cpp
+++ b/src/mongo/db/catalog/index_catalog.cpp
@@ -47,7 +47,7 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/curop.h"
#include "mongo/db/field_ref.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_legacy.h"
@@ -497,7 +497,7 @@ namespace {
double v = vElt.Number();
// SERVER-16893 Forbid use of v0 indexes with non-mmapv1 engines
- if (v == 0 && !getGlobalEnvironment()->getGlobalStorageEngine()->isMmapV1()) {
+ if (v == 0 && !getGlobalServiceContext()->getGlobalStorageEngine()->isMmapV1()) {
return Status( ErrorCodes::CannotCreateIndex,
str::stream() << "use of v0 indexes is only allowed with the "
<< "mmapv1 storage engine");
@@ -1300,7 +1300,7 @@ namespace {
// immediately after it recovers from yield, such that no further work is done
// on the index build. Thus this thread does not have to synchronize with the
// bg index operation; we can just assume that it is safe to proceed.
- getGlobalEnvironment()->killOperation(opNum);
+ getGlobalServiceContext()->killOperation(opNum);
}
if (indexes.size() > 0) {
diff --git a/src/mongo/db/catalog/index_catalog_entry.cpp b/src/mongo/db/catalog/index_catalog_entry.cpp
index 7ad596f0f50..ad4e3b31b3a 100644
--- a/src/mongo/db/catalog/index_catalog_entry.cpp
+++ b/src/mongo/db/catalog/index_catalog_entry.cpp
@@ -39,10 +39,10 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/index/index_descriptor.h"
-#include "mongo/db/global_environment_experiment.h"
#include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/operation_context.h"
+#include "mongo/db/service_context.h"
#include "mongo/util/file_allocator.h"
#include "mongo/util/log.h"
#include "mongo/util/scopeguard.h"
@@ -210,7 +210,7 @@ namespace mongo {
// setMultikey. The reason we need is to avoid artificial WriteConflicts, which happen
// with snapshot isolation.
{
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
RecoveryUnitSwap ruSwap(txn, storageEngine->newRecoveryUnit());
WriteUnitOfWork wuow(txn);
diff --git a/src/mongo/db/clientlistplugin.cpp b/src/mongo/db/clientlistplugin.cpp
index a8200a5c997..6f0a30efedc 100644
--- a/src/mongo/db/clientlistplugin.cpp
+++ b/src/mongo/db/clientlistplugin.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/curop.h"
#include "mongo/db/currentop_command.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/dbwebserver.h"
diff --git a/src/mongo/db/cloner.cpp b/src/mongo/db/cloner.cpp
index 395e24baae6..fa69594e2fa 100644
--- a/src/mongo/db/cloner.cpp
+++ b/src/mongo/db/cloner.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/commands/rename_collection.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
@@ -152,7 +152,7 @@ namespace mongo {
verify(collection);
if (logForRepl) {
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
txn,
to_collection,
CollectionOptions());
@@ -234,7 +234,7 @@ namespace mongo {
}
uassertStatusOK( loc.getStatus() );
if (logForRepl)
- getGlobalEnvironment()->getOpObserver()->onInsert(txn, to_collection.ns(), js);
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn, to_collection.ns(), js);
wunit.commit();
@@ -341,7 +341,7 @@ namespace mongo {
collection = db->createCollection( txn, to_collection.ns() );
invariant(collection);
if (logForRepl) {
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(txn,
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(txn,
to_collection,
CollectionOptions());
}
@@ -372,7 +372,7 @@ namespace mongo {
const char* createIndexNs = targetSystemIndexesCollectionName.c_str();
for (vector<BSONObj>::const_iterator it = indexesToBuild.begin();
it != indexesToBuild.end(); ++it) {
- getGlobalEnvironment()->getOpObserver()->onInsert(txn, createIndexNs, *it);
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn, createIndexNs, *it);
}
}
wunit.commit();
@@ -651,7 +651,7 @@ namespace mongo {
c->deleteDocument(txn, *it, true, true, opts.logForRepl ? &id : NULL);
if (opts.logForRepl)
- getGlobalEnvironment()->getOpObserver()->onDelete(txn,
+ getGlobalServiceContext()->getOpObserver()->onDelete(txn,
c->ns().ns(),
id);
wunit.commit();
@@ -664,7 +664,7 @@ namespace mongo {
WriteUnitOfWork wunit(txn);
indexer.commit();
if (opts.logForRepl) {
- getGlobalEnvironment()->getOpObserver()->onCreateIndex(
+ getGlobalServiceContext()->getOpObserver()->onCreateIndex(
txn,
c->ns().getSystemIndexesCollection().c_str(),
c->getIndexCatalog()->getDefaultIdIndexSpec());
diff --git a/src/mongo/db/commands/apply_ops.cpp b/src/mongo/db/commands/apply_ops.cpp
index 2ab7f437c44..6551a5588fe 100644
--- a/src/mongo/db/commands/apply_ops.cpp
+++ b/src/mongo/db/commands/apply_ops.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/matcher.h"
#include "mongo/db/operation_context_impl.h"
@@ -224,7 +224,7 @@ namespace mongo {
while (true) {
try {
WriteUnitOfWork wunit(txn);
- getGlobalEnvironment()->getOpObserver()->onApplyOps(txn,
+ getGlobalServiceContext()->getOpObserver()->onApplyOps(txn,
tempNS,
cmdRewritten);
wunit.commit();
diff --git a/src/mongo/db/commands/collection_to_capped.cpp b/src/mongo/db/commands/collection_to_capped.cpp
index 9e2c33a9a87..b5a5aa90574 100644
--- a/src/mongo/db/commands/collection_to_capped.cpp
+++ b/src/mongo/db/commands/collection_to_capped.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context_impl.h"
@@ -126,7 +126,7 @@ namespace {
WriteUnitOfWork wunit(txn);
toCollection->insertDocument( txn, obj, true );
if ( logForReplication ) {
- getGlobalEnvironment()->getOpObserver()->onInsert(txn, toNs, obj);
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn, toNs, obj);
}
wunit.commit();
}
@@ -300,7 +300,7 @@ namespace {
return appendCommandStatus( result, status );
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onConvertToCapped(
+ getGlobalServiceContext()->getOpObserver()->onConvertToCapped(
txn,
NamespaceString(longSource),
size);
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index eed2eb96a13..39db8afa3fe 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/curop.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/insert.h"
@@ -162,7 +162,7 @@ namespace mongo {
collection = db->createCollection( txn, ns.ns() );
invariant( collection );
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
txn,
ns,
CollectionOptions());
@@ -274,7 +274,7 @@ namespace mongo {
if ( !fromRepl ) {
for ( size_t i = 0; i < specs.size(); i++ ) {
std::string systemIndexes = ns.getSystemIndexesCollection();
- getGlobalEnvironment()->getOpObserver()->onCreateIndex(txn,
+ getGlobalServiceContext()->getOpObserver()->onCreateIndex(txn,
systemIndexes,
specs[i]);
}
diff --git a/src/mongo/db/commands/drop_indexes.cpp b/src/mongo/db/commands/drop_indexes.cpp
index fa555166966..d427e3a720f 100644
--- a/src/mongo/db/commands/drop_indexes.cpp
+++ b/src/mongo/db/commands/drop_indexes.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/op_observer.h"
@@ -132,7 +132,7 @@ namespace mongo {
return false;
}
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onDropIndex(txn,
+ getGlobalServiceContext()->getOpObserver()->onDropIndex(txn,
dbname + ".$cmd",
jsobj);
}
diff --git a/src/mongo/db/commands/find_and_modify.cpp b/src/mongo/db/commands/find_and_modify.cpp
index 86f155394de..88fe9647e6c 100644
--- a/src/mongo/db/commands/find_and_modify.cpp
+++ b/src/mongo/db/commands/find_and_modify.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/exec/update.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/delete.h"
#include "mongo/db/ops/update.h"
@@ -444,7 +444,7 @@ namespace mongo {
// This is the last thing we do before the WriteUnitOfWork commits (except
// for some BSON manipulation).
- getGlobalEnvironment()->getOpObserver()->onInsert(txn,
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn,
collection->ns().ns(),
newDoc);
diff --git a/src/mongo/db/commands/find_cmd.cpp b/src/mongo/db/commands/find_cmd.cpp
index 2995e118fce..30971083313 100644
--- a/src/mongo/db/commands/find_cmd.cpp
+++ b/src/mongo/db/commands/find_cmd.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/query/explain.h"
#include "mongo/db/query/find.h"
#include "mongo/db/query/get_executor.h"
@@ -336,7 +336,7 @@ namespace mongo {
// subsequent getMore requests. The calling OpCtx gets a fresh RecoveryUnit.
txn->recoveryUnit()->commitAndRestart();
cursor->setOwnedRecoveryUnit(txn->releaseRecoveryUnit());
- StorageEngine* engine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* engine = getGlobalServiceContext()->getGlobalStorageEngine();
txn->setRecoveryUnit(engine->newRecoveryUnit());
}
}
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 7c0442f205e..8a2329c7f95 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/commands.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/db/client.h"
@@ -152,7 +152,7 @@ namespace mongo {
// Take a global IS lock to ensure the storage engine is not shutdown
Lock::GlobalLock global(txn->lockState(), MODE_IS, UINT_MAX);
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
result.append( "numFiles" , storageEngine->flushAllFiles( sync ) );
}
return 1;
@@ -233,7 +233,7 @@ namespace mongo {
txn.lockState()->downgradeGlobalXtoSForMMAPV1();
try {
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->flushAllFiles(true);
}
catch( std::exception& e ) {
diff --git a/src/mongo/db/commands/getmore_cmd.cpp b/src/mongo/db/commands/getmore_cmd.cpp
index 4a7578b9557..16a2eac4c13 100644
--- a/src/mongo/db/commands/getmore_cmd.cpp
+++ b/src/mongo/db/commands/getmore_cmd.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/query/find.h"
#include "mongo/db/query/getmore_request.h"
#include "mongo/db/stats/counters.h"
@@ -184,7 +184,7 @@ namespace mongo {
if (!cursor->hasRecoveryUnit()) {
// Start using a new RecoveryUnit.
cursor->setOwnedRecoveryUnit(
- getGlobalEnvironment()->getGlobalStorageEngine()->newRecoveryUnit());
+ getGlobalServiceContext()->getGlobalStorageEngine()->newRecoveryUnit());
}
// Swap RecoveryUnit(s) between the ClientCursor and OperationContext.
diff --git a/src/mongo/db/commands/list_collections.cpp b/src/mongo/db/commands/list_collections.cpp
index f67a117dd0f..092822ba663 100644
--- a/src/mongo/db/commands/list_collections.cpp
+++ b/src/mongo/db/commands/list_collections.cpp
@@ -44,7 +44,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/queued_data_stage.h"
#include "mongo/db/exec/working_set.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/query/find_constants.h"
#include "mongo/db/storage/storage_engine.h"
diff --git a/src/mongo/db/commands/list_databases.cpp b/src/mongo/db/commands/list_databases.cpp
index 603f340bddc..e5997e36d2c 100644
--- a/src/mongo/db/commands/list_databases.cpp
+++ b/src/mongo/db/commands/list_databases.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/catalog/database_holder.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/storage_engine.h"
namespace mongo {
@@ -78,7 +78,7 @@ namespace mongo {
bool /*fromRepl*/) {
vector< string > dbNames;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases( &dbNames );
vector< BSONObj > dbInfos;
diff --git a/src/mongo/db/commands/list_indexes.cpp b/src/mongo/db/commands/list_indexes.cpp
index 41457ce9d20..fddf6cc6cba 100644
--- a/src/mongo/db/commands/list_indexes.cpp
+++ b/src/mongo/db/commands/list_indexes.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/queued_data_stage.h"
#include "mongo/db/exec/working_set.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/query/find_constants.h"
#include "mongo/db/storage/storage_engine.h"
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index 15918b1d28f..a3e0ec2d870 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/db.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/instance.h"
#include "mongo/db/matcher/matcher.h"
@@ -441,7 +441,7 @@ namespace mongo {
b.append( "create", nsToCollectionSubstring( _config.tempNamespace ));
b.appendElements( options.toBSON() );
string logNs = nsToDatabase( _config.tempNamespace ) + ".$cmd";
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
_txn,
NamespaceString(_config.tempNamespace),
options);
@@ -458,7 +458,7 @@ namespace mongo {
}
// Log the createIndex operation.
string logNs = nsToDatabase( _config.tempNamespace ) + ".system.indexes";
- getGlobalEnvironment()->getOpObserver()->onInsert(_txn, logNs, *it);
+ getGlobalServiceContext()->getOpObserver()->onInsert(_txn, logNs, *it);
}
wuow.commit();
}
@@ -695,7 +695,7 @@ namespace mongo {
BSONObj bo = b.obj();
uassertStatusOK( coll->insertDocument( _txn, bo, true ).getStatus() );
- getGlobalEnvironment()->getOpObserver()->onInsert(_txn, ns, bo);
+ getGlobalServiceContext()->getOpObserver()->onInsert(_txn, ns, bo);
wuow.commit();
}
diff --git a/src/mongo/db/commands/oplog_note.cpp b/src/mongo/db/commands/oplog_note.cpp
index bc41c2a1409..2dc3dd204fb 100644
--- a/src/mongo/db/commands/oplog_note.cpp
+++ b/src/mongo/db/commands/oplog_note.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/auth/resource_pattern.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/commands.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context.h"
@@ -84,7 +84,7 @@ namespace mongo {
Lock::GlobalWrite globalWrite(txn->lockState());
WriteUnitOfWork wuow(txn);
- getGlobalEnvironment()->getOpObserver()->onOpMessage(txn, dataElement.Obj());
+ getGlobalServiceContext()->getOpObserver()->onOpMessage(txn, dataElement.Obj());
wuow.commit();
return true;
}
diff --git a/src/mongo/db/commands/pipeline_command.cpp b/src/mongo/db/commands/pipeline_command.cpp
index d3d9e1e288c..a67620e6343 100644
--- a/src/mongo/db/commands/pipeline_command.cpp
+++ b/src/mongo/db/commands/pipeline_command.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/pipeline_proxy.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/pipeline/accumulator.h"
#include "mongo/db/pipeline/document.h"
#include "mongo/db/pipeline/document_source.h"
@@ -138,7 +138,7 @@ namespace mongo {
// getMore requests. The calling OpCtx gets a fresh RecoveryUnit.
txn->recoveryUnit()->commitAndRestart();
cursor->setOwnedRecoveryUnit(txn->releaseRecoveryUnit());
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
txn->setRecoveryUnit(storageEngine->newRecoveryUnit());
}
diff --git a/src/mongo/db/commands/rename_collection.cpp b/src/mongo/db/commands/rename_collection.cpp
index 81e5f992f83..162208b73cf 100644
--- a/src/mongo/db/commands/rename_collection.cpp
+++ b/src/mongo/db/commands/rename_collection.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/commands/rename_collection.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/namespace_string.h"
@@ -247,7 +247,7 @@ namespace mongo {
}
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onRenameCollection(
+ getGlobalServiceContext()->getOpObserver()->onRenameCollection(
txn,
NamespaceString(source),
NamespaceString(target),
@@ -351,7 +351,7 @@ namespace mongo {
indexer.commit();
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onRenameCollection(
+ getGlobalServiceContext()->getOpObserver()->onRenameCollection(
txn,
NamespaceString(source),
NamespaceString(target),
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 0db4eb08f90..eb6408e6d5b 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context_impl.h"
@@ -235,7 +235,7 @@ namespace mongo {
IndexBuilder::restoreIndexes(txn, indexes);
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onEmptyCapped(txn, collection->ns());
+ getGlobalServiceContext()->getOpObserver()->onEmptyCapped(txn, collection->ns());
}
wuow.commit();
diff --git a/src/mongo/db/commands/write_commands/batch_executor.cpp b/src/mongo/db/commands/write_commands/batch_executor.cpp
index 21f024513c3..594a121c76c 100644
--- a/src/mongo/db/commands/write_commands/batch_executor.cpp
+++ b/src/mongo/db/commands/write_commands/batch_executor.cpp
@@ -45,7 +45,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/delete.h"
#include "mongo/db/exec/update.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
#include "mongo/db/lasterror.h"
@@ -1072,7 +1072,7 @@ namespace mongo {
request->getTargetingNS())));
return false;
}
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
txn,
NamespaceString(request->getTargetingNS()),
CollectionOptions());
@@ -1199,7 +1199,7 @@ namespace mongo {
result->setError(toWriteError(status.getStatus()));
}
else {
- getGlobalEnvironment()->getOpObserver()->onInsert(txn, insertNS, docToInsert);
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn, insertNS, docToInsert);
result->getStats().n = 1;
wunit.commit();
}
diff --git a/src/mongo/db/concurrency/SConscript b/src/mongo/db/concurrency/SConscript
index 1687fa6ce04..d38a2032f98 100644
--- a/src/mongo/db/concurrency/SConscript
+++ b/src/mongo/db/concurrency/SConscript
@@ -21,10 +21,10 @@ env.Library(
'lock_stats.cpp',
],
LIBDEPS=[
+ "$BUILD_DIR/mongo/server_parameters",
'$BUILD_DIR/mongo/base/base',
'$BUILD_DIR/mongo/foundation',
- '$BUILD_DIR/mongo/global_environment_experiment',
- "$BUILD_DIR/mongo/server_parameters",
+ '$BUILD_DIR/mongo/service_context',
'$BUILD_DIR/mongo/spin_lock',
'$BUILD_DIR/third_party/shim_boost',
],
diff --git a/src/mongo/db/concurrency/d_concurrency.cpp b/src/mongo/db/concurrency/d_concurrency.cpp
index 73c4c89113b..5882c5a1950 100644
--- a/src/mongo/db/concurrency/d_concurrency.cpp
+++ b/src/mongo/db/concurrency/d_concurrency.cpp
@@ -32,7 +32,7 @@
#include <string>
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/server_parameters.h"
#include "mongo/util/assert_util.h"
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index ace5c26beee..2ceb854be1c 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -32,7 +32,7 @@
#include "mongo/db/concurrency/lock_state.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/namespace_string.h"
#include "mongo/platform/compiler.h"
#include "mongo/util/concurrency/synchronization.h"
diff --git a/src/mongo/db/curop.cpp b/src/mongo/db/curop.cpp
index 7379aa6bd7a..439e0c20921 100644
--- a/src/mongo/db/curop.cpp
+++ b/src/mongo/db/curop.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/client.h"
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/catalog/database.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/json.h"
#include "mongo/db/stats/top.h"
#include "mongo/util/fail_point_service.h"
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 8f4480d5ef0..e490160ea2c 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -62,8 +62,8 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbmessage.h"
#include "mongo/db/dbwebserver.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index_names.h"
#include "mongo/db/index_rebuilder.h"
#include "mongo/db/initialize_server_global_state.h"
@@ -347,7 +347,7 @@ namespace mongo {
vector<string> dbNames;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases( &dbNames );
// Repair all databases first, so that we do not try to open them if they are in bad shape
@@ -479,7 +479,7 @@ namespace mongo {
}
// Warn if field name matches non-active registered storage engine.
- if (getGlobalEnvironment()->isRegisteredStorageEngine(e.fieldName())) {
+ if (getGlobalServiceContext()->isRegisteredStorageEngine(e.fieldName())) {
warning() << "Detected configuration for non-active storage engine "
<< e.fieldName()
<< " when current storage engine is "
@@ -488,8 +488,8 @@ namespace mongo {
}
}
- getGlobalEnvironment()->setGlobalStorageEngine(storageGlobalParams.engine);
- getGlobalEnvironment()->setOpObserver(stdx::make_unique<OpObserver>());
+ getGlobalServiceContext()->setGlobalStorageEngine(storageGlobalParams.engine);
+ getGlobalServiceContext()->setOpObserver(stdx::make_unique<OpObserver>());
const repl::ReplSettings& replSettings =
repl::getGlobalReplicationCoordinator()->getSettings();
@@ -818,7 +818,7 @@ MONGO_INITIALIZER_WITH_PREREQUISITES(CreateReplicationManager, ("SetGlobalEnviro
static_cast<int64_t>(curTimeMillis64()));
repl::setGlobalReplicationCoordinator(replCoord);
repl::setOplogCollectionName();
- getGlobalEnvironment()->registerKillOpListener(replCoord);
+ getGlobalServiceContext()->registerKillOpListener(replCoord);
return Status::OK();
}
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index b0e67cd1fc3..f0da12eeec7 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -59,8 +59,8 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
@@ -219,7 +219,7 @@ namespace mongo {
WriteUnitOfWork wunit(txn);
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onDropDatabase(txn, dbname + ".$cmd");
+ getGlobalServiceContext()->getOpObserver()->onDropDatabase(txn, dbname + ".$cmd");
}
wunit.commit();
@@ -299,7 +299,7 @@ namespace mongo {
e = cmdObj.getField( "backupOriginalFiles" );
bool backupOriginalFiles = e.isBoolean() && e.boolean();
- StorageEngine* engine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* engine = getGlobalServiceContext()->getGlobalStorageEngine();
Status status = repairDatabase(txn, engine, dbname, preserveClonedFilesOnFailure,
backupOriginalFiles );
@@ -529,7 +529,7 @@ namespace mongo {
}
if ( !fromRepl ) {
- getGlobalEnvironment()->getOpObserver()->onDropCollection(
+ getGlobalServiceContext()->getOpObserver()->onDropCollection(
txn,
NamespaceString(nsToDrop));
}
@@ -1173,7 +1173,7 @@ namespace mongo {
}
if (!fromRepl) {
- getGlobalEnvironment()->getOpObserver()->onCollMod(txn,
+ getGlobalServiceContext()->getOpObserver()->onCollMod(txn,
(dbname + ".$cmd").c_str(),
jsobj);
}
diff --git a/src/mongo/db/dbhelpers.cpp b/src/mongo/db/dbhelpers.cpp
index 74737b38d28..6833aa33dc9 100644
--- a/src/mongo/db/dbhelpers.cpp
+++ b/src/mongo/db/dbhelpers.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/db.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/btree_access_method.h"
#include "mongo/db/json.h"
#include "mongo/db/keypattern.h"
@@ -449,7 +449,7 @@ namespace mongo {
BSONObj deletedId;
collection->deleteDocument( txn, rloc, false, false, &deletedId );
// The above throws on failure, and so is not logged
- getGlobalEnvironment()->getOpObserver()->onDelete(txn, ns, deletedId, fromMigrate);
+ getGlobalServiceContext()->getOpObserver()->onDelete(txn, ns, deletedId, fromMigrate);
wuow.commit();
numDeleted++;
}
diff --git a/src/mongo/db/dbwebserver.cpp b/src/mongo/db/dbwebserver.cpp
index 6c71a4f8cd5..a1de920ba2b 100644
--- a/src/mongo/db/dbwebserver.cpp
+++ b/src/mongo/db/dbwebserver.cpp
@@ -48,7 +48,7 @@
#include "mongo/db/background.h"
#include "mongo/db/commands.h"
#include "mongo/db/db.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/instance.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/stats/snapshots.h"
@@ -297,7 +297,7 @@ namespace {
vector<string>& headers,
const SockAddr &from) {
- boost::scoped_ptr<OperationContext> txn(getGlobalEnvironment()->newOpCtx());
+ boost::scoped_ptr<OperationContext> txn(getGlobalServiceContext()->newOpCtx());
if (url.size() > 1) {
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index a6d8a967704..b6bf7b03361 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/exec/scoped_timer.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/repl/replication_coordinator_global.h"
@@ -164,7 +164,7 @@ namespace mongo {
<< ", not logging.";
}
else {
- getGlobalEnvironment()->getOpObserver()->onDelete(
+ getGlobalServiceContext()->getOpObserver()->onDelete(
_txn,
_collection->ns().ns(),
deletedDoc,
diff --git a/src/mongo/db/exec/update.cpp b/src/mongo/db/exec/update.cpp
index 0da9981261f..d9f8e291662 100644
--- a/src/mongo/db/exec/update.cpp
+++ b/src/mongo/db/exec/update.cpp
@@ -36,7 +36,7 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/exec/scoped_timer.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/update_lifecycle.h"
#include "mongo/db/query/explain.h"
@@ -590,7 +590,7 @@ namespace mongo {
// Call logOp if requested, and we're not an explain.
if (request->shouldCallLogOp() && !logObj.isEmpty() && !request->isExplain()) {
BSONObj idQuery = driver->makeOplogEntryQuery(newObj, request->isMulti());
- getGlobalEnvironment()->getOpObserver()->onUpdate(
+ getGlobalServiceContext()->getOpObserver()->onUpdate(
_txn,
request->getNamespaceString().ns().c_str(),
logObj,
@@ -742,7 +742,7 @@ namespace mongo {
!request->isGod()/*enforceQuota*/);
uassertStatusOK(newLoc.getStatus());
if (request->shouldCallLogOp()) {
- getGlobalEnvironment()->getOpObserver()->onInsert(_txn,
+ getGlobalServiceContext()->getOpObserver()->onInsert(_txn,
request->getNamespaceString().ns(),
newObj,
request->isFromMigration());
diff --git a/src/mongo/db/exec/working_set_common.cpp b/src/mongo/db/exec/working_set_common.cpp
index b78bfaee632..16f1b25bc95 100644
--- a/src/mongo/db/exec/working_set_common.cpp
+++ b/src/mongo/db/exec/working_set_common.cpp
@@ -31,9 +31,9 @@
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/catalog/collection.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/exec/working_set.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/query/canonical_query.h"
diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp
index d8d7ab5dfa5..b73d76acd3e 100644
--- a/src/mongo/db/index_rebuilder.cpp
+++ b/src/mongo/db/index_rebuilder.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/client.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/instance.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/storage_engine.h"
@@ -154,7 +154,7 @@ namespace {
std::vector<std::string> dbNames;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases( &dbNames );
try {
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index a60b2714dd1..2ab4f1e58a3 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -58,7 +58,7 @@
#include "mongo/db/dbmessage.h"
#include "mongo/db/exec/delete.h"
#include "mongo/db/exec/update.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/global_optime.h"
#include "mongo/db/instance.h"
#include "mongo/db/introspect.h"
@@ -174,7 +174,7 @@ namespace mongo {
else {
log() << "going to kill op: " << e << endl;
obj = fromjson("{\"info\":\"attempting to kill op\"}");
- getGlobalEnvironment()->killOperation( (unsigned) e.number() );
+ getGlobalServiceContext()->killOperation( (unsigned) e.number() );
}
}
replyToQuery(0, m, dbresponse, obj);
@@ -978,7 +978,7 @@ namespace {
if ( !collection ) {
collection = ctx.db()->createCollection( txn, ns );
verify( collection );
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
txn,
NamespaceString(ns),
CollectionOptions());
@@ -986,7 +986,7 @@ namespace {
StatusWith<RecordId> status = collection->insertDocument( txn, js, true );
uassertStatusOK( status.getStatus() );
- getGlobalEnvironment()->getOpObserver()->onInsert(txn, std::string(ns), js);
+ getGlobalServiceContext()->getOpObserver()->onInsert(txn, std::string(ns), js);
wunit.commit();
break;
}
@@ -1201,7 +1201,7 @@ namespace {
log(LogComponent::kNetwork) << "shutdown: going to close sockets..." << endl;
boost::thread close_socket_thread( stdx::bind(MessagingPort::closeAllSockets, 0) );
- getGlobalEnvironment()->shutdownGlobalStorageEngineCleanly();
+ getGlobalServiceContext()->shutdownGlobalStorageEngineCleanly();
}
// shutdownLock
@@ -1225,13 +1225,13 @@ namespace {
boost::lock_guard<boost::mutex> lockguard(shutdownLock);
// Global storage engine may not be started in all cases before we exit
- if (getGlobalEnvironment()->getGlobalStorageEngine() == NULL) {
+ if (getGlobalServiceContext()->getGlobalStorageEngine() == NULL) {
dbexit(code); // returns only under a windows service
invariant(code == EXIT_WINDOWS_SERVICE_STOP);
return;
}
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
repl::getGlobalReplicationCoordinator()->shutdown();
diff --git a/src/mongo/db/op_observer.cpp b/src/mongo/db/op_observer.cpp
index 25aa20b35a7..eab851bcc0c 100644
--- a/src/mongo/db/op_observer.cpp
+++ b/src/mongo/db/op_observer.cpp
@@ -34,7 +34,7 @@
#include "mongo/db/catalog/collection_options.h"
#include "mongo/db/commands/dbhash.h"
#include "mongo/db/dbdirectclient.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replication_coordinator_global.h"
diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp
index 356db253596..47a04b191d5 100644
--- a/src/mongo/db/operation_context_impl.cpp
+++ b/src/mongo/db/operation_context_impl.cpp
@@ -35,7 +35,7 @@
#include "mongo/db/client.h"
#include "mongo/db/concurrency/lock_state.h"
#include "mongo/db/curop.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/storage/storage_engine.h"
@@ -53,7 +53,7 @@ namespace mongo {
invariant(_locker);
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
_recovery.reset(storageEngine->newRecoveryUnit());
_client->setOperationContext(this);
@@ -161,7 +161,7 @@ namespace mongo {
}
Status OperationContextImpl::checkForInterruptNoAssert() const {
- if (getGlobalEnvironment()->getKillAllOperations()) {
+ if (getGlobalServiceContext()->getKillAllOperations()) {
return Status(ErrorCodes::InterruptedAtShutdown, "interrupted at shutdown");
}
diff --git a/src/mongo/db/ops/update.cpp b/src/mongo/db/ops/update.cpp
index c2c42aaa0d4..2c828d164c3 100644
--- a/src/mongo/db/ops/update.cpp
+++ b/src/mongo/db/ops/update.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/clientcursor.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/exec/update.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/ops/update_driver.h"
@@ -92,7 +92,7 @@ namespace mongo {
invariant(collection);
if (!request.isFromReplication()) {
- getGlobalEnvironment()->getOpObserver()->onCreateCollection(
+ getGlobalServiceContext()->getOpObserver()->onCreateCollection(
txn,
NamespaceString(nsString),
CollectionOptions());
diff --git a/src/mongo/db/query/find.cpp b/src/mongo/db/query/find.cpp
index 800ecf6e1f1..9875b0c4a24 100644
--- a/src/mongo/db/query/find.cpp
+++ b/src/mongo/db/query/find.cpp
@@ -42,7 +42,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/exec/filter.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/keypattern.h"
#include "mongo/db/query/explain.h"
#include "mongo/db/query/find_constants.h"
@@ -352,7 +352,7 @@ namespace mongo {
if (!cc->hasRecoveryUnit()) {
// Start using a new RecoveryUnit
cc->setOwnedRecoveryUnit(
- getGlobalEnvironment()->getGlobalStorageEngine()->newRecoveryUnit());
+ getGlobalServiceContext()->getGlobalStorageEngine()->newRecoveryUnit());
}
// Swap RecoveryUnit(s) between the ClientCursor and OperationContext.
@@ -705,7 +705,7 @@ namespace mongo {
// getMore requests. The calling OpCtx gets a fresh RecoveryUnit.
txn->recoveryUnit()->commitAndRestart();
cc->setOwnedRecoveryUnit(txn->releaseRecoveryUnit());
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
txn->setRecoveryUnit(storageEngine->newRecoveryUnit());
}
diff --git a/src/mongo/db/query/get_executor.cpp b/src/mongo/db/query/get_executor.cpp
index 7a17b0ca610..6e3af1c474b 100644
--- a/src/mongo/db/query/get_executor.cpp
+++ b/src/mongo/db/query/get_executor.cpp
@@ -50,26 +50,26 @@
#include "mongo/db/exec/shard_filter.h"
#include "mongo/db/exec/subplan.h"
#include "mongo/db/exec/update.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/index_names.h"
#include "mongo/db/matcher/expression_algo.h"
#include "mongo/db/ops/update_lifecycle.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/query/explain.h"
-#include "mongo/db/query/query_settings.h"
#include "mongo/db/query/index_bounds_builder.h"
#include "mongo/db/query/internal_plans.h"
#include "mongo/db/query/plan_cache.h"
#include "mongo/db/query/plan_executor.h"
-#include "mongo/db/query/planner_analysis.h"
#include "mongo/db/query/planner_access.h"
+#include "mongo/db/query/planner_analysis.h"
#include "mongo/db/query/query_knobs.h"
#include "mongo/db/query/query_planner.h"
#include "mongo/db/query/query_planner_common.h"
+#include "mongo/db/query/query_settings.h"
#include "mongo/db/query/stage_builder.h"
#include "mongo/db/repl/replication_coordinator_global.h"
-#include "mongo/db/index_names.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_parameters.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/oplog_hack.h"
#include "mongo/s/d_state.h"
#include "mongo/scripting/engine.h"
diff --git a/src/mongo/db/query/plan_executor.cpp b/src/mongo/db/query/plan_executor.cpp
index 4e62046da81..0cbd507b780 100644
--- a/src/mongo/db/query/plan_executor.cpp
+++ b/src/mongo/db/query/plan_executor.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/exec/subplan.h"
#include "mongo/db/exec/working_set.h"
#include "mongo/db/exec/working_set_common.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/query/plan_yield_policy.h"
#include "mongo/db/storage/record_fetcher.h"
diff --git a/src/mongo/db/range_deleter.cpp b/src/mongo/db/range_deleter.cpp
index 8d14aef3a98..e754fb9fb02 100644
--- a/src/mongo/db/range_deleter.cpp
+++ b/src/mongo/db/range_deleter.cpp
@@ -35,7 +35,7 @@
#include <boost/date_time/posix_time/posix_time_duration.hpp>
#include <memory>
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/util/concurrency/synchronization.h"
@@ -445,7 +445,7 @@ namespace {
while (!inShutdown() && !stopRequested()) {
string errMsg;
- boost::scoped_ptr<OperationContext> txn(getGlobalEnvironment()->newOpCtx());
+ boost::scoped_ptr<OperationContext> txn(getGlobalServiceContext()->newOpCtx());
RangeDeleteEntry* nextTask = NULL;
diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h
index 3cb478209c0..a1a9bb97a2c 100644
--- a/src/mongo/db/range_deleter.h
+++ b/src/mongo/db/range_deleter.h
@@ -71,7 +71,7 @@ namespace mongo {
* RangeDeleter* deleter = new RangeDeleter(new ...);
* deleter->startWorkers();
* ...
- * getGlobalEnvironment()->killAllOperations(); // stop all deletes
+ * getGlobalServiceContext()->killAllOperations(); // stop all deletes
* deleter->stopWorkers();
* delete deleter;
*/
diff --git a/src/mongo/db/range_deleter_mock_env.cpp b/src/mongo/db/range_deleter_mock_env.cpp
index 7bff0c9dcc8..97786c83ee7 100644
--- a/src/mongo/db/range_deleter_mock_env.cpp
+++ b/src/mongo/db/range_deleter_mock_env.cpp
@@ -28,8 +28,9 @@
#include "mongo/db/range_deleter_mock_env.h"
-#include "mongo/db/global_environment_experiment.h"
-#include "mongo/db/global_environment_noop.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_noop.h"
+#include "mongo/stdx/memory.h"
namespace mongo {
@@ -56,7 +57,7 @@ namespace mongo {
_pausedCount(0),
_getCursorsCallCount(0) {
- setGlobalEnvironment(new GlobalEnvironmentNoop());
+ setGlobalServiceContext(stdx::make_unique<ServiceContextNoop>());
}
void RangeDeleterMockEnv::addCursorId(StringData ns, CursorId id) {
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index f8b89ef3bba..674cc75e8bc 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -84,13 +84,14 @@ env.Library('repl_coordinator_impl',
'replication_coordinator_impl_heartbeat.cpp',
'replica_set_config_checks.cpp',
],
- LIBDEPS=['$BUILD_DIR/mongo/db/common',
+ LIBDEPS=[
+ '$BUILD_DIR/mongo/db/common',
'$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/fail_point',
'$BUILD_DIR/mongo/foundation',
- '$BUILD_DIR/mongo/global_environment_experiment',
'$BUILD_DIR/mongo/global_optime',
'$BUILD_DIR/mongo/server_options_core',
+ '$BUILD_DIR/mongo/service_context',
'repl_coordinator_interface',
'replica_set_messages',
'replication_executor',
diff --git a/src/mongo/db/repl/master_slave.cpp b/src/mongo/db/repl/master_slave.cpp
index a8397987999..3c7c14d0ee8 100644
--- a/src/mongo/db/repl/master_slave.cpp
+++ b/src/mongo/db/repl/master_slave.cpp
@@ -56,7 +56,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/ops/update.h"
@@ -1284,7 +1284,7 @@ namespace repl {
try {
WriteUnitOfWork wuow(&txn);
- getGlobalEnvironment()->getOpObserver()->onOpMessage(&txn, BSONObj());
+ getGlobalServiceContext()->getOpObserver()->onOpMessage(&txn, BSONObj());
wuow.commit();
}
catch (...) {
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index b1a6c783bce..8f3bbe52de5 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -51,7 +51,7 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/global_optime.h"
#include "mongo/db/index_builder.h"
#include "mongo/db/namespace_string.h"
@@ -415,11 +415,11 @@ namespace {
WriteUnitOfWork uow( txn );
invariant(ctx.db()->createCollection(txn, _oplogCollectionName, options));
if( !rs )
- getGlobalEnvironment()->getOpObserver()->onOpMessage(txn, BSONObj());
+ getGlobalServiceContext()->getOpObserver()->onOpMessage(txn, BSONObj());
uow.commit();
/* sync here so we don't get any surprising lag later when we try to sync */
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->flushAllFiles(true);
log() << "******" << endl;
}
diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
index a1b163b529b..824aac77634 100644
--- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp
@@ -43,7 +43,7 @@
#include "mongo/db/client.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/op_observer.h"
@@ -117,7 +117,7 @@ namespace {
Lock::GlobalWrite globalWrite(txn->lockState());
WriteUnitOfWork wuow(txn);
- getGlobalEnvironment()->getOpObserver()->onOpMessage(txn, BSON("msg" << "initiating set"));
+ getGlobalServiceContext()->getOpObserver()->onOpMessage(txn, BSON("msg" << "initiating set"));
wuow.commit();
}
@@ -237,7 +237,7 @@ namespace {
}
void ReplicationCoordinatorExternalStateImpl::killAllUserOperations(OperationContext* txn) {
- GlobalEnvironmentExperiment* environment = getGlobalEnvironment();
+ ServiceContext* environment = getGlobalServiceContext();
environment->killAllUserOperations(txn);
}
@@ -257,7 +257,7 @@ namespace {
void ReplicationCoordinatorExternalStateImpl::dropAllTempCollections(OperationContext* txn) {
std::vector<std::string> dbNames;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases(&dbNames);
for (std::vector<std::string>::iterator it = dbNames.begin(); it != dbNames.end(); ++it) {
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h
index 210d4224012..a66043ac23e 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.h
+++ b/src/mongo/db/repl/replication_coordinator_impl.h
@@ -36,7 +36,7 @@
#include "mongo/base/status.h"
#include "mongo/bson/optime.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/repl/member_state.h"
#include "mongo/db/repl/replica_set_config.h"
#include "mongo/db/repl/replication_coordinator.h"
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp
index 9514c25218a..a86ee0e1379 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/replset_commands.cpp
@@ -39,7 +39,7 @@
#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/commands.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/repl/initial_sync.h"
#include "mongo/db/repl/oplog.h"
@@ -401,7 +401,7 @@ namespace {
WriteUnitOfWork wuow(txn);
if (status.isOK() && !parsedArgs.force) {
- getGlobalEnvironment()->getOpObserver()->onOpMessage(
+ getGlobalServiceContext()->getOpObserver()->onOpMessage(
txn,
BSON("msg" << "Reconfig set" <<
"version" << parsedArgs.newConfigObj["version"]));
@@ -634,7 +634,7 @@ namespace {
*/
bool replHasDatabases(OperationContext* txn) {
std::vector<string> names;
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
storageEngine->listDatabases(&names);
if( names.size() >= 2 ) return true;
diff --git a/src/mongo/db/repl/rs_initialsync.cpp b/src/mongo/db/repl/rs_initialsync.cpp
index cb4ea34f966..be6525bd850 100644
--- a/src/mongo/db/repl/rs_initialsync.cpp
+++ b/src/mongo/db/repl/rs_initialsync.cpp
@@ -41,7 +41,7 @@
#include "mongo/db/cloner.h"
#include "mongo/db/db_raii.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/operation_context_impl.h"
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 5ea3e2e8c25..2a3e299a62c 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -46,7 +46,7 @@
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/curop.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/prefetch.h"
#include "mongo/db/repl/bgsync.h"
@@ -267,7 +267,7 @@ namespace repl {
// Doles out all the work to the writer pool threads and waits for them to complete
OpTime SyncTail::multiApply(OperationContext* txn, std::deque<BSONObj>& ops) {
- if (getGlobalEnvironment()->getGlobalStorageEngine()->isMmapV1()) {
+ if (getGlobalServiceContext()->getGlobalStorageEngine()->isMmapV1()) {
// Use a ThreadPool to prefetch all the operations in a batch.
prefetchOps(ops);
}
@@ -338,7 +338,7 @@ namespace repl {
*mustAwaitCommit = true;
}
- if (getGlobalEnvironment()->getGlobalStorageEngine()->supportsDocLocking() &&
+ if (getGlobalServiceContext()->getGlobalStorageEngine()->supportsDocLocking() &&
isCrudOpType(opType)) {
BSONElement id;
switch (opType[0]) {
diff --git a/src/mongo/db/global_environment_experiment.cpp b/src/mongo/db/service_context.cpp
index 8981a4104a2..64e24d33a27 100644
--- a/src/mongo/db/global_environment_experiment.cpp
+++ b/src/mongo/db/service_context.cpp
@@ -28,7 +28,7 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/bson/bsonobj.h"
#include "mongo/db/operation_context.h"
@@ -39,25 +39,23 @@ namespace mongo {
namespace {
- GlobalEnvironmentExperiment* globalEnvironmentExperiment = NULL;
+ ServiceContext* globalServiceContext = NULL;
} // namespace
- bool hasGlobalEnvironment() { return globalEnvironmentExperiment; }
+ bool hasGlobalServiceContext() { return globalServiceContext; }
- GlobalEnvironmentExperiment* getGlobalEnvironment() {
- fassert(17508, globalEnvironmentExperiment);
- return globalEnvironmentExperiment;
+ ServiceContext* getGlobalServiceContext() {
+ fassert(17508, globalServiceContext);
+ return globalServiceContext;
}
- void setGlobalEnvironment(GlobalEnvironmentExperiment* newGlobalEnvironment) {
- fassert(17509, newGlobalEnvironment);
+ void setGlobalServiceContext(std::unique_ptr<ServiceContext>&& serviceContext) {
+ fassert(17509, serviceContext.get());
- if (NULL != globalEnvironmentExperiment) {
- delete globalEnvironmentExperiment;
- }
+ delete globalServiceContext;
- globalEnvironmentExperiment = newGlobalEnvironment;
+ globalServiceContext = serviceContext.release();
}
bool _supportsDocLocking = false;
@@ -67,8 +65,7 @@ namespace mongo {
}
bool isMMAPV1() {
- invariant(hasGlobalEnvironment());
- StorageEngine* globalStorageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* globalStorageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
invariant(globalStorageEngine);
return globalStorageEngine->isMmapV1();
@@ -87,7 +84,7 @@ namespace mongo {
<< "' has to be an embedded document.");
}
- boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalEnvironment()->
+ boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalServiceContext()->
makeStorageFactoriesIterator());
invariant(sfi);
bool found = false;
diff --git a/src/mongo/db/global_environment_experiment.h b/src/mongo/db/service_context.h
index 3c72a235aff..429327dc718 100644
--- a/src/mongo/db/global_environment_experiment.h
+++ b/src/mongo/db/service_context.h
@@ -67,10 +67,10 @@ namespace mongo {
StorageFactoriesIterator() { }
};
- class GlobalEnvironmentExperiment {
- MONGO_DISALLOW_COPYING(GlobalEnvironmentExperiment);
+ class ServiceContext {
+ MONGO_DISALLOW_COPYING(ServiceContext);
public:
- virtual ~GlobalEnvironmentExperiment() { }
+ virtual ~ServiceContext() { }
//
// Storage
@@ -149,7 +149,7 @@ namespace mongo {
* Registers a listener to be notified each time an op is killed.
*
* listener does not become owned by the environment. As there is currently no way to
- * unregister, the listener object must outlive this GlobalEnvironmentExperiment object.
+ * unregister, the listener object must outlive this ServiceContext object.
*/
virtual void registerKillOpListener(KillOpListenerInterface* listener) = 0;
@@ -173,30 +173,30 @@ namespace mongo {
virtual OpObserver* getOpObserver() = 0;
protected:
- GlobalEnvironmentExperiment() { }
+ ServiceContext() { }
};
/**
- * Returns true if there is a globalEnvironment.
+ * Returns true if there is a global ServiceContext.
*/
- bool hasGlobalEnvironment();
+ bool hasGlobalServiceContext();
/**
- * Returns the singleton GlobalEnvironmentExperiment for this server process.
+ * Returns the singleton ServiceContext for this server process.
*
- * Fatal if there is currently no globalEnvironment.
+ * Fatal if there is currently no global ServiceContext.
*
* Caller does not own pointer.
*/
- GlobalEnvironmentExperiment* getGlobalEnvironment();
+ ServiceContext* getGlobalServiceContext();
/**
- * Sets the GlobalEnvironmentExperiment. If 'globalEnvironment' is NULL, un-sets and deletes
- * the current GlobalEnvironmentExperiment.
+ * Sets the global ServiceContext. If 'serviceContext' is NULL, un-sets and deletes
+ * the current global ServiceContext.
*
- * Takes ownership of 'globalEnvironment'.
+ * Takes ownership of 'serviceContext'.
*/
- void setGlobalEnvironment(GlobalEnvironmentExperiment* globalEnvironment);
+ void setGlobalServiceContext(std::unique_ptr<ServiceContext>&& serviceContext);
/**
* Shortcut for querying the storage engine about whether it supports document-level locking.
diff --git a/src/mongo/db/global_environment_d.cpp b/src/mongo/db/service_context_d.cpp
index 3cb18d9a3fe..4c3d30032df 100644
--- a/src/mongo/db/global_environment_d.cpp
+++ b/src/mongo/db/service_context_d.cpp
@@ -28,7 +28,7 @@
#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kDefault
-#include "mongo/db/global_environment_d.h"
+#include "mongo/db/service_context_d.h"
#include "mongo/base/init.h"
#include "mongo/base/initializer.h"
@@ -41,6 +41,7 @@
#include "mongo/db/storage/storage_engine_metadata.h"
#include "mongo/db/storage_options.h"
#include "mongo/scripting/engine.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/scopeguard.h"
@@ -48,19 +49,19 @@
namespace mongo {
MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
- setGlobalEnvironment(new GlobalEnvironmentMongoD());
+ setGlobalServiceContext(stdx::make_unique<ServiceContextMongoD>());
return Status::OK();
}
- GlobalEnvironmentMongoD::GlobalEnvironmentMongoD()
+ ServiceContextMongoD::ServiceContextMongoD()
: _globalKill(false),
_storageEngine(NULL) { }
- GlobalEnvironmentMongoD::~GlobalEnvironmentMongoD() {
+ ServiceContextMongoD::~ServiceContextMongoD() {
}
- StorageEngine* GlobalEnvironmentMongoD::getGlobalStorageEngine() {
+ StorageEngine* ServiceContextMongoD::getGlobalStorageEngine() {
// We don't check that globalStorageEngine is not-NULL here intentionally. We can encounter
// an error before it's initialized and proceed to exitCleanly which is equipped to deal
// with a NULL storage engine.
@@ -69,7 +70,7 @@ namespace mongo {
extern bool _supportsDocLocking;
- void GlobalEnvironmentMongoD::setGlobalStorageEngine(const std::string& name) {
+ void ServiceContextMongoD::setGlobalStorageEngine(const std::string& name) {
// This should be set once.
invariant(!_storageEngine);
@@ -123,15 +124,15 @@ namespace mongo {
_supportsDocLocking = _storageEngine->supportsDocLocking();
}
- void GlobalEnvironmentMongoD::shutdownGlobalStorageEngineCleanly() {
+ void ServiceContextMongoD::shutdownGlobalStorageEngineCleanly() {
invariant(_storageEngine);
invariant(_lockFile.get());
_storageEngine->cleanShutdown();
_lockFile->clearPidAndUnlock();
}
- void GlobalEnvironmentMongoD::registerStorageEngine(const std::string& name,
- const StorageEngine::Factory* factory) {
+ void ServiceContextMongoD::registerStorageEngine(const std::string& name,
+ const StorageEngine::Factory* factory) {
// No double-registering.
invariant(0 == _storageFactories.count(name));
@@ -144,18 +145,18 @@ namespace mongo {
_storageFactories[name] = factory;
}
- bool GlobalEnvironmentMongoD::isRegisteredStorageEngine(const std::string& name) {
+ bool ServiceContextMongoD::isRegisteredStorageEngine(const std::string& name) {
return _storageFactories.count(name);
}
- StorageFactoriesIterator* GlobalEnvironmentMongoD::makeStorageFactoriesIterator() {
+ StorageFactoriesIterator* ServiceContextMongoD::makeStorageFactoriesIterator() {
return new StorageFactoriesIteratorMongoD(_storageFactories.begin(),
_storageFactories.end());
}
StorageFactoriesIteratorMongoD::StorageFactoriesIteratorMongoD(
- const GlobalEnvironmentMongoD::FactoryMap::const_iterator& begin,
- const GlobalEnvironmentMongoD::FactoryMap::const_iterator& end) :
+ const ServiceContextMongoD::FactoryMap::const_iterator& begin,
+ const ServiceContextMongoD::FactoryMap::const_iterator& end) :
_curr(begin), _end(end) {
}
@@ -167,7 +168,7 @@ namespace mongo {
return _curr++->second;
}
- void GlobalEnvironmentMongoD::setKillAllOperations() {
+ void ServiceContextMongoD::setKillAllOperations() {
boost::lock_guard<boost::mutex> clientLock(Client::clientsMutex);
_globalKill = true;
for (size_t i = 0; i < _killOpListeners.size(); i++) {
@@ -180,11 +181,11 @@ namespace mongo {
}
}
- bool GlobalEnvironmentMongoD::getKillAllOperations() {
+ bool ServiceContextMongoD::getKillAllOperations() {
return _globalKill;
}
- bool GlobalEnvironmentMongoD::_killOperationsAssociatedWithClientAndOpId_inlock(
+ bool ServiceContextMongoD::_killOperationsAssociatedWithClientAndOpId_inlock(
Client* client, unsigned int opId) {
for( CurOp *k = client->curop(); k; k = k->parent() ) {
if ( k->opNum() != opId )
@@ -208,7 +209,7 @@ namespace mongo {
return false;
}
- bool GlobalEnvironmentMongoD::killOperation(unsigned int opId) {
+ bool ServiceContextMongoD::killOperation(unsigned int opId) {
boost::lock_guard<boost::mutex> clientLock(Client::clientsMutex);
for(ClientSet::const_iterator j = Client::clients.begin();
@@ -225,7 +226,7 @@ namespace mongo {
return false;
}
- void GlobalEnvironmentMongoD::killAllUserOperations(const OperationContext* txn) {
+ void ServiceContextMongoD::killAllUserOperations(const OperationContext* txn) {
boost::lock_guard<boost::mutex> scopedLock(Client::clientsMutex);
for (ClientSet::const_iterator i = Client::clients.begin();
i != Client::clients.end(); i++) {
@@ -250,24 +251,24 @@ namespace mongo {
}
}
- void GlobalEnvironmentMongoD::unsetKillAllOperations() {
+ void ServiceContextMongoD::unsetKillAllOperations() {
_globalKill = false;
}
- void GlobalEnvironmentMongoD::registerKillOpListener(KillOpListenerInterface* listener) {
+ void ServiceContextMongoD::registerKillOpListener(KillOpListenerInterface* listener) {
boost::lock_guard<boost::mutex> clientLock(Client::clientsMutex);
_killOpListeners.push_back(listener);
}
- OperationContext* GlobalEnvironmentMongoD::newOpCtx() {
+ OperationContext* ServiceContextMongoD::newOpCtx() {
return new OperationContextImpl();
}
- void GlobalEnvironmentMongoD::setOpObserver(std::unique_ptr<OpObserver> opObserver) {
+ void ServiceContextMongoD::setOpObserver(std::unique_ptr<OpObserver> opObserver) {
_opObserver.reset(opObserver.get());
}
- OpObserver* GlobalEnvironmentMongoD::getOpObserver() {
+ OpObserver* ServiceContextMongoD::getOpObserver() {
return _opObserver.get();
}
diff --git a/src/mongo/db/global_environment_d.h b/src/mongo/db/service_context_d.h
index 6c94098b03d..cae5841ee7a 100644
--- a/src/mongo/db/global_environment_d.h
+++ b/src/mongo/db/service_context_d.h
@@ -31,7 +31,7 @@
#include <boost/scoped_ptr.hpp>
#include <vector>
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/util/concurrency/mutex.h"
@@ -40,13 +40,13 @@ namespace mongo {
class Client;
class StorageEngineLockFile;
- class GlobalEnvironmentMongoD : public GlobalEnvironmentExperiment {
+ class ServiceContextMongoD : public ServiceContext {
public:
typedef std::map<std::string, const StorageEngine::Factory*> FactoryMap;
- GlobalEnvironmentMongoD();
+ ServiceContextMongoD();
- ~GlobalEnvironmentMongoD();
+ ~ServiceContextMongoD();
StorageEngine* getGlobalStorageEngine();
@@ -103,7 +103,7 @@ namespace mongo {
class StorageFactoriesIteratorMongoD : public StorageFactoriesIterator {
public:
- typedef GlobalEnvironmentMongoD::FactoryMap::const_iterator FactoryMapIterator;
+ typedef ServiceContextMongoD::FactoryMap::const_iterator FactoryMapIterator;
StorageFactoriesIteratorMongoD(const FactoryMapIterator& begin,
const FactoryMapIterator& end);
diff --git a/src/mongo/db/global_environment_noop.cpp b/src/mongo/db/service_context_noop.cpp
index 2170420a00e..8b43c4e1bbf 100644
--- a/src/mongo/db/global_environment_noop.cpp
+++ b/src/mongo/db/service_context_noop.cpp
@@ -28,34 +28,34 @@
#include "mongo/platform/basic.h"
-#include "mongo/db/global_environment_noop.h"
+#include "mongo/db/service_context_noop.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/op_observer.h"
namespace mongo {
- StorageEngine* GlobalEnvironmentNoop::getGlobalStorageEngine() {
+ StorageEngine* ServiceContextNoop::getGlobalStorageEngine() {
return NULL;
}
- void GlobalEnvironmentNoop::setGlobalStorageEngine(const std::string& name) {
+ void ServiceContextNoop::setGlobalStorageEngine(const std::string& name) {
}
- void GlobalEnvironmentNoop::shutdownGlobalStorageEngineCleanly() {
+ void ServiceContextNoop::shutdownGlobalStorageEngineCleanly() {
}
- void GlobalEnvironmentNoop::registerStorageEngine(const std::string& name,
- const StorageEngine::Factory* factory) {
+ void ServiceContextNoop::registerStorageEngine(const std::string& name,
+ const StorageEngine::Factory* factory) {
// Takes ownership of 'factory' and deletes it because we don't need it.
delete factory;
}
- bool GlobalEnvironmentNoop::isRegisteredStorageEngine(const std::string& name) {
+ bool ServiceContextNoop::isRegisteredStorageEngine(const std::string& name) {
return false;
}
- StorageFactoriesIterator* GlobalEnvironmentNoop::makeStorageFactoriesIterator() {
+ StorageFactoriesIterator* ServiceContextNoop::makeStorageFactoriesIterator() {
class EmptySFI : public StorageFactoriesIterator {
public:
virtual bool more() const { return false; }
@@ -64,31 +64,31 @@ namespace mongo {
return new EmptySFI();
}
- void GlobalEnvironmentNoop::setKillAllOperations() { }
+ void ServiceContextNoop::setKillAllOperations() { }
- void GlobalEnvironmentNoop::unsetKillAllOperations() { }
+ void ServiceContextNoop::unsetKillAllOperations() { }
- bool GlobalEnvironmentNoop::getKillAllOperations() {
+ bool ServiceContextNoop::getKillAllOperations() {
return false;
}
- bool GlobalEnvironmentNoop::killOperation(unsigned int opId) {
+ bool ServiceContextNoop::killOperation(unsigned int opId) {
return false;
}
- void GlobalEnvironmentNoop::killAllUserOperations(const OperationContext* txn) {}
+ void ServiceContextNoop::killAllUserOperations(const OperationContext* txn) {}
- void GlobalEnvironmentNoop::registerKillOpListener(KillOpListenerInterface* listener) {
+ void ServiceContextNoop::registerKillOpListener(KillOpListenerInterface* listener) {
}
- OperationContext* GlobalEnvironmentNoop::newOpCtx() {
+ OperationContext* ServiceContextNoop::newOpCtx() {
return new OperationContextNoop();
}
- void GlobalEnvironmentNoop::setOpObserver(std::unique_ptr<OpObserver> opObserver) {
+ void ServiceContextNoop::setOpObserver(std::unique_ptr<OpObserver> opObserver) {
}
- OpObserver* GlobalEnvironmentNoop::getOpObserver() {
+ OpObserver* ServiceContextNoop::getOpObserver() {
return nullptr;
}
} // namespace mongo
diff --git a/src/mongo/db/global_environment_noop.h b/src/mongo/db/service_context_noop.h
index dc946f28b7d..679b683bb74 100644
--- a/src/mongo/db/global_environment_noop.h
+++ b/src/mongo/db/service_context_noop.h
@@ -26,11 +26,11 @@
* it in the license file.
*/
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
namespace mongo {
- class GlobalEnvironmentNoop : public GlobalEnvironmentExperiment {
+ class ServiceContextNoop : public ServiceContext {
public:
StorageEngine* getGlobalStorageEngine();
diff --git a/src/mongo/db/storage/devnull/devnull_init.cpp b/src/mongo/db/storage/devnull/devnull_init.cpp
index 604df977d94..ad22a5ca25e 100644
--- a/src/mongo/db/storage/devnull/devnull_init.cpp
+++ b/src/mongo/db/storage/devnull/devnull_init.cpp
@@ -30,8 +30,8 @@
*/
#include "mongo/base/init.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/devnull/devnull_kv_engine.h"
#include "mongo/db/storage/kv/kv_storage_engine.h"
#include "mongo/db/storage_options.h"
@@ -67,7 +67,7 @@ namespace mongo {
MONGO_INITIALIZER_WITH_PREREQUISITES(DevNullEngineInit,
("SetGlobalEnvironment"))
(InitializerContext* context ) {
- getGlobalEnvironment()->registerStorageEngine("devnull", new DevNullStorageEngineFactory() );
+ getGlobalServiceContext()->registerStorageEngine("devnull", new DevNullStorageEngineFactory() );
return Status::OK();
}
diff --git a/src/mongo/db/storage/in_memory/in_memory_init.cpp b/src/mongo/db/storage/in_memory/in_memory_init.cpp
index 639c017dee1..bca7d60ef6c 100644
--- a/src/mongo/db/storage/in_memory/in_memory_init.cpp
+++ b/src/mongo/db/storage/in_memory/in_memory_init.cpp
@@ -30,7 +30,7 @@
*/
#include "mongo/base/init.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/in_memory/in_memory_engine.h"
#include "mongo/db/storage/kv/kv_storage_engine.h"
#include "mongo/db/storage_options.h"
@@ -70,7 +70,7 @@ namespace mongo {
("SetGlobalEnvironment"))
(InitializerContext* context) {
- getGlobalEnvironment()->registerStorageEngine("inMemoryExperiment", new InMemoryFactory());
+ getGlobalServiceContext()->registerStorageEngine("inMemoryExperiment", new InMemoryFactory());
return Status::OK();
}
diff --git a/src/mongo/db/storage/kv/kv_database_catalog_entry_test.cpp b/src/mongo/db/storage/kv/kv_database_catalog_entry_test.cpp
index 2408106144c..9a7eb87f0fb 100644
--- a/src/mongo/db/storage/kv/kv_database_catalog_entry_test.cpp
+++ b/src/mongo/db/storage/kv/kv_database_catalog_entry_test.cpp
@@ -32,11 +32,12 @@
#include "mongo/base/init.h"
#include "mongo/db/catalog/collection_options.h"
-#include "mongo/db/global_environment_experiment.h"
-#include "mongo/db/global_environment_noop.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_noop.h"
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/storage/devnull/devnull_kv_engine.h"
#include "mongo/db/storage/kv/kv_storage_engine.h"
+#include "mongo/stdx/memory.h"
#include "mongo/unittest/unittest.h"
namespace {
@@ -44,7 +45,7 @@ namespace {
using namespace mongo;
MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
- setGlobalEnvironment(new GlobalEnvironmentNoop());
+ setGlobalServiceContext(stdx::make_unique<ServiceContextNoop>());
return Status::OK();
}
diff --git a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
index 3ba0dc7dc6f..cf1d1abca88 100644
--- a/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file_sync.cpp
@@ -33,7 +33,7 @@
#include "mongo/db/storage/mmap_v1/data_file_sync.h"
#include "mongo/db/commands/server_status_metric.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/instance.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_options.h"
#include "mongo/db/storage_options.h"
@@ -84,7 +84,7 @@ namespace mongo {
}
Date_t start = jsTime();
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
int numFiles = storageEngine->flushAllFiles( true );
time_flushing = (int) (jsTime() - start);
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
index cb481ec9835..17a72099531 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_extent_manager.cpp
@@ -37,7 +37,7 @@
#include "mongo/base/counter.h"
#include "mongo/db/audit.h"
#include "mongo/db/client.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/storage/mmap_v1/data_file.h"
#include "mongo/db/storage/mmap_v1/record.h"
@@ -114,7 +114,7 @@ namespace mongo {
_path(path.toString()),
_directoryPerDB(directoryPerDB),
_rid(RESOURCE_METADATA, dbname) {
- StorageEngine* engine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* engine = getGlobalServiceContext()->getGlobalStorageEngine();
invariant(engine->isMmapV1());
MMAPV1Engine* mmapEngine = static_cast<MMAPV1Engine*>(engine);
_recordAccessTracker = &mmapEngine->getRecordAccessTracker();
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp
index c16bf35cd1b..29fb1bc8c97 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_init.cpp
@@ -31,7 +31,7 @@
#include "mongo/base/init.h"
#include "mongo/bson/bsonobjbuilder.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/mmap_v1/mmap_v1_engine.h"
#include "mongo/db/storage/storage_engine_metadata.h"
#include "mongo/db/storage_options.h"
@@ -76,7 +76,7 @@ namespace mongo {
("SetGlobalEnvironment"))
(InitializerContext* context) {
- getGlobalEnvironment()->registerStorageEngine("mmapv1", new MMAPV1Factory());
+ getGlobalServiceContext()->registerStorageEngine("mmapv1", new MMAPV1Factory());
return Status::OK();
}
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp
index 6d490be951e..2fb752eab8e 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_init_test.cpp
@@ -30,7 +30,7 @@
#include <boost/scoped_ptr.hpp>
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/json.h"
#include "mongo/db/storage/storage_engine_metadata.h"
#include "mongo/db/storage_options.h"
@@ -44,10 +44,10 @@ namespace {
class MMAPV1FactoryTest : public mongo::unittest::Test {
private:
virtual void setUp() {
- GlobalEnvironmentExperiment* globalEnv = getGlobalEnvironment();
+ ServiceContext* globalEnv = getGlobalServiceContext();
ASSERT_TRUE(globalEnv);
- ASSERT_TRUE(getGlobalEnvironment()->isRegisteredStorageEngine("mmapv1"));
- boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalEnvironment()->
+ ASSERT_TRUE(getGlobalServiceContext()->isRegisteredStorageEngine("mmapv1"));
+ boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalServiceContext()->
makeStorageFactoriesIterator());
ASSERT_TRUE(sfi);
bool found = false;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
index 148df9d9696..59391adf8b2 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init.cpp
@@ -33,8 +33,8 @@
#include "mongo/base/init.h"
#include "mongo/db/catalog/collection_options.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/storage/kv/kv_storage_engine.h"
#include "mongo/db/storage/storage_engine_lock_file.h"
@@ -121,7 +121,7 @@ namespace mongo {
("SetGlobalEnvironment"))
(InitializerContext* context ) {
- getGlobalEnvironment()->registerStorageEngine(kWiredTigerEngineName,
+ getGlobalServiceContext()->registerStorageEngine(kWiredTigerEngineName,
new WiredTigerFactory());
return Status::OK();
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp
index 358397a5176..767e23d6c37 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_init_test.cpp
@@ -30,7 +30,7 @@
#include <boost/scoped_ptr.hpp>
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/json.h"
#include "mongo/db/storage/storage_engine_metadata.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_global_options.h"
@@ -46,10 +46,10 @@ namespace {
class WiredTigerFactoryTest : public mongo::unittest::Test {
private:
virtual void setUp() {
- GlobalEnvironmentExperiment* globalEnv = getGlobalEnvironment();
+ ServiceContext* globalEnv = getGlobalServiceContext();
ASSERT_TRUE(globalEnv);
- ASSERT_TRUE(getGlobalEnvironment()->isRegisteredStorageEngine(kWiredTigerEngineName));
- boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalEnvironment()->
+ ASSERT_TRUE(getGlobalServiceContext()->isRegisteredStorageEngine(kWiredTigerEngineName));
+ boost::scoped_ptr<StorageFactoriesIterator> sfi(getGlobalServiceContext()->
makeStorageFactoriesIterator());
ASSERT_TRUE(sfi);
bool found = false;
diff --git a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
index dc9b5fc1e52..a8681ff2b61 100644
--- a/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
+++ b/src/mongo/db/storage/wiredtiger/wiredtiger_record_store_mongod.cpp
@@ -40,7 +40,7 @@
#include "mongo/db/client.h"
#include "mongo/db/concurrency/d_concurrency.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/wiredtiger/wiredtiger_kv_engine.h"
@@ -72,7 +72,7 @@ namespace mongo {
* @return Number of documents deleted.
*/
int64_t _deleteExcessDocuments() {
- if (!getGlobalEnvironment()->getGlobalStorageEngine()) {
+ if (!getGlobalServiceContext()->getGlobalStorageEngine()) {
LOG(1) << "no global storage engine yet";
return 0;
}
diff --git a/src/mongo/db/write_concern.cpp b/src/mongo/db/write_concern.cpp
index a19629e96c9..8b1b7334813 100644
--- a/src/mongo/db/write_concern.cpp
+++ b/src/mongo/db/write_concern.cpp
@@ -33,7 +33,7 @@
#include "mongo/base/counter.h"
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/commands/server_status_metric.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/server_options.h"
@@ -104,7 +104,7 @@ namespace mongo {
}
Status validateWriteConcern( const WriteConcernOptions& writeConcern ) {
- const bool isJournalEnabled = getGlobalEnvironment()->getGlobalStorageEngine()->isDurable();
+ const bool isJournalEnabled = getGlobalServiceContext()->getGlobalStorageEngine()->isDurable();
if ( writeConcern.syncMode == WriteConcernOptions::JOURNAL && !isJournalEnabled ) {
return Status( ErrorCodes::BadValue,
@@ -207,7 +207,7 @@ namespace mongo {
case WriteConcernOptions::NONE:
break;
case WriteConcernOptions::FSYNC: {
- StorageEngine* storageEngine = getGlobalEnvironment()->getGlobalStorageEngine();
+ StorageEngine* storageEngine = getGlobalServiceContext()->getGlobalStorageEngine();
if ( !storageEngine->isDurable() ) {
result->fsyncFiles = storageEngine->flushAllFiles( true );
}
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 21d502f340b..52386fb7e83 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -40,11 +40,12 @@
#include "mongo/db/catalog/index_create.h"
#include "mongo/db/commands.h"
#include "mongo/db/db_raii.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/repl/replication_coordinator_global.h"
#include "mongo/db/repl/replication_coordinator_mock.h"
#include "mongo/dbtests/framework.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/quick_exit.h"
#include "mongo/util/signal_handlers_synchronous.h"
#include "mongo/util/startup_test.h"
@@ -104,7 +105,7 @@ namespace dbtests {
int dbtestsMain( int argc, char** argv, char** envp ) {
static StaticObserver StaticObserver;
::mongo::setupSynchronousSignalHandlers();
- setGlobalEnvironment(new GlobalEnvironmentMongoD());
+ setGlobalServiceContext(stdx::make_unique<ServiceContextMongoD>());
repl::ReplSettings replSettings;
replSettings.oplogSize = 10 * 1024 * 1024;
repl::setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorMock(replSettings));
diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp
index d05abef5323..a22187460be 100644
--- a/src/mongo/dbtests/executor_registry.cpp
+++ b/src/mongo/dbtests/executor_registry.cpp
@@ -38,7 +38,7 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/exec/collection_scan.h"
#include "mongo/db/exec/plan_stage.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/db/operation_context_impl.h"
diff --git a/src/mongo/dbtests/framework.cpp b/src/mongo/dbtests/framework.cpp
index 7054e70e503..04852b76037 100644
--- a/src/mongo/dbtests/framework.cpp
+++ b/src/mongo/dbtests/framework.cpp
@@ -41,8 +41,8 @@
#include "mongo/base/status.h"
#include "mongo/db/client.h"
#include "mongo/db/concurrency/lock_state.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/ops/update.h"
#include "mongo/dbtests/dbtests.h"
#include "mongo/dbtests/framework_options.h"
@@ -118,7 +118,7 @@ namespace mongo {
printOpenSSLVersion();
printSysInfo();
- getGlobalEnvironment()->setGlobalStorageEngine(storageGlobalParams.engine);
+ getGlobalServiceContext()->setGlobalStorageEngine(storageGlobalParams.engine);
TestWatchDog twd;
twd.go();
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index cf92968a55a..cf01a43a9b1 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -36,8 +36,8 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/dbtests/dbtests.h"
@@ -64,7 +64,7 @@ namespace IndexUpdateTests {
}
~IndexBuildBase() {
_client.dropCollection( _ns );
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
}
Collection* collection() {
return _ctx.getCollection();
@@ -485,12 +485,12 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "a" << 1 ) << "ns" << _ns << "name" << "a_1" );
// The call is interrupted because mayInterrupt == true.
ASSERT_TRUE(buildIndexInterrupted(indexInfo, true));
// only want to interrupt the index build
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// The new index is not listed in the index catalog because the index build failed.
ASSERT( !coll->getIndexCatalog()->findIndexByName( &_txn, "a_1" ) );
}
@@ -518,12 +518,12 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "a" << 1 ) << "ns" << _ns << "name" << "a_1" );
// The call is not interrupted because mayInterrupt == false.
ASSERT_FALSE(buildIndexInterrupted(indexInfo, false));
// only want to interrupt the index build
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// The new index is listed in the index catalog because the index build completed.
ASSERT( coll->getIndexCatalog()->findIndexByName( &_txn, "a_1" ) );
}
@@ -554,14 +554,14 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "_id" << 1 ) <<
"ns" << _ns <<
"name" << "_id_" );
// The call is interrupted because mayInterrupt == true.
ASSERT_TRUE(buildIndexInterrupted(indexInfo, true));
// only want to interrupt the index build
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// The new index is not listed in the index catalog because the index build failed.
ASSERT( !coll->getIndexCatalog()->findIndexByName( &_txn, "_id_" ) );
}
@@ -592,14 +592,14 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "_id" << 1 ) <<
"ns" << _ns <<
"name" << "_id_" );
// The call is not interrupted because mayInterrupt == false.
ASSERT_FALSE(buildIndexInterrupted(indexInfo, false));
// only want to interrupt the index build
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// The new index is listed in the index catalog because the index build succeeded.
ASSERT( coll->getIndexCatalog()->findIndexByName( &_txn, "_id_" ) );
}
@@ -619,11 +619,11 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
// The call is not interrupted.
Helpers::ensureIndex( &_txn, collection(), BSON( "a" << 1 ), false, "a_1" );
// only want to interrupt the index build
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// The new index is listed in getIndexSpecs because the index build completed.
ASSERT_EQUALS( 2U, _client.getIndexSpecs(_ns).size());
}
@@ -867,7 +867,7 @@ namespace IndexUpdateTests {
const std::string storageEngineName = "wiredTiger";
// Run 'wiredTiger' tests if the storage engine is supported.
- if (getGlobalEnvironment()->isRegisteredStorageEngine(storageEngineName)) {
+ if (getGlobalServiceContext()->isRegisteredStorageEngine(storageEngineName)) {
// Every field under "storageEngine" has to be an object.
ASSERT_NOT_OK(createIndex("unittest", _createSpec(BSON(storageEngineName << 1))));
diff --git a/src/mongo/dbtests/mmaptests.cpp b/src/mongo/dbtests/mmaptests.cpp
index 6f2cad63043..1c699360177 100644
--- a/src/mongo/dbtests/mmaptests.cpp
+++ b/src/mongo/dbtests/mmaptests.cpp
@@ -34,7 +34,7 @@
#include <iostream>
#include "mongo/db/concurrency/lock_state.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/storage/mmap_v1/data_file.h"
#include "mongo/db/storage/mmap_v1/durable_mapped_file.h"
#include "mongo/db/storage/mmap_v1/extent.h"
@@ -180,7 +180,7 @@ namespace MMapTests {
public:
All() : Suite( "mmap" ) {}
void setupTests() {
- if (!getGlobalEnvironment()->getGlobalStorageEngine()->isMmapV1())
+ if (!getGlobalServiceContext()->getGlobalStorageEngine()->isMmapV1())
return;
add< LeakTest >();
diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp
index 745bcfd3a01..98505db31dd 100644
--- a/src/mongo/dbtests/oplogstarttests.cpp
+++ b/src/mongo/dbtests/oplogstarttests.cpp
@@ -30,7 +30,7 @@
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/exec/oplogstart.h"
#include "mongo/db/exec/working_set.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/query/canonical_query.h"
#include "mongo/db/repl/repl_settings.h"
@@ -366,7 +366,7 @@ namespace OplogStartTests {
// These tests rely on extent allocation details specific to mmapv1.
// TODO figure out a way to generically test this.
- if (getGlobalEnvironment()->getGlobalStorageEngine()->isMmapV1()) {
+ if (getGlobalServiceContext()->getGlobalStorageEngine()->isMmapV1()) {
add< OplogStartIsNewestExtentHop >();
add< OplogStartOneEmptyExtent >();
add< OplogStartTwoEmptyExtents >();
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index a860e6a9120..4ce39171757 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -38,8 +38,8 @@
#include "mongo/db/db_raii.h"
#include "mongo/db/dbdirectclient.h"
#include "mongo/db/dbhelpers.h"
-#include "mongo/db/global_environment_d.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context_d.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/global_optime.h"
#include "mongo/db/json.h"
#include "mongo/db/lasterror.h"
@@ -298,7 +298,7 @@ namespace QueryTests {
class GetMoreKillOp : public ClientBase {
public:
~GetMoreKillOp() {
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
_client.dropCollection( "unittests.querytests.GetMoreKillOp" );
}
void run() {
@@ -321,13 +321,13 @@ namespace QueryTests {
// Set the killop kill all flag, forcing the next get more to fail with a kill op
// exception.
- getGlobalEnvironment()->setKillAllOperations();
+ getGlobalServiceContext()->setKillAllOperations();
while( cursor->more() ) {
cursor->next();
}
// Revert the killop kill all flag.
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
// Check that the cursor has been removed.
{
@@ -350,7 +350,7 @@ namespace QueryTests {
class GetMoreInvalidRequest : public ClientBase {
public:
~GetMoreInvalidRequest() {
- getGlobalEnvironment()->unsetKillAllOperations();
+ getGlobalServiceContext()->unsetKillAllOperations();
_client.dropCollection( "unittests.querytests.GetMoreInvalidRequest" );
}
void run() {
diff --git a/src/mongo/s/d_migrate.cpp b/src/mongo/s/d_migrate.cpp
index 80bbb875304..9138dc201fc 100644
--- a/src/mongo/s/d_migrate.cpp
+++ b/src/mongo/s/d_migrate.cpp
@@ -61,7 +61,7 @@
#include "mongo/db/dbhelpers.h"
#include "mongo/db/exec/plan_stage.h"
#include "mongo/db/field_parser.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/hasher.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/op_observer.h"
@@ -2060,7 +2060,7 @@ namespace mongo {
for (size_t i = 0; i < indexSpecs.size(); i++) {
// make sure to create index on secondaries as well
- getGlobalEnvironment()->getOpObserver()->onCreateIndex(
+ getGlobalServiceContext()->getOpObserver()->onCreateIndex(
txn,
db->getSystemIndexesName(),
indexSpecs[i],
diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp
index 18b7b5d156d..2f702bef0a3 100644
--- a/src/mongo/s/server.cpp
+++ b/src/mongo/s/server.cpp
@@ -51,8 +51,8 @@
#include "mongo/db/auth/user_cache_invalidator_job.h"
#include "mongo/db/client_basic.h"
#include "mongo/db/dbwebserver.h"
-#include "mongo/db/global_environment_experiment.h"
-#include "mongo/db/global_environment_noop.h"
+#include "mongo/db/service_context.h"
+#include "mongo/db/service_context_noop.h"
#include "mongo/db/initialize_server_global_state.h"
#include "mongo/db/instance.h"
#include "mongo/db/lasterror.h"
@@ -71,6 +71,7 @@
#include "mongo/s/request.h"
#include "mongo/s/version_mongos.h"
#include "mongo/scripting/engine.h"
+#include "mongo/stdx/memory.h"
#include "mongo/util/admin_access.h"
#include "mongo/util/cmdline_utils/censor_cmdline.h"
#include "mongo/util/concurrency/task.h"
@@ -412,7 +413,7 @@ MONGO_INITIALIZER_GENERAL(CreateAuthorizationManager,
}
MONGO_INITIALIZER(SetGlobalEnvironment)(InitializerContext* context) {
- setGlobalEnvironment(new GlobalEnvironmentNoop());
+ setGlobalServiceContext(stdx::make_unique<ServiceContextNoop>());
return Status::OK();
}
diff --git a/src/mongo/scripting/engine.cpp b/src/mongo/scripting/engine.cpp
index 3f56ee467b3..a3178880ea5 100644
--- a/src/mongo/scripting/engine.cpp
+++ b/src/mongo/scripting/engine.cpp
@@ -41,7 +41,7 @@
#include "mongo/client/dbclientcursor.h"
#include "mongo/client/dbclientinterface.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/util/file.h"
diff --git a/src/mongo/scripting/engine.h b/src/mongo/scripting/engine.h
index 17717455588..e970f82b4e7 100644
--- a/src/mongo/scripting/engine.h
+++ b/src/mongo/scripting/engine.h
@@ -29,7 +29,7 @@
#pragma once
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/jsobj.h"
#include "mongo/platform/atomic_word.h"
diff --git a/src/mongo/scripting/engine_v8-3.25.cpp b/src/mongo/scripting/engine_v8-3.25.cpp
index df5299f30ce..2e8142da771 100644
--- a/src/mongo/scripting/engine_v8-3.25.cpp
+++ b/src/mongo/scripting/engine_v8-3.25.cpp
@@ -34,7 +34,7 @@
#include <iostream>
#include "mongo/base/init.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/scripting/v8-3.25_db.h"
@@ -383,8 +383,8 @@ namespace mongo {
if (!globalScriptEngine) {
globalScriptEngine = new V8ScriptEngine();
- if (hasGlobalEnvironment()) {
- getGlobalEnvironment()->registerKillOpListener(globalScriptEngine);
+ if (hasGlobalServiceContext()) {
+ getGlobalServiceContext()->registerKillOpListener(globalScriptEngine);
}
}
}
diff --git a/src/mongo/scripting/engine_v8.cpp b/src/mongo/scripting/engine_v8.cpp
index 5c5f503f4c9..64386b0deaa 100644
--- a/src/mongo/scripting/engine_v8.cpp
+++ b/src/mongo/scripting/engine_v8.cpp
@@ -36,7 +36,7 @@
#include <iostream>
#include "mongo/base/init.h"
-#include "mongo/db/global_environment_experiment.h"
+#include "mongo/db/service_context.h"
#include "mongo/db/operation_context.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/scripting/v8_db.h"
@@ -362,8 +362,8 @@ namespace mongo {
if (!globalScriptEngine) {
globalScriptEngine = new V8ScriptEngine();
- if (hasGlobalEnvironment()) {
- getGlobalEnvironment()->registerKillOpListener(globalScriptEngine);
+ if (hasGlobalServiceContext()) {
+ getGlobalServiceContext()->registerKillOpListener(globalScriptEngine);
}
}
}
diff --git a/src/mongo/util/version_reporting.cpp b/src/mongo/util/version_reporting.cpp
index f0dadcaa7ce..1c4d219a054 100644
--- a/src/mongo/util/version_reporting.cpp
+++ b/src/mongo/util/version_reporting.cpp
@@ -39,14 +39,13 @@
#include "mongo/bson/bsonobjbuilder.h"
#include "mongo/config.h"
-#include "mongo/db/global_environment_experiment.h"
#include "mongo/db/jsobj.h"
+#include "mongo/db/service_context.h"
#include "mongo/util/debug_util.h"
#include "mongo/util/log.h"
#include "mongo/util/net/ssl_manager.h"
#include "mongo/util/version.h"
-
namespace mongo {
using std::endl;
@@ -66,11 +65,11 @@ namespace mongo {
}
BSONArray storageEngineList() {
- if (!hasGlobalEnvironment())
+ if (!hasGlobalServiceContext())
return BSONArray();
boost::scoped_ptr<StorageFactoriesIterator> sfi(
- getGlobalEnvironment()->makeStorageFactoriesIterator());
+ getGlobalServiceContext()->makeStorageFactoriesIterator());
if (!sfi)
return BSONArray();