Repository navigation
fix: upgrade documentdb_core before documentdb - #507
Conversation
Upgrade co-versioned dependencies first in a single transaction and repair existing mismatches when schema upgrades are authorized. Preserve two-phase behavior and leave independently versioned extensions unmanaged. Co-authored-by: Copilot <[email protected]> Copilot-Session: 251a6aad-1c9b-4e75-9768-1d79b8eb8a7f Signed-off-by: Wenting Wu <[email protected]>
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (controllers, test, docs); effort from diff stats (330+34 LOC, 9 files) If a label is wrong, ping |
Limit the fix to upgrading documentdb_core before documentdb in the existing upgrade transaction. Remove dependency prechecks and existing-mismatch repair while retaining same-target upgrades, existing schema gates, and focused regression coverage. Co-authored-by: Copilot <[email protected]> Copilot-Session: 251a6aad-1c9b-4e75-9768-1d79b8eb8a7f Signed-off-by: Wenting Wu <[email protected]>
Remove ExtensionDependencies and use the fixed documentdb-to-documentdb_core relationship only when the main extension is documentdb. Keep both upgrades in the same transaction and leave other products unchanged. Co-authored-by: Copilot <[email protected]> Copilot-Session: 251a6aad-1c9b-4e75-9768-1d79b8eb8a7f Signed-off-by: Wenting Wu <[email protected]>
Remove the duplicate primary-pod listing found during self-review and use the existing CNPG helper with explicit missing-primary handling. Co-authored-by: Copilot <[email protected]> Copilot-Session: 251a6aad-1c9b-4e75-9768-1d79b8eb8a7f Signed-off-by: Wenting Wu <[email protected]>
Move the fixed core-first transaction into ExtensionUpdateSQL and restore the reconciler unchanged. Auto upgrades use each packaged default; explicit upgrades use the same requested target for both extensions. Preserve standalone SQL for other extensions. Co-authored-by: Copilot <[email protected]> Copilot-Session: 251a6aad-1c9b-4e75-9768-1d79b8eb8a7f Signed-off-by: Wenting Wu <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
Irreversible extension migrations lack cluster E2E validation of core-first upgrades and transaction rollback on failure against packaged old/new engine images.
No open issues 🎉
What changed in this PR
Updates DocumentDB schema upgrades to upgrade documentdb_core before documentdb in one transaction, without changing reconciliation gates or other products’ upgrade behavior.
Changes:
- Applies explicit schema targets to both extensions; automatic upgrades use each extension’s packaged default.
- Adds SQL and controller assertions for core-first upgrades, plus end-to-end checks of both installed versions.
- Documents the behavior and the deferred repair of existing version mismatches.
| File | Description |
|---|---|
test/e2e/tests/upgrade/upgrade_schema_test.go |
Checks both extension versions after finalizing an upgrade. |
test/e2e/tests/upgrade/upgrade_schema_auto_test.go |
Checks both extension versions after an automatic upgrade. |
test/e2e/tests/upgrade/helpers_test.go |
Adds primary-pod lookup and requires installed extension versions to agree. |
operator/src/pkg/core/core.go |
Documents transactional, core-first upgrade behavior. |
operator/src/internal/product/documentdb.go |
Defines the DocumentDB core extension name. |
operator/src/internal/controller/documentdb_controller_test.go |
Verifies transactional SQL and explicit targets below the binary version. |
operator/src/internal/cnpg/extension_sql.go |
Generates core-first transactional SQL for DocumentDB upgrades. |
operator/src/internal/cnpg/extension_sql_test.go |
Covers default, explicit, and standalone extension upgrades. |
docs/designs/product-neutral-core.md |
Explains upgrade semantics and mismatch-repair limitations. |
Review effort: Balanced
Verification on a local kind clusterI tested on kind (Kubernetes 1.35, cert-manager 1.19.6) using the reproduction from #501 in ImageVolume mode, upgrading the engine from
Remaining gaps vs. #501 (non-blocking)
LGTM for the fix itself. |
xgerman
left a comment
There was a problem hiding this comment.
No new blocking findings at a337827.
Verified against packaged DocumentDB: an explicit 0.116-0 → 0.117-0 upgrade advances both extensions even with binary default 1.0-0; auto then advances both to 1.0-0. A failure in either statement returns nonzero from the single psql -c invocation, and a second-statement failure rolls back the core update. The inspected recent package defaults and upgrade edges agree between documentdb and documentdb_core.
Focused SQL/executor, engine/core, and controller upgrade tests passed; upgrade E2E compilation passed. No full cluster E2E run was performed in this review. The existing review already documents the CI execution gap and deferred repair of previously mismatched clusters.
- Release date 2026-11-17. - Add CHANGELOG entries for changes merged after the release PR was opened: OTel Collector outbound proxy (documentdb#476), documentdb_core upgraded with documentdb (documentdb#507), and stable documentation links and checks (documentdb#513, documentdb#514). documentdb#508 already added its own entry; documentdb#509 is internal. Co-authored-by: Copilot <[email protected]> Copilot-Session: 9f1a71b4-9969-4456-9f65-8d19dd550d8e Signed-off-by: Rayhan Hossain <[email protected]>
Summary
Addresses #501 for future engine upgrades.
ExtensionUpdateSQL, when the extension isdocumentdb, upgrade its fixed dependencydocumentdb_corefirst in one transaction.autouses each extension’s packaged default; an explicit schema version is applied to both extensions.Coverage and validation
internal/cnpg,internal/engine,internal/controller, andpkg/core; change-scoped lint withGODEBUG=gotypesalias=1.