Skip to content

fix(postgresql): parse PITR switch interval as decimal - #3392

Draft
weicao wants to merge 2 commits into
easton/pg-pitr-retention-ttl-base10from
easton/pg-pitr-switch-interval-base10
Draft

fix(postgresql): parse PITR switch interval as decimal#3392
weicao wants to merge 2 commits into
easton/pg-pitr-retention-ttl-base10from
easton/pg-pitr-switch-interval-base10

Conversation

@weicao

@weicao weicao commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Summary

  • parse validated SWITCH_WAL_INTERVAL_SECONDS explicitly as base 10 during PITR startup
  • preserve the existing default for unset or malformed input
  • cover leading-zero decimal intervals so Bash cannot silently shorten the WAL-switch throttle through octal interpretation

Candidate

Contract

  • kubeblocks-addon-docs/docs/addon-continuous-backup-pitr-chain-integrity-guide.md: Continuous backup must keep advancing its recoverable WAL chain without silent scheduling distortion
  • kubeblocks-addon-docs/docs/addon-api/09b-backup-extensions.md: Continuous/PITR archive production and time-range behavior must remain explainable and testable

TDD evidence

RED commit b8a04ccff:

  • configured SWITCH_WAL_INTERVAL_SECONDS=00300
  • elapsed time: 350 - 123 = 227s
  • expected decimal behavior: remain throttled until 300s, no PostgreSQL probe, checkpoint stays 123
  • observed before fix: interval remained 00300, Bash interpreted it as octal 192, probed PostgreSQL, and advanced checkpoint to 350
  • focused result: 1 example, 1 failure with 2 failed assertions

GREEN exact head 2865c1c85:

  • focused Bash 3.2: 61 examples, 0 failures
  • full PostgreSQL Bash 5.3: 274 examples, 0 failures
  • ShellCheck severity error: clean
  • Bash syntax and git diff --check: clean
  • Helm lint: 1 chart, 0 failures
  • Helm render: 41 documents, 1,012,462 bytes

Runtime boundary

This is source-level scheduling arithmetic and ShellSpec validation only. Runtime packaging, environment execution, cleanup, and formal acceptance counts remain Test-owned and are not claimed by this PR.

@weicao
weicao requested review from a team, ldming and leon-ape as code owners August 16, 2026 16:41
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 0% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 0.00%. Comparing base (cd5ef60) to head (2865c1c).

Files with missing lines Patch % Lines
...ons/postgresql/scripts-ut-spec/pitr_backup_spec.sh 0.00% 13 Missing ⚠️
Additional details and impacted files
@@                         Coverage Diff                         @@
##           easton/pg-pitr-retention-ttl-base10   #3392   +/-   ##
===================================================================
  Coverage                                 0.00%   0.00%           
===================================================================
  Files                                      195     195           
  Lines                                    28274   28287   +13     
===================================================================
- Misses                                   28274   28287   +13     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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