Fix inverted cpuset assignment#1863
Open
nix-oss wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Hi, @nix-oss welcome!🎊 Thanks for taking the effort to make our project better! 🙌 Keep making such awesome contributions!
tuhaihe
reviewed
Jul 26, 2026
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.
Fixes #1862
What does this PR do?
Fix inverted cpuset assignment in
getCpuSetByRole(). The function returned the wrong cpuset for coordinator and segment roles when the cpuset string contains a semicolon separator (e.g., "0-7;0-15"). This caused incorrect CPU affinity settings on clusters.Additionally, this PR addresses the suggestion from the @my-ship-it to return a palloc'd copy instead of a pointer into the caller's string.
A unit test for
getCpuSetByRole()is also added to guard against future regressions.Type of Change
Test Plan
Impact
Performance:
This fix ensures that CPU cores are assigned to the coordinator and segments exactly as configured by the administrator. It prevents unintended usage of cores that may be reserved for other critical system tasks.
User-facing changes:
Users can now successfully set cpuset strings with a semicolon separator (e.g.,
ALTER RESOURCE GROUP ... SET CPUSET '4-7;9-17') without receiving a "cpu cores unavailable" error.Checklist