diff options
author | Benety Goh <benety@mongodb.com> | 2019-10-18 19:31:56 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-18 19:31:56 +0000 |
commit | c00bee5ceaaff758eb01975f58d1c7a09432dea0 (patch) | |
tree | fe71fdc6327813a2c2b3915bf1a1ac92de345f77 /src/mongo/db/repl | |
parent | 4706c3bebf74c942f6ff9cab905027f053fbdc95 (diff) | |
download | mongo-c00bee5ceaaff758eb01975f58d1c7a09432dea0.tar.gz |
SERVER-39484 IndexBuildsCoordinator receives notifications on rollback/step up to primary
This partially restores some of the replication state transition functions removed in
commit adab6702bc9869557c14eb8b0e888c6e854f4593.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/SConscript | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_external_state_impl.cpp | 3 |
3 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript index cc60be2e808..5069a772f10 100644 --- a/src/mongo/db/repl/SConscript +++ b/src/mongo/db/repl/SConscript @@ -128,6 +128,7 @@ env.Library( '$BUILD_DIR/mongo/client/connection_pool', '$BUILD_DIR/mongo/client/fetcher', '$BUILD_DIR/mongo/db/concurrency/write_conflict_exception', + '$BUILD_DIR/mongo/db/index_builds_coordinator_interface', '$BUILD_DIR/mongo/db/service_context', '$BUILD_DIR/mongo/util/concurrency/thread_pool', ], @@ -1197,6 +1198,7 @@ env.Library( 'repl_server_parameters', '$BUILD_DIR/mongo/db/commands/mongod_fcv', '$BUILD_DIR/mongo/db/commands/test_commands_enabled', + '$BUILD_DIR/mongo/db/index_builds_coordinator_interface', ], ) diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp index 497a0fefca9..39cb42f86f7 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -45,6 +45,7 @@ #include "mongo/db/concurrency/replication_state_transition_lock_guard.h" #include "mongo/db/concurrency/write_conflict_exception.h" #include "mongo/db/dbhelpers.h" +#include "mongo/db/index_builds_coordinator.h" #include "mongo/db/repl/data_replicator_external_state_impl.h" #include "mongo/db/repl/oplog.h" #include "mongo/db/repl/oplog_interface_local.h" @@ -633,6 +634,8 @@ void BackgroundSync::_runRollback(OperationContext* opCtx, // are visible before potentially truncating the oplog. storageInterface->waitForAllEarlierOplogWritesToBeVisible(opCtx); + IndexBuildsCoordinator::get(opCtx)->onRollback(opCtx); + auto storageEngine = opCtx->getServiceContext()->getStorageEngine(); if (!forceRollbackViaRefetch.load() && storageEngine->supportsRecoverToStableTimestamp()) { log() << "Rollback using 'recoverToStableTimestamp' method."; diff --git a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp index e7489542f40..23611a79206 100644 --- a/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_external_state_impl.cpp @@ -53,6 +53,7 @@ #include "mongo/db/dbdirectclient.h" #include "mongo/db/dbhelpers.h" #include "mongo/db/free_mon/free_mon_mongod.h" +#include "mongo/db/index_builds_coordinator.h" #include "mongo/db/jsobj.h" #include "mongo/db/kill_sessions_local.h" #include "mongo/db/logical_clock.h" @@ -468,6 +469,8 @@ OpTime ReplicationCoordinatorExternalStateImpl::onTransitionToPrimary(OperationC _dropAllTempCollections(opCtx); + IndexBuildsCoordinator::get(opCtx)->onStepUp(opCtx); + notifyFreeMonitoringOnTransitionToPrimary(); // It is only necessary to check the system indexes on the first transition to master. |