Fixed slow migration. - #50992
Conversation
|
@coderabbitai full review |
✅ Action performedFull review finished. |
There was a problem hiding this comment.
Warning
- Copilot's review of this pull request may be incomplete because some of the changed files are excluded by your Copilot content exclusion settings. See Excluding content from Copilot for details.
Pull request overview
This PR addresses the long-running Windows host certificate migration reported in #50933 by adjusting the migration’s batch-selection query to encourage a more efficient index choice during iteration.
Changes:
- Adds an explicit MySQL index hint (
FORCE INDEX (PRIMARY)) to the batchedSELECT hc.idquery used during the incremental soft-delete loop. - Includes a user-visible changes entry in
changes/(content excluded from review output per policy).
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server/datastore/mysql/migrations/tables/20260723181402_ReparseWindowsHostCertificates.go | Forces primary-key index usage for the batch ID scan to improve migration performance on large datasets. |
| changes/50933-slow-windows-host-certificate-migration | User-visible change log entry (content excluded by policy). |
Files excluded by content exclusion policy (1)
- changes/50933-slow-windows-host-certificate-migration
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #50992 +/- ##
==========================================
+ Coverage 68.53% 68.56% +0.02%
==========================================
Files 3978 3985 +7
Lines 256274 256669 +395
Branches 13627 13627
==========================================
+ Hits 175632 175977 +345
- Misses 65006 65046 +40
- Partials 15636 15646 +10
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
WalkthroughThe Windows host certificate migration now forces MySQL to use the Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
<!-- Add the related story/sub-task/bug number, like Resolves #123, or remove if NA --> **Related issue:** Resolves #50933 # Checklist for submitter If some of the following don't apply, delete the relevant line. - [x] Changes file added for user-visible changes in `changes/`, `orbit/changes/` or `ee/fleetd-chrome/changes`. See [Changes files](https://github.com/fleetdm/fleet/blob/main/docs/Contributing/guides/committing-changes.md#changes-files) for more information. ## Testing - [x] QA'd all new/changed functionality manually <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **Bug Fixes** - Improved the performance of database migrations for deployments with many Windows host certificates. - Reduced delays when identifying certificates for soft deletion during migration. <!-- end of auto-generated comment: release notes by coderabbit.ai --> (cherry picked from commit 1f923ad)
Related issue: Resolves #50933
Checklist for submitter
If some of the following don't apply, delete the relevant line.
changes/,orbit/changes/oree/fleetd-chrome/changes.See Changes files for more information.
Testing
Summary by CodeRabbit