[SERVER-29546] Add hostname to standard $currentOp output, and include shard name when run on a cluster Created: 09/Jun/17 Updated: 30/Oct/23 Resolved: 02/Aug/17 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Aggregation Framework, Diagnostics |
| Affects Version/s: | None |
| Fix Version/s: | 3.5.10 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Bernard Gorman | Assignee: | Bernard Gorman |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||||||
| Sprint: | Query 2017-07-10 | ||||||||||||||||||||
| Participants: | |||||||||||||||||||||
| Description |
|
As tracked on In particular, we do not include the name of the shard/host from which each operation originated. We do prepend the opID of active operations with the shard name, as shown below:
However, inactive connections do not have an opID, and therefore contain no information identifying what shard/host they came from:
This means that something as simple as grouping by shard is cumbersome for active operations:
... and impossible for inactive connections. To better support aggregating the $currentOp output in a sharded cluster, each currentOp document should include the shard and host names when running in a sharded context. |
| Comments |
| Comment by Githook User [ 23/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
Author: {u'username': u'gormanb', u'name': u'Bernard Gorman', u'email': u'bernard.gorman@gmail.com'}Message: | ||||||||||||||||||||||||||||||||||||||
| Comment by David Storch [ 19/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
This proposal LGTM. I agree with James, I think the host information information should be supplied irrespective of whether the $currentOp or $collStats is running in a sharded environment. That helps to keep the format more consistent, and also will simplify the implementation a bit. | ||||||||||||||||||||||||||||||||||||||
| Comment by Bernard Gorman [ 19/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
james.wahlin - I hadn't originally intended to, since it's usually self-evident which host a $currentOp is reporting on in a non-sharded environment. However, it might be useful in the case that the user is running the aggregation with a non-Primary read preference, and in any case it would probably be good bookkeeping practice to include a 'host' field. Will update the ticket accordingly. | ||||||||||||||||||||||||||||||||||||||
| Comment by James Wahlin [ 19/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
bernard.gorman - would these fields be present when running currentOp against a replica set? There is precedent for providing 'host' information for both mongod and mongos with the $indexStats DocumentSource. | ||||||||||||||||||||||||||||||||||||||
| Comment by Bernard Gorman [ 17/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
Hey ian.whalen, This change would add two new fields, "shard" and "host", to the beginning of each document produced by $currentOp and $collStats. The values of these fields, both strings, would be the name of the shard and the hostname:port of the specific mongoD that output the document, respectively. For instance, the two sample $currentOp documents from my comment above would appear as follows after this change:
Thanks, | ||||||||||||||||||||||||||||||||||||||
| Comment by Ian Whalen (Inactive) [ 16/Jun/17 ] | ||||||||||||||||||||||||||||||||||||||
|
bernard.gorman can you put a proposal here for what this change would specifically do to currentOp and collStats? Response format, new fields? |