diff options
-rw-r--r-- | src/mongo/db/commands/kill_op.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/mongo/db/commands/kill_op.cpp b/src/mongo/db/commands/kill_op.cpp index bd0555b9364..baaf8106220 100644 --- a/src/mongo/db/commands/kill_op.cpp +++ b/src/mongo/db/commands/kill_op.cpp @@ -81,6 +81,12 @@ public: log() << "going to kill op: " << op; result.append("info", "attempting to kill op"); + // Internally opid is an unsigned 32-bit int, but as BSON only has signed integer types, + // we wrap values exceeding 2,147,483,647 to negative numbers. The following undoes this + // transformation, so users can use killOp on the (negative) opid they received. + if (op >= std::numeric_limits<int>::min() && op < 0) + op += 1ull << 32; + uassert(26823, str::stream() << "invalid op : " << op, (op >= 0) && (op <= std::numeric_limits<unsigned int>::max())); |