SERVER-106210 add server parameter to turn on async oplog (#38510)

GitOrigin-RevId: 0a4a835d3955a6c7e6d903a516bfc2a66fbdafcb
This commit is contained in:
adelinexchen 2025-07-24 13:14:58 +10:00 committed by MongoDB Bot
parent 57257d9ad6
commit e83005b5d4
2 changed files with 14 additions and 1 deletions

View File

@ -73,3 +73,11 @@ server_parameters:
default: 300
validator: {gt: 300}
redact: false
oplogSamplingAsyncEnabled:
description: "Whether or not oplog sampling is running asynchronously to startup."
set_at: [startup]
cpp_vartype: "bool"
cpp_varname: gOplogSamplingAsyncEnabled
default: true
redact: false

View File

@ -117,7 +117,12 @@ std::shared_ptr<OplogTruncateMarkers> OplogTruncateMarkers::sampleAndUpdate(Oper
std::shared_ptr<OplogTruncateMarkers> OplogTruncateMarkers::createOplogTruncateMarkers(
OperationContext* opCtx, RecordStore& rs) {
if (!feature_flags::gOplogSamplingAsyncEnabled.isEnabled()) {
bool samplingAsynchronously =
feature_flags::gOplogSamplingAsyncEnabled.isEnabled() && gOplogSamplingAsyncEnabled;
LOGV2(10621000,
"Creating oplog markers",
"sampling asynchronously"_attr = samplingAsynchronously);
if (!samplingAsynchronously) {
return sampleAndUpdate(opCtx, rs);
}
return createEmptyOplogTruncateMarkers(rs);