[SERVER-18094] currentOp on a mongoS should also show current mongoS operations Created: 17/Apr/15  Updated: 17/May/19  Resolved: 15/Mar/18

Status: Closed
Project: Core Server
Component/s: Diagnostics, Sharding
Affects Version/s: None
Fix Version/s: 3.7.4

Type: New Feature Priority: Major - P3
Reporter: Joanna Cheng Assignee: Bernard Gorman
Resolution: Done Votes: 2
Labels: curop, currentop, supportgrab2018Q1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-33462 Allow killop on a mongos op id Closed
is depended on by SERVER-33283 Add test coverage for case where pinn... Closed
is depended on by SERVER-33700 Adapt invalidate_cursors.js to run ki... Closed
Documented
is documented by DOCS-11566 Docs for SERVER-18094: currentOp on a... Closed
Duplicate
is duplicated by SERVER-28649 Create a currentRouterOps command in ... Closed
is duplicated by SERVER-33268 Put description of command request in... Closed
is duplicated by SERVER-25354 users on mongos should always be able... Closed
Related
related to SERVER-32103 CTRL-C in mongo shell does not termin... Backlog
related to SERVER-6496 provide a way to kill a sharded query... Closed
related to SERVER-4984 make it possible to interrupt operati... Closed
related to SERVER-33939 Improve logging in sharded clusters t... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v3.6, v3.4
Sprint: Query 2018-02-26, Query 2018-03-12, Query 2018-03-26
Participants:
Case:

 Description   

When there is a long running operation in a sharded cluster, if you run currentOp() on the mongoS, you can see the shard operations:

		{
			"desc" : "conn6",
			"threadId" : "0x7ff5c34124b0",
			"connectionId" : 6,
			"opid" : "shard01:26",
			"active" : true,
			"secs_running" : 6,
			"microsecs_running" : NumberLong(6237133),
			"op" : "query",
			"ns" : "test",
			"query" : {
				"$eval" : function () { for(i=0; i<5; i++) { db.bar.findOne(); sleep(10000)}}
			},
			"client_s" : "10.8.1.231:52889",
			"numYields" : 0,
			"locks" : {
				"Global" : "W",
				"MMAPV1Journal" : "w"
			},
			"waitingForLock" : false,
			"lockStats" : {
				"Global" : {
					"acquireCount" : {
						"r" : NumberLong(2),
						"W" : NumberLong(1)
					}
				},
				"MMAPV1Journal" : {
					"acquireCount" : {
						"w" : NumberLong(1)
					}
				},
				"Database" : {
					"acquireCount" : {
						"r" : NumberLong(2)
					}
				},
				"Collection" : {
					"acquireCount" : {
						"R" : NumberLong(2)
					}
				}
			}
		},

While it's possible to tell which mongoS it came from, it's not possible to trace it back further unless you have verbose logging on the mongoS. It would be nice to be able to find the source of the long running operation directly from currentOp output.

If you are running a query, you could use $comment to annotate the query. However for other operations (writes, commands, internal things like chunk migrations, etc) there is no such feature.



 Comments   
Comment by Bernard Gorman [ 31/May/18 ]

david.storch: correct - localOps has not been backported nor will it be, and the 3.6 commit above just extracts a client metadata bugfix that was included in the full localOps patch on master.

Comment by David Storch [ 31/May/18 ]

bernard.gorman, it looks like the cherry-pick to 3.6 was in fact just a fix for ClientMetadata, correct? We have not backported the localOps parameter to the 3.6 branch, nor do we intend to. Should we delete the comment from the githook above in order to clarify the situation?

Comment by Githook User [ 29/May/18 ]

Author:

{'username': 'gormanb', 'name': 'Bernard Gorman', 'email': 'bernard.gorman@gmail.com'}

Message: SERVER-18094 Add 'localOps' parameter to $currentOp to show local mongoS operations

Note: this commit does not include the complete patch, but only backports the fix for a client metadata issue discovered during work on localOps. 

(cherry picked from commit 5ecf2c0a5bffa837c96ad20dea23a94c5165739a)
Branch: v3.6
https://github.com/mongodb/mongo/commit/9d31a95079287684db5e8f9edc60cfc2d9785121

Comment by Githook User [ 16/Mar/18 ]

Author:

{'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'}

Message: SERVER-18094 Tag currentop_query.js to resolve test failures on mobile variants
Branch: master
https://github.com/mongodb/mongo/commit/fafb34dda41840937f062ab0a48fd784d63b8803

Comment by Githook User [ 15/Mar/18 ]

Author:

{'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'}

Message: SERVER-18094 Add 'localOps' parameter to $currentOp to show local mongoS operations
Branch: master
https://github.com/mongodb/mongo/commit/5ecf2c0a5bffa837c96ad20dea23a94c5165739a

Comment by Kaloian Manassiev [ 11/Jan/18 ]

Sounds good to me.

Comment by David Storch [ 11/Jan/18 ]

kaloian.manassiev, the query team is looking into achieving this work as part of the logging improvements we're making for mongos. I'm going to move this one to our team's backlog as well. Let me know if you have any objections.

Generated at Thu Feb 08 03:46:33 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.