diff options
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/SConscript | 17 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_recovery.cpp | 9 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_recovery_test.cpp | 2 |
3 files changed, 20 insertions, 8 deletions
diff --git a/src/mongo/db/repl/SConscript b/src/mongo/db/repl/SConscript index 735292c2cd6..81bf3b17a9e 100644 --- a/src/mongo/db/repl/SConscript +++ b/src/mongo/db/repl/SConscript @@ -273,6 +273,7 @@ env.Library( LIBDEPS_PRIVATE=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/storage/journal_flusher', + '$BUILD_DIR/mongo/db/storage/storage_control', '$BUILD_DIR/mongo/db/storage/storage_options', 'oplog', 'oplog_application', @@ -314,7 +315,7 @@ env.Library( source=[ 'scatter_gather_algorithm.cpp', 'scatter_gather_runner.cpp', - ], + ], LIBDEPS=[ '$BUILD_DIR/mongo/executor/task_executor_interface', ], @@ -816,7 +817,7 @@ env.Library( 'member_config.idl', 'repl_set_config.idl', 'repl_set_config_params.idl', - ], + ], LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/bson/util/bson_extract', @@ -967,7 +968,7 @@ env.Library( 'database_cloner.cpp', 'initial_sync_base_cloner.cpp', ], - LIBDEPS = [ + LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/client/clientdriver_network', '$BUILD_DIR/mongo/util/concurrency/thread_pool', @@ -997,7 +998,7 @@ env.Library( 'tenant_database_cloner.cpp', 'tenant_base_cloner.cpp', ], - LIBDEPS = [ + LIBDEPS=[ '$BUILD_DIR/mongo/base', '$BUILD_DIR/mongo/db/dbdirectclient', 'base_cloner', @@ -1248,7 +1249,7 @@ env.Library( env.Library( target='tenant_migration_errors', - source= [ + source=[ 'tenant_migration_conflict_info.cpp', ], LIBDEPS=[ @@ -1313,7 +1314,7 @@ env.Library( env.Library( target='tenant_migration_recipient_service', - source= [ + source=[ 'tenant_migration_recipient_service.cpp', ], LIBDEPS=[ @@ -1608,6 +1609,7 @@ if wiredtiger: '$BUILD_DIR/mongo/db/service_context_test_fixture', '$BUILD_DIR/mongo/db/stats/counters', '$BUILD_DIR/mongo/db/storage/ephemeral_for_test/storage_ephemeral_for_test_core', + '$BUILD_DIR/mongo/db/storage/storage_control', '$BUILD_DIR/mongo/db/transaction', '$BUILD_DIR/mongo/db/update/update_test_helpers', '$BUILD_DIR/mongo/dbtests/mocklib', @@ -1722,7 +1724,8 @@ env.CppUnitTest( 'tenant_cloner_test_fixture.cpp', ], LIBDEPS=[ - '$BUILD_DIR/mongo/db/auth/authmocks', # Required for service context test fixture + # Required for service context test fixture + '$BUILD_DIR/mongo/db/auth/authmocks', '$BUILD_DIR/mongo/db/catalog/collection_options', '$BUILD_DIR/mongo/db/service_context_d_test_fixture', '$BUILD_DIR/mongo/dbtests/mocklib', diff --git a/src/mongo/db/repl/replication_recovery.cpp b/src/mongo/db/repl/replication_recovery.cpp index e4f49e5c132..2af2027aaec 100644 --- a/src/mongo/db/repl/replication_recovery.cpp +++ b/src/mongo/db/repl/replication_recovery.cpp @@ -51,6 +51,7 @@ #include "mongo/db/server_recovery.h" #include "mongo/db/session.h" #include "mongo/db/storage/control/journal_flusher.h" +#include "mongo/db/storage/durable_history_pin.h" #include "mongo/db/storage/storage_parameters_gen.h" #include "mongo/db/transaction_history_iterator.h" #include "mongo/db/transaction_participant.h" @@ -551,13 +552,19 @@ void ReplicationRecoveryImpl::_recoverFromUnstableCheckpoint(OperationContext* o // When `recoverFromOplog` truncates the oplog, that also happens to set the "oldest // timestamp" to the truncation point[1]. `_applyToEndOfOplog` will then perform writes // before the truncation point. Doing so violates the constraint that all updates must be - // timestamped newer than the "oldest timestamp". This call will move the "oldest + // timestamped newer than the "oldest timestamp". So we will need to move the "oldest // timestamp" back to the `startPoint`. // + // Before doing so, we will remove any pins. Forcing the oldest timestamp backwards will + // error if there are pins in place, as those pin requests will no longer be satisfied. + // Recovering from an unstable checkpoint has no history in the first place. Thus, clearing + // pins has no real effect on history being held. + // // [1] This is arguably incorrect. On rollback for nodes that are not keeping history to // the "majority point", the "oldest timestamp" likely needs to go back in time. The // oplog's `cappedTruncateAfter` method was a convenient location for this logic, which, // unfortunately, conflicts with the usage above. + DurableHistoryRegistry::get(opCtx->getServiceContext())->clearPins(opCtx); opCtx->getServiceContext()->getStorageEngine()->setOldestTimestamp( appliedThrough.getTimestamp()); diff --git a/src/mongo/db/repl/replication_recovery_test.cpp b/src/mongo/db/repl/replication_recovery_test.cpp index 742313ddae1..e3818a07c71 100644 --- a/src/mongo/db/repl/replication_recovery_test.cpp +++ b/src/mongo/db/repl/replication_recovery_test.cpp @@ -50,6 +50,7 @@ #include "mongo/db/service_context_d_test_fixture.h" #include "mongo/db/session_catalog_mongod.h" #include "mongo/db/session_txn_record_gen.h" +#include "mongo/db/storage/durable_history_pin.h" #include "mongo/db/storage/storage_options.h" #include "mongo/db/storage/storage_parameters_gen.h" #include "mongo/db/transaction_participant.h" @@ -188,6 +189,7 @@ private: auto service = getServiceContext(); StorageInterface::set(service, std::make_unique<StorageInterfaceRecovery>()); _storageInterface = static_cast<StorageInterfaceRecovery*>(StorageInterface::get(service)); + DurableHistoryRegistry::set(service, std::make_unique<DurableHistoryRegistry>()); _createOpCtx(); _consistencyMarkers = std::make_unique<ReplicationConsistencyMarkersMock>(); |