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

shutdown command should log its parameters before shutting down

    XMLWordPrintableJSON

Details

    • Icon: Improvement Improvement
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 3.7.3
    • None
    • Diagnostics
    • None
    • Fully Compatible
    • Sharding 2017-12-04, Sharding 2018-01-01, Sharding 2017-12-18

    Description

      There is a strong expectation that logLevel 1 can be used to log all commands that are run, along with their parameters. However, this only happens once the command has finished (so that timing info can be included).

      When the shutdown command succeeds, it does not finish (because the server exits), and so it isn't logged. This means that even at logLevel 1, it is impossible to know whether or not the shutdown was forced with force: true:

      Loglevel 1

      2015-06-15T20:36:29.735+1000 [conn1426] terminating, shutdown command received
      2015-06-15T20:36:29.735+1000 [conn1426] dbexit: shutdown called
      2015-06-15T20:36:29.735+1000 [conn1426] shutdown: going to close listening sockets...
      ...
      2015-06-15T20:36:29.852+1000 [conn1426] dbexit: really exiting now
      

      Loglevel 2

      2015-06-15T20:38:36.862+1000 [conn2] run command admin.$cmd { shutdown: 1.0, force: true }
      2015-06-15T20:38:36.862+1000 [conn2] command: { shutdown: 1.0, force: true }
      2015-06-15T20:38:36.862+1000 [conn2] terminating, shutdown command received
      2015-06-15T20:38:36.862+1000 [conn2] dbexit: shutdown called
      2015-06-15T20:38:36.862+1000 [conn2] shutdown: going to close listening sockets...
      ...
      2015-06-15T20:38:36.942+1000 [conn2] dbexit: really exiting now
      

      Suggested change is:

      -2015-06-15T20:36:29.735+1000 [conn1426] terminating, shutdown command received
      +2015-06-15T20:36:29.735+1000 [conn1426] terminating, shutdown command received { shutdown: 1.0, force: true }
       2015-06-15T20:36:29.735+1000 [conn1426] dbexit: shutdown called
       2015-06-15T20:36:29.735+1000 [conn1426] shutdown: going to close listening sockets...
       ...
       2015-06-15T20:36:29.852+1000 [conn1426] dbexit: really exiting now
      

      i.e. log the shutdown cmdObj at all logLevels.

      Should be straightforward to pass the cmdObj to shutdownHelper() (maybe optionally), since it's only called from the mongod and mongos shutdown command implementations, i.e. CmdShutdownMongoD and ClusterShutdownCmd, both of which have the cmdObj object available.

      Attachments

        Activity

          People

            kevin.pulo@mongodb.com Kevin Pulo
            kevin.pulo@mongodb.com Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: