Re: 010_pg_basebackup.pl vs multiple filesystems

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Andres Freund <andres(at)anarazel(dot)de>, pgsql-hackers(at)postgresql(dot)org
Cc: Dave Page <dpage(at)pgadmin(dot)org>
Subject: Re: 010_pg_basebackup.pl vs multiple filesystems
Date: 2024-07-07 11:28:28
Message-ID: 2545bea4-9690-4922-ad77-19194fa3edd6@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


On 2024-07-07 Su 3:02 AM, Andres Freund wrote:
> Hi,
>
> While working on [1] I encountered the issue that, on github-actions,
> 010_pg_basebackup.pl fails on windows.
>
> The reason for that is that github actions uses two drives, with TMP/TEMP
> located on c:, the tested code on d:. This causes the following code to fail:
>
> # Create a temporary directory in the system location.
> my $sys_tempdir = PostgreSQL::Test::Utils::tempdir_short;
>
> # On Windows use the short location to avoid path length issues.
> # Elsewhere use $tempdir to avoid file system boundary issues with moving.
> my $tmploc = $windows_os ? $sys_tempdir : $tempdir;
>
> rename("$pgdata/pg_replslot", "$tmploc/pg_replslot")
> or BAIL_OUT "could not move $pgdata/pg_replslot";
> dir_symlink("$tmploc/pg_replslot", "$pgdata/pg_replslot")
> or BAIL_OUT "could not symlink to $pgdata/pg_replslot";
>
> It's not possible to move (vs copy) a file between two filesystems, on most
> operating systems. Which thus leads to:
>
> [23:02:03.114](0.288s) Bail out! could not move D:\a\winpgbuild\winpgbuild\postgresql-17beta2\build/testrun/pg_basebackup/010_pg_basebackup\data/t_010_pg_basebackup_main_data/pgdata/pg_replslot
>
>
> This logic was added in
>
> commit e213de8e785aac4e2ebc44282b8dc0fcc74834e8
> Author: Andrew Dunstan <andrew(at)dunslane(dot)net>
> Date: 2023-07-08 11:21:58 -0400
>
> Use shorter location for pg_replslot in pg_basebackup test
>
> and revised in
>
> commit e9f15bc9db7564a29460d089c0917590bc13fffc
> Author: Andrew Dunstan <andrew(at)dunslane(dot)net>
> Date: 2023-07-08 12:34:25 -0400
>
> Fix tmpdir issues with commit e213de8e78
>
> The latter deals with precisely this issue, for !windows.
>
>
> I've temporarily worked around this by setting TMP/TEMP to something else, but
> ISTM we need a better solution.

I'll be happy to hear of one. I agree it's a mess.  Maybe we could test
that the temp directory is on the same device on Windows and skip the
test if not? You could still get the test to run by setting TMPDIR
and/or friends.

cheers

andrew

--
Andrew Dunstan
EDB: https://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dean Rasheed 2024-07-07 11:28:32 Incorrect results from numeric round() and trunc()
Previous Message David Rowley 2024-07-07 10:57:17 Optimize WindowAgg's use of tuplestores