diff options
author | Geert Bosch <geert@mongodb.com> | 2016-03-10 14:54:56 -0500 |
---|---|---|
committer | Ramon Fernandez <ramon@mongodb.com> | 2016-03-29 17:24:52 -0400 |
commit | e01ce34903ad4047bce2400ec984e31f8ec6a871 (patch) | |
tree | dd202fdc01727c1e6e904340337620125026a374 | |
parent | 83da3a052de642e4222f8e90ac2cf22090c9b968 (diff) | |
download | mongo-e01ce34903ad4047bce2400ec984e31f8ec6a871.tar.gz |
SERVER-23066 Make killOp accept negative opid
(cherry picked from commit cbb3a09da470edae68fca624cca880582491a782)
-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())); |