summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
authorKevin Pulo <kevin.pulo@mongodb.com>2020-01-14 07:11:41 +0000
committerevergreen <evergreen@mongodb.com>2020-01-14 07:11:41 +0000
commitc4659b5d156bef2a503320e4e76ce3bf49e4fe9a (patch)
tree43e33ac040b5d1094909689826343ba567f8bfff /src/mongo
parent515b5d3510124d307e6db8c85b72c8f680ed37e1 (diff)
downloadmongo-c4659b5d156bef2a503320e4e76ce3bf49e4fe9a.tar.gz
SERVER-43246 Add a log line for when a cursor is reaped due to logical session cleanup
(cherry picked from commit 89c93866980e924c7ae91ca30b5bd3674727fe4f) SERVER-45277 Temporarily blacklist sharding/kill_sessions.js in multiversion (cherry picked from commit 532b4a761e27d3ffa3b852fd3e936190dd5d2461)
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/cursor_manager.cpp1
-rw-r--r--src/mongo/s/query/cluster_cursor_manager.cpp1
-rw-r--r--src/mongo/scripting/mozjs/internedstring.defs1
-rw-r--r--src/mongo/scripting/mozjs/numberlong.cpp18
-rw-r--r--src/mongo/scripting/mozjs/numberlong.h1
5 files changed, 22 insertions, 0 deletions
diff --git a/src/mongo/db/cursor_manager.cpp b/src/mongo/db/cursor_manager.cpp
index a577689f4dc..cfbf832362b 100644
--- a/src/mongo/db/cursor_manager.cpp
+++ b/src/mongo/db/cursor_manager.cpp
@@ -90,6 +90,7 @@ std::pair<Status, int> CursorManager::killCursorsWithMatchingSessions(
OperationContext* opCtx, const SessionKiller::Matcher& matcher) {
auto eraser = [&](CursorManager& mgr, CursorId id) {
uassertStatusOK(mgr.killCursor(opCtx, id, true));
+ log() << "killing cursor: " << id << " as part of killing session(s)";
};
auto bySessionCursorKiller = makeKillCursorsBySessionAdaptor(opCtx, matcher, std::move(eraser));
diff --git a/src/mongo/s/query/cluster_cursor_manager.cpp b/src/mongo/s/query/cluster_cursor_manager.cpp
index 8c901ef8afb..15ac5d3ef34 100644
--- a/src/mongo/s/query/cluster_cursor_manager.cpp
+++ b/src/mongo/s/query/cluster_cursor_manager.cpp
@@ -680,6 +680,7 @@ std::pair<Status, int> ClusterCursorManager::killCursorsWithMatchingSessions(
return;
}
uassertStatusOK(mgr.killCursor(opCtx, *cursorNss, id));
+ log() << "killing cursor: " << id << " as part of killing session(s)";
};
auto bySessionCursorKiller = makeKillCursorsBySessionAdaptor(opCtx, matcher, std::move(eraser));
diff --git a/src/mongo/scripting/mozjs/internedstring.defs b/src/mongo/scripting/mozjs/internedstring.defs
index 89900e5c35c..a02b5d680b2 100644
--- a/src/mongo/scripting/mozjs/internedstring.defs
+++ b/src/mongo/scripting/mozjs/internedstring.defs
@@ -19,6 +19,7 @@ MONGO_MOZJS_INTERNED_STRING(defaultDB, "defaultDB")
MONGO_MOZJS_INTERNED_STRING(dollar_db, "$db")
MONGO_MOZJS_INTERNED_STRING(dollar_id, "$id")
MONGO_MOZJS_INTERNED_STRING(dollar_ref, "$ref")
+MONGO_MOZJS_INTERNED_STRING(exactValueString, "exactValueString")
MONGO_MOZJS_INTERNED_STRING(_fields, "_fields")
MONGO_MOZJS_INTERNED_STRING(fileName, "fileName")
MONGO_MOZJS_INTERNED_STRING(flags, "flags")
diff --git a/src/mongo/scripting/mozjs/numberlong.cpp b/src/mongo/scripting/mozjs/numberlong.cpp
index 32163e6c31e..5150d3134f7 100644
--- a/src/mongo/scripting/mozjs/numberlong.cpp
+++ b/src/mongo/scripting/mozjs/numberlong.cpp
@@ -130,6 +130,13 @@ void NumberLongInfo::Functions::floatApprox::call(JSContext* cx, JS::CallArgs ar
ValueReader(cx, args.rval()).fromDouble(numLong);
}
+void NumberLongInfo::Functions::exactValueString::call(JSContext* cx, JS::CallArgs args) {
+ str::stream ss;
+ int64_t val = NumberLongInfo::ToNumberLong(cx, args.thisv());
+ ss << val;
+ ValueReader(cx, args.rval()).fromStringData(ss.operator std::string());
+}
+
void NumberLongInfo::Functions::top::call(JSContext* cx, JS::CallArgs args) {
auto numULong = static_cast<uint64_t>(NumberLongInfo::ToNumberLong(cx, args.thisv()));
ValueReader(cx, args.rval()).fromDouble(numULong >> 32);
@@ -236,6 +243,17 @@ void NumberLongInfo::postInstall(JSContext* cx, JS::HandleObject global, JS::Han
JSPROP_ENUMERATE)) {
uasserted(ErrorCodes::JSInterpreterFailure, "Failed to JS_DefinePropertyById");
}
+
+ // exactValueString
+ if (!JS_DefinePropertyById(
+ cx,
+ proto,
+ getScope(cx)->getInternedStringId(InternedString::exactValueString),
+ smUtils::wrapConstrainedMethod<Functions::exactValueString, false, NumberLongInfo>,
+ nullptr,
+ JSPROP_ENUMERATE)) {
+ uasserted(ErrorCodes::JSInterpreterFailure, "Failed to JS_DefinePropertyById");
+ }
}
} // namespace mozjs
diff --git a/src/mongo/scripting/mozjs/numberlong.h b/src/mongo/scripting/mozjs/numberlong.h
index 354a229d79c..ec2f18e50cd 100644
--- a/src/mongo/scripting/mozjs/numberlong.h
+++ b/src/mongo/scripting/mozjs/numberlong.h
@@ -63,6 +63,7 @@ struct NumberLongInfo : public BaseInfo {
MONGO_DECLARE_JS_FUNCTION(floatApprox);
MONGO_DECLARE_JS_FUNCTION(top);
MONGO_DECLARE_JS_FUNCTION(bottom);
+ MONGO_DECLARE_JS_FUNCTION(exactValueString);
};
static const JSFunctionSpec methods[6];