summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2014-08-05 14:32:45 -0400
committerBenety Goh <benety@mongodb.com>2014-08-12 18:56:41 -0400
commita3845092f26955e6cbfca868fd136b7d5eefed9b (patch)
treedfb566b50a00b8c64002e6107d9fcbdb1443c6cf /src/mongo/db
parent0ea8cf462b48a1aeefb10fd4bba0b1e93b0e661e (diff)
downloadmongo-a3845092f26955e6cbfca868fd136b7d5eefed9b.tar.gz
SERVER-14729 logging cleanup - removed mongo/util/log.h from headers, de-inlining functions that use logging where applicable.
de-inlined BSONElement::_asCode() de-inlined BSONObjBuilder::appendDate() de-inlined DBClientCursor::nextSafe() de-inlined IndexDescriptor::_checkOk() de-inlined LastErrorHolder::getSafe() de-inlined UpdateResult constructor de-inlined QueryPlannerCommon::reverseScans() de-inlined repl::ScopedConn::connect() de-inlined repl::_MultiCommand::run() de-inlined OplogReader::tailCheck() de-inlined repl::StateBox::change() de-inlined repl::SyncSourceFeedback::_resetConnection() de-inlined DiskLoc56Bit::operator=() de-inlined DurableInterface::~DurableInterface() de-inlined ListeningSockets::closeAll() de-inlined RelativePath::fromFullPath() and getPartition() de-inlined V8Scope::checkV8ErrorState and removed debug log message from ObjTracker destructor (v8-3.25) de-inlined V8Scope::checkV8ErrorState and removed debug log message from ObjTracker destructor removed log message from List1::orphan() - this should have no user-facing impact because List1::orphan() is used in tests only removed log message from RWLockRecursiveNongreedy::Lock() removed log message from RSBase destructor removed log.h dependency from DESTRUCTOR_GUARD macro removed mongo/util/log.h dependency from qlog.h removed mongo/util/log.h dependency from stacktrace.h removed mongo/util/log.h dependency from s2 logging header removed mongo/util/log.h dependency from chunk_diff-inl.cpp removed mongo/util/log.h from pch.h removed unused mongo/util/log.h include from inlined file sorter.cpp convert HashTable<K,V> to non-template NamespaceHashTable. De-inlined NamespaceHashTable::_find() and constructor convert isself getMyAddrs()and getallIPs() debug log to use LOG() macro assign default log component MONGO_LOG_DEFAULT_COMPONENT removed unused macros LOGATMOST and LOGSOME removed unused FLOG() macro from goodies.h
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_local.cpp1
-rw-r--r--src/mongo/db/auth/authz_manager_external_state_s.cpp1
-rw-r--r--src/mongo/db/auth/authz_session_external_state_server_common.cpp1
-rw-r--r--src/mongo/db/auth/security_key.cpp1
-rw-r--r--src/mongo/db/auth/user_document_parser.cpp1
-rw-r--r--src/mongo/db/catalog/collection.cpp1
-rw-r--r--src/mongo/db/catalog/collection_compact.cpp1
-rw-r--r--src/mongo/db/client.cpp1
-rw-r--r--src/mongo/db/commands.cpp1
-rw-r--r--src/mongo/db/commands/auth_schema_upgrade_d.cpp1
-rw-r--r--src/mongo/db/commands/authentication_commands.cpp1
-rw-r--r--src/mongo/db/commands/clone_collection.cpp1
-rw-r--r--src/mongo/db/commands/compact.cpp1
-rw-r--r--src/mongo/db/commands/count.cpp1
-rw-r--r--src/mongo/db/commands/dbhash.cpp1
-rw-r--r--src/mongo/db/commands/fsync.cpp1
-rw-r--r--src/mongo/db/commands/geo_near_cmd.cpp1
-rw-r--r--src/mongo/db/commands/isself.cpp2
-rw-r--r--src/mongo/db/commands/server_status.cpp1
-rw-r--r--src/mongo/db/commands/test_commands.cpp1
-rw-r--r--src/mongo/db/commands/user_management_commands.cpp1
-rw-r--r--src/mongo/db/d_concurrency.cpp1
-rw-r--r--src/mongo/db/dbcommands_generic.cpp1
-rw-r--r--src/mongo/db/dbeval.cpp1
-rw-r--r--src/mongo/db/exec/collection_scan.cpp1
-rw-r--r--src/mongo/db/exec/delete.cpp1
-rw-r--r--src/mongo/db/exec/geo_near.cpp1
-rw-r--r--src/mongo/db/exec/index_scan.cpp1
-rw-r--r--src/mongo/db/exec/projection.cpp1
-rw-r--r--src/mongo/db/fts/fts_command.cpp1
-rw-r--r--src/mongo/db/fts/fts_enabled.cpp2
-rw-r--r--src/mongo/db/fts/fts_index_format_test.cpp1
-rw-r--r--src/mongo/db/geo/geo_query.cpp1
-rw-r--r--src/mongo/db/geo/geoparser.cpp1
-rw-r--r--src/mongo/db/geo/r2_region_coverer_test.cpp1
-rw-r--r--src/mongo/db/global_environment_d.cpp1
-rw-r--r--src/mongo/db/index/SConscript9
-rw-r--r--src/mongo/db/index/btree_based_access_method.cpp1
-rw-r--r--src/mongo/db/index/expression_keys_private.cpp1
-rw-r--r--src/mongo/db/index/index_descriptor.cpp8
-rw-r--r--src/mongo/db/index/index_descriptor.h7
-rw-r--r--src/mongo/db/index/s2_access_method.cpp1
-rw-r--r--src/mongo/db/index_rebuilder.cpp2
-rw-r--r--src/mongo/db/instance.cpp1
-rw-r--r--src/mongo/db/introspect.cpp1
-rw-r--r--src/mongo/db/json.cpp1
-rw-r--r--src/mongo/db/lasterror.cpp12
-rw-r--r--src/mongo/db/lasterror.h11
-rw-r--r--src/mongo/db/lockstat.h1
-rw-r--r--src/mongo/db/lockstate.cpp1
-rw-r--r--src/mongo/db/log_process_details.cpp1
-rw-r--r--src/mongo/db/matcher/expression_parser_leaf_test.cpp1
-rw-r--r--src/mongo/db/matcher/path.cpp1
-rw-r--r--src/mongo/db/mongod_options.cpp1
-rw-r--r--src/mongo/db/operation_context_impl.cpp1
-rw-r--r--src/mongo/db/ops/delete_executor.cpp1
-rw-r--r--src/mongo/db/ops/update_result.cpp58
-rw-r--r--src/mongo/db/ops/update_result.h16
-rw-r--r--src/mongo/db/query/SConscript1
-rw-r--r--src/mongo/db/query/canonical_query.cpp1
-rw-r--r--src/mongo/db/query/index_bounds_builder.cpp1
-rw-r--r--src/mongo/db/query/plan_enumerator.cpp1
-rw-r--r--src/mongo/db/query/planner_access.cpp1
-rw-r--r--src/mongo/db/query/planner_ixselect.cpp1
-rw-r--r--src/mongo/db/query/qlog.h12
-rw-r--r--src/mongo/db/query/query_planner_common.cpp86
-rw-r--r--src/mongo/db/query/query_planner_common.h48
-rw-r--r--src/mongo/db/query/query_planner_test.cpp1
-rw-r--r--src/mongo/db/query/stage_builder.cpp1
-rw-r--r--src/mongo/db/range_deleter_db_env.cpp1
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/connections.cpp62
-rw-r--r--src/mongo/db/repl/connections.h21
-rw-r--r--src/mongo/db/repl/health.cpp1
-rw-r--r--src/mongo/db/repl/heartbeat.cpp1
-rw-r--r--src/mongo/db/repl/initial_sync.cpp1
-rw-r--r--src/mongo/db/repl/isself.cpp15
-rw-r--r--src/mongo/db/repl/multicmd.cpp54
-rw-r--r--src/mongo/db/repl/multicmd.h15
-rw-r--r--src/mongo/db/repl/oplogreader.cpp7
-rw-r--r--src/mongo/db/repl/oplogreader.h7
-rw-r--r--src/mongo/db/repl/repl_coordinator_hybrid.cpp1
-rw-r--r--src/mongo/db/repl/repl_coordinator_impl.cpp1
-rw-r--r--src/mongo/db/repl/replset_commands.cpp1
-rw-r--r--src/mongo/db/repl/rs.cpp1
-rw-r--r--src/mongo/db/repl/rs_base.h7
-rw-r--r--src/mongo/db/repl/rs_initiate.cpp1
-rw-r--r--src/mongo/db/repl/rs_sync.cpp1
-rw-r--r--src/mongo/db/repl/state_box.cpp57
-rw-r--r--src/mongo/db/repl/state_box.h15
-rw-r--r--src/mongo/db/repl/sync_source_feedback.cpp5
-rw-r--r--src/mongo/db/repl/sync_source_feedback.h8
-rw-r--r--src/mongo/db/repl/write_concern.cpp1
-rw-r--r--src/mongo/db/restapi.cpp1
-rw-r--r--src/mongo/db/server_options_helpers.cpp1
-rw-r--r--src/mongo/db/sorter/sorter.cpp1
-rw-r--r--src/mongo/db/stats/counters.cpp1
-rw-r--r--src/mongo/db/stats/snapshots.cpp1
-rw-r--r--src/mongo/db/stats/top.cpp1
-rw-r--r--src/mongo/db/storage/heap1/SConscript1
-rw-r--r--src/mongo/db/storage/heap1/heap1_database_catalog_entry_index_real.cpp1
-rw-r--r--src/mongo/db/storage/heap1/record_store_heap.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/SConscript4
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_ondisk.cpp53
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h15
-rw-r--r--src/mongo/db/storage/mmap_v1/btree/key.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/hashtab.cpp95
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/hashtab.h63
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace-inl.h4
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_details.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/catalog/namespace_index.h3
-rw-r--r--src/mongo/db/storage/mmap_v1/data_file.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.cpp6
-rw-r--r--src/mongo/db/storage/mmap_v1/dur.h2
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_commitjob.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_journal.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/dur_recover.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp3
-rw-r--r--src/mongo/db/storage/mmap_v1/durop.cpp2
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.cpp1
-rw-r--r--src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp1
-rw-r--r--src/mongo/db/storage/rocks/rocks_database_catalog_entry.cpp1
-rw-r--r--src/mongo/db/storage/rocks/rocks_record_store.cpp2
131 files changed, 659 insertions, 236 deletions
diff --git a/src/mongo/db/auth/authz_manager_external_state_local.cpp b/src/mongo/db/auth/authz_manager_external_state_local.cpp
index ed28d14da90..e23d2522354 100644
--- a/src/mongo/db/auth/authz_manager_external_state_local.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_local.cpp
@@ -34,6 +34,7 @@
#include "mongo/bson/util/bson_extract.h"
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/user_document_parser.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/auth/authz_manager_external_state_s.cpp b/src/mongo/db/auth/authz_manager_external_state_s.cpp
index 848cd18c330..b6cdf8ed6d3 100644
--- a/src/mongo/db/auth/authz_manager_external_state_s.cpp
+++ b/src/mongo/db/auth/authz_manager_external_state_s.cpp
@@ -43,6 +43,7 @@
#include "mongo/s/type_database.h"
#include "mongo/s/grid.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/auth/authz_session_external_state_server_common.cpp b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
index a62b472e5ab..d6c94dca62f 100644
--- a/src/mongo/db/auth/authz_session_external_state_server_common.cpp
+++ b/src/mongo/db/auth/authz_session_external_state_server_common.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/client.h"
#include "mongo/db/server_parameters.h"
#include "mongo/util/debug_util.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/auth/security_key.cpp b/src/mongo/db/auth/security_key.cpp
index efbe3bdb201..125dccbac66 100644
--- a/src/mongo/db/auth/security_key.cpp
+++ b/src/mongo/db/auth/security_key.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/auth/privilege.h"
#include "mongo/db/auth/user.h"
#include "mongo/db/server_options.h"
+#include "mongo/util/log.h"
#include "mongo/util/password_digest.h"
namespace mongo {
diff --git a/src/mongo/db/auth/user_document_parser.cpp b/src/mongo/db/auth/user_document_parser.cpp
index 39ee04be0d4..341f22c9a3c 100644
--- a/src/mongo/db/auth/user_document_parser.cpp
+++ b/src/mongo/db/auth/user_document_parser.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/auth/user.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 1fc7d39a64e..fd4e54b8dfd 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -45,6 +45,7 @@
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/auth/user_document_parser.h" // XXX-ANDY
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp
index c4d91c17168..1e4d7d15d97 100644
--- a/src/mongo/db/catalog/collection_compact.cpp
+++ b/src/mongo/db/catalog/collection_compact.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/catalog/index_key_validate.h"
#include "mongo/db/index/index_access_method.h"
#include "mongo/db/operation_context.h"
+#include "mongo/util/log.h"
#include "mongo/util/touch_pages.h"
namespace mongo {
diff --git a/src/mongo/db/client.cpp b/src/mongo/db/client.cpp
index bead7c20752..35e2bd30f04 100644
--- a/src/mongo/db/client.cpp
+++ b/src/mongo/db/client.cpp
@@ -66,6 +66,7 @@
#include "mongo/util/concurrency/thread_name.h"
#include "mongo/util/file_allocator.h"
#include "mongo/util/mongoutils/str.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands.cpp b/src/mongo/db/commands.cpp
index 67a1f730f3b..951a8ab8d27 100644
--- a/src/mongo/db/commands.cpp
+++ b/src/mongo/db/commands.cpp
@@ -47,6 +47,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/server_parameters.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/auth_schema_upgrade_d.cpp b/src/mongo/db/commands/auth_schema_upgrade_d.cpp
index 962820d262c..0de0cb58e72 100644
--- a/src/mongo/db/commands/auth_schema_upgrade_d.cpp
+++ b/src/mongo/db/commands/auth_schema_upgrade_d.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/rs_config.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/version.h"
diff --git a/src/mongo/db/commands/authentication_commands.cpp b/src/mongo/db/commands/authentication_commands.cpp
index de6229524af..9124abc46be 100644
--- a/src/mongo/db/commands/authentication_commands.cpp
+++ b/src/mongo/db/commands/authentication_commands.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/platform/random.h"
#include "mongo/util/concurrency/mutex.h"
+#include "mongo/util/log.h"
#include "mongo/util/md5.hpp"
#include "mongo/util/net/ssl_manager.h"
#include "mongo/util/text.h"
diff --git a/src/mongo/db/commands/clone_collection.cpp b/src/mongo/db/commands/clone_collection.cpp
index c0e7ce576aa..5dc75a5dba4 100644
--- a/src/mongo/db/commands/clone_collection.cpp
+++ b/src/mongo/db/commands/clone_collection.cpp
@@ -51,6 +51,7 @@
#include "mongo/db/repl/oplogreader.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index 4ff1e8d85fc..a31b84cf1b9 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/count.cpp b/src/mongo/db/commands/count.cpp
index d49203cedfb..ea74c4e7c2b 100644
--- a/src/mongo/db/commands/count.cpp
+++ b/src/mongo/db/commands/count.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/query/explain.h"
#include "mongo/db/query/type_explain.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/dbhash.cpp b/src/mongo/db/commands/dbhash.cpp
index 945a9e8ebb2..2125dd85e8c 100644
--- a/src/mongo/db/commands/dbhash.cpp
+++ b/src/mongo/db/commands/dbhash.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/catalog/database.h"
#include "mongo/db/catalog/database_catalog_entry.h"
#include "mongo/db/query/internal_plans.h"
+#include "mongo/util/log.h"
#include "mongo/util/md5.hpp"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/commands/fsync.cpp b/src/mongo/db/commands/fsync.cpp
index 4bf4a742cdb..8db840c2338 100644
--- a/src/mongo/db/commands/fsync.cpp
+++ b/src/mongo/db/commands/fsync.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/operation_context_impl.h"
#include "mongo/util/background.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/geo_near_cmd.cpp b/src/mongo/db/commands/geo_near_cmd.cpp
index 7b85946e9cf..7631e2f279b 100644
--- a/src/mongo/db/commands/geo_near_cmd.cpp
+++ b/src/mongo/db/commands/geo_near_cmd.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/query/explain.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/platform/unordered_map.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/isself.cpp b/src/mongo/db/commands/isself.cpp
index 1f9e154b07c..0339cfdb0e6 100644
--- a/src/mongo/db/commands/isself.cpp
+++ b/src/mongo/db/commands/isself.cpp
@@ -60,4 +60,4 @@ namespace mongo {
return Status::OK();
}
-}
+} // namespace mongo
diff --git a/src/mongo/db/commands/server_status.cpp b/src/mongo/db/commands/server_status.cpp
index 49a4cacb303..9ff11711e40 100644
--- a/src/mongo/db/commands/server_status.cpp
+++ b/src/mongo/db/commands/server_status.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/commands/server_status_metric.h"
#include "mongo/db/stats/counters.h"
#include "mongo/platform/process_id.h"
+#include "mongo/util/log.h"
#include "mongo/util/net/listen.h"
#include "mongo/util/net/ssl_manager.h"
#include "mongo/util/processinfo.h"
diff --git a/src/mongo/db/commands/test_commands.cpp b/src/mongo/db/commands/test_commands.cpp
index 97a61695193..7583929a3eb 100644
--- a/src/mongo/db/commands/test_commands.cpp
+++ b/src/mongo/db/commands/test_commands.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/catalog/collection.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/operation_context_impl.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/commands/user_management_commands.cpp b/src/mongo/db/commands/user_management_commands.cpp
index e0fe630cf45..4139481645f 100644
--- a/src/mongo/db/commands/user_management_commands.cpp
+++ b/src/mongo/db/commands/user_management_commands.cpp
@@ -56,6 +56,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/platform/unordered_set.h"
#include "mongo/stdx/functional.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_manager.h"
#include "mongo/util/sequence_util.h"
diff --git a/src/mongo/db/d_concurrency.cpp b/src/mongo/db/d_concurrency.cpp
index 737118f2a2a..2c7fcffd4ea 100644
--- a/src/mongo/db/d_concurrency.cpp
+++ b/src/mongo/db/d_concurrency.cpp
@@ -47,6 +47,7 @@
#include "mongo/util/concurrency/qlock.h"
#include "mongo/util/concurrency/rwlock.h"
#include "mongo/util/concurrency/threadlocal.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/stacktrace.h"
diff --git a/src/mongo/db/dbcommands_generic.cpp b/src/mongo/db/dbcommands_generic.cpp
index 6b276d4c871..6a466cc0dd4 100644
--- a/src/mongo/db/dbcommands_generic.cpp
+++ b/src/mongo/db/dbcommands_generic.cpp
@@ -57,6 +57,7 @@
#include "mongo/util/exit.h"
#include "mongo/util/fail_point.h"
#include "mongo/util/fail_point_service.h"
+#include "mongo/util/log.h"
#include "mongo/util/md5.hpp"
#include "mongo/util/processinfo.h"
#include "mongo/util/ramlog.h"
diff --git a/src/mongo/db/dbeval.cpp b/src/mongo/db/dbeval.cpp
index 355f725026e..b34e07058f4 100644
--- a/src/mongo/db/dbeval.cpp
+++ b/src/mongo/db/dbeval.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/json.h"
#include "mongo/scripting/engine.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/exec/collection_scan.cpp b/src/mongo/db/exec/collection_scan.cpp
index 963d2a3ef4e..ab03475676e 100644
--- a/src/mongo/db/exec/collection_scan.cpp
+++ b/src/mongo/db/exec/collection_scan.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/exec/working_set.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/util/fail_point_service.h"
+#include "mongo/util/log.h"
#include "mongo/db/client.h" // XXX-ERH
diff --git a/src/mongo/db/exec/delete.cpp b/src/mongo/db/exec/delete.cpp
index f06fac15398..fda4b8ba779 100644
--- a/src/mongo/db/exec/delete.cpp
+++ b/src/mongo/db/exec/delete.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/exec/geo_near.cpp b/src/mongo/db/exec/geo_near.cpp
index 1c5a045a914..270a18152d2 100644
--- a/src/mongo/db/exec/geo_near.cpp
+++ b/src/mongo/db/exec/geo_near.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/matcher/expression.h"
#include "mongo/db/query/expression_index.h"
#include "mongo/db/query/expression_index_knobs.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/exec/index_scan.cpp b/src/mongo/db/exec/index_scan.cpp
index 0d165623ee1..a16ed4ab33b 100644
--- a/src/mongo/db/exec/index_scan.cpp
+++ b/src/mongo/db/exec/index_scan.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/index/index_cursor.h"
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/query/explain.h"
+#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/exec/projection.cpp b/src/mongo/db/exec/projection.cpp
index 244b68540d6..de6f8885dd2 100644
--- a/src/mongo/db/exec/projection.cpp
+++ b/src/mongo/db/exec/projection.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/exec/working_set_common.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/fts/fts_command.cpp b/src/mongo/db/fts/fts_command.cpp
index 128b5a9f255..21a7e86fc6c 100644
--- a/src/mongo/db/fts/fts_command.cpp
+++ b/src/mongo/db/fts/fts_command.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/fts/fts_command.h"
#include "mongo/db/fts/fts_util.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/fts/fts_enabled.cpp b/src/mongo/db/fts/fts_enabled.cpp
index 25a4619eae1..0d20f0eb039 100644
--- a/src/mongo/db/fts/fts_enabled.cpp
+++ b/src/mongo/db/fts/fts_enabled.cpp
@@ -30,6 +30,8 @@
#include "mongo/db/server_parameters.h"
+#include "mongo/util/log.h"
+
namespace mongo {
namespace fts {
namespace {
diff --git a/src/mongo/db/fts/fts_index_format_test.cpp b/src/mongo/db/fts/fts_index_format_test.cpp
index 09a3766f94e..ee7d8f7208d 100644
--- a/src/mongo/db/fts/fts_index_format_test.cpp
+++ b/src/mongo/db/fts/fts_index_format_test.cpp
@@ -34,6 +34,7 @@
#include <set>
#include "mongo/db/fts/fts_index_format.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/unittest/unittest.h"
diff --git a/src/mongo/db/geo/geo_query.cpp b/src/mongo/db/geo/geo_query.cpp
index 60cf9665bb7..22270a2732e 100644
--- a/src/mongo/db/geo/geo_query.cpp
+++ b/src/mongo/db/geo/geo_query.cpp
@@ -29,6 +29,7 @@
#include "mongo/db/geo/geo_query.h"
#include "mongo/db/geo/geoparser.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/geo/geoparser.cpp b/src/mongo/db/geo/geoparser.cpp
index 658e145efb1..e34be56007e 100644
--- a/src/mongo/db/geo/geoparser.cpp
+++ b/src/mongo/db/geo/geoparser.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/geo/shapes.h"
#include "mongo/db/jsobj.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "third_party/s2/s2polygonbuilder.h"
diff --git a/src/mongo/db/geo/r2_region_coverer_test.cpp b/src/mongo/db/geo/r2_region_coverer_test.cpp
index e3d1c980c71..34c91d13634 100644
--- a/src/mongo/db/geo/r2_region_coverer_test.cpp
+++ b/src/mongo/db/geo/r2_region_coverer_test.cpp
@@ -32,6 +32,7 @@
#include "mongo/platform/random.h"
#include "mongo/bson/bsonmisc.h"
#include "mongo/db/geo/geometry_container.h"
+#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/global_environment_d.cpp b/src/mongo/db/global_environment_d.cpp
index 27155f89c3d..76a658543f8 100644
--- a/src/mongo/db/global_environment_d.cpp
+++ b/src/mongo/db/global_environment_d.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/scripting/engine.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/index/SConscript b/src/mongo/db/index/SConscript
index 8d062d13878..5d28d1990ad 100644
--- a/src/mongo/db/index/SConscript
+++ b/src/mongo/db/index/SConscript
@@ -3,6 +3,15 @@
Import("env")
env.Library(
+ target='index_descriptor',
+ source=[
+ 'index_descriptor.cpp',
+ ],
+ LIBDEPS=[
+ ],
+)
+
+env.Library(
target='key_generator',
source=[
'btree_key_generator.cpp',
diff --git a/src/mongo/db/index/btree_based_access_method.cpp b/src/mongo/db/index/btree_based_access_method.cpp
index ac1ac47f39a..afed5a92661 100644
--- a/src/mongo/db/index/btree_based_access_method.cpp
+++ b/src/mongo/db/index/btree_based_access_method.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/pdfile_private.h"
#include "mongo/db/server_parameters.h"
#include "mongo/db/operation_context.h"
+#include "mongo/util/log.h"
#include "mongo/util/progress_meter.h"
diff --git a/src/mongo/db/index/expression_keys_private.cpp b/src/mongo/db/index/expression_keys_private.cpp
index 44be3b10aa8..0cbdcf1f6e0 100644
--- a/src/mongo/db/index/expression_keys_private.cpp
+++ b/src/mongo/db/index/expression_keys_private.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/index_names.h"
#include "mongo/db/index/2d_common.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "third_party/s2/s2cell.h"
#include "third_party/s2/s2regioncoverer.h"
diff --git a/src/mongo/db/index/index_descriptor.cpp b/src/mongo/db/index/index_descriptor.cpp
index e227be9e914..758d07bc927 100644
--- a/src/mongo/db/index/index_descriptor.cpp
+++ b/src/mongo/db/index/index_descriptor.cpp
@@ -29,6 +29,7 @@
*/
#include "mongo/db/index/index_descriptor.h"
+#include "mongo/util/log.h"
namespace mongo {
@@ -80,4 +81,11 @@ namespace mongo {
return existingOptionsMap == newOptionsMap;
}
+ void IndexDescriptor::_checkOk() const {
+ if ( _magic == 123987 )
+ return;
+ log() << "uh oh: " << (void*)(this) << " " << _magic;
+ invariant(0);
+ }
+
}
diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h
index ce1bb344644..64b67d6c76a 100644
--- a/src/mongo/db/index/index_descriptor.h
+++ b/src/mongo/db/index/index_descriptor.h
@@ -178,12 +178,7 @@ namespace mongo {
private:
- void _checkOk() const {
- if ( _magic == 123987 )
- return;
- log() << "uh oh: " << (void*)(this) << " " << _magic;
- verify(0);
- }
+ void _checkOk() const;
int _magic;
diff --git a/src/mongo/db/index/s2_access_method.cpp b/src/mongo/db/index/s2_access_method.cpp
index 3f4b0f95deb..fe8d41d5f0f 100644
--- a/src/mongo/db/index/s2_access_method.cpp
+++ b/src/mongo/db/index/s2_access_method.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/index/expression_keys_private.h"
#include "mongo/db/index/expression_params.h"
#include "mongo/db/jsobj.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/index_rebuilder.cpp b/src/mongo/db/index_rebuilder.cpp
index 83765f06728..f8854feae14 100644
--- a/src/mongo/db/index_rebuilder.cpp
+++ b/src/mongo/db/index_rebuilder.cpp
@@ -45,7 +45,7 @@
namespace mongo {
- MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kStorage);
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kIndexing);
IndexRebuilder indexRebuilder;
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp
index 3abd2c8ebf5..411ee1cf85a 100644
--- a/src/mongo/db/instance.cpp
+++ b/src/mongo/db/instance.cpp
@@ -337,6 +337,7 @@ namespace mongo {
Message& m,
DbResponse& dbresponse,
const HostAndPort& remote ) {
+ MONGO_LOG_DEFAULT_COMPONENT_LOCAL(::mongo::logger::LogComponent::kQuery);
// before we lock...
int op = m.operation();
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp
index c32d1f71efb..4e6cf821604 100644
--- a/src/mongo/db/introspect.cpp
+++ b/src/mongo/db/introspect.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/storage_options.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/util/goodies.h"
+#include "mongo/util/log.h"
namespace {
const size_t MAX_PROFILE_DOC_SIZE_BYTES = 100*1024;
diff --git a/src/mongo/db/json.cpp b/src/mongo/db/json.cpp
index 130d453c7ac..a7ed1b5959d 100644
--- a/src/mongo/db/json.cpp
+++ b/src/mongo/db/json.cpp
@@ -33,6 +33,7 @@
#include "mongo/platform/strtoll.h"
#include "mongo/util/base64.h"
#include "mongo/util/hex.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/time_support.h"
diff --git a/src/mongo/db/lasterror.cpp b/src/mongo/db/lasterror.cpp
index 130254c4a8f..b3bc72f068d 100644
--- a/src/mongo/db/lasterror.cpp
+++ b/src/mongo/db/lasterror.cpp
@@ -27,11 +27,12 @@
* then also delete it in the license file.
*/
-#include "mongo/pch.h"
+#include "mongo/platform/basic.h"
#include "mongo/db/lasterror.h"
#include "mongo/db/jsobj.h"
+#include "mongo/util/log.h"
#include "mongo/util/net/message.h"
namespace mongo {
@@ -117,6 +118,15 @@ namespace mongo {
return 0;
}
+ LastError * LastErrorHolder::getSafe() {
+ LastError * le = get(false);
+ if ( ! le ) {
+ error() << " no LastError!" << std::endl;
+ verify( le );
+ }
+ return le;
+ }
+
LastError * LastErrorHolder::_get( bool create ) {
LastError * le = _tl.get();
if ( ! le && create ) {
diff --git a/src/mongo/db/lasterror.h b/src/mongo/db/lasterror.h
index 45788c08ab2..d1f953734f0 100644
--- a/src/mongo/db/lasterror.h
+++ b/src/mongo/db/lasterror.h
@@ -34,7 +34,6 @@
#include "mongo/db/jsobj.h"
#include "mongo/bson/oid.h"
-#include "mongo/util/log.h"
namespace mongo {
class BSONObjBuilder;
@@ -136,15 +135,7 @@ namespace mongo {
~LastErrorHolder();
LastError * get( bool create = false );
- LastError * getSafe() {
- LastError * le = get(false);
- if ( ! le ) {
- error() << " no LastError!" << std::endl;
- verify( le );
- }
- return le;
- }
-
+ LastError * getSafe();
LastError * _get( bool create = false ); // may return a disabled LastError
void reset( LastError * le );
diff --git a/src/mongo/db/lockstat.h b/src/mongo/db/lockstat.h
index cf0e43c50ad..82b24e3c004 100644
--- a/src/mongo/db/lockstat.h
+++ b/src/mongo/db/lockstat.h
@@ -31,6 +31,7 @@
#pragma once
+#include "mongo/bson/util/builder.h"
#include "mongo/platform/atomic_word.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/lockstate.cpp b/src/mongo/db/lockstate.cpp
index 372a34c5641..3e5744703f7 100644
--- a/src/mongo/db/lockstate.cpp
+++ b/src/mongo/db/lockstate.cpp
@@ -31,6 +31,7 @@
#include "mongo/db/lockstate.h"
#include "mongo/db/namespace_string.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/log_process_details.cpp b/src/mongo/db/log_process_details.cpp
index a851444f5cd..955ae0557b2 100644
--- a/src/mongo/db/log_process_details.cpp
+++ b/src/mongo/db/log_process_details.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
+#include "mongo/util/log.h"
#include "mongo/util/net/sock.h"
#include "mongo/util/net/ssl_manager.h"
#include "mongo/util/processinfo.h"
diff --git a/src/mongo/db/matcher/expression_parser_leaf_test.cpp b/src/mongo/db/matcher/expression_parser_leaf_test.cpp
index 594cd5d7309..42cf3a37887 100644
--- a/src/mongo/db/matcher/expression_parser_leaf_test.cpp
+++ b/src/mongo/db/matcher/expression_parser_leaf_test.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/json.h"
#include "mongo/db/matcher/expression.h"
#include "mongo/db/matcher/expression_leaf.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/matcher/path.cpp b/src/mongo/db/matcher/path.cpp
index cd4f1ee9c0a..ae8a884d3cc 100644
--- a/src/mongo/db/matcher/path.cpp
+++ b/src/mongo/db/matcher/path.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/path_internal.h"
#include "mongo/db/matcher/path.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/mongod_options.cpp b/src/mongo/db/mongod_options.cpp
index eedead3865c..5d17679c6c5 100644
--- a/src/mongo/db/mongod_options.cpp
+++ b/src/mongo/db/mongod_options.cpp
@@ -41,6 +41,7 @@
#include "mongo/db/repl/repl_settings.h"
#include "mongo/db/server_options.h"
#include "mongo/db/server_options_helpers.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/ssl_options.h"
#include "mongo/util/options_parser/startup_options.h"
diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp
index ea82457cc9b..fed76022dbb 100644
--- a/src/mongo/db/operation_context_impl.cpp
+++ b/src/mongo/db/operation_context_impl.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/storage/storage_engine.h"
#include "mongo/platform/random.h"
+#include "mongo/util/log.h"
#include "mongo/util/fail_point_service.h"
namespace mongo {
diff --git a/src/mongo/db/ops/delete_executor.cpp b/src/mongo/db/ops/delete_executor.cpp
index ba36650e634..607c13fc4e5 100644
--- a/src/mongo/db/ops/delete_executor.cpp
+++ b/src/mongo/db/ops/delete_executor.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/query/get_executor.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/ops/update_result.cpp b/src/mongo/db/ops/update_result.cpp
new file mode 100644
index 00000000000..be3d39abe3f
--- /dev/null
+++ b/src/mongo/db/ops/update_result.cpp
@@ -0,0 +1,58 @@
+//@file update_result.cpp
+
+/**
+ * Copyright (C) 2008-2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/ops/update_result.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kQuery);
+
+ UpdateResult::UpdateResult(bool existing_,
+ bool modifiers_,
+ unsigned long long numDocsModified_,
+ unsigned long long numMatched_,
+ const BSONObj& upsertedObject_)
+ : existing(existing_),
+ modifiers(modifiers_),
+ numDocsModified(numDocsModified_),
+ numMatched(numMatched_) {
+
+ BSONElement id = upsertedObject_["_id"];
+ if ( ! existing && numMatched == 1 && !id.eoo() ) {
+ upserted = id.wrap(kUpsertedFieldName);
+ }
+ LOG(4) << "UpdateResult -- " << toString();
+ }
+
+} // namespace mongo
diff --git a/src/mongo/db/ops/update_result.h b/src/mongo/db/ops/update_result.h
index 46174da538e..276813ae150 100644
--- a/src/mongo/db/ops/update_result.h
+++ b/src/mongo/db/ops/update_result.h
@@ -31,7 +31,6 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/curop.h"
#include "mongo/db/namespace_string.h"
-#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
@@ -44,20 +43,7 @@ namespace mongo {
bool modifiers_,
unsigned long long numDocsModified_,
unsigned long long numMatched_,
- const BSONObj& upsertedObject_ )
- : existing(existing_)
- , modifiers(modifiers_)
- , numDocsModified(numDocsModified_)
- , numMatched(numMatched_) {
- MONGO_LOG_DEFAULT_COMPONENT_LOCAL(::mongo::logger::LogComponent::kQuery);
-
- BSONElement id = upsertedObject_["_id"];
- if ( ! existing && numMatched == 1 && !id.eoo() ) {
- upserted = id.wrap(kUpsertedFieldName);
- }
-
- LOG(4) << "UpdateResult -- " << toString();
- }
+ const BSONObj& upsertedObject_ );
// if existing objects were modified
diff --git a/src/mongo/db/query/SConscript b/src/mongo/db/query/SConscript
index 769d6f59aa1..91d3af5be9b 100644
--- a/src/mongo/db/query/SConscript
+++ b/src/mongo/db/query/SConscript
@@ -16,6 +16,7 @@ env.Library(
"planner_ixselect.cpp",
"query_knobs.cpp",
"query_planner.cpp",
+ "query_planner_common.cpp",
"query_solution.cpp",
],
LIBDEPS=[
diff --git a/src/mongo/db/query/canonical_query.cpp b/src/mongo/db/query/canonical_query.cpp
index 603c636a403..a8b501821ba 100644
--- a/src/mongo/db/query/canonical_query.cpp
+++ b/src/mongo/db/query/canonical_query.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/matcher/expression_array.h"
#include "mongo/db/matcher/expression_geo.h"
#include "mongo/db/query/query_planner_common.h"
+#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/query/index_bounds_builder.cpp b/src/mongo/db/query/index_bounds_builder.cpp
index af8621090cd..87a2a8ea135 100644
--- a/src/mongo/db/query/index_bounds_builder.cpp
+++ b/src/mongo/db/query/index_bounds_builder.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/query/indexability.h"
#include "mongo/db/query/qlog.h"
#include "mongo/db/query/query_knobs.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/db/geo/s2.h"
#include "third_party/s2/s2cell.h"
diff --git a/src/mongo/db/query/plan_enumerator.cpp b/src/mongo/db/query/plan_enumerator.cpp
index c958dc3d3a2..94a66d3d952 100644
--- a/src/mongo/db/query/plan_enumerator.cpp
+++ b/src/mongo/db/query/plan_enumerator.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/query/indexability.h"
#include "mongo/db/query/index_tag.h"
#include "mongo/db/query/qlog.h"
+#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/query/planner_access.cpp b/src/mongo/db/query/planner_access.cpp
index 4c32b4c4277..cb43096e9ae 100644
--- a/src/mongo/db/query/planner_access.cpp
+++ b/src/mongo/db/query/planner_access.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/query/qlog.h"
#include "mongo/db/query/query_planner.h"
#include "mongo/db/query/query_planner_common.h"
+#include "mongo/util/log.h"
namespace {
diff --git a/src/mongo/db/query/planner_ixselect.cpp b/src/mongo/db/query/planner_ixselect.cpp
index 864f05d39b3..f2067f651dc 100644
--- a/src/mongo/db/query/planner_ixselect.cpp
+++ b/src/mongo/db/query/planner_ixselect.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/query/index_tag.h"
#include "mongo/db/query/qlog.h"
#include "mongo/db/query/query_planner_common.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/query/qlog.h b/src/mongo/db/query/qlog.h
index 1d0ada2fb99..3050877ba2b 100644
--- a/src/mongo/db/query/qlog.h
+++ b/src/mongo/db/query/qlog.h
@@ -28,9 +28,11 @@
#pragma once
-#include <ostream>
-
-#include "mongo/util/log.h"
+#include "mongo/logger/log_component.h"
+#include "mongo/logger/log_severity.h"
+#include "mongo/logger/logger.h"
+#include "mongo/logger/logstream_builder.h"
+#include "mongo/util/concurrency/thread_name.h"
namespace mongo {
@@ -57,7 +59,9 @@ namespace mongo {
const logger::LogSeverity verboseQueryLogSeverity = logger::LogSeverity::Debug(5);
// With a #define like this, we don't evaluate the costly toString()s that are QLOG'd
-#define QLOG() MONGO_LOG_COMPONENT(verboseQueryLogSeverity, verboseQueryLogComponent) << "[QLOG] "
+#define QLOG() \
+ if (!(::mongo::logger::globalLogDomain())->shouldLog(::mongo::verboseQueryLogComponent, ::mongo::verboseQueryLogSeverity)) {} \
+ else ::mongo::logger::LogstreamBuilder(::mongo::logger::globalLogDomain(), ::mongo::getThreadName(), ::mongo::verboseQueryLogSeverity, ::mongo::verboseQueryLogComponent) << "[QLOG] "
bool qlogOff();
bool qlogOn();
diff --git a/src/mongo/db/query/query_planner_common.cpp b/src/mongo/db/query/query_planner_common.cpp
new file mode 100644
index 00000000000..c31252e3c37
--- /dev/null
+++ b/src/mongo/db/query/query_planner_common.cpp
@@ -0,0 +1,86 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/query/query_planner_common.h"
+
+#include "mongo/db/query/qlog.h"
+#include "mongo/util/assert_util.h"
+
+namespace mongo {
+
+ void QueryPlannerCommon::reverseScans(QuerySolutionNode* node) {
+ StageType type = node->getType();
+
+ if (STAGE_IXSCAN == type) {
+ IndexScanNode* isn = static_cast<IndexScanNode*>(node);
+ isn->direction *= -1;
+
+ if (isn->bounds.isSimpleRange) {
+ std::swap(isn->bounds.startKey, isn->bounds.endKey);
+ // XXX: Not having a startKeyInclusive means that if we reverse a max/min query
+ // we have different results with and without the reverse...
+ isn->bounds.endKeyInclusive = true;
+ }
+ else {
+ for (size_t i = 0; i < isn->bounds.fields.size(); ++i) {
+ std::vector<Interval>& iv = isn->bounds.fields[i].intervals;
+ // Step 1: reverse the list.
+ std::reverse(iv.begin(), iv.end());
+ // Step 2: reverse each interval.
+ for (size_t j = 0; j < iv.size(); ++j) {
+ iv[j].reverse();
+ }
+ }
+ }
+
+ if (!isn->bounds.isValidFor(isn->indexKeyPattern, isn->direction)) {
+ QLOG() << "Invalid bounds: " << isn->bounds.toString() << std::endl;
+ invariant(0);
+ }
+
+ // TODO: we can just negate every value in the already computed properties.
+ isn->computeProperties();
+ }
+ else if (STAGE_SORT_MERGE == type) {
+ // reverse direction of comparison for merge
+ MergeSortNode* msn = static_cast<MergeSortNode*>(node);
+ msn->sort = reverseSortObj(msn->sort);
+ }
+ else {
+ invariant(STAGE_SORT != type);
+ // This shouldn't be here...
+ }
+
+ for (size_t i = 0; i < node->children.size(); ++i) {
+ reverseScans(node->children[i]);
+ }
+ }
+
+} // namespace mongo
diff --git a/src/mongo/db/query/query_planner_common.h b/src/mongo/db/query/query_planner_common.h
index 2caa2545be3..848e0f00ba1 100644
--- a/src/mongo/db/query/query_planner_common.h
+++ b/src/mongo/db/query/query_planner_common.h
@@ -31,7 +31,6 @@
#include "mongo/db/jsobj.h"
#include "mongo/db/matcher/expression.h"
#include "mongo/db/query/query_solution.h"
-#include "mongo/db/query/qlog.h"
namespace mongo {
@@ -80,53 +79,8 @@ namespace mongo {
* Traverses the tree rooted at 'node'. For every STAGE_IXSCAN encountered, reverse
* the scan direction and index bounds.
*/
- static void reverseScans(QuerySolutionNode* node) {
- StageType type = node->getType();
+ static void reverseScans(QuerySolutionNode* node);
- if (STAGE_IXSCAN == type) {
- IndexScanNode* isn = static_cast<IndexScanNode*>(node);
- isn->direction *= -1;
-
- if (isn->bounds.isSimpleRange) {
- std::swap(isn->bounds.startKey, isn->bounds.endKey);
- // XXX: Not having a startKeyInclusive means that if we reverse a max/min query
- // we have different results with and without the reverse...
- isn->bounds.endKeyInclusive = true;
- }
- else {
- for (size_t i = 0; i < isn->bounds.fields.size(); ++i) {
- std::vector<Interval>& iv = isn->bounds.fields[i].intervals;
- // Step 1: reverse the list.
- std::reverse(iv.begin(), iv.end());
- // Step 2: reverse each interval.
- for (size_t j = 0; j < iv.size(); ++j) {
- iv[j].reverse();
- }
- }
- }
-
- if (!isn->bounds.isValidFor(isn->indexKeyPattern, isn->direction)) {
- QLOG() << "Invalid bounds: " << isn->bounds.toString() << std::endl;
- verify(0);
- }
-
- // TODO: we can just negate every value in the already computed properties.
- isn->computeProperties();
- }
- else if (STAGE_SORT_MERGE == type) {
- // reverse direction of comparison for merge
- MergeSortNode* msn = static_cast<MergeSortNode*>(node);
- msn->sort = reverseSortObj(msn->sort);
- }
- else {
- verify(STAGE_SORT != type);
- // This shouldn't be here...
- }
-
- for (size_t i = 0; i < node->children.size(); ++i) {
- reverseScans(node->children[i]);
- }
- }
};
} // namespace mongo
diff --git a/src/mongo/db/query/query_planner_test.cpp b/src/mongo/db/query/query_planner_test.cpp
index 93b87844da6..b10d874f400 100644
--- a/src/mongo/db/query/query_planner_test.cpp
+++ b/src/mongo/db/query/query_planner_test.cpp
@@ -42,6 +42,7 @@
#include "mongo/db/query/query_solution.h"
#include "mongo/unittest/unittest.h"
#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
using namespace mongo;
diff --git a/src/mongo/db/query/stage_builder.cpp b/src/mongo/db/query/stage_builder.cpp
index 7621abbd9e1..d82ef8bb657 100644
--- a/src/mongo/db/query/stage_builder.cpp
+++ b/src/mongo/db/query/stage_builder.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/index/fts_access_method.h"
#include "mongo/db/catalog/collection.h"
#include "mongo/db/catalog/database.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/range_deleter_db_env.cpp b/src/mongo/db/range_deleter_db_env.cpp
index 29e96e4ead4..dcce2025b01 100644
--- a/src/mongo/db/range_deleter_db_env.cpp
+++ b/src/mongo/db/range_deleter_db_env.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/repl/rs.h"
#include "mongo/db/write_concern_options.h"
#include "mongo/s/d_logic.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index 0d17be5942d..e9803d19eb9 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -47,6 +47,7 @@ env.Library('repl_coordinator_impl',
LIBDEPS=['$BUILD_DIR/mongo/db/common',
'$BUILD_DIR/mongo/fail_point',
'$BUILD_DIR/mongo/foundation',
+ '$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/server_options_core',
'repl_coordinator_interface',
'replica_set_messages',
diff --git a/src/mongo/db/repl/connections.cpp b/src/mongo/db/repl/connections.cpp
new file mode 100644
index 00000000000..b5811792a5c
--- /dev/null
+++ b/src/mongo/db/repl/connections.cpp
@@ -0,0 +1,62 @@
+// @connections.cpp
+
+/*
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/connections.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+namespace repl {
+
+ // we should already be locked...
+ bool ScopedConn::connect() {
+ std::string err;
+ if (!connInfo->cc->connect(HostAndPort(_hostport), err)) {
+ log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
+ return false;
+ }
+ connInfo->connected = true;
+ connInfo->tagPort();
+
+ // if we cannot authenticate against a member, then either its key file
+ // or our key file has to change. if our key file has to change, we'll
+ // be rebooting. if their file has to change, they'll be rebooted so the
+ // connection created above will go dead, reconnect, and reauth.
+ if (getGlobalAuthorizationManager()->isAuthEnabled()) {
+ return authenticateInternalUser(connInfo->cc.get());
+ }
+
+ return true;
+ }
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/connections.h b/src/mongo/db/repl/connections.h
index eadf4e92d49..62eb727ed4a 100644
--- a/src/mongo/db/repl/connections.h
+++ b/src/mongo/db/repl/connections.h
@@ -130,25 +130,8 @@ namespace repl {
const std::string _hostport;
// we should already be locked...
- bool connect() {
- std::string err;
- if (!connInfo->cc->connect(HostAndPort(_hostport), err)) {
- log() << "couldn't connect to " << _hostport << ": " << err << rsLog;
- return false;
- }
- connInfo->connected = true;
- connInfo->tagPort();
-
- // if we cannot authenticate against a member, then either its key file
- // or our key file has to change. if our key file has to change, we'll
- // be rebooting. if their file has to change, they'll be rebooted so the
- // connection created above will go dead, reconnect, and reauth.
- if (getGlobalAuthorizationManager()->isAuthEnabled()) {
- return authenticateInternalUser(connInfo->cc.get());
- }
-
- return true;
- }
+ bool connect();
+
};
inline ScopedConn::ScopedConn(const std::string& hostport) : _hostport(hostport) {
diff --git a/src/mongo/db/repl/health.cpp b/src/mongo/db/repl/health.cpp
index 65422709641..665a2df2d56 100644
--- a/src/mongo/db/repl/health.cpp
+++ b/src/mongo/db/repl/health.cpp
@@ -43,6 +43,7 @@
#include "mongo/util/background.h"
#include "mongo/util/concurrency/task.h"
#include "mongo/util/goodies.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/html.h"
#include "mongo/util/ramlog.h"
diff --git a/src/mongo/db/repl/heartbeat.cpp b/src/mongo/db/repl/heartbeat.cpp
index fa1b0fde090..f9ae91d7ef2 100644
--- a/src/mongo/db/repl/heartbeat.cpp
+++ b/src/mongo/db/repl/heartbeat.cpp
@@ -48,6 +48,7 @@
#include "mongo/util/concurrency/task.h"
#include "mongo/util/fail_point_service.h"
#include "mongo/util/goodies.h"
+#include "mongo/util/log.h"
#include "mongo/util/ramlog.h"
namespace mongo {
diff --git a/src/mongo/db/repl/initial_sync.cpp b/src/mongo/db/repl/initial_sync.cpp
index 19822bbc75b..63a0d0937d2 100644
--- a/src/mongo/db/repl/initial_sync.cpp
+++ b/src/mongo/db/repl/initial_sync.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/repl/oplog.h"
#include "mongo/db/repl/replset_commands.h"
#include "mongo/db/repl/rs.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/isself.cpp b/src/mongo/db/repl/isself.cpp
index fc7eca41f34..5d4f003f237 100644
--- a/src/mongo/db/repl/isself.cpp
+++ b/src/mongo/db/repl/isself.cpp
@@ -26,6 +26,8 @@
* it in the license file.
*/
+#define MONGO_LOG_DEFAULT_COMPONENT ::mongo::logger::LogComponent::kNetworking
+
#include "mongo/platform/basic.h"
#include "mongo/db/repl/isself.h"
@@ -33,6 +35,7 @@
#include <boost/algorithm/string.hpp>
#include "mongo/base/init.h"
+#include "mongo/bson/util/builder.h"
#include "mongo/client/dbclientinterface.h"
#include "mongo/db/commands.h"
#include "mongo/db/auth/action_set.h"
@@ -131,14 +134,12 @@ namespace {
}
if (logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(2))) {
- LogstreamBuilder builder(logger::globalLogDomain(),
- getThreadName(),
- logger::LogSeverity::Debug(2));
+ StringBuilder builder;
builder << "getAddrsForHost(\"" << iporhost << ":" << port << "\"):";
for (std::vector<std::string>::const_iterator o = out.begin(); o != out.end(); ++o) {
builder << " [ " << *o << "]";
}
- builder << std::endl;
+ LOG(2) << builder.str();
}
return out;
@@ -338,14 +339,12 @@ namespace {
#endif // defined(_WIN32)
if (logger::globalLogDomain()->shouldLog(logger::LogSeverity::Debug(2))) {
- LogstreamBuilder builder(logger::globalLogDomain(),
- getThreadName(),
- logger::LogSeverity::Debug(2));
+ StringBuilder builder;
builder << "getBoundAddrs():";
for (std::vector<std::string>::const_iterator o = out.begin(); o != out.end(); ++o) {
builder << " [ " << *o << "]";
}
- builder << std::endl;
+ LOG(2) << builder.str();
}
return out;
#else // ifdef FASTPATH
diff --git a/src/mongo/db/repl/multicmd.cpp b/src/mongo/db/repl/multicmd.cpp
new file mode 100644
index 00000000000..7889696e809
--- /dev/null
+++ b/src/mongo/db/repl/multicmd.cpp
@@ -0,0 +1,54 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/multicmd.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kReplication);
+
+namespace repl {
+
+ void _MultiCommandJob::run() {
+ try {
+ ScopedConn c(d.toHost);
+ LOG(1) << "multiCommand running on host " << d.toHost;
+ d.ok = c.runCommand("admin", cmd, d.result);
+ LOG(1) << "multiCommand response: " << d.result;
+ }
+ catch (const DBException& e) {
+ LOG(1) << "dev caught " << e.what() << " on multiCommand to " << d.toHost;
+ }
+ }
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/multicmd.h b/src/mongo/db/repl/multicmd.h
index 7848040836a..1705ad17580 100644
--- a/src/mongo/db/repl/multicmd.h
+++ b/src/mongo/db/repl/multicmd.h
@@ -32,7 +32,6 @@
#include "mongo/db/repl/connections.h"
#include "mongo/util/background.h"
-#include "mongo/util/log.h"
namespace mongo {
namespace repl {
@@ -61,19 +60,7 @@ namespace repl {
private:
std::string name() const { return "MultiCommandJob"; }
- void run() {
- MONGO_LOG_DEFAULT_COMPONENT_LOCAL(::mongo::logger::LogComponent::kReplication);
-
- try {
- ScopedConn c(d.toHost);
- LOG(1) << "multiCommand running on host " << d.toHost;
- d.ok = c.runCommand("admin", cmd, d.result);
- LOG(1) << "multiCommand response: " << d.result;
- }
- catch (const DBException& e) {
- LOG(1) << "dev caught " << e.what() << " on multiCommand to " << d.toHost;
- }
- }
+ void run();
};
inline void multiCommand(BSONObj cmd, std::list<Target>& L) {
diff --git a/src/mongo/db/repl/oplogreader.cpp b/src/mongo/db/repl/oplogreader.cpp
index 8cc45e43612..82e45cbb164 100644
--- a/src/mongo/db/repl/oplogreader.cpp
+++ b/src/mongo/db/repl/oplogreader.cpp
@@ -155,6 +155,13 @@ namespace repl {
return false;
}
+ void OplogReader::tailCheck() {
+ if( cursor.get() && cursor->isDead() ) {
+ log() << "repl: old cursor isDead, will initiate a new one" << std::endl;
+ resetCursor();
+ }
+ }
+
bool OplogReader::passthroughHandshake(const mongo::OID& rid, const int nextOnChainId) {
BSONObjBuilder cmd;
cmd.append("handshake", rid);
diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h
index 22a20c097b6..0660e081806 100644
--- a/src/mongo/db/repl/oplogreader.h
+++ b/src/mongo/db/repl/oplogreader.h
@@ -80,12 +80,7 @@ namespace repl {
bool connect(const mongo::OID& rid, const int from, const std::string& to);
- void tailCheck() {
- if( cursor.get() && cursor->isDead() ) {
- log() << "repl: old cursor isDead, will initiate a new one" << std::endl;
- resetCursor();
- }
- }
+ void tailCheck();
bool haveCursor() { return cursor.get() != 0; }
diff --git a/src/mongo/db/repl/repl_coordinator_hybrid.cpp b/src/mongo/db/repl/repl_coordinator_hybrid.cpp
index fba4093cdf5..f8d508aaa68 100644
--- a/src/mongo/db/repl/repl_coordinator_hybrid.cpp
+++ b/src/mongo/db/repl/repl_coordinator_hybrid.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/repl/network_interface_impl.h"
#include "mongo/db/repl/repl_coordinator_external_state_impl.h"
#include "mongo/db/repl/topology_coordinator_impl.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/repl/repl_coordinator_impl.cpp b/src/mongo/db/repl/repl_coordinator_impl.cpp
index 121b4f7889d..0137312972a 100644
--- a/src/mongo/db/repl/repl_coordinator_impl.cpp
+++ b/src/mongo/db/repl/repl_coordinator_impl.cpp
@@ -51,6 +51,7 @@
#include "mongo/stdx/functional.h"
#include "mongo/util/assert_util.h"
#include "mongo/util/fail_point_service.h"
+#include "mongo/util/log.h"
#include "mongo/util/time_support.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/repl/replset_commands.cpp b/src/mongo/db/repl/replset_commands.cpp
index 8c8e815308d..30c28b9b575 100644
--- a/src/mongo/db/repl/replset_commands.cpp
+++ b/src/mongo/db/repl/replset_commands.cpp
@@ -40,6 +40,7 @@
#include "mongo/db/repl/rs_config.h"
#include "mongo/db/repl/update_position_args.h"
#include "mongo/db/repl/write_concern.h"
+#include "mongo/util/log.h"
namespace mongo {
namespace repl {
diff --git a/src/mongo/db/repl/rs.cpp b/src/mongo/db/repl/rs.cpp
index ed2f98329c7..34abf39639a 100644
--- a/src/mongo/db/repl/rs.cpp
+++ b/src/mongo/db/repl/rs.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/repl/connections.h"
#include "mongo/db/repl/repl_set_impl.h"
#include "mongo/db/server_parameters.h"
+#include "mongo/util/log.h"
namespace mongo {
namespace repl {
diff --git a/src/mongo/db/repl/rs_base.h b/src/mongo/db/repl/rs_base.h
index 8896b195aea..549fb201d4a 100644
--- a/src/mongo/db/repl/rs_base.h
+++ b/src/mongo/db/repl/rs_base.h
@@ -30,7 +30,6 @@
#include "mongo/db/repl/health.h"
#include "mongo/util/concurrency/mutex.h"
-#include "mongo/util/log.h"
namespace mongo {
namespace repl {
@@ -48,11 +47,7 @@ namespace repl {
ThreadLocalValue<bool> _lockedByMe;
protected:
RSBase() : m("RSBase"), _locked(0) { }
- ~RSBase() {
- // this can happen if we throw in the constructor; otherwise never happens. thus we
- // logit as it is quite unusual.
- log() << "replSet ~RSBase called" << rsLog;
- }
+ ~RSBase() { }
public:
class lock {
diff --git a/src/mongo/db/repl/rs_initiate.cpp b/src/mongo/db/repl/rs_initiate.cpp
index 8356b51897f..ac56e20c923 100644
--- a/src/mongo/db/repl/rs_initiate.cpp
+++ b/src/mongo/db/repl/rs_initiate.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/repl/replset_commands.h"
#include "mongo/db/repl/rs.h"
#include "mongo/db/repl/rs_config.h"
+#include "mongo/util/log.h"
#include "mongo/util/mmap.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/repl/rs_sync.cpp b/src/mongo/db/repl/rs_sync.cpp
index a755e778d12..82ec24381a9 100644
--- a/src/mongo/db/repl/rs_sync.cpp
+++ b/src/mongo/db/repl/rs_sync.cpp
@@ -55,6 +55,7 @@
#include "mongo/db/operation_context_impl.h"
#include "mongo/db/storage_options.h"
#include "mongo/util/fail_point_service.h"
+#include "mongo/util/log.h"
namespace mongo {
namespace repl {
diff --git a/src/mongo/db/repl/state_box.cpp b/src/mongo/db/repl/state_box.cpp
new file mode 100644
index 00000000000..eb04d3e2d4e
--- /dev/null
+++ b/src/mongo/db/repl/state_box.cpp
@@ -0,0 +1,57 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/repl/state_box.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kReplication);
+
+namespace repl {
+
+ void StateBox::change(MemberState s, const Member *self) {
+ rwlock lk(m, true);
+ if( sp.state != s ) {
+ log() << "replSet " << s.toString() << rsLog;
+ }
+ sp.state = s;
+ if( s.primary() ) {
+ sp.primary = self;
+ }
+ else {
+ if( self == sp.primary )
+ sp.primary = 0;
+ }
+ }
+
+} // namespace repl
+} // namespace mongo
diff --git a/src/mongo/db/repl/state_box.h b/src/mongo/db/repl/state_box.h
index 8e4a09a78d3..1a889ee3035 100644
--- a/src/mongo/db/repl/state_box.h
+++ b/src/mongo/db/repl/state_box.h
@@ -57,20 +57,7 @@ namespace repl {
rwlock lk(m, false);
return sp.primary;
}
- void change(MemberState s, const Member *self) {
- rwlock lk(m, true);
- if( sp.state != s ) {
- log() << "replSet " << s.toString() << rsLog;
- }
- sp.state = s;
- if( s.primary() ) {
- sp.primary = self;
- }
- else {
- if( self == sp.primary )
- sp.primary = 0;
- }
- }
+ void change(MemberState s, const Member *self);
void set(MemberState s, const Member *p) {
rwlock lk(m, true);
sp.state = s;
diff --git a/src/mongo/db/repl/sync_source_feedback.cpp b/src/mongo/db/repl/sync_source_feedback.cpp
index c85f7357f1b..2b47c5a3f53 100644
--- a/src/mongo/db/repl/sync_source_feedback.cpp
+++ b/src/mongo/db/repl/sync_source_feedback.cpp
@@ -58,6 +58,11 @@ namespace repl {
_shutdownSignaled(false) {}
SyncSourceFeedback::~SyncSourceFeedback() {}
+ void SyncSourceFeedback::_resetConnection() {
+ LOG(1) << "resetting connection in sync source feedback";
+ _connection.reset();
+ }
+
bool SyncSourceFeedback::replAuthenticate() {
if (!getGlobalAuthorizationManager()->isAuthEnabled())
return true;
diff --git a/src/mongo/db/repl/sync_source_feedback.h b/src/mongo/db/repl/sync_source_feedback.h
index a1a3c09c034..5becbcc84aa 100644
--- a/src/mongo/db/repl/sync_source_feedback.h
+++ b/src/mongo/db/repl/sync_source_feedback.h
@@ -35,7 +35,6 @@
#include "mongo/client/constants.h"
#include "mongo/client/dbclientcursor.h"
-#include "mongo/util/log.h"
namespace mongo {
@@ -75,12 +74,7 @@ namespace repl {
void shutdown();
private:
- void _resetConnection() {
- MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kReplication);
-
- LOG(1) << "resetting connection in sync source feedback";
- _connection.reset();
- }
+ void _resetConnection();
/**
* Authenticates _connection using the server's cluster-membership credentials.
diff --git a/src/mongo/db/repl/write_concern.cpp b/src/mongo/db/repl/write_concern.cpp
index adf1dc9f35f..cce25fe36e3 100644
--- a/src/mongo/db/repl/write_concern.cpp
+++ b/src/mongo/db/repl/write_concern.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/instance.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/operation_context_impl.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
//#define REPLDEBUG(x) log() << "replBlock: " << x << endl;
diff --git a/src/mongo/db/restapi.cpp b/src/mongo/db/restapi.cpp
index f1399a22a65..c1d5c329773 100644
--- a/src/mongo/db/restapi.cpp
+++ b/src/mongo/db/restapi.cpp
@@ -43,6 +43,7 @@
#include "mongo/db/instance.h"
#include "mongo/db/repl/master_slave.h"
#include "mongo/db/repl/repl_coordinator_global.h"
+#include "mongo/util/log.h"
#include "mongo/util/md5.hpp"
#include "mongo/util/mongoutils/html.h"
#include "mongo/util/net/miniwebserver.h"
diff --git a/src/mongo/db/server_options_helpers.cpp b/src/mongo/db/server_options_helpers.cpp
index 94333afc673..376fe51b87a 100644
--- a/src/mongo/db/server_options_helpers.cpp
+++ b/src/mongo/db/server_options_helpers.cpp
@@ -44,6 +44,7 @@
#include "mongo/logger/log_component.h"
#include "mongo/logger/message_event_utf8_encoder.h"
#include "mongo/util/cmdline_utils/censor_cmdline.h"
+#include "mongo/util/log.h"
#include "mongo/util/map_util.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/net/listen.h" // For DEFAULT_MAX_CONN
diff --git a/src/mongo/db/sorter/sorter.cpp b/src/mongo/db/sorter/sorter.cpp
index 113813d22f3..2844cc9f4a8 100644
--- a/src/mongo/db/sorter/sorter.cpp
+++ b/src/mongo/db/sorter/sorter.cpp
@@ -57,7 +57,6 @@
#include "mongo/util/assert_util.h"
#include "mongo/util/bufreader.h"
#include "mongo/util/goodies.h"
-#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/stats/counters.cpp b/src/mongo/db/stats/counters.cpp
index eba6ae93b0b..a422116eafc 100644
--- a/src/mongo/db/stats/counters.cpp
+++ b/src/mongo/db/stats/counters.cpp
@@ -33,6 +33,7 @@
#include "mongo/db/stats/counters.h"
#include "mongo/db/jsobj.h"
+#include "mongo/util/log.h"
namespace mongo {
OpCounters::OpCounters() {}
diff --git a/src/mongo/db/stats/snapshots.cpp b/src/mongo/db/stats/snapshots.cpp
index ecd392decea..d540bc558bb 100644
--- a/src/mongo/db/stats/snapshots.cpp
+++ b/src/mongo/db/stats/snapshots.cpp
@@ -34,6 +34,7 @@
#include "mongo/db/client.h"
#include "mongo/db/clientcursor.h"
+#include "mongo/util/log.h"
/**
handles snapshotting performance metrics and other such things
diff --git a/src/mongo/db/stats/top.cpp b/src/mongo/db/stats/top.cpp
index 2ec710ae57d..00d057a2973 100644
--- a/src/mongo/db/stats/top.cpp
+++ b/src/mongo/db/stats/top.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/auth/action_type.h"
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/privilege.h"
+#include "mongo/util/log.h"
#include "mongo/util/net/message.h"
#include "mongo/db/commands.h"
diff --git a/src/mongo/db/storage/heap1/SConscript b/src/mongo/db/storage/heap1/SConscript
index 948a430820a..ecc27938906 100644
--- a/src/mongo/db/storage/heap1/SConscript
+++ b/src/mongo/db/storage/heap1/SConscript
@@ -23,6 +23,7 @@ env.Library(
'$BUILD_DIR/mongo/bson',
'$BUILD_DIR/mongo/db/catalog/collection_options',
'$BUILD_DIR/mongo/db/storage/index_entry_comparison',
+ '$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/foundation',
]
)
diff --git a/src/mongo/db/storage/heap1/heap1_database_catalog_entry_index_real.cpp b/src/mongo/db/storage/heap1/heap1_database_catalog_entry_index_real.cpp
index 69a665f6029..0ebaf3bd52f 100644
--- a/src/mongo/db/storage/heap1/heap1_database_catalog_entry_index_real.cpp
+++ b/src/mongo/db/storage/heap1/heap1_database_catalog_entry_index_real.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/index/index_descriptor.h"
#include "mongo/db/index/s2_access_method.h"
#include "mongo/db/storage/heap1/heap1_btree_impl.h"
+#include "mongo/util/log.h"
namespace mongo {
IndexAccessMethod* Heap1DatabaseCatalogEntry::getIndex( OperationContext* txn,
diff --git a/src/mongo/db/storage/heap1/record_store_heap.cpp b/src/mongo/db/storage/heap1/record_store_heap.cpp
index a1157df4a90..3145e6f1c75 100644
--- a/src/mongo/db/storage/heap1/record_store_heap.cpp
+++ b/src/mongo/db/storage/heap1/record_store_heap.cpp
@@ -29,6 +29,7 @@
#include "mongo/db/storage/heap1/record_store_heap.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/SConscript b/src/mongo/db/storage/mmap_v1/SConscript
index ad6ab270785..20edaaa5934 100644
--- a/src/mongo/db/storage/mmap_v1/SConscript
+++ b/src/mongo/db/storage/mmap_v1/SConscript
@@ -2,7 +2,8 @@ Import("env")
env.Library(
target = 'storage_mmapv1',
- source = [ "catalog/index_details.cpp",
+ source = [ "catalog/hashtab.cpp",
+ "catalog/index_details.cpp",
"catalog/namespace.cpp",
"catalog/namespace_details.cpp",
"catalog/namespace_details_collection_entry.cpp",
@@ -93,6 +94,7 @@ env.Library(
source= [
'btree/btree_logic.cpp',
'btree/btree_interface.cpp',
+ 'btree/btree_ondisk.cpp',
'btree/key.cpp'
],
LIBDEPS= [
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
index ee52e8796aa..88fb0653c42 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_logic_test.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/operation_context_noop.h"
#include "mongo/db/storage/mmap_v1/btree/btree_test_help.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.cpp b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.cpp
new file mode 100644
index 00000000000..cdf89eff1c3
--- /dev/null
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.cpp
@@ -0,0 +1,53 @@
+/**
+ * Copyright (C) 2014 MongoDB Inc.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License, version 3,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * As a special exception, the copyright holders give permission to link the
+ * code of portions of this program with the OpenSSL library under certain
+ * conditions as described in each individual source file and distribute
+ * linked combinations including the program with the OpenSSL library. You
+ * must comply with the GNU Affero General Public License in all respects for
+ * all of the code used other than as permitted herein. If you modify file(s)
+ * with this exception, you may extend this exception to your version of the
+ * file(s), but you are not obligated to do so. If you do not wish to do so,
+ * delete this exception statement from your version. If you delete this
+ * exception statement from all source files in the program, then also delete
+ * it in the license file.
+ */
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/storage/mmap_v1/btree/btree_ondisk.h"
+
+#include "mongo/util/assert_util.h"
+#include "mongo/util/log.h"
+
+namespace mongo {
+
+ void DiskLoc56Bit::operator=(const DiskLoc& loc) {
+ ofs = loc.getOfs();
+ int la = loc.a();
+ invariant( la <= 0xffffff ); // must fit in 3 bytes
+ if( la < 0 ) {
+ if ( la != -1 ) {
+ log() << "btree diskloc isn't negative 1: " << la << std::endl;
+ invariant ( la == -1 );
+ }
+ la = 0;
+ ofs = OurNullOfs;
+ }
+ memcpy(_a, &la, 3); // endian
+ }
+
+} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h
index 7f91cd2fb27..dcb0697a2b0 100644
--- a/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h
+++ b/src/mongo/db/storage/mmap_v1/btree/btree_ondisk.h
@@ -267,20 +267,7 @@ namespace mongo {
_a[0] = _a[1] = _a[2] = 0;
}
- void operator=(const DiskLoc& loc) {
- ofs = loc.getOfs();
- int la = loc.a();
- invariant( la <= 0xffffff ); // must fit in 3 bytes
- if( la < 0 ) {
- if ( la != -1 ) {
- log() << "btree diskloc isn't negative 1: " << la << std::endl;
- invariant ( la == -1 );
- }
- la = 0;
- ofs = OurNullOfs;
- }
- memcpy(_a, &la, 3); // endian
- }
+ void operator=(const DiskLoc& loc);
//
// Type Conversion
diff --git a/src/mongo/db/storage/mmap_v1/btree/key.cpp b/src/mongo/db/storage/mmap_v1/btree/key.cpp
index a6ccd61d2cf..22218911618 100644
--- a/src/mongo/db/storage/mmap_v1/btree/key.cpp
+++ b/src/mongo/db/storage/mmap_v1/btree/key.cpp
@@ -30,6 +30,7 @@
#include "mongo/bson/util/builder.h"
#include "mongo/platform/float_utils.h"
+#include "mongo/util/log.h"
#include "mongo/util/startup_test.h"
diff --git a/src/mongo/db/storage/mmap_v1/catalog/hashtab.cpp b/src/mongo/db/storage/mmap_v1/catalog/hashtab.cpp
new file mode 100644
index 00000000000..0f5691ce783
--- /dev/null
+++ b/src/mongo/db/storage/mmap_v1/catalog/hashtab.cpp
@@ -0,0 +1,95 @@
+// hashtab.cpp
+
+/**
+* Copyright (C) 2014 MongoDB Inc.
+*
+* This program is free software: you can redistribute it and/or modify
+* it under the terms of the GNU Affero General Public License, version 3,
+* as published by the Free Software Foundation.
+*
+* This program is distributed in the hope that it will be useful,
+* but WITHOUT ANY WARRANTY; without even the implied warranty of
+* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+* GNU Affero General Public License for more details.
+*
+* You should have received a copy of the GNU Affero General Public License
+* along with this program. If not, see <http://www.gnu.org/licenses/>.
+*
+* As a special exception, the copyright holders give permission to link the
+* code of portions of this program with the OpenSSL library under certain
+* conditions as described in each individual source file and distribute
+* linked combinations including the program with the OpenSSL library. You
+* must comply with the GNU Affero General Public License in all respects for
+* all of the code used other than as permitted herein. If you modify file(s)
+* with this exception, you may extend this exception to your version of the
+* file(s), but you are not obligated to do so. If you do not wish to do so,
+* delete this exception statement from your version. If you delete this
+* exception statement from all source files in the program, then also delete
+* it in the license file.
+*/
+
+#include "mongo/platform/basic.h"
+
+#include "mongo/db/storage/mmap_v1/catalog/hashtab.h"
+
+#include "mongo/util/log.h"
+
+namespace mongo {
+
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kIndexing);
+
+ int NamespaceHashTable::_find(const Key& k, bool& found) {
+ found = false;
+ int h = k.hash();
+ int i = h % n;
+ int start = i;
+ int chain = 0;
+ int firstNonUsed = -1;
+ while ( 1 ) {
+ if ( !nodes(i).inUse() ) {
+ if ( firstNonUsed < 0 )
+ firstNonUsed = i;
+ }
+
+ if ( nodes(i).hash == h && nodes(i).k == k ) {
+ if ( chain >= 200 )
+ log() << "warning: hashtable " << name << " long chain " << std::endl;
+ found = true;
+ return i;
+ }
+ chain++;
+ i = (i+1) % n;
+ if ( i == start ) {
+ // shouldn't get here / defensive for infinite loops
+ log() << "error: hashtable " << name << " is full n:" << n << std::endl;
+ return -1;
+ }
+ if( chain >= maxChain ) {
+ if ( firstNonUsed >= 0 )
+ return firstNonUsed;
+ log() << "error: hashtable " << name << " max chain reached:" << maxChain << std::endl;
+ return -1;
+ }
+ }
+ }
+
+ /* buf must be all zeroes on initialization. */
+ NamespaceHashTable::NamespaceHashTable(void* buf, int buflen, const char *_name)
+ : name(_name) {
+ int m = sizeof(Node);
+ // log() << "hashtab init, buflen:" << buflen << " m:" << m << std::endl;
+ n = buflen / m;
+ if ( (n & 1) == 0 )
+ n--;
+ maxChain = (int) (n * 0.05);
+ _buf = buf;
+ //nodes = (Node *) buf;
+
+ if ( sizeof(Node) != 628 ) {
+ log() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n
+ << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << std::endl;
+ verify( sizeof(Node) == 628 );
+ }
+
+ }
+} // namespace mongo
diff --git a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h
index 07916dc873d..125387feac9 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/hashtab.h
+++ b/src/mongo/db/storage/mmap_v1/catalog/hashtab.h
@@ -34,8 +34,10 @@
#pragma once
-#include "mongo/pch.h"
#include <map>
+
+#include "mongo/db/storage/mmap_v1/catalog/namespace.h"
+#include "mongo/db/storage/mmap_v1/catalog/namespace_details.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/operation_context.h"
#include "mongo/stdx/functional.h"
@@ -47,11 +49,14 @@ namespace mongo {
/* you should define:
int Key::hash() return > 0 always.
+ Used in NamespaceIndex only.
*/
- template <class Key,class Type>
- class HashTable : boost::noncopyable {
+ class NamespaceHashTable : boost::noncopyable {
public:
+ typedef Namespace Key;
+ typedef NamespaceDetails Type;
+
const char *name;
struct Node {
int hash;
@@ -73,59 +78,11 @@ namespace mongo {
return nodes[i];
}
- int _find(const Key& k, bool& found) {
- found = false;
- int h = k.hash();
- int i = h % n;
- int start = i;
- int chain = 0;
- int firstNonUsed = -1;
- while ( 1 ) {
- if ( !nodes(i).inUse() ) {
- if ( firstNonUsed < 0 )
- firstNonUsed = i;
- }
-
- if ( nodes(i).hash == h && nodes(i).k == k ) {
- if ( chain >= 200 )
- log() << "warning: hashtable " << name << " long chain " << std::endl;
- found = true;
- return i;
- }
- chain++;
- i = (i+1) % n;
- if ( i == start ) {
- // shouldn't get here / defensive for infinite loops
- log() << "error: hashtable " << name << " is full n:" << n << std::endl;
- return -1;
- }
- if( chain >= maxChain ) {
- if ( firstNonUsed >= 0 )
- return firstNonUsed;
- log() << "error: hashtable " << name << " max chain reached:" << maxChain << std::endl;
- return -1;
- }
- }
- }
+ int _find(const Key& k, bool& found);
public:
/* buf must be all zeroes on initialization. */
- HashTable(void* buf, int buflen, const char *_name) : name(_name) {
- int m = sizeof(Node);
- // log() << "hashtab init, buflen:" << buflen << " m:" << m << std::endl;
- n = buflen / m;
- if ( (n & 1) == 0 )
- n--;
- maxChain = (int) (n * 0.05);
- _buf = buf;
- //nodes = (Node *) buf;
-
- if ( sizeof(Node) != 628 ) {
- log() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << std::endl;
- verify( sizeof(Node) == 628 );
- }
-
- }
+ NamespaceHashTable(void* buf, int buflen, const char *_name);
Type* get(const Key& k) {
bool found;
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace-inl.h b/src/mongo/db/storage/mmap_v1/catalog/namespace-inl.h
index 5cd45963f1f..02b8b5167b6 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace-inl.h
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace-inl.h
@@ -30,6 +30,10 @@
#pragma once
+#include <boost/filesystem/path.hpp>
+
+#include "mongo/util/assert_util.h"
+
namespace mongo {
inline Namespace& Namespace::operator=(const StringData& ns) {
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp
index 2fe3d226e5d..c84bb6a3cdf 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.cpp
@@ -44,6 +44,7 @@
#include "mongo/db/ops/delete.h"
#include "mongo/db/ops/update.h"
#include "mongo/db/storage/mmap_v1/catalog/hashtab.h"
+#include "mongo/db/storage/mmap_v1/catalog/namespace_index.h"
#include "mongo/db/operation_context.h"
#include "mongo/scripting/engine.h"
#include "mongo/util/startup_test.h"
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h
index 0a6734e7d9d..cdda3b89d11 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_details.h
@@ -32,11 +32,11 @@
#include "mongo/db/namespace_string.h"
#include "mongo/db/storage/mmap_v1/catalog/index_details.h"
#include "mongo/db/storage/mmap_v1/catalog/namespace.h"
-#include "mongo/db/storage/mmap_v1/catalog/namespace_index.h"
namespace mongo {
class Collection;
+ class NamespaceIndex;
class OperationContext;
/* deleted lists -- linked lists of deleted records -- are placed in 'buckets' of various sizes
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
index 9bbf8ef6303..1324b2c7b36 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.cpp
@@ -197,7 +197,7 @@ namespace mongo {
verify( len <= 0x7fffffff );
- _ht.reset(new HashTable<Namespace,NamespaceDetails>(p, (int) len, "namespace index"));
+ _ht.reset(new NamespaceHashTable(p, (int) len, "namespace index"));
}
diff --git a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h
index 3ce2c2e0194..59c0a98a9ad 100644
--- a/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h
+++ b/src/mongo/db/storage/mmap_v1/catalog/namespace_index.h
@@ -37,6 +37,7 @@
#include "mongo/db/diskloc.h"
#include "mongo/db/storage/mmap_v1/catalog/hashtab.h"
#include "mongo/db/storage/mmap_v1/catalog/namespace.h"
+#include "mongo/db/storage/mmap_v1/durable_mapped_file.h"
namespace mongo {
@@ -86,7 +87,7 @@ namespace mongo {
void maybeMkdir() const;
DurableMappedFile _f;
- scoped_ptr<HashTable<Namespace,NamespaceDetails> > _ht;
+ scoped_ptr<NamespaceHashTable> _ht;
std::string _dir;
std::string _database;
};
diff --git a/src/mongo/db/storage/mmap_v1/data_file.cpp b/src/mongo/db/storage/mmap_v1/data_file.cpp
index 044f2ef3656..422ca1c6ce0 100644
--- a/src/mongo/db/storage/mmap_v1/data_file.cpp
+++ b/src/mongo/db/storage/mmap_v1/data_file.cpp
@@ -39,6 +39,7 @@
#include "mongo/db/lockstate.h"
#include "mongo/db/operation_context.h"
#include "mongo/util/file_allocator.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/dur.cpp b/src/mongo/db/storage/mmap_v1/dur.cpp
index b8258571670..c903b2e8bb3 100644
--- a/src/mongo/db/storage/mmap_v1/dur.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur.cpp
@@ -94,7 +94,7 @@ using namespace mongoutils;
namespace mongo {
- MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kStorage);
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kJournaling);
namespace dur {
@@ -889,6 +889,10 @@ namespace mongo {
boost::thread t(durThread);
}
+ DurableInterface::~DurableInterface() {
+ log() << "ERROR warning ~DurableInterface not intended to be called" << std::endl;
+ }
+
void DurableImpl::syncDataAndTruncateJournal(OperationContext* txn) {
invariant(txn->lockState()->isW());
diff --git a/src/mongo/db/storage/mmap_v1/dur.h b/src/mongo/db/storage/mmap_v1/dur.h
index 065d39ecd2d..730f631ced5 100644
--- a/src/mongo/db/storage/mmap_v1/dur.h
+++ b/src/mongo/db/storage/mmap_v1/dur.h
@@ -57,7 +57,7 @@ namespace mongo {
class DurableInterface : boost::noncopyable {
public:
- virtual ~DurableInterface() { log() << "ERROR warning ~DurableInterface not intended to be called" << std::endl; }
+ virtual ~DurableInterface();
/** Declare that a file has been created
Normally writes are applied only after journaling, for safety. But here the file
diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
index 60a5c932a8c..6a071648212 100644
--- a/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/client.h"
#include "mongo/db/storage/mmap_v1/dur_stats.h"
#include "mongo/util/concurrency/threadlocal.h"
+#include "mongo/util/log.h"
#include "mongo/util/stacktrace.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/dur_journal.cpp b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
index 0933c762ed6..c48afef8660 100644
--- a/src/mongo/db/storage/mmap_v1/dur_journal.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_journal.cpp
@@ -60,7 +60,7 @@ using namespace mongoutils;
namespace mongo {
- MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kStorage);
+ MONGO_LOG_DEFAULT_COMPONENT_FILE(::mongo::logger::LogComponent::kJournaling);
class AlignedBuilder;
diff --git a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
index 4e1bc7a7b4e..994b28b91c2 100644
--- a/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_preplogbuffer.cpp
@@ -45,6 +45,7 @@
#include "mongo/db/storage/mmap_v1/dur_stats.h"
#include "mongo/server.h"
#include "mongo/util/alignedbuilder.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/stacktrace.h"
#include "mongo/util/timer.h"
diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.cpp b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
index 18b2baa67ce..e552a32c868 100644
--- a/src/mongo/db/storage/mmap_v1/dur_recover.cpp
+++ b/src/mongo/db/storage/mmap_v1/dur_recover.cpp
@@ -52,6 +52,7 @@
#include "mongo/util/bufreader.h"
#include "mongo/util/checksum.h"
#include "mongo/util/compress.h"
+#include "mongo/util/log.h"
#include "mongo/util/mongoutils/str.h"
#include "mongo/util/startup_test.h"
diff --git a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
index 0a4c6e8a7e9..e717ce47638 100644
--- a/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
+++ b/src/mongo/db/storage/mmap_v1/durable_mapped_file.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/d_concurrency.h"
+#include "mongo/db/storage_options.h"
#include "mongo/db/storage/mmap_v1/dur.h"
#include "mongo/db/storage/mmap_v1/dur_journalformat.h"
#include "mongo/util/mongoutils/str.h"
@@ -139,7 +140,7 @@ namespace mongo {
else
_fileSuffixNo = (int) str::toUnsigned(suffix);
- _p = RelativePath::fromFullPath(prefix);
+ _p = RelativePath::fromFullPath(storageGlobalParams.dbpath, prefix);
}
bool DurableMappedFile::open(const std::string& fname, bool sequentialHint) {
diff --git a/src/mongo/db/storage/mmap_v1/durop.cpp b/src/mongo/db/storage/mmap_v1/durop.cpp
index c3dc60c875b..b1c778fa459 100644
--- a/src/mongo/db/storage/mmap_v1/durop.cpp
+++ b/src/mongo/db/storage/mmap_v1/durop.cpp
@@ -98,7 +98,7 @@ namespace mongo {
FileCreatedOp::FileCreatedOp(const std::string& f, unsigned long long l) :
DurOp(JEntry::OpCode_FileCreated) {
- _p = RelativePath::fromFullPath(f);
+ _p = RelativePath::fromFullPath(storageGlobalParams.dbpath, f);
_len = l;
}
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
index 9a77b192c7e..96768ef5983 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/storage/mmap_v1/dur_recovery_unit.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_capped.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_simple.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
index 66436256c09..14217369464 100644
--- a/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
+++ b/src/mongo/db/storage/mmap_v1/mmap_v1_engine.cpp
@@ -50,6 +50,7 @@
#include "mongo/db/storage_options.h"
#include "mongo/platform/process_id.h"
#include "mongo/util/file_allocator.h"
+#include "mongo/util/log.h"
#include "mongo/util/mmap.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
index 3a1bed72dd9..47ca3498893 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_base.cpp
@@ -37,6 +37,7 @@
#include "mongo/db/storage/mmap_v1/extent_manager.h"
#include "mongo/db/storage/mmap_v1/record.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.h"
+#include "mongo/util/log.h"
#include "mongo/util/progress_meter.h"
#include "mongo/util/timer.h"
#include "mongo/util/touch_pages.h"
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
index c8524c76e22..ab704ef4505 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_capped.cpp
@@ -35,6 +35,7 @@
#include "mongo/db/storage/mmap_v1/extent_manager.h"
#include "mongo/db/storage/mmap_v1/record.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_capped_iterator.h"
+#include "mongo/util/log.h"
#include "mongo/util/mmap.h"
#include "mongo/util/mongoutils/str.h"
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.cpp
index a210c0dc0f3..be42a991929 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_repair_iterator.cpp
@@ -32,6 +32,7 @@
#include "mongo/db/storage/mmap_v1/extent.h"
#include "mongo/db/storage/mmap_v1/extent_manager.h"
#include "mongo/db/storage/mmap_v1/record_store_v1_simple.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
index 3ea4298332f..be5364ada69 100644
--- a/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
+++ b/src/mongo/db/storage/mmap_v1/record_store_v1_test_help.cpp
@@ -38,6 +38,7 @@
#include "mongo/db/storage/mmap_v1/extent.h"
#include "mongo/db/storage/mmap_v1/record.h"
#include "mongo/unittest/unittest.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/rocks/rocks_database_catalog_entry.cpp b/src/mongo/db/storage/rocks/rocks_database_catalog_entry.cpp
index dcf49210bf3..7c074a1529f 100644
--- a/src/mongo/db/storage/rocks/rocks_database_catalog_entry.cpp
+++ b/src/mongo/db/storage/rocks/rocks_database_catalog_entry.cpp
@@ -36,6 +36,7 @@
#include "mongo/db/storage/rocks/rocks_collection_catalog_entry.h"
#include "mongo/db/storage/rocks/rocks_engine.h"
#include "mongo/db/storage/rocks/rocks_record_store.h"
+#include "mongo/util/log.h"
namespace mongo {
diff --git a/src/mongo/db/storage/rocks/rocks_record_store.cpp b/src/mongo/db/storage/rocks/rocks_record_store.cpp
index 3dbde39c5ee..268ec0af86d 100644
--- a/src/mongo/db/storage/rocks/rocks_record_store.cpp
+++ b/src/mongo/db/storage/rocks/rocks_record_store.cpp
@@ -38,6 +38,8 @@
#include <rocksdb/options.h>
#include <rocksdb/slice.h>
+#include "mongo/util/log.h"
+
namespace mongo {
RocksRecordStore::RocksRecordStore( const StringData& ns,