summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSpencer Jackson <spencer.jackson@mongodb.com>2019-02-21 10:54:41 -0500
committerSpencer Jackson <spencer.jackson@mongodb.com>2019-02-25 13:16:17 -0500
commitc856af8f3ad9c2ad204362101b4f007f3fe28b17 (patch)
tree3542b69f24cbd7c4474699dbca3ba38e685c0cd9
parent4dbea5ed56d85b291fdf373a4100fce17704229b (diff)
downloadmongo-c856af8f3ad9c2ad204362101b4f007f3fe28b17.tar.gz
SERVER-39536 Convert src/mongo/db/cursor_server_params.cpp to IDL
-rw-r--r--src/mongo/db/SConscript5
-rw-r--r--src/mongo/db/cursor_server_params.cpp17
-rw-r--r--src/mongo/db/cursor_server_params.idl45
3 files changed, 52 insertions, 15 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 1f9b5f59d73..32047ea9dbc 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -1989,9 +1989,10 @@ env.Library(
target='cursor_server_params',
source=[
'cursor_server_params.cpp',
+ env.Idlc('cursor_server_params.idl')[0],
],
- LIBDEPS=[
- '$BUILD_DIR/mongo/db/server_parameters',
+ LIBDEPS_PRIVATE=[
+ "$BUILD_DIR/mongo/idl/server_parameter",
],
)
diff --git a/src/mongo/db/cursor_server_params.cpp b/src/mongo/db/cursor_server_params.cpp
index 7287d3748d0..b6038539c6b 100644
--- a/src/mongo/db/cursor_server_params.cpp
+++ b/src/mongo/db/cursor_server_params.cpp
@@ -31,30 +31,21 @@
#include "mongo/db/cursor_server_params.h"
+#include "mongo/db/cursor_server_params_gen.h"
#include "mongo/db/server_parameters.h"
namespace mongo {
-namespace {
-
-static constexpr Minutes kDefaultCursorTimeoutMinutes{10};
-
-MONGO_EXPORT_SERVER_PARAMETER(clientCursorMonitorFrequencySecs, int, 4);
-MONGO_EXPORT_SERVER_PARAMETER(cursorTimeoutMillis,
- long long,
- durationCount<Milliseconds>(kDefaultCursorTimeoutMinutes));
-
-} // namespace
int getClientCursorMonitorFrequencySecs() {
- return clientCursorMonitorFrequencySecs.load();
+ return gClientCursorMonitorFrequencySecs.load();
}
long long getCursorTimeoutMillis() {
- return cursorTimeoutMillis.load();
+ return gCursorTimeoutMillis.load();
}
Milliseconds getDefaultCursorTimeoutMillis() {
- return kDefaultCursorTimeoutMinutes;
+ return Milliseconds(kCursorTimeoutMillisDefault);
}
} // namespace mongo
diff --git a/src/mongo/db/cursor_server_params.idl b/src/mongo/db/cursor_server_params.idl
new file mode 100644
index 00000000000..480e9ea7466
--- /dev/null
+++ b/src/mongo/db/cursor_server_params.idl
@@ -0,0 +1,45 @@
+# 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:
+ clientCursorMonitorFrequencySecs:
+ description: 'Interval at which expired cursors are identified and reaped'
+ set_at: [startup, runtime]
+ cpp_vartype: AtomicWord<int>
+ cpp_varname: gClientCursorMonitorFrequencySecs
+ default: 4
+
+ cursorTimeoutMillis:
+ description: 'Period of time, in milliseconds, after which mortal cursors are killed for inactivity'
+ set_at: [startup, runtime]
+ cpp_vartype: AtomicWord<long long>
+ cpp_varname: gCursorTimeoutMillis
+ default: 600000