summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp4
-rw-r--r--src/mongo/db/index_builds_coordinator.h9
-rw-r--r--src/mongo/db/repl/SConscript1
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp4
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp4
5 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index c63cc40ecd8..d245cf9620c 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -353,6 +353,10 @@ void IndexBuildsCoordinator::awaitNoBgOpInProgForDb(StringData db) const {
dbIndexBuildsIt->second->waitUntilNoIndexBuildsRemain(lk);
}
+void IndexBuildsCoordinator::onReplicaSetReconfig() {
+ // TODO: not yet implemented.
+}
+
void IndexBuildsCoordinator::sleepIndexBuilds_forTestOnly(bool sleep) {
stdx::unique_lock<stdx::mutex> lk(_mutex);
_sleepForTest = sleep;
diff --git a/src/mongo/db/index_builds_coordinator.h b/src/mongo/db/index_builds_coordinator.h
index 458843b4b60..02ca79faa4f 100644
--- a/src/mongo/db/index_builds_coordinator.h
+++ b/src/mongo/db/index_builds_coordinator.h
@@ -279,6 +279,15 @@ public:
*/
void awaitNoBgOpInProgForDb(StringData db) const;
+ /**
+ * Called by the replication coordinator when a replica set reconfig occurs, which could affect
+ * any index build to make their commit quorum unachievable.
+ *
+ * Checks if the commit quorum is still satisfiable for each index build, if it is no longer
+ * satisfiable, then those index builds are aborted.
+ */
+ void onReplicaSetReconfig();
+
void sleepIndexBuilds_forTestOnly(bool sleep);
void verifyNoIndexBuilds_forTestOnly();
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript
index d14ac46e152..6bbbe7ece3e 100644
--- a/src/mongo/db/repl/SConscript
+++ b/src/mongo/db/repl/SConscript
@@ -850,6 +850,7 @@ env.Library(
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/db/commands/test_commands_enabled',
+ '$BUILD_DIR/mongo/db/index_builds_coordinator_interface',
],
)
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 0c717af02bf..f128d9c42e6 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -49,6 +49,7 @@
#include "mongo/db/concurrency/global_lock_acquisition_tracker.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/index/index_descriptor.h"
+#include "mongo/db/index_builds_coordinator.h"
#include "mongo/db/kill_sessions_local.h"
#include "mongo/db/logical_clock.h"
#include "mongo/db/logical_time.h"
@@ -2553,6 +2554,9 @@ void ReplicationCoordinatorImpl::_finishReplSetReconfig(
lk.unlock();
_performPostMemberStateUpdateAction(action);
_replExecutor->signalEvent(finishedEvent);
+
+ // Inform the index builds coordinator of the replica set reconfig.
+ IndexBuildsCoordinator::get(opCtx.get())->onReplicaSetReconfig();
}
Status ReplicationCoordinatorImpl::processReplSetInitiate(OperationContext* opCtx,
diff --git a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
index ece31e5739d..48a476609f1 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_heartbeat.cpp
@@ -40,6 +40,7 @@
#include "mongo/base/status.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
+#include "mongo/db/index_builds_coordinator.h"
#include "mongo/db/kill_sessions_local.h"
#include "mongo/db/logical_clock.h"
#include "mongo/db/logical_time_validator.h"
@@ -628,6 +629,9 @@ void ReplicationCoordinatorImpl::_heartbeatReconfigFinish(
_setCurrentRSConfig(lk, opCtx.get(), newConfig, myIndexValue);
lk.unlock();
_performPostMemberStateUpdateAction(action);
+
+ // Inform the index builds coordinator of the replica set reconfig.
+ IndexBuildsCoordinator::get(opCtx.get())->onReplicaSetReconfig();
}
void ReplicationCoordinatorImpl::_trackHeartbeatHandle_inlock(