Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-36441

Don't truncate 'comment' command parameter in the slow query logs

    • Query Execution

      ISSUE DESCRIPTION

       

      Currently, the following behavior is observed for the $comment field displayed in the mongodb logs.

      • The $comment field's length gets truncated to 150 characters, when it is captured in the logs.
      • Increasing the value for maxLogSizeKB, makes no difference. The $comment field length still gets truncated in the logs at 150 characters.

      REPRODUCER

       

      1. The following command can be run in the mongo shell - note the `AB` at the end of the $comment string:

       

      replset:PRIMARY> db.<collectionName>.aggregate([ { $match: { $comment: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXAB"} } ])

       

      2. In the logs it will be observed that the $comment field gets truncated (note the `...` and no `AB` at the end):

      command test.<collectionName> appName: "MongoDB Shell" command: aggregate { aggregate: "<collectionName>", pipeline: [ { $match: { $comment: "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX..." } } ]

      3. Performing a character count on the length of the $comment field (the "XXXX...") will show they are `150 `characters.

       


      FEATURE REQUEST

      Requesting for a feature that allows for changing the length of the $comment field displayed in the logs.

       

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            harshad.dhavale@mongodb.com Harshad Dhavale
            Votes:
            3 Vote for this issue
            Watchers:
            20 Start watching this issue

              Created:
              Updated: