summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2017-05-16 17:23:57 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2017-05-16 17:23:57 -0400
commitb7a125a62bf68ef8d7b90d30f02447a695ab5506 (patch)
tree4e5b2a893c56bed16b709e78e3adb2acc6ed74af
parentbcf3d946e680c2c5d8ba737bfb677af7bbc3eb3f (diff)
downloadmongo-b7a125a62bf68ef8d7b90d30f02447a695ab5506.tar.gz
SERVER-29235 Ripple dependency-graph resolutions
This adds necessary edges for catalog helpers to libraries that need it, and it also removes an exemption for a now resolvable-edge. Also move some code defined in the catalog library but declared in the collection free-form interface into the collection interface library.
-rw-r--r--src/mongo/db/catalog/collection.cpp75
-rw-r--r--src/mongo/db/catalog/collection_impl.cpp71
-rw-r--r--src/mongo/db/commands/SConscript8
-rw-r--r--src/mongo/db/repl/SConscript8
4 files changed, 84 insertions, 78 deletions
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index 07054e8c03a..b63c5879c2b 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -120,3 +120,78 @@ auto Collection::parseValidationAction(const StringData data) -> StatusWith<Vali
return parseValidationActionImpl(data);
}
} // namespace mongo
+
+
+namespace mongo {
+std::string CompactOptions::toString() const {
+ std::stringstream ss;
+ ss << "paddingMode: ";
+ switch (paddingMode) {
+ case NONE:
+ ss << "NONE";
+ break;
+ case PRESERVE:
+ ss << "PRESERVE";
+ break;
+ case MANUAL:
+ ss << "MANUAL (" << paddingBytes << " + ( doc * " << paddingFactor << ") )";
+ }
+
+ ss << " validateDocuments: " << validateDocuments;
+
+ return ss.str();
+}
+
+//
+// CappedInsertNotifier
+//
+
+CappedInsertNotifier::CappedInsertNotifier() : _version(0), _dead(false) {}
+
+void CappedInsertNotifier::notifyAll() {
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
+ ++_version;
+ _notifier.notify_all();
+}
+
+void CappedInsertNotifier::_wait(stdx::unique_lock<stdx::mutex>& lk,
+ uint64_t prevVersion,
+ Microseconds timeout) const {
+ while (!_dead && prevVersion == _version) {
+ if (timeout == Microseconds::max()) {
+ _notifier.wait(lk);
+ } else if (stdx::cv_status::timeout == _notifier.wait_for(lk, timeout.toSystemDuration())) {
+ return;
+ }
+ }
+}
+
+void CappedInsertNotifier::wait(uint64_t prevVersion, Microseconds timeout) const {
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
+ _wait(lk, prevVersion, timeout);
+}
+
+void CappedInsertNotifier::wait(Microseconds timeout) const {
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
+ _wait(lk, _version, timeout);
+}
+
+void CappedInsertNotifier::wait() const {
+ stdx::unique_lock<stdx::mutex> lk(_mutex);
+ _wait(lk, _version, Microseconds::max());
+}
+
+void CappedInsertNotifier::kill() {
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
+ _dead = true;
+ _notifier.notify_all();
+}
+
+bool CappedInsertNotifier::isDead() {
+ stdx::lock_guard<stdx::mutex> lk(_mutex);
+ return _dead;
+}
+
+// ----
+
+} // namespace mongo
diff --git a/src/mongo/db/catalog/collection_impl.cpp b/src/mongo/db/catalog/collection_impl.cpp
index 4840f77828e..05230692281 100644
--- a/src/mongo/db/catalog/collection_impl.cpp
+++ b/src/mongo/db/catalog/collection_impl.cpp
@@ -164,77 +164,6 @@ using logger::LogComponent;
static const int IndexKeyMaxSize = 1024; // this goes away with SERVER-3372
-std::string CompactOptions::toString() const {
- std::stringstream ss;
- ss << "paddingMode: ";
- switch (paddingMode) {
- case NONE:
- ss << "NONE";
- break;
- case PRESERVE:
- ss << "PRESERVE";
- break;
- case MANUAL:
- ss << "MANUAL (" << paddingBytes << " + ( doc * " << paddingFactor << ") )";
- }
-
- ss << " validateDocuments: " << validateDocuments;
-
- return ss.str();
-}
-
-//
-// CappedInsertNotifier
-//
-
-CappedInsertNotifier::CappedInsertNotifier() : _version(0), _dead(false) {}
-
-void CappedInsertNotifier::notifyAll() {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
- ++_version;
- _notifier.notify_all();
-}
-
-void CappedInsertNotifier::_wait(stdx::unique_lock<stdx::mutex>& lk,
- uint64_t prevVersion,
- Microseconds timeout) const {
- while (!_dead && prevVersion == _version) {
- if (timeout == Microseconds::max()) {
- _notifier.wait(lk);
- } else if (stdx::cv_status::timeout == _notifier.wait_for(lk, timeout.toSystemDuration())) {
- return;
- }
- }
-}
-
-void CappedInsertNotifier::wait(uint64_t prevVersion, Microseconds timeout) const {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
- _wait(lk, prevVersion, timeout);
-}
-
-void CappedInsertNotifier::wait(Microseconds timeout) const {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
- _wait(lk, _version, timeout);
-}
-
-void CappedInsertNotifier::wait() const {
- stdx::unique_lock<stdx::mutex> lk(_mutex);
- _wait(lk, _version, Microseconds::max());
-}
-
-void CappedInsertNotifier::kill() {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
- _dead = true;
- _notifier.notify_all();
-}
-
-bool CappedInsertNotifier::isDead() {
- stdx::lock_guard<stdx::mutex> lk(_mutex);
- return _dead;
-}
-
-// ----
-
CollectionImpl::CollectionImpl(Collection* _this_init,
OperationContext* opCtx,
StringData fullNS,
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 228c64f7173..35f15a45fe1 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -146,6 +146,7 @@ env.Library(
'$BUILD_DIR/mongo/db/background',
'$BUILD_DIR/mongo/db/catalog/collection',
'$BUILD_DIR/mongo/db/catalog/index_key_validate',
+ '$BUILD_DIR/mongo/db/catalog/catalog_helpers',
'$BUILD_DIR/mongo/db/clientcursor',
'$BUILD_DIR/mongo/db/cloner',
'$BUILD_DIR/mongo/db/commands',
@@ -156,8 +157,11 @@ env.Library(
'$BUILD_DIR/mongo/db/ops/write_ops_parsers',
'$BUILD_DIR/mongo/db/pipeline/serveronly',
'$BUILD_DIR/mongo/db/repair_database',
+ '$BUILD_DIR/mongo/db/repl/apply_ops',
+ '$BUILD_DIR/mongo/db/repl/oplog',
'$BUILD_DIR/mongo/db/repl/isself',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_impl',
+ '$BUILD_DIR/mongo/db/rw_concern_d',
'$BUILD_DIR/mongo/db/server_options_core',
'$BUILD_DIR/mongo/db/stats/serveronly',
'$BUILD_DIR/mongo/db/storage/mmap_v1/storage_mmapv1',
@@ -166,10 +170,10 @@ env.Library(
'apply_ops_cmd_common',
'core',
'killcursors_common',
- #'$BUILD_DIR/mongo/db/catalog/catalog', # CYCLE
+ #'$BUILD_DIR/mongo/db/catalog/catalog', # CYCLE (CursorManager)
],
LIBDEPS_TAGS=[
- # TODO(ADAM, 2017-03-10): See `CYCLE` tags above.
+ # TODO(ADAM, 2017-05-16): See `CYCLE` tags above.
'illegal_cyclic_or_unresolved_dependencies_whitelisted',
],
)
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index ec9a22c5af3..3b84bb828b6 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -53,11 +53,14 @@ env.Library(
'rollback_source_impl.cpp',
],
LIBDEPS=[
+ 'oplog',
+ 'oplog_interface_remote',
'repl_coordinator_interface',
'repl_coordinator_global',
'$BUILD_DIR/mongo/base',
'$BUILD_DIR/mongo/db/background',
'$BUILD_DIR/mongo/db/catalog/database',
+ '$BUILD_DIR/mongo/db/cloner',
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/db_raii',
'$BUILD_DIR/mongo/db/dbhelpers',
@@ -65,11 +68,6 @@ env.Library(
'$BUILD_DIR/mongo/db/index/index_descriptor',
'$BUILD_DIR/mongo/util/fail_point',
'$BUILD_DIR/mongo/db/ops/write_ops',
- #'$BUILD_DIR/mongo/db/catalog/catalog', # CYCLE
- ],
- LIBDEPS_TAGS=[
- # TODO(ADAM, 2017-04-06): See `CYCLE` tags above
- 'illegal_cyclic_or_unresolved_dependencies_whitelisted',
],
)