Skip to content

Handle exotic partition bounds and refuse DEFAULT partitions - #70

Merged
vyruss merged 1 commit into
mainfrom
fix/partition-bound-edge-cases
Jul 30, 2026
Merged

Handle exotic partition bounds and refuse DEFAULT partitions#70
vyruss merged 1 commit into
mainfrom
fix/partition-bound-edge-cases

Conversation

@vyruss

@vyruss vyruss commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

If the archiver couldn't read a partition bound, it aborted the run for tables that came after it alphabetically. Now the bound parser covers PG's full date range, including the BC era suffix and years wider than four digits, and open edges (MINVALUE, MAXVALUE, infinity) resolve to timestamps outside that range,
which no real bound can equal, so the existing comparisons hold unchanged. Timestamp rendering consolidated into one helper in sqlutil.

DEFAULT partitions are refused at registration. Their rows can never tier or expire, and PostgreSQL refuses concurrent detach of every partition of a table that has one, which is how we expire partitions.

Closes #68
Closes #69

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@vyruss, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 9618bcb0-8e51-41cb-84bf-87c5fc577c81

📥 Commits

Reviewing files that changed from the base of the PR and between 9908d89 and 8f26c6d.

📒 Files selected for processing (12)
  • ci/journey.sh
  • cmd/archiver/main.go
  • docs/usage.md
  • internal/partcfg/commands.go
  • internal/partcfg/commands_test.go
  • internal/partition/boundary.go
  • internal/partition/boundary_test.go
  • internal/partition/partition.go
  • internal/partition/partition_test.go
  • internal/sqlutil/sqlutil.go
  • internal/sqlutil/sqlutil_test.go
  • internal/view/view.go
📝 Walkthrough

Walkthrough

Changes

The archiver now parses and renders PostgreSQL timestamps across BC-era, wide-future, infinite, and open partition bounds. Registration rejects DEFAULT partitions, documentation describes these rules, and tiered E2E coverage validates archiver completion and cutover.

Exotic partition bounds

Layer / File(s) Summary
PostgreSQL timestamp literal formatting
internal/sqlutil/*, cmd/archiver/main.go, internal/view/view.go
Adds shared PostgreSQL timestamp formatting for positive and BC-era times and uses it in generated SQL boundaries.
Extended partition-bound parsing
internal/partition/*
Supports open bounds, BC dates, large years, and leap days while rejecting non-timestamp tokens.
DEFAULT partition registration validation
internal/partcfg/*, docs/usage.md
Detects DEFAULT partitions through PostgreSQL catalogs, validates errors, and documents registration constraints.
Tiered archiver regression story
ci/journey.sh
Exercises unusual partition bounds, verifies BC partition cutover, and confirms DEFAULT partition registration is rejected.

Estimated code review effort: 4 (Complex) | ~45 minutes

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Out of Scope Changes check ⚠️ Warning The DEFAULT-partition validation, docs, and E2E story are unrelated to the linked BC/year-10000 crash issues. Split the DEFAULT-partition work into a separate PR or link the issue that requires it.
Docstring Coverage ⚠️ Warning Docstring coverage is 76.47% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The bound-parsing changes address the BC and 10000+ crash cases in #68 and #69, preventing archiver aborts on those partitions.
Title check ✅ Passed The title clearly summarizes the two main changes: exotic partition-bound handling and DEFAULT partition rejection.
Description check ✅ Passed The description accurately describes the bound-parsing fixes and DEFAULT partition registration rule.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/partition-bound-edge-cases

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/sqlutil/sqlutil.go`:
- Around line 25-30: Update Timestamp so it converts t to UTC before checking
the year, then use that same UTC value for both the positive-year and BC
formatting branches. This ensures the era is determined from the rendered UTC
instant.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: b0b42e2b-67be-4f9b-a3e2-33225e11af91

📥 Commits

Reviewing files that changed from the base of the PR and between 466b726 and 9908d89.

📒 Files selected for processing (12)
  • ci/journey.sh
  • cmd/archiver/main.go
  • docs/usage.md
  • internal/partcfg/commands.go
  • internal/partcfg/commands_test.go
  • internal/partition/boundary.go
  • internal/partition/boundary_test.go
  • internal/partition/partition.go
  • internal/partition/partition_test.go
  • internal/sqlutil/sqlutil.go
  • internal/sqlutil/sqlutil_test.go
  • internal/view/view.go

Comment thread internal/sqlutil/sqlutil.go
@codacy-production

codacy-production Bot commented Jul 30, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 9 complexity · 0 duplication

Metric Results
Complexity 9
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@vyruss
vyruss force-pushed the fix/partition-bound-edge-cases branch from 9908d89 to 8f26c6d Compare July 30, 2026 20:55
@vyruss
vyruss merged commit 0a976a6 into main Jul 30, 2026
6 checks passed
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.

Archiver crashes on year 10000+ partition boundaries Archiver crashes on tables with BC date partition boundaries

1 participant