From: | Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com> |
---|---|
To: | Alexander Lakhin <exclusion(at)gmail(dot)com> |
Cc: | Justin Pryzby <pryzby(at)telsasoft(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: More time spending with "delete pending" |
Date: | 2020-11-16 12:52:03 |
Message-ID: | CAC+AXB3Ckp+ErgqrDutQ5LQZUubnt3OYBki0WTVcx7CqOQajDA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Nov 15, 2020 at 4:00 PM Alexander Lakhin <exclusion(at)gmail(dot)com>
wrote:
> As I've found out, readdir() replacement for Windows in fact gets all
> the needed information (correct file size, attributes...) in
> WIN32_FIND_DATA, but it just leaves it inside and returns only fields of
> the dirent structure. So pg_ls_dir_files() (that calls
> ReadDir()/readdir()) needs to get this information again, that leads to
> opening a file on Windows.
> I think it can be done more effectively by adding a new function
> ReadDirExtendedInfo(), that will additionally accept a pointer to
> "struct dirent_extra" with fields {valid (indicating that the structure
> is filled), attributes, file size, mtime}. Maybe the advanced function
> could also invoke stat() inside (not on Windows).
>
> As to patch I proposed before, I think it's still needed to fully
> support the following usage pattern:
> stat();
> if (no_error) {
> do_something();
> } else if (file_not_found) {
> do_something_else();
> } else {
> error();
> }
We are currently missing a WIN32 lstat() port. I was thinking about
proposing a patch to implement it using GetFileAttributesEx(). That might
work as fall back to the CreateFile() if the file attribute is not a
FILE_ATTRIBUTE_REPARSE_POINT.
Anyhow, I do not think any retry logic should be in the stat() function,
but in the caller.
Regards,
Juan José Santamaría Flecha
>
>
From | Date | Subject | |
---|---|---|---|
Next Message | Shawn Wang | 2020-11-16 12:52:40 | Re: ECPG: proposal for new DECLARE STATEMENT |
Previous Message | Li Japin | 2020-11-16 12:40:57 | Re: Terminate the idle sessions |