Skip to content

Engine upgrade doesn't update the documentdb_core extension #501

Open

Description

@hossain-rayhan

Summary

On an engine upgrade, the operator runs ALTER EXTENSION documentdb UPDATE but never updates documentdb_core. After the upgrade the cluster has mismatched extension versions.

Reproduction (Azure Local, combined image mode, operator 1.1.0)

  1. Create a cluster on the 0.117.0 test build (spec.image.documentDB/gateway = …:0.117.0-build-42184844433-1-f6af3d1). Both extensions are 0.117-0.
  2. Update the binary to 1.0.0 (spec.image: null, spec.documentDBVersion: "1.0.0").
  3. Finalize with spec.schemaVersion: "1.0.0".
select extname, extversion from pg_extension where extname like 'documentdb%';
 documentdb      | 1.0-0
 documentdb_core | 0.117-0     <- not updated

A fresh 1.0.0 cluster has both on 1.0-0, and pg_available_extensions shows documentdb_core default version 1.0-0 on the upgraded cluster.

Cause

HandleExtensionUpgrade / DetermineSchemaTarget only update r.extensionName() (documentdb): operator/src/internal/engine/extension.go:127, :267, :307. PostgreSQL's ALTER EXTENSION doesn't update dependencies. Upstream's upgrade procedure updates core first (documentdb-local/scripts/documentdb-setup.sh at v1.0-0):

-- ALTER EXTENSION does not update dependencies, so upgrade core first.
ALTER EXTENSION documentdb_core UPDATE;
ALTER EXTENSION documentdb UPDATE;

Impact

  • 0.117 → 1.0: none in practice; upstream documentdb_core--0.117-0--1.0-0.sql is empty.
  • Any future release whose documentdb_core upgrade script isn't empty: upgraded clusters run a new documentdb on an old documentdb_core.
  • status.schemaVersion reports 1.0.0 while core is still 0.117-0.

Suggested fix

Update dependent extensions (documentdb_core, then documentdb) in one transaction, to the same target version, both for auto and explicit schemaVersion. Consider making the dependency list part of the product profile (internal/product/documentdb.go). Add a test that checks both extension versions after an upgrade, plus an E2E check in the combined-mode engine-upgrade test.

Activity

  1. added
    bug
    on Nov 6, 2026
  2. added
    go
    on Nov 6, 2026
  3. documentdb-triage-tool commented on Nov 6, 2026

    @documentdb-triage-tool

    🤖 Auto-triaged by documentdb-triage-tool.

    Applied: go
    Project fields suggested: Component controllers · Priority P2 · Effort M · Status Triage
    Confidence: 0.88 (llm)

    Reasoning

    LLM: Engine upgrade leaves documentdb_core at the old version, causing extension version mismatch; well-diagnosed with a clear fix, contained to the extension upgrade logic in one component.

    If a label is wrong, remove it manually and ping @patty-chow so the rules can be tuned. The bot will not re-label items that already have component labels.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggo

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions