Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lssY8-00023I-3t for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Jun 2021 19:47:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lssY6-0003rj-1o for pgsql-hackers@arkaria.postgresql.org; Mon, 14 Jun 2021 19:47:06 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lssY5-0003rb-QF for pgsql-hackers@lists.postgresql.org; Mon, 14 Jun 2021 19:47:05 +0000 Received: from relay2-d.mail.gandi.net ([217.70.183.194]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lssY2-0003nW-RI for pgsql-hackers@lists.postgresql.org; Mon, 14 Jun 2021 19:47:04 +0000 Received: (Authenticated sender: adsend@dunslane.net) by relay2-d.mail.gandi.net (Postfix) with ESMTPSA id 8788140004; Mon, 14 Jun 2021 19:46:58 +0000 (UTC) Subject: Re: Race condition in recovery? From: Andrew Dunstan To: Robert Haas Cc: Tom Lane , Michael Paquier , Dilip Kumar , Kyotaro Horiguchi , Heikki Linnakangas , PostgreSQL Hackers References: <20210611.104036.2233408362728572267.horikyota.ntt@gmail.com> <1832766.1623376398@sss.pgh.pa.us> <20210611.151459.1951886846697638472.horikyota.ntt@gmail.com> <1880685.1623422805@sss.pgh.pa.us> <38830da5-ae00-2262-0f0d-e6b25d9df921@dunslane.net> <2178605.1623507624@sss.pgh.pa.us> <6981f25c-4d48-5781-67a1-0d71fded37bd@dunslane.net> Message-ID: Date: Mon, 14 Jun 2021 15:46:57 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.4.0 MIME-Version: 1.0 In-Reply-To: <6981f25c-4d48-5781-67a1-0d71fded37bd@dunslane.net> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 6/14/21 3:32 PM, Andrew Dunstan wrote: > On 6/14/21 1:50 PM, Andrew Dunstan wrote: >> On 6/14/21 1:11 PM, Robert Haas wrote: >>> On Mon, Jun 14, 2021 at 12:56 PM Andrew Dunstan wrote: >>>> $^X is not at all broken. >>>> >>>> The explanation here is pretty simple - the argument to perl2host is >>>> meant to be a directory. If we're going to accomodate plain files then >>>> we have some more work to do in TestLib. >>> This explanation seems to contradict the documentation in TestLib.pm, >>> which makes no mention of any such restriction. >> Heres a snippet: >> >> >> sub perl2host >> { >> my ($subject) = @_; >> ... >> if (chdir $subject) >> >> >> Last time I looked you can't chdir to anything except a directory. > > > Actually, I take it back, it does work for a file. I'll change it. I > probably did this when something else wasn't working. So, will you feel happier with this applied? I haven't tested it yet but I'm confident it will work. diff --git a/src/test/recovery/t/025_stuck_on_old_timeline.pl b/src/test/recovery/t/025_stuck_on_old_timeline.pl index e4e58cb8ab..3e19bc4c50 100644 --- a/src/test/recovery/t/025_stuck_on_old_timeline.pl +++ b/src/test/recovery/t/025_stuck_on_old_timeline.pl @@ -24,11 +24,11 @@ my $node_primary = get_new_node('primary'); # the timeline history file reaches the archive but before any of the WAL files # get there. $node_primary->init(allows_streaming => 1, has_archiving => 1); -my $perlbin = $^X; -if ($^O eq 'msys') -{ - $perlbin = TestLib::perl2host(dirname($^X)) . '\\' . basename($^X); -} + +# Note: consistent use of forward slashes here avoids any escaping problems +# that arise from use of backslashes. That means we need to double-quote all +# the paths in the archive_command +my $perlbin = TestLib::perl2host(^X); $perlbin =~ s!\\!/!g if $TestLib::windows_os; my $archivedir_primary = $node_primary->archive_dir; $archivedir_primary =~ s!\\!/!g if $TestLib::windows_os; @@ -36,6 +36,8 @@ $node_primary->append_conf('postgresql.conf', qq( archive_command = '"$perlbin" "$FindBin::RealBin/cp_history_files" "%p" "$archivedir_primary/%f"' wal_keep_size=128MB )); +# make sure that Msys perl doesn't complain about difficulty in setting locale +# when called this way. local $ENV{PERL_BADLANG}=0; $node_primary->start; cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com