Skip to content

fix(pg_upgrade): keep the status file at running in local and CI mode - #2749

Draft
idawson-sb wants to merge 1 commit into
developfrom
fix/pg-upgrade-status-local-mode
Draft

idawson-sb wants to merge 1 commit into
developfrom
fix/pg-upgrade-status-local-mode

Conversation

@idawson-sb

Copy link
Copy Markdown
Contributor

What kind of change does this PR introduce?

Bug fix.

What is the current behavior?

initiate.sh writes running to /tmp/pg-upgrade-status. In local mode (IS_LOCAL_UPGRADE=true) and CI mode (IS_CI), it then deletes the file at once and runs the upgrade in the foreground:

echo "running" >/tmp/pg-upgrade-status
if [ -z "$IS_CI" ] && [ -z "$IS_LOCAL_UPGRADE" ]; then
	initiate_upgrade &
else
	rm -f /tmp/pg-upgrade-status
	initiate_upgrade
fi

So during a local or CI run the file is absent, and check.sh and other readers of the file see no upgrade in progress. Local mode is the documented way to test the upgrade scripts on a running machine (nix/docs/testing-pg-upgrade-scripts.md), so these test runs look different from real upgrades.

What is the new behavior?

The file stays at running in all modes while initiate_upgrade runs. This is a one-line removal.

Nothing else changes:

  • initiate.sh does not read the file. It only writes it.
  • cleanup() already writes the final status (complete or failed) at the end of the run in all modes. So the file exists after a local or CI run today too.
  • The CI path of complete.sh and tests/pg_upgrade/debug.sh delete the file before they run complete.sh, so the complete.sh "already started" check still passes in CI.
  • tests/pg_upgrade/test-start-guard.sh extracts only cleanup and on_exit, so it is not affected.

Additional context

The deletion came in #695 (automated pg_upgrade testing). I could not find a reader that needs the file to be absent during the run. Please tell me if I missed one.

Related: #2748 (an EXIT trap for complete.sh, so that the file does not stay at running after an unexpected exit).

Not tested yet:

  • A local-mode run on a host (IS_LOCAL_UPGRADE=true), with cat /tmp/pg-upgrade-status during and after the run.
  • The CI upgrade test. I checked the syntax with bash -n.

🤖 Generated with Claude Code

initiate.sh writes "running" to /tmp/pg-upgrade-status, then deletes
it before a local (IS_LOCAL_UPGRADE) or CI run. So during the run the
file is absent, and check.sh and other readers see no upgrade. This is
the documented way to test the upgrade scripts on a running machine.

Keep the file at "running" in all modes. cleanup() already writes the
final status at the end of the run, in all modes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown

Package version diff

Compares built package versions in legacyPackages between this PR and the tip of the base branch, per system.

aarch64-linux: Closure size: 372 -> 372 (2 paths added, 2 paths removed, delta +0, disk usage -32B).
<<< /nix/store/9l16s6yi3fvhzvh4655nvyidkscig59g-build-ami
>>> /nix/store/rkzvdl73hsc4kap15r67g61ng6vg1vk3-build-ami
No version or selection state changes.
Closure size: 98 -> 98 (2 paths added, 2 paths removed, delta +0, disk usage -32B).
<<< /nix/store/vg18631iv6lgslyw5sj8spwgf8rs873a-build-qemu-image
>>> /nix/store/n4ddaxj255kq9s9vxzdx3k16grm6vvzw-build-qemu-image
No version or selection state changes.
Closure size: 372 -> 372 (2 paths added, 2 paths removed, delta +0, disk usage -32B).
x86_64-linux: Closure size: 370 -> 370 (2 paths added, 2 paths removed, delta +0, disk usage -32B).
<<< /nix/store/p5spcvwfbxs2zb7dbsmaisdacypp4l10-build-ami
>>> /nix/store/asksr85fdhy7vrv0kxy2hvaa3svl83qk-build-ami
No version or selection state changes.
Closure size: 99 -> 99 (2 paths added, 2 paths removed, delta +0, disk usage -32B).
<<< /nix/store/056y11rzc7kadcy1gm3sjbp6vxsn5vn3-build-qemu-image
>>> /nix/store/j40adwisyxlxlny2466k4fj9b68ps4pj-build-qemu-image
No version or selection state changes.
Closure size: 370 -> 370 (2 paths added, 2 paths removed, delta +0, disk usage -32B).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant