Today I had an interesting question about the CTRL+C handler for the SQLIOSim console execution. After some investigation I found that a design change request is in order as the CTRL+C handler has a few holes- (I am working on that part).
The CTRL+C handler does not prompt you for something like ‘Do you wish to terminate the test (Y/N)?’. Instead the first time the CTRL+C is encountered a message is posted to all simulation threads indicating that the test should be shutdown gracefully. The messages are handled by each thread, shutting down the current and all future test cycles then returning control to the command line.
SQLIOSim is an MFC based application to handle the GUI needs and this is built as a windows console application to allow batch file/command line execution. What really happens during a CTRL+C is the same thing that happens when you press the ‘STOP’ button during a GUI test run. The CTRL+C handlers calls the button handler to execute code that sets the graceful shutdown in motion.
If you press the CTRL+C a second time a dump is taken and the an abrupt shutdown is triggered. Pressing the cancel in the GUI a second time does not initiate the abrupt shutdown.
The quirk in the CTRL+C handler is currently in the way a log-off or close window is handled. In most of these paths the testing will abruptly terminate.
Bob Dorr – Principal SQL Server Escalation Engineer