Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)

From: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: "houzj(dot)fnst(at)fujitsu(dot)com" <houzj(dot)fnst(at)fujitsu(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)
Date: 2021-08-23 09:43:19
Message-ID: CAFiTN-tVo8=BWiRZPhKi5zVZtnWqGMnOLXeSJqS58w_HGWYrnA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Mon, Aug 23, 2021 at 1:43 PM Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> wrote:

Note: merge comments from multiple mails

> > I think we should handle that in worker.c itself, by adding a
> > before_dsm_detach function before_shmem_exit right?
> >
>
> Yeah, I thought of handling it in worker.c similar to what you've in 0002 patch.
>

I have done handling in worker.c

On Mon, Aug 23, 2021 at 9:11 AM houzj(dot)fnst(at)fujitsu(dot)com
<houzj(dot)fnst(at)fujitsu(dot)com> wrote:
>
> On Sat, Aug 21, 2021 8:38 PM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>
> 1)
> + TempTablespacePath(tempdirpath, tablespace);
> + snprintf(path, MAXPGPATH, "%s/%s%lu.%u.sharedfileset",
> + tempdirpath, PG_TEMP_FILE_PREFIX,
> + (unsigned long) fileset->creator_pid, fileset->number);
>
> do we need to use different filename for shared and un-shared fileset ?

I was also thinking about the same, does it make sense to name it just
""%s/%s%lu.%u.fileset"?

On Mon, Aug 23, 2021 at 1:08 PM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:

> Here are some comments on 0001 patch:
>
> +/*
> + * Initialize a space for temporary files. This API can be used by shared
> + * fileset as well as if the temporary files are used only by single backend
> + * but the files need to be opened and closed multiple times and also the
> + * underlying files need to survive across transactions.
> + *
> + * Files will be distributed over the tablespaces configured in
> + * temp_tablespaces.
> + *
> + * Under the covers the set is one or more directories which will eventually
> + * be deleted.
> + */
>
> I think it's better to mention cleaning up here like we do in the
> comment of SharedFileSetInit().

Right, done

>
> ---
> I think we need to clean up both stream_fileset and subxact_fileset on
> proc exit. In 0002 patch cleans up the fileset but I think we need to
> do that also in 0001 patch.

Done

> ---
> There still are some comments using "shared fileset" in both buffile.c
> and worker.c.

Done

--
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com

Attachment Content-Type Size
v2-0001-Sharedfileset-refactoring.patch text/x-patch 40.8 KB
v2-0002-Better-usage-of-sharedfileset-in-apply-worker.patch text/x-patch 17.6 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Daniel Gustafsson 2021-08-23 11:12:28 Re: pgsql: psql: Add test for query canceling
Previous Message Amit Kapila 2021-08-23 08:13:01 Re: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2021-08-23 10:02:24 Re: [bug] Logical Decoding of relation rewrite with toast does not reset toast_hash
Previous Message Magnus Hagander 2021-08-23 09:33:09 Re: Proposal: More structured logging