Skip to content

Commit a86207e

Browse files
committed
Describe the 1.0 to 1.2 package upgrade
The 1.2 setup restarts PostgreSQL itself when it still runs the replaced libraries, and a re-run without --admin-user keeps the admin passwords. The old steps reset the admin password and only covered v0.116/v0.117. Signed-off-by: Guanzhou Song <26541184+GuanzhouSong@users.noreply.github.com>
1 parent 82519c0 commit a86207e

3 files changed

Lines changed: 39 additions & 35 deletions

File tree

‎PACKAGE-INSTALL.md‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,11 @@ The current release publishes PostgreSQL 17 and 18. Install `documentdb-17` or
368368

369369
## Upgrading an existing install
370370

371-
Package installs from v0.116 or v0.117 upgrade in place to 1.0. Move the entire stack
371+
Package installs from 1.0.0 upgrade in place to 1.2. Move the entire stack
372372
together; upgrading only `postgresql-N-documentdb` does not update the gateway, tools, common
373373
payload, or `documentdb-N`. These steps use systemd; upgrading a host without it isn't covered here.
374+
There is no downgrade: an older release starts on the updated catalog, but some commands then fail,
375+
so back up the data directory first if you may need to go back.
374376
On a package-managed private PostgreSQL 18 instance:
375377

376378
> **Warning:** A host that ran a 1.0 release candidate (RC1 or RC2) has no upgrade path. Use a
@@ -391,18 +393,17 @@ sudo dnf upgrade documentdb-18 postgresql18-documentdb \
391393
documentdb-common documentdb-gateway documentdb-postgresql-tools
392394
```
393395

394-
Upgrading the packages does not update the database catalog. The simplest way is to restart
395-
PostgreSQL so it loads the new libraries, then re-run setup with the options you installed with.
396-
Setup updates the extensions and then starts the gateway:
396+
Upgrading the packages does not update the database catalog. Re-run setup with the PostgreSQL
397+
major, plus any `--data-dir` or `--pg-port` you installed with. It restarts PostgreSQL once to
398+
load the new libraries, updates the extensions, and then starts the gateway:
397399

398400
```bash
399-
sudo systemctl restart documentdb-postgresql@18.service &&
400-
sudo documentdb-setup --pg-version 18 --use-new-postgres-instance --admin-user admin
401+
sudo documentdb-setup --pg-version 18 --yes
401402
```
402403

403-
Setup adds any missing `shared_preload_libraries` entries and updates the extensions, but only in
404-
the `postgres` database. If your gateway uses another database, take the manual route below. It also asks for the admin password and sets it on the existing admin
405-
user: enter the current password to keep it.
404+
Without `--admin-user`, setup asks for no password and keeps every admin user and password as
405+
they are. It adds any missing `shared_preload_libraries` entries and updates the extensions, but only in
406+
the `postgres` database. If your gateway uses another database, take the manual route below.
406407

407408
To update by hand, or for every other database that has DocumentDB installed, first check that
408409
the extended RUM library is preloaded:
@@ -411,7 +412,7 @@ the extended RUM library is preloaded:
411412
sudo -u documentdb-local psql -h /run/documentdb-local/18/postgresql -p 9718 -d postgres -X -Atc "SHOW shared_preload_libraries;"
412413
```
413414

414-
If `pg_documentdb_extended_rum` is missing (possible on a 0.116 install), add it before updating;
415+
If `pg_documentdb_extended_rum` is missing (possible on a host first set up with 0.116), add it before updating;
415416
the update below would succeed without it, and index builds would fail later. If the gateway uses
416417
`postgres`, re-run setup as above. If it uses another database, add the library to
417418
`shared_preload_libraries` in the instance's `postgresql.conf` yourself: setup would point the
@@ -439,12 +440,11 @@ On a host with both PostgreSQL 17 and 18, `documentdb-common`, `documentdb-gatew
439440
(`documentdb-gateway-local@17.service` and `@18.service`) before upgrading, then update each major.
440441

441442
For an adopted PostgreSQL instance, setup never restarts PostgreSQL. Stop the gateway
442-
(`documentdb-gateway-local@18.service`) before upgrading, restart the operator-managed PostgreSQL
443-
service yourself, then re-run
444-
`documentdb-setup --pg-version 18 --target-postgres-instance 18/main --admin-user admin` (with your cluster name); it
445-
updates the extensions and then starts the gateway. If
446-
setup has to change `shared_preload_libraries`, it exits without updating the extensions: restart
447-
PostgreSQL and run it once more. By hand, use that instance's own `psql` connection.
443+
(`documentdb-gateway-local@18.service`) before upgrading, then run
444+
`sudo documentdb-setup --target-postgres-instance 18/main --yes` (with your cluster name). It
445+
prints the command that restarts your PostgreSQL service and the setup command to run after it,
446+
then exits without updating the extensions. Run both; the second run updates the extensions and
447+
starts the gateway. By hand, use that instance's own `psql` connection.
448448

449449
Confirm afterwards with:
450450

‎app/services/articleService.ts‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ The current official release publishes the full stack — extension, gateway, se
196196
**Recommended:** install the complete stack, then create a new private PostgreSQL 18 instance. The commands detect architecture on the Linux host where you run them. For containers or macOS/Windows evaluation, choose [Docker installation](/packages?method=docker).
197197
198198
> [!IMPORTANT]
199-
> Already running v0.116 or v0.117 from packages? Follow [Upgrading](/docs/linux-packages#upgrading) instead of installing again. Hosts that ran a 1.0 release candidate have no upgrade path; use a clean host. Removing packages preserves database files; reinstalling is not a data reset.
199+
> Already running 1.0 from packages? Follow [Upgrading](/docs/linux-packages#upgrading) instead of installing again. Hosts that ran a 1.0 release candidate have no upgrade path; use a clean host. Removing packages preserves database files; reinstalling is not a data reset.
200200
201201
> [!NOTE]
202202
> Need another distribution or PostgreSQL major? We welcome community builds. Check out the \`v1.2-0\` tag, pass \`--version 1.2.0\`, and use the version-parameterized [packaging scripts](https://github.com/documentdb/documentdb/blob/v1.2-0/packaging/README.md). \`build_packages.sh\` builds the extension, \`gateway/build_gateway_packages.sh\` builds the gateway, and \`build_extra_packages.sh\` builds the common, tools, stand-alone, and meta packages. PostgreSQL 15 is extension-only because the setup tools require PostgreSQL 16 or newer. These builds are on demand and are not official release assets hosted by documentdb.io.
@@ -438,9 +438,11 @@ For an adopted instance, use the operator's existing PostgreSQL connection inste
438438
439439
## Upgrading
440440
441-
Package installs from v0.116 or v0.117 upgrade in place to 1.0. Move the entire stack
441+
Package installs from 1.0.0 upgrade in place to 1.2. Move the entire stack
442442
together; upgrading only \`postgresql-N-documentdb\` does not update the gateway, tools,
443443
common payload, or \`documentdb-N\`. These steps use systemd; upgrading a host without it isn't covered here.
444+
There is no downgrade: an older release starts on the updated catalog, but some commands then fail,
445+
so back up the data directory first if you may need to go back.
444446
On a package-managed private PostgreSQL 18 instance:
445447
446448
> [!WARNING]
@@ -463,18 +465,17 @@ sudo dnf upgrade documentdb-18 postgresql18-documentdb \\
463465
documentdb-common documentdb-gateway documentdb-postgresql-tools
464466
\`\`\`
465467
466-
Upgrading the packages does not update the database catalog. The simplest way is to restart
467-
PostgreSQL so it loads the new libraries, then re-run setup with the options you installed with.
468-
Setup updates the extensions and then starts the gateway:
468+
Upgrading the packages does not update the database catalog. Re-run setup with the PostgreSQL
469+
major, plus any \`--data-dir\` or \`--pg-port\` you installed with. It restarts PostgreSQL once to
470+
load the new libraries, updates the extensions, and then starts the gateway:
469471
470472
\`\`\`bash
471-
sudo systemctl restart documentdb-postgresql@18.service &&
472-
sudo documentdb-setup --pg-version 18 --use-new-postgres-instance --admin-user admin
473+
sudo documentdb-setup --pg-version 18 --yes
473474
\`\`\`
474475
475-
Setup adds any missing \`shared_preload_libraries\` entries and updates the extensions, but only in
476-
the \`postgres\` database. If your gateway uses another database, take the manual route below. It also asks for the admin password and sets it on the existing admin
477-
user: enter the current password to keep it.
476+
Without \`--admin-user\`, setup asks for no password and keeps every admin user and password as
477+
they are. It adds any missing \`shared_preload_libraries\` entries and updates the extensions, but only in
478+
the \`postgres\` database. If your gateway uses another database, take the manual route below.
478479
479480
To update by hand, or for every other database that has DocumentDB installed, first check that
480481
the extended RUM library is preloaded:
@@ -483,7 +484,7 @@ the extended RUM library is preloaded:
483484
sudo -u documentdb-local psql -h /run/documentdb-local/18/postgresql -p 9718 -d postgres -X -Atc "SHOW shared_preload_libraries;"
484485
\`\`\`
485486
486-
If \`pg_documentdb_extended_rum\` is missing (possible on a 0.116 install), add it before updating;
487+
If \`pg_documentdb_extended_rum\` is missing (possible on a host first set up with 0.116), add it before updating;
487488
the update below would succeed without it, and index builds would fail later. If the gateway uses
488489
\`postgres\`, re-run setup as above. If it uses another database, add the library to
489490
\`shared_preload_libraries\` in the instance's \`postgresql.conf\` yourself: setup would point the
@@ -511,12 +512,11 @@ On a host with both PostgreSQL 17 and 18, \`documentdb-common\`, \`documentdb-ga
511512
(\`documentdb-gateway-local@17.service\` and \`@18.service\`) before upgrading, then update each major.
512513
513514
For an adopted PostgreSQL instance, setup never restarts PostgreSQL. Stop the gateway
514-
(\`documentdb-gateway-local@18.service\`) before upgrading, restart the operator-managed PostgreSQL
515-
service yourself, then re-run
516-
\`documentdb-setup --pg-version 18 --target-postgres-instance 18/main --admin-user admin\` (with your cluster name); it
517-
updates the extensions and then starts the gateway. If
518-
setup has to change \`shared_preload_libraries\`, it exits without updating the extensions: restart
519-
PostgreSQL and run it once more. By hand, use that instance's own \`psql\` connection.
515+
(\`documentdb-gateway-local@18.service\`) before upgrading, then run
516+
\`sudo documentdb-setup --target-postgres-instance 18/main --yes\` (with your cluster name). It
517+
prints the command that restarts your PostgreSQL service and the setup command to run after it,
518+
then exits without updating the extensions. Run both; the second run updates the extensions and
519+
starts the gateway. By hand, use that instance's own \`psql\` connection.
520520
521521
## Remove or reset
522522

‎tests/packageArticles.test.ts‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -589,9 +589,13 @@ describe('manual extension upgrade SQL', () => {
589589
// Setup repoints the gateway at `postgres`, so a gateway on another database must not re-run it.
590590
expect(text).toMatch(/If your gateway uses another database, take the manual route below\./);
591591
expect(text).toMatch(/If it uses another database, add the library to\s+`shared_preload_libraries`[\s\S]*?setup would point the\s+gateway back at `postgres`/);
592-
// Restarting the whole target would start the gateway before setup updates the extensions.
593-
expect(text).toMatch(/restart documentdb-postgresql@18\.service &&\nsudo documentdb-setup/);
592+
// Setup restarts PostgreSQL itself; restarting the target first would start the gateway on the old catalog.
593+
expect(text).toContain('```bash\nsudo documentdb-setup --pg-version 18 --yes\n```');
594594
expect(text).not.toMatch(/restart documentdb-local@18\.target &&\nsudo documentdb-setup/);
595+
// Without --admin-user the re-run keeps the admin passwords; with it, setup resets that user's.
596+
const upgrading = text.match(/^## Upgrading.*$[\s\S]*?(?=^## )/m)?.[0];
597+
expect(upgrading).toContain('sudo documentdb-setup --target-postgres-instance 18/main --yes');
598+
expect(upgrading).not.toMatch(/documentdb-setup[^\n]*--admin-user/);
595599
});
596600
});
597601

0 commit comments

Comments
 (0)