You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudberry.apache.org by yj...@apache.org on 2025/02/10 03:09:02 UTC

(cloudberry) 09/10: Make 102_non_standby_recovery.pl less likely to fail.

This is an automated email from the ASF dual-hosted git repository.

yjhjstz pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/cloudberry.git

commit 7b76d4c863b0dae6468fee371430e92b659f1949
Author: Brent Doil <bd...@vmware.com>
AuthorDate: Tue Jan 10 20:21:44 2023 -0500

    Make 102_non_standby_recovery.pl less likely to fail.
    
    The test will now wait until the restored node has finished recovery
    before trying to query the node, which causes a test failure.
    
    Authored-by: Brent Doil <bd...@vmware.com>
---
 src/test/recovery/t/102_non_standby_recovery.pl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/test/recovery/t/102_non_standby_recovery.pl b/src/test/recovery/t/102_non_standby_recovery.pl
index a8568b25d2..eaaa5d46db 100644
--- a/src/test/recovery/t/102_non_standby_recovery.pl
+++ b/src/test/recovery/t/102_non_standby_recovery.pl
@@ -31,6 +31,9 @@ $node->safe_psql(
 	INSERT INTO co select i, i FROM generate_series(1,10)i;
 	COMMIT;");
 
+my $lsn =
+  $node->safe_psql('postgres', "SELECT pg_current_wal_lsn();");
+
 # Stop the PostgreSQL server
 $node->stop;
 
@@ -43,7 +46,12 @@ $restored_node->init_from_backup($node, 'testbackup', has_restoring => 1, standb
 # Start the PostgreSQL server
 $restored_node->start;
 
-# Make sure that the server is up and running
+# Wait until restored node has replayed the data.
+my $caughtup_query =
+	"SELECT '$lsn'::pg_lsn <= pg_last_wal_replay_lsn()";
+$restored_node->poll_query_until('postgres', $caughtup_query)
+	or die "Timed out while waiting for restored node to catch up";
+
 is($restored_node->safe_psql('postgres', 'SELECT count(*) from ao'), '10', 'AO table read check');
 is($restored_node->safe_psql('postgres', 'SELECT count(*) from co'), '10', 'AOCS table read check');
 is($restored_node->safe_psql('postgres', 'SELECT count(*) from heap'), '10', 'Heap table read check');


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cloudberry.apache.org
For additional commands, e-mail: commits-help@cloudberry.apache.org