Skip to content

Updated partition options#60

Merged
djthorpe merged 2 commits into
mainfrom
djt/0618/partition
Jun 18, 2026
Merged

Updated partition options#60
djthorpe merged 2 commits into
mainfrom
djt/0618/partition

Conversation

@djthorpe

Copy link
Copy Markdown
Member

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:

  • Added new options to configure partition size (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]
  • Updated CreateNextPartition to 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:

  • Changed the default partition creation threshold to 0.5, the default number of partitions to create ahead to 1, and reduced the default maintenance period from one hour to ten minutes (schema.go).

Ticker registration update:

  • Modified registration of the maintenance ticker to use the configurable maintenance period instead of the fixed default (manager.go).

Testing improvements:

  • Added a unit test to verify partition creation with custom threshold and ahead values (partition_test.go).

Copilot AI review requested due to automatic review settings June 18, 2026 08:04
@djthorpe djthorpe self-assigned this Jun 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 CreateNextPartition to 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.

Comment thread pgqueue/manager/partition.go
Comment thread pgqueue/manager/partition_test.go Outdated
@github-actions

Copy link
Copy Markdown

Coverage for this change: 13.5%

@djthorpe djthorpe merged commit 2c43a32 into main Jun 18, 2026
2 checks passed
@djthorpe djthorpe deleted the djt/0618/partition branch June 18, 2026 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants