MDEV-41080 startup code on Windows, remove checks for existing service - #5729
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The service dispatch table can prevent installed services from starting correctly.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates Windows startup handling to use SCM dispatching, report errors, and rely on SCM-provided service names.
Changes:
- Removes service-existence heuristics.
- Adds Event Log reporting for startup errors.
- Uses the service name supplied by SCM.
| File | Summary |
|---|---|
sql/winmain.cc |
Critical issue: use NULL rather than an empty service name in the dispatch table. The file header also needs updating to reflect the new startup behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
No-argument service invocations still bypass the service dispatcher and fail to connect to the SCM.
Get a fresh assessment by requesting another Copilot review.
Review effort: Balanced
Findings: 1
Resolved since last review (1)
sanja-byelkin
left a comment
There was a problem hiding this comment.
Please remove magic number if possible otherwise it is good (as far as I can check :) )
c08dc5a to
9212d9c
Compare
They were not necessary, just try to run as service, and fallback to command line. Add some diagnostics - unexpected errors from StartServiceCtrlDispatcher and RegisterServiceCtrlHandler are now reported to Windows event log. Also use authoritative service name, returned as first argument in svc_main by service control manager.
9212d9c to
707f1a6
Compare

Summary
is_existing_serviceheuristic; always attemptStartServiceCtrlDispatcherand fall back to running as a normal process if that failsStartServiceCtrlDispatcher/RegisterServiceCtrlHandlerto the Windows Event Logsvc_mainby the Service Control Manager, instead of guessing it from the command line🤖 Generated with Claude Code