From: | Ashutosh Bapat <ashutosh(dot)bapat(dot)oss(at)gmail(dot)com> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Progress report removal of temp files and temp relation files using ereport_startup_progress |
Date: | 2022-05-02 12:56:33 |
Message-ID: | CAExHW5v1Byk5PBB8o7A5iHgj9FcbzQDZQBCv-CoK89cV3dEbrg@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi Bharath,
On Sat, Apr 30, 2022 at 11:08 AM Bharath Rupireddy
<bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:
>
> Hi,
>
> At times, there can be many temp files (under pgsql_tmp) and temp
> relation files (under removal which after crash may take longer during
> which users have no clue about what's going on in the server before it
> comes up online.
>
> Here's a proposal to use ereport_startup_progress to report the
> progress of the file removal.
>
> Thoughts?
The patch looks good to me.
With this patch, the user would at least know which directory is being
scanned and how much time has elapsed. It would be better to know how
much work is remaining. I could not find a way to estimate the number
of files in the directory so that we can extrapolate elapsed time and
estimate the remaining time. Well, we could loop the output of
opendir() twice, first to estimate and then for the actual work. This
might actually work, if the time to delete all the files is very high
compared to the time it takes to scan all the files/directories.
Another possibility is to scan the sorted output of opendir() thus
using the current file name to estimate remaining files in a very
crude and inaccurate way. That doesn't look attractive either. I can't
think of any better way to estimate the remaining time.
But at least with this patch, a user knows which files have been
deleted, guessing how far, in the directory structure, the process has
reached. S/he can then take a look at the remaining contents of the
directory to estimate how much it should wait.
--
Best Wishes,
Ashutosh Bapat
From | Date | Subject | |
---|---|---|---|
Next Message | Laurenz Albe | 2022-05-02 13:00:07 | Re: Item compression in the Gist index |
Previous Message | Bharath Rupireddy | 2022-05-02 12:51:22 | Add pg_strtoupper and pg_strtolower functions |