diff options
author | Geert Bosch <geert@mongodb.com> | 2016-03-10 14:54:56 -0500 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2016-03-11 07:46:23 -0500 |
commit | cbb3a09da470edae68fca624cca880582491a782 (patch) | |
tree | 02a3f5b576f63d729568c6b411f09cef4e2cb253 | |
parent | 7ed2327abb1168d7f89e3cd05c8740eee20dcdde (diff) | |
download | mongo-cbb3a09da470edae68fca624cca880582491a782.tar.gz |
SERVER-23066 Make killOp accept negative opid
-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())); |