mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix race in test of pg_switch_wal().
The test failed when something added WAL between pg_switch_wal() and pg_current_wal_lsn(), seen on buildfarm members hornet and sungazer. Fix v10, v9.6 and v9.5 by making this code mirror its v13+ counterpart. v12 and v11 lack a counterpart.
This commit is contained in:
		@@ -141,12 +141,14 @@ $primary->safe_psql(
 | 
				
			|||||||
	'postgres', q{
 | 
						'postgres', q{
 | 
				
			||||||
	INSERT INTO mine SELECT generate_series(21,30) AS x;
 | 
						INSERT INTO mine SELECT generate_series(21,30) AS x;
 | 
				
			||||||
	CHECKPOINT;
 | 
						CHECKPOINT;
 | 
				
			||||||
	SELECT pg_switch_wal();
 | 
					 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Make sure that the standby has caught here.
 | 
					# Switch to a new segment and use the returned LSN to make sure that the
 | 
				
			||||||
my $primary_lsn = $primary->safe_psql('postgres',
 | 
					# standby has caught up to this point.
 | 
				
			||||||
	q{SELECT pg_current_wal_lsn()});
 | 
					my $primary_lsn = $primary->safe_psql(
 | 
				
			||||||
 | 
						'postgres', q{
 | 
				
			||||||
 | 
						SELECT pg_switch_wal();
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
$standby1->poll_query_until('postgres',
 | 
					$standby1->poll_query_until('postgres',
 | 
				
			||||||
	qq{ SELECT pg_wal_lsn_diff(pg_last_wal_replay_lsn(), '$primary_lsn') >= 0 },
 | 
						qq{ SELECT pg_wal_lsn_diff(pg_last_wal_replay_lsn(), '$primary_lsn') >= 0 },
 | 
				
			||||||
	't')
 | 
						't')
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user