Repository navigation
Description
These lifecycle, upgrade and settings gaps in the documentdb-local image were found by running the containers through restart, kill, recreate and image-upgrade scenarios.
Tested on release/1.0-RC2-v2 @ 40f86c0. The images (pg17, pg18) were built from packaging/gateway/docker/Dockerfile_documentdb_local the way CI builds them. Older volumes came from the published 1.0-rc1 and latest (0.117.0) images.
Related: #758 (secure defaults), #759 (init and quickstart), #688 (E2E coverage), #752 (admin can't create users).
Items
- A bind-mount volume is wedged for good if the first boot is interrupted
- Boot failures exit without stopping PostgreSQL, so every failed boot leaves crash recovery for the next one
- A newer image never runs
ALTER EXTENSION ... UPDATEon an existing volume - A PG major mismatch between volume and image gives only "start_oss_server.sh failed"
- A changed
--passwordon an existing volume is silently ignored -
--log-leveland--enable-telemetrydo nothing - Init data: a typo'd path is silent, scripts run on already-used volumes, and a failed seed is skipped forever
- Input validation is late or missing
- Log noise
1. Interrupted first boot on a bind mount
docker kill during the first-boot CREATE EXTENSION on an empty bind mount, then start again:
- The second boot refuses because of the stale
postmaster.pid. That message is good: it namesDOCUMENTDB_FORCE_REMOVE_STALE_POSTMASTER_PID=true. - With the override set, every boot fails with
schema "documentdb_api" does not exist/ "could not install the getParameter rejection stub".
PG_VERSION exists, so start_oss_server.sh skips setup, and nothing ever creates the extensions. Named volumes avoid this because of the baked template.
Expected: detect the half-initialized cluster and finish setup.
2. Failed boots skip PG shutdown
Several error paths in emulator_entrypoint.sh call exit instead of cleanup, so PostgreSQL is SIGKILLed. These include:
- the EnforceTls write
- PG never ready for admin creation
- admin creation failure
- the gateway readiness timeout
- any command failure after
utils.shinstalls its ERR trap
Example: a bad custom cert. The container exits after 65 s with "Gateway failed to start within 60 seconds" and no "Stopping PostgreSQL" line. The next boot logs removing /data/postmaster.pid ... left by an unclean stop and PG runs crash recovery. With --restart unless-stopped this loops every ~63 s.
The cert error itself should also be reported immediately: today the entrypoint waits the full 60 s polling a port the dead gateway will never open.
3. No extension update on image upgrade
We started a volume created by latest (0.117.0, PG17) under the RC2 PG17 image:
- The catalog stays
0.117-0while the binary is 1.0.0. - There is no warning and no
ALTER EXTENSION. - Basic CRUD and existing indexes worked. [engine] $lookup type-0 error, uncancellable string expressions, reindex retry and old-catalog failures #769 covers what breaks on an old catalog.
Neither emulator_entrypoint.sh nor start_oss_server.sh runs ALTER EXTENSION documentdb_core/documentdb/documentdb_extended_rum UPDATE.
4. PG major mismatch
A PG17 image on a PG18 volume (or the reverse, e.g. when latest moves) prints only start_oss_server.sh failed (status 1). The real reason ("database files are incompatible with server") is only in pglog.log inside the volume.
Expected: compare PG_VERSION with the server major before starting, and print which tag to use.
5. Password change ignored
Restarting with a new --password on an existing volume prints only Role u already exists.. The old password keeps working and the new one fails.
Combined with first-time INIT_DATA=true, the container exits 1 after 88 s with "did not become ready within 60 seconds", although the real cause is an auth failure.
Expected: update the password, or warn loudly that it was ignored.
6. No-op flags
--log-level and --enable-telemetry are validated and listed in --help, but nothing reads LOG_LEVEL or ENABLE_TELEMETRY. --log-level trace and --log-level quiet give identical gateway logs. The gateway reads DOCUMENTDB_LOG_LEVEL/RUST_LOG.
7. Init data
- A nonexistent
--init-data-pathprints "No initialization data loaded." and continues. - The docs say init data applies to fresh volumes, but scripts mounted on an already-used volume with no marker run on that boot.
- After a failed custom seed, later boots skip it forever and the container reports healthy without the data. It now warns, but the healthcheck still passes.
8. Validation
| Input | Behaviour |
|---|---|
| Gateway port 0 or 65536 | Fails only after 63-65 s. --pg-port 70000 is caught in 3 s |
--username --password |
Sets the username to "--password" |
| Username with a space | Accepted |
DOCUMENTDB_PORT == POSTGRESQL_PORT |
Fails fast, but as a Rust unwrap() panic |
--create-user false --init-data true |
Auth failure after 89 s |
Non-empty bind dir without PG_VERSION |
Message tells container users to pass a -c flag they can't pass |
| Data path with spaces | Fails: "pg_ctl: too many command-line arguments" |
--user 1001:1001 |
emulator_entrypoint.sh: Permission denied |
9. Logs
- Every gateway line appears twice in
docker logs: raw, and again with[GATEWAY-FILE]. - The
[GATEWAY]prefix the banner promises doesn't exist. - Readiness and healthcheck probes log gateway
ERROR ... Connection closedon every probe. FATAL: database "documentdb" does not existrepeats.- The TLS state-dir WARN appears on every boot.
Activity
guanzhousongmicrosoft commentedon Oct 6, 2026
1.0 blocker: item 3 (a newer image never updates the volume's extensions). The fix is in review. The other items don't block 1.0.
guanzhousongmicrosoft commentedon Nov 23, 2026
On main: item 3 (extensions are updated when the image is upgraded, 53e5456) and the
--log-levelpart of item 6 (e91dd04). #833 makes documentdb-local refuse a data path with whitespace or glob characters with a clear error instead of failing inpg_ctl. The other items are still open.