feat: add --prioritize-fullness flag to undo-upmaps command#62
Open
bumarcell wants to merge 2 commits intodigitalocean:mainfrom
Open
feat: add --prioritize-fullness flag to undo-upmaps command#62bumarcell wants to merge 2 commits intodigitalocean:mainfrom
bumarcell wants to merge 2 commits intodigitalocean:mainfrom
Conversation
Add opt-in OSD utilization (fullness) consideration to the undo-upmaps command via the --prioritize-fullness flag. When enabled, the tool selects PGs to undo based on a composite score combining OSD fullness and backfill load, with fullness as the primary factor. Key features: - Fetches OSD df data to determine utilization percentage - Composite scoring: score = (backfillWeight * backfillScore) + (fullnessWeight * fullnessScore) - Default weights (backfillWeight=1, fullnessWeight=10) make a 1% fullness difference equivalent to ~1 backfill reservation slot - With --target flag: prioritizes removing PGs from fuller OSDs - Without --target: prioritizes moving PGs to emptier OSDs - Gracefully falls back to backfill-only scoring if OSD df data unavailable - Works with both replicated and EC pools This is especially useful after swap-bucket operations or when rebalancing clusters with uneven disk utilization. Implementation details: - Added osdBackfillState.utilization field to track OSD fullness - Added osdDf() function in ceph.go with caching - Modified remapLeastBusyPg() to accept scoreSource and preferFuller parameters - Added comprehensive tests for fullness scoring, tiebreaker logic, and fallback Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Add test coverage for OSD fullness prioritization: - TestRemapLeastBusyPgWithFullness: Basic fullness scoring - TestRemapLeastBusyPgWithoutFullness: Baseline behavior without flag - TestFullnessTiebreaker: Backfill load as tiebreaker when fullness equal - TestMissingOsdDfData: Graceful fallback when OSD df unavailable - Updated TestCalcPgMappingsToUndoUpmaps expectations for fixed scoring All tests verify correct behavior for both target and source modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add opt-in OSD utilization (fullness) consideration to the
undo-upmapscommand via the--prioritize-fullnessflag. When enabled, the tool selects PGs to undo based on a composite score combining OSD fullness and backfill load, with fullness as the primary factor.Motivation
After swap-bucket operations or in clusters with uneven disk utilization, it's often desirable to prioritize data movement based on OSD fullness rather than just backfill load. This allows operators to preferentially drain fuller OSDs or fill emptier ones, helping to rebalance storage utilization more effectively.
Key Features
score = (backfillWeight * backfillScore) + (fullnessWeight * fullnessScore)--targetflag: prioritizes removing PGs from fuller OSDs--target: prioritizes moving PGs to emptier OSDsImplementation Details
osdBackfillState.utilizationfield to track OSD fullnessosdDf()function inceph.gowith caching supportremapLeastBusyPg()to acceptscoreSourceandpreferFullerparameters for flexible scoringExample Usage
After a swap-bucket operation, prioritize draining the fuller OSDs:
With
--targetflag, bring data back from the fullest OSDs:Testing
All existing tests pass, and new tests cover:
$ go test -v PASS ok github.com/digitalocean/pgremapper 0.360sDocumentation
Co-Authored-By: Claude Sonnet 4.5 noreply@anthropic.com