[SERVER-23066] killOp should accept negative opid Created: 10/Mar/16  Updated: 21/Nov/16  Resolved: 11/Mar/16

Status: Closed
Project: Core Server
Component/s: Internal Code, Usability
Affects Version/s: 3.2.4
Fix Version/s: 3.2.5, 3.3.3

Type: Bug Priority: Major - P3
Reporter: Geert Bosch Assignee: Geert Bosch
Resolution: Done Votes: 0
Labels: code-only
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-8567 Large enough Opid will overflow when ... Backlog
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Steps To Reproduce:

diff --git a/src/mongo/db/operation_context_impl.cpp b/src/mongo/db/operation_context_impl.cpp
index b773395..7fa1e5c 100644
--- a/src/mongo/db/operation_context_impl.cpp
+++ b/src/mongo/db/operation_context_impl.cpp
@@ -70,7 +70,7 @@ private:
 
 const auto clientOperationInfoDecoration = Client::declareDecoration<ClientOperationInfo>();
 
-AtomicUInt32 nextOpId{1};
+AtomicUInt32 nextOpId{0x80000000};
 }  // namespace

and start a shell and do :

db.fsyncLock()

there and in another shell get the opid and kill it.

Sprint: Integration 11 (03/14/16)
Participants:
Case:

 Description   

As opid is a 32-bit unsigned type internally, but is reported by currentOp as 32-bit signed type, values exceeding 2,147,483,647 are reported as negative numbers. These numbers result in uassert 26823, "invalid op", requiring users to add 2**32 themselves (using the double or NumberLong type) for killing operations. Instead accept negative opids, and do the addition in killOp.



 Comments   
Comment by Githook User [ 29/Mar/16 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-23066 Make killOp accept negative opid

(cherry picked from commit cbb3a09da470edae68fca624cca880582491a782)
Branch: v3.2
https://github.com/mongodb/mongo/commit/e01ce34903ad4047bce2400ec984e31f8ec6a871

Comment by Githook User [ 11/Mar/16 ]

Author:

{u'username': u'GeertBosch', u'name': u'Geert Bosch', u'email': u'geert@mongodb.com'}

Message: SERVER-23066 Make killOp accept negative opid
Branch: master
https://github.com/mongodb/mongo/commit/cbb3a09da470edae68fca624cca880582491a782

Comment by Geert Bosch [ 10/Mar/16 ]

While this issue is related, SERVER-8567 is about it being desirable to not show negative opIds, while this ticket is about killOp not being able to kill using that same negative opId.

Generated at Thu Feb 08 04:02:16 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.