summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mongo/db/SConscript2
-rw-r--r--src/mongo/db/read_concern_mongod.cpp25
-rw-r--r--src/mongo/db/read_concern_mongod.idl42
3 files changed, 55 insertions, 14 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 3f54d790b39..1f9b5f59d73 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -1110,8 +1110,10 @@ env.Library(
target="read_concern_d_impl",
source=[
"read_concern_mongod.cpp",
+ env.Idlc('read_concern_mongod.idl')[0],
],
LIBDEPS_PRIVATE=[
+ "$BUILD_DIR/mongo/idl/server_parameter",
"$BUILD_DIR/mongo/s/grid",
"catalog_raii",
"curop",
diff --git a/src/mongo/db/read_concern_mongod.cpp b/src/mongo/db/read_concern_mongod.cpp
index d20f4ad7b38..2837d64b29e 100644
--- a/src/mongo/db/read_concern_mongod.cpp
+++ b/src/mongo/db/read_concern_mongod.cpp
@@ -37,11 +37,11 @@
#include "mongo/db/logical_clock.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context.h"
+#include "mongo/db/read_concern_mongod_gen.h"
#include "mongo/db/repl/repl_client_info.h"
#include "mongo/db/repl/speculative_majority_read_info.h"
#include "mongo/db/s/sharding_state.h"
#include "mongo/db/server_options.h"
-#include "mongo/db/server_parameters.h"
#include "mongo/db/transaction_participant.h"
#include "mongo/s/grid.h"
#include "mongo/util/concurrency/notification.h"
@@ -54,8 +54,8 @@ namespace {
MONGO_FAIL_POINT_DEFINE(hangBeforeLinearizableReadConcern);
/**
-* Synchronize writeRequests
-*/
+ * Synchronize writeRequests
+ */
class WriteRequestSynchronizer;
const auto getWriteRequestsSynchronizer =
@@ -66,10 +66,10 @@ public:
WriteRequestSynchronizer() = default;
/**
- * Returns a tuple <false, existingWriteRequest> if it can find the one that happened after or
- * at clusterTime.
- * Returns a tuple <true, newWriteRequest> otherwise.
- */
+ * Returns a tuple <false, existingWriteRequest> if it can find the one that happened after or
+ * at clusterTime.
+ * Returns a tuple <true, newWriteRequest> otherwise.
+ */
std::tuple<bool, std::shared_ptr<Notification<Status>>> getOrCreateWriteRequest(
LogicalTime clusterTime) {
stdx::unique_lock<stdx::mutex> lock(_mutex);
@@ -84,8 +84,8 @@ public:
}
/**
- * Erases writeRequest that happened at clusterTime
- */
+ * Erases writeRequest that happened at clusterTime
+ */
void deleteWriteRequest(LogicalTime clusterTime) {
stdx::unique_lock<stdx::mutex> lock(_mutex);
auto el = _writeRequests.find(clusterTime.asTimestamp());
@@ -100,12 +100,9 @@ private:
std::map<Timestamp, std::shared_ptr<Notification<Status>>> _writeRequests;
};
-
-MONGO_EXPORT_SERVER_PARAMETER(waitForSecondaryBeforeNoopWriteMS, int, 10);
-
/**
-* Schedule a write via appendOplogNote command to the primary of this replica set.
-*/
+ * Schedule a write via appendOplogNote command to the primary of this replica set.
+ */
Status makeNoopWriteIfNeeded(OperationContext* opCtx, LogicalTime clusterTime) {
repl::ReplicationCoordinator* const replCoord = repl::ReplicationCoordinator::get(opCtx);
invariant(replCoord->isReplEnabled());
diff --git a/src/mongo/db/read_concern_mongod.idl b/src/mongo/db/read_concern_mongod.idl
new file mode 100644
index 00000000000..3369135c567
--- /dev/null
+++ b/src/mongo/db/read_concern_mongod.idl
@@ -0,0 +1,42 @@
+# Copyright (C) 2019-present MongoDB, Inc.
+#
+# This program is free software: you can redistribute it and/or modify
+# it under the terms of the Server Side Public License, version 1,
+# as published by MongoDB, Inc.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# Server Side Public License for more details.
+#
+# You should have received a copy of the Server Side Public License
+# along with this program. If not, see
+# <http://www.mongodb.com/licensing/server-side-public-license>.
+#
+# As a special exception, the copyright holders give permission to link the
+# code of portions of this program with the OpenSSL library under certain
+# conditions as described in each individual source file and distribute
+# linked combinations including the program with the OpenSSL library. You
+# must comply with the Server Side Public License in all respects for
+# all of the code used other than as permitted herein. If you modify file(s)
+# with this exception, you may extend this exception to your version of the
+# file(s), but you are not obligated to do so. If you do not wish to do so,
+# delete this exception statement from your version. If you delete this
+# exception statement from all source files in the program, then also delete
+# it in the license file.
+
+global:
+ cpp_namespace: mongo
+
+server_parameters:
+ waitForSecondaryBeforeNoopWriteMS:
+ description: >-
+ The length of time (in milliseconds) that a secondary must wait if the afterClusterTime
+ is greater than the last applied time from the oplog. After the
+ waitForSecondaryBeforeNoopWriteMS passes, if the afterClusterTime is still greater than
+ the last applied time, the secondary makes a no-op write to advance the last applied
+ time.
+ set_at: [startup, runtime]
+ cpp_vartype: AtomicWord<int>
+ cpp_varname: waitForSecondaryBeforeNoopWriteMS
+ default: 10