mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Retry initial slurp_file("current_logfiles"), in test 004_logrotate.pl.
Buildfarm member topminnow failed when the test script attempted this before the syslogger would have created the file. Back-patch to v12, which introduced the test.
This commit is contained in:
		@@ -21,7 +21,19 @@ $node->start();
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
$node->psql('postgres', 'SELECT 1/0');
 | 
					$node->psql('postgres', 'SELECT 1/0');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
my $current_logfiles = slurp_file($node->data_dir . '/current_logfiles');
 | 
					# might need to retry if logging collector process is slow...
 | 
				
			||||||
 | 
					my $max_attempts = 180 * 10;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					my $current_logfiles;
 | 
				
			||||||
 | 
					for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						eval {
 | 
				
			||||||
 | 
							$current_logfiles = slurp_file($node->data_dir . '/current_logfiles');
 | 
				
			||||||
 | 
						};
 | 
				
			||||||
 | 
						last unless $@;
 | 
				
			||||||
 | 
						usleep(100_000);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					die $@ if $@;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
note "current_logfiles = $current_logfiles";
 | 
					note "current_logfiles = $current_logfiles";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -34,9 +46,6 @@ my $lfname = $current_logfiles;
 | 
				
			|||||||
$lfname =~ s/^stderr //;
 | 
					$lfname =~ s/^stderr //;
 | 
				
			||||||
chomp $lfname;
 | 
					chomp $lfname;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# might need to retry if logging collector process is slow...
 | 
					 | 
				
			||||||
my $max_attempts = 180 * 10;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
my $first_logfile;
 | 
					my $first_logfile;
 | 
				
			||||||
for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
 | 
					for (my $attempts = 0; $attempts < $max_attempts; $attempts++)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user