[SERVER-29794] Adding a comment to all commands Created: 22/Jun/17  Updated: 30/Oct/23  Resolved: 24/Sep/19

Status: Closed
Project: Core Server
Component/s: Logging
Affects Version/s: None
Fix Version/s: 4.3.1

Type: New Feature Priority: Minor - P4
Reporter: James Phelan (Inactive) Assignee: Arun Banala
Resolution: Fixed Votes: 5
Labels: storch
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-39951 Change existing $out tests to use com... Backlog
is depended on by DRIVERS-742 Add support for the comment field to ... Closed
Documented
is documented by DOCS-13051 Investigate changes in SERVER-29794: ... Closed
Duplicate
is duplicated by SERVER-33716 $comment is internally converted to a... Closed
is duplicated by SERVER-33118 Allow top-level comment field on comm... Closed
is duplicated by SERVER-39955 Add support for a "comment" parameter... Closed
Problem/Incident
causes SERVER-58403 Serialize concurrent accesses to `Ope... Closed
Related
related to SERVER-45002 Addition of "comment" field to getMor... Closed
related to SERVER-63315 Count command only accepts a string c... Closed
related to SERVER-43284 Extend shell helpers to allow setting... Backlog
related to SERVER-36441 Don't truncate 'comment' command para... Backlog
related to SERVER-45579 Remove FCV check guarding addition of... Closed
is related to SERVER-39955 Add support for a "comment" parameter... Closed
Backwards Compatibility: Fully Compatible
Sprint: Query 2019-07-29, Query 2019-08-12, Query 2019-08-26, Query 2019-09-09, Query 2019-09-23, Query 2019-10-07
Participants:
Case:
Linked BF Score: 46

 Description   

The following proposed feature request would allow comments to be added to bulk operations. The comment should behave similar to cursor.comment().

The requested functionality is as follows:

  • Allow a configurable comment be added to bulk.execute() commands.
  • When using a sharded collection if the bulk operation is directed at more than one shard the same comment should appear for the bulk operation across all shards.
  • If a more verbose log level is enabled that shows the individual operation for the bulk operation the same comment should be present on these individual operations.
  • The comment should appear in the mongod logs, system.profile and db.currentOp().


 Comments   
Comment by David Bartley [ 10/Oct/20 ]

Comment by David Storch [ 09/Oct/20 ]

Hi bartle! Due to the complexity of the changes in this patch and the upgrade/downgrade implications, I'd be reluctant to attempt a backport of this improvement to 4.2 and earlier. There are upgrade/downgrade implications because older versions may reject commands with a comment field, causing commands sent between nodes in the cluster during an upgrade or downgrade to fail. We are using featureCompatibilityVersion ensure that the comment parameter is only fully available once the featureCompatibilityVersion is set to "4.4". I think by backporting this to 4.2.x, for example, we could break the minor version upgrade from 4.2.(x-1) to 4.2.x. See linked ticket SERVER-45002 for details on the upgrade/downgrade related implications of this ticket.

Comment by David Bartley [ 06/Oct/20 ]

Would it be possible to backport this to 4.2, 4.0. and 3.6?

Comment by Arun Banala [ 14/Jul/20 ]

jeff.yemin Yes, the comment can be any BSON value.

Comment by Jeffrey Yemin [ 14/Jul/20 ]

arun.banala can the comment be any BSON value, or only string or document? e.g. is this allowed:

{
   find: "test",
   comment: true
}

Comment by Githook User [ 25/Sep/19 ]

Author:

{'name': 'Arun Banala', 'username': 'banarun', 'email': 'arun.banala@10gen.com'}

Message: SERVER-29794 Fix failing tests
Branch: master
https://github.com/mongodb/mongo/commit/f686020621ea0098ed615f1d825e8f2444010dcd

Comment by David Bartley [ 25/Sep/19 ]

Thanks, that's great!

Comment by Arun Banala [ 24/Sep/19 ]

bartle, james.phelan: This feature is now implemented. The 'comment' field can now be attached as a top level field to any command. The 'comment' attached to a command will be visible on system.profile, $currentOp and logs for the corresponding command. Additionally, a comment attached to 'find' or 'aggregate' would appear on system.profile, $currentOp and logs of the corresponding 'getMore' request.

Comment by Githook User [ 24/Sep/19 ]

Author:

{'username': 'banarun', 'email': 'arun.banala@10gen.com', 'name': 'Arun Banala'}

Message: SERVER-29794 Adding a comment to all commands
Branch: master
https://github.com/mongodb/mongo/commit/60518c8920064b30df53129ea880dacfcb04be71

Comment by David Bartley [ 22/Mar/19 ]

Any update on this?  More specifically, is there any reason not to just allow "comment" as a top-level field on every command?  We include various metadata in the comment (tracing information, caller information/stack frame), so it's rather convenient to have that available on all commands in a uniform and consistent manner.  The change itself should be straightforward; just add a "comment" entry in src/mongo/db/command_generic_argument.cpp.

Comment by Ian Whalen (Inactive) [ 23/Jun/17 ]

Expanding the scope of this ticket to cover all CRUD commands.

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