Repository navigation
test(e2e): fix the flaky parallel WAL restore spec on slow runners - #1262
Merged
Merged
Conversation
The "Parallel WAL restore" spec invokes `/controller/manager wal-restore` by hand on a standby, and sometimes failed with exit code 1 on the first request (WAL #1) or on the first one after the spool is drained (WAL #4). The cause is a CloudNativePG feature: to let PostgreSQL retry streaming replication, the instance manager makes wal-restore fail on purpose for 5s every 30s on a standby, for any segment that is not already in the spool ("Failing restore_command on purpose to let streaming replication resume"). The 30s are measured from the first restore of the standby, which is recorded in /controller/wal-restore-streaming-retry.json. On a fast runner the spec sends its requests before the first window opens. On a standard `ubuntu-latest` runner, such as the ones used by pull requests from forks, cluster creation and the WAL forging take long enough for the window to open first, and the request is rejected. Remove the state file right before the first request, so the whole sequence runs inside a fresh window. Also make failures diagnosable: ExecuteInContainer used to drop stdout and stderr on a non-zero exit, so the failure only showed the exit code. It now returns them along with the error, and a failing wal-restore prints its output together with the tail of the plugin sidecar logs. The aws CLI stderr is included when forging a WAL segment fails. Assisted-By: Claude Signed-off-by: Leonardo Cecchi <leonardo.cecchi@enterprisedb.com>
leonardoce
force-pushed
the
fix/e2e-walrestore-streaming-retry
branch
from
November 26, 2026 14:26
cb35e33 to
391db16
Compare
Removing the state file starts a new 30s interval at the first restore after it, the request for WAL #1, but the instance manager still checks every request whose segment is not in the spool: #4, both requests for #6 and the child-timeline one. If the sequence takes longer than 30s, one of them can still be failed on purpose. Replace the state file with an empty read-only one instead. The instance manager cannot store its state and then never fails a restore on purpose, so the forced failures stay off for the whole spec, whatever the speed of the runner. Signed-off-by: Armando Ruocco <armando.ruocco@enterprisedb.com>
armru
approved these changes
Nov 27, 2026
Signed-off-by: Marco Nenciarini <marco.nenciarini@enterprisedb.com>
mnencia
approved these changes
Nov 27, 2026
armru
approved these changes
Nov 27, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The "Parallel WAL restore" spec runs
/controller/manager wal-restoreby hand on a standby, and sometimes failed with exit code 1 on the first request (WAL #1) or on the first one after the spool is drained (WAL #4).The cause is a CloudNativePG feature. To let PostgreSQL retry streaming replication, the instance manager makes wal-restore fail on purpose for 5s every 30s on a standby, for any segment that is not in the spool. On a fast runner the spec finishes before the first window opens. On a standard
ubuntu-latestrunner, such as the ones used by pull requests from forks, cluster creation and WAL forging are slow enough for the window to open first.Replace the state file the instance manager keeps (
/controller/wal-restore-streaming-retry.json) with an empty read-only one. The instance manager cannot store its state, so it never fails a restore on purpose, however slow the runner is.Also make failures diagnosable.
ExecuteInContainernow returns stdout and stderr on a non-zero exit. A failing wal-restore prints them with the tail of the plugin sidecar logs, and a failing WAL forge includes the aws CLI stderr.Assisted-by: Claude