Skip to content

Provide options to control shutdown#423

Merged
SimonCropp merged 1 commit intoSimonCropp:mainfrom
mattjohnsonpint:shutdown-options
Apr 30, 2022
Merged

Provide options to control shutdown#423
SimonCropp merged 1 commit intoSimonCropp:mainfrom
mattjohnsonpint:shutdown-options

Conversation

@mattjohnsonpint
Copy link
Copy Markdown
Contributor

When shutting down the database, there are some options provided by the underlying LocalDBStopInstance function to control shutdown mode and timeout.

Previously, the shutdown mode was hardcoded to dwFlag 0 (uses the SHUTDOWN T-SQL statement), and a timeout of 10 seconds.
Rather than hardcoding these, it would be useful if they could be controlled.

The only public API that currently calls into this is SqlInstance.Cleanup - which does a shutdown and delete. For that code path, it makes more sense for the default behavior to shutdown as fast as possible by killing the process (dwFlag 1). No need to have SQL cleanup if we're just going to delete the datafiles anyway.

For the other code paths (used only in tests currently), I left the default as it was previously.

After this is incorporated, it might later make sense to figure out which tests should keep the database running and which should close it. Presently, running all tests leaves many orphaned processes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants