shutdown command should log its parameters before shutting down

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 3.7.3
    • Affects Version/s: None
    • Component/s: Diagnostics
    • None
    • Fully Compatible
    • Sharding 2017-12-04, Sharding 2018-01-01, Sharding 2017-12-18
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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:

      Unable to find source-code formatter for language: diff. Available languages are: actionscript, ada, applescript, bash, c, c#, c++, cpp, css, erlang, go, groovy, haskell, html, java, javascript, js, json, lua, none, nyan, objc, perl, php, python, r, rainbow, ruby, scala, sh, sql, swift, visualbasic, xml, yaml
      -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.

            Assignee:
            Kevin Pulo
            Reporter:
            Kevin Pulo
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: