public inbox for [email protected]  
help / color / mirror / Atom feed
From: Andres Freund <[email protected]>
To: Bharath Rupireddy <[email protected]>
Cc: Michael Paquier <[email protected]>
Cc: Nathan Bossart <[email protected]>
Cc: Thomas Munro <[email protected]>
Cc: Tom Lane <[email protected]>
Cc: Bossart, Nathan <[email protected]>
Cc: Julien Rouhaud <[email protected]>
Cc: PostgreSQL Hackers <[email protected]>
Subject: Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work
Date: Wed, 31 Aug 2022 12:14:33 -0700
Message-ID: <[email protected]> (raw)
In-Reply-To: <CALj2ACV2boDSpQGYvp5Won6qfJgwdpeFMJTO-4Z7dKZy8UAH2Q@mail.gmail.com>
References: <CA+hUKGKPtfOW5k+O4O3_ZEKBBCitm90e3bkOU_GGcKXe5QACHQ@mail.gmail.com>
	<CALj2ACVd0ukptEi5pFyeEx-nw_C9jTRvtQJvQpm0BUhOCvrH0g@mail.gmail.com>
	<CA+hUKGL30BKpudMLYP++hTvK+O5DirMkwEg6yWQ9BLycKfPUvw@mail.gmail.com>
	<CALj2ACWSjE8AiJ4xaBS4ULQ8T6RevwsNhTD6yPBLugJBTD5LCw@mail.gmail.com>
	<20220816203233.GA255076@nathanxps13>
	<CALj2ACXZPMYXrPZ+CUE0_5DKDnxyqDGRftSgPPx--PWhWB3RtQ@mail.gmail.com>
	<20220823180744.GD1207981@nathanxps13>
	<CALj2ACX0TW4C8gtwFMjyG2r=xnbRUnO5uRWQVscJoZFD208U_g@mail.gmail.com>
	<[email protected]>
	<CALj2ACV2boDSpQGYvp5Won6qfJgwdpeFMJTO-4Z7dKZy8UAH2Q@mail.gmail.com>

Hi,

On 2022-08-27 14:06:32 +0530, Bharath Rupireddy wrote:
> @@ -50,7 +51,7 @@ copydir(char *fromdir, char *todir, bool recurse)
>  
>  	while ((xlde = ReadDir(xldir, fromdir)) != NULL)
>  	{
> -		struct stat fst;
> +		PGFileType	xlde_type;
>  
>  		/* If we got a cancel signal during the copy of the directory, quit */
>  		CHECK_FOR_INTERRUPTS();
> @@ -62,18 +63,15 @@ copydir(char *fromdir, char *todir, bool recurse)
>  		snprintf(fromfile, sizeof(fromfile), "%s/%s", fromdir, xlde->d_name);
>  		snprintf(tofile, sizeof(tofile), "%s/%s", todir, xlde->d_name);
>  
> -		if (lstat(fromfile, &fst) < 0)
> -			ereport(ERROR,
> -					(errcode_for_file_access(),
> -					 errmsg("could not stat file \"%s\": %m", fromfile)));
> +		xlde_type = get_dirent_type(fromfile, xlde, false, ERROR);
>  
> -		if (S_ISDIR(fst.st_mode))
> +		if (xlde_type == PGFILETYPE_DIR)
>  		{
>  			/* recurse to handle subdirectories */
>  			if (recurse)
>  				copydir(fromfile, tofile, true);
>  		}
> -		else if (S_ISREG(fst.st_mode))
> +		else if (xlde_type == PGFILETYPE_REG)
>  			copy_file(fromfile, tofile);
>  	}
>  	FreeDir(xldir);

It continues to make no sense to me to add behaviour changes around
error-handling as part of a conversion to get_dirent_type(). I don't at all
understand why e.g. the above change to make copydir() silently skip over
files it can't stat is ok?

Greetings,

Andres Freund





view thread (45+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
  Subject: Re: Avoid erroring out when unable to remove or parse logical rewrite files to save checkpoint work
  In-Reply-To: <[email protected]>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox