Skip to content

e2e: expand schema-upgrade coverage — gaps not covered by #426 #439

Closed

Description

@WentingWu666666

Context

Follow-up to #426, which adds the first two-phase extension schema-upgrade e2e spec (test/e2e/tests/upgrade/upgrade_schema_test.go). In review, @xgerman noted the PR intentionally covers only the happy-path single old→new hop and asked to file tickets for the explicit gaps. This issue tracks that future work.

Not covered by #426 (explicit gaps)

Acceptance

Each gap above is either covered by an e2e spec (with appropriate labels/level) or explicitly deferred with a documented rationale. ✅ Met — see the closing comment.

Follow-up to #426. Deferred work tracked in #448.

Activity

  1. added
    enhancement
    on Jul 31, 2026
  2. WentingWu666666 commented on Aug 13, 2026

    @WentingWu666666
    CollaboratorAuthor

    First two gaps addressed in #443 (draft):

    • spec.schemaVersion: "auto" single-step path
    • Rollback within the safe window (binary downgrade before finalize)

    Remaining: negative/failure paths, multi-instance/HA rollout ordering, and multi-version chain.

  3. WentingWu666666 commented on Aug 13, 2026

    @WentingWu666666
    CollaboratorAuthor

    Design proposal: fail-fast preflight for schema-upgrade path (re: ">1 minor jump")

    Splitting the "skip >1 minor" sub-item out for a design decision, because today the operator has no update-path validation anywhere — it runs a blanket ALTER EXTENSION documentdb UPDATE and relies entirely on PostgreSQL to resolve the path.

    Context: cadence forces us to support jumps

    The documentdb extension ships minors frequently (about monthly, at times bi-weekly). A user who upgrades quarterly is already 3+ minors behind; twice-a-year is 6+. Forcing adjacent-only (N to N+1) upgrades would mean 3–12 sequential rolling restarts to catch up, which pushes users to never upgrade. Conclusion: multi-minor jumps should be a first-class, supported path — not rejected.

    The risk to manage

    A jump only works if the extension ships a continuous chain of documentdb--A--B.sql update scripts. If any release forgets to publish its script, ALTER EXTENSION UPDATE fails at execution time with a raw PG error ("extension has no update path from X to Y"), re-fires every reconcile, and the user gets a cryptic failure with no actionable status.

    Proposal: preflight the path before migrating

    PostgreSQL exposes the update-path graph read-only:

    SELECT path FROM pg_extension_update_paths('documentdb')
    WHERE source = '0.109-0' AND target = '0.113-0';
    • Path resolvable -> non-NULL arrow-joined sequence.
    • No path -> path IS NULL -> fail-fast signal.

    Hook this into documentdb_controller.go immediately before the SQLExecutor(... updateSQL) call: if no path exists, skip ALTER EXTENSION, emit a Warning event + a SchemaUpgradeBlocked (reason NoUpdatePath) status condition naming the exact gap, and return cleanly (stable, no crash-loop).

    Today With preflight
    When failure is learned After firing ALTER EXTENSION Before touching schema
    Error quality Raw PG error in logs Actionable status condition + event
    Visibility Operator logs only status.conditions on the CR
    Loop behavior Errors every reconcile Clean stop

    Cheap static parts could also move to the validating webhook, but the path check needs DB connectivity, so the controller (which already has a SQL executor + cluster handle) is the pragmatic home.

    Proposed sequencing

    1. This PR (test(e2e): schema-upgrade coverage — auto, rollback, HA, unpullable version #443): implement the remaining test-only gaps (multi-instance/HA, multi-version chain, plus the non-jump negative paths), which do not require operator changes.
    2. Follow-up PR: implement this preflight (operator behavior change) and the e2e test for the >1-minor jump case together, once the contract below is ratified.

    Decision needed from maintainers

    • Confirm jumps should be supported (not rejected) given the release cadence.
    • Confirm the fail-fast contract: block + status condition when no update path exists (vs. attempt-and-surface-raw-error).
    • Confirm whether path validation belongs in the controller only, or also (statically) in the webhook.
  4. WentingWu666666 commented on Aug 24, 2026

    @WentingWu666666
    CollaboratorAuthor

    Closing — the acceptance criterion here ("each gap is either covered by an e2e spec or explicitly deferred with a documented rationale") is now met.

    Covered by #443 (merged):

    • spec.schemaVersion: "auto" single-step path
    • Rollback within the safe window (binary downgrade before finalize)
    • Multi-instance / HA rollout ordering, verifying replica schema convergence via pg_extension.extversion
    • Invalid / unpullable documentDBVersion

    Deferred to #448, with rationale: the three remaining gaps — migration failure, >1-minor jumps, and the multi-version chain — all hinge on the same unmade decision. The operator currently does no update-path validation at all: it fires a blanket ALTER EXTENSION documentdb UPDATE and lets PostgreSQL resolve the path. Writing e2e specs against that today would just pin in whatever behavior falls out, and the migration-failure case isn't even deterministically reachable without a broken update path to trigger it. #448 carries the design decision (fail-fast pg_extension_update_paths preflight + SchemaUpgradeBlocked condition), the implementation, and these three tests together, so the tests assert a ratified contract rather than an accident.

    #448 needs a maintainer call on three points before implementation starts — whether multi-minor jumps are supported (they should be, given the roughly monthly extension cadence), the fail-fast contract, and controller-vs-webhook placement. @xgerman @alaye-ms, that's the decision to weigh in on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancementtest

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions