Updated partition options#60
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This pull request makes partition management in pgqueue configurable by introducing new manager options (size, threshold, ahead count, and maintenance period), updating partition creation logic to honor those settings, and adjusting defaults to run maintenance more frequently.
Changes:
- Added manager options to configure partition sizing/creation behavior and maintenance ticker period.
- Updated
CreateNextPartitionto create multiple partitions ahead once the configured threshold is crossed. - Added a unit test covering custom threshold/ahead behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pgqueue/schema/schema.go | Adds default constants for partition threshold/ahead and reduces default maintenance period. |
| pgqueue/manager/opt.go | Introduces new configurable manager options with defaults and validation. |
| pgqueue/manager/partition.go | Implements threshold-based, multi-partition-ahead creation logic using the new options. |
| pgqueue/manager/manager.go | Registers the maintenance ticker using the configured maintenance period. |
| pgqueue/manager/partition_test.go | Adds a test validating partition creation with custom threshold and ahead count. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Coverage for this change: 13.5% |
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.
This pull request introduces configurable partition management options to the queue manager, enabling more flexible and efficient partition creation. It adds new options for partition size, threshold, and ahead count, updates the partition creation logic to use these options, and adjusts the default maintenance period. Unit tests are also added to ensure the new functionality works as expected.
Partition management enhancements:
WithPartitionSize), partition creation threshold (WithPartitionThreshold), number of partitions to create ahead (WithPartitionAhead), and maintenance period (WithMaintenancePeriod) in the manager options (opt.go). [1] [2] [3]CreateNextPartitionto use the configurable partition size, threshold, and ahead count, allowing multiple partitions to be created at once when the threshold is reached (partition.go). [1] [2]Default configuration changes:
schema.go).Ticker registration update:
manager.go).Testing improvements:
partition_test.go).