[SERVER-18972] shutdown command should log its parameters before shutting down Created: 15/Jun/15  Updated: 21/Feb/18  Resolved: 21/Feb/18

Status: Closed
Project: Core Server
Component/s: Diagnostics
Affects Version/s: None
Fix Version/s: 3.7.3

Type: Improvement Priority: Major - P3
Reporter: Kevin Pulo Assignee: Kevin Pulo
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Sharding 2017-12-04, Sharding 2018-01-01, Sharding 2017-12-18
Participants:

 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.



 Comments   
Comment by Githook User [ 21/Feb/18 ]

Author:

{'email': 'kevin.pulo@mongodb.com', 'name': 'Kevin Pulo', 'username': 'devkev'}

Message: SERVER-18972 log parameters passed to shutdown cmd
Branch: master
https://github.com/mongodb/mongo/commit/232c772546f26bcb5a5556d859e56002a4135f0b

Generated at Thu Feb 08 03:49:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.