diff --git a/src/mongo/db/storage/oplog_truncate_marker_parameters.idl b/src/mongo/db/storage/oplog_truncate_marker_parameters.idl index 0d6d3ef9f81..9412b931f09 100644 --- a/src/mongo/db/storage/oplog_truncate_marker_parameters.idl +++ b/src/mongo/db/storage/oplog_truncate_marker_parameters.idl @@ -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 diff --git a/src/mongo/db/storage/oplog_truncate_markers.cpp b/src/mongo/db/storage/oplog_truncate_markers.cpp index f97045097c1..e5f6aa493a3 100644 --- a/src/mongo/db/storage/oplog_truncate_markers.cpp +++ b/src/mongo/db/storage/oplog_truncate_markers.cpp @@ -117,7 +117,12 @@ std::shared_ptr OplogTruncateMarkers::sampleAndUpdate(Oper std::shared_ptr 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);