pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com>
To: Dilip Kumar <dilipbalaut@gmail.com>
Cc: Andres Freund <andres@anarazel.de>
Cc: Thomas Munro <thomas.munro@gmail.com>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>
Cc: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Subject: RE: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o
Date: Mon, 23 Aug 2021 03:41:22 +0000
Message-ID: <OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAFiTN-vPEB4FbD4kLitQSiYXWVPr_KN62jEOV_Z6nc1UbUF5zw@mail.gmail.com>
References: <CAD21AoAjrg5EuWM9qNApKRLC2LP+G18=u8xE=qbm2smmMzGC-A@mail.gmail.com>
	<CAFiTN-uzNeU+cO-JZW6WCNAXu0qZgOoqzGrsP8y+k2BKu4SHdQ@mail.gmail.com>
	<CAA4eK1JHUoE997NdUXbS9ikHk1oOtPupnNpGGnN_P3pn+jb6LQ@mail.gmail.com>
	<20210812082237.in7l5x3rc4gxhgjh@alap3.anarazel.de>
	<CAA4eK1L=fepiRg8PCx7_0z2Xgcu3bohzs=zMS6qutq0oD07wSQ@mail.gmail.com>
	<20210812124819.5mrurb6ueizmqgru@alap3.anarazel.de>
	<CAA4eK1Khx7nvqSS-inKB0WGbYxX1sy6EkzzxR-QmnVmFqnmmXw@mail.gmail.com>
	<20210813155940.kp7mdg3ynl2hodqk@alap3.anarazel.de>
	<CAFiTN-v7kyWA3EZ_btNqLrwFoD0xwuX8eZ3CNaupN-JJircLaQ@mail.gmail.com>
	<CAA4eK1+gfd3tCLgYUbLYK+U-1r=DSO1-kfFS+QEDVBb0KZbF1A@mail.gmail.com>
	<20210817110427.yd5i7iostgqf5gvt@alap3.anarazel.de>
	<CAA4eK1+qsCEXuxd3sGyF29CiEaBA98SjuPuC8P7d5ZsUpc-JzQ@mail.gmail.com>
	<CAFiTN-sWv5Pxx+Cvsa37368f5gi49R6uWLyQzH3WEzbdP9JNnQ@mail.gmail.com>
	<CAFiTN-vPEB4FbD4kLitQSiYXWVPr_KN62jEOV_Z6nc1UbUF5zw@mail.gmail.com>

On Sat, Aug 21, 2021 8:38 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> On Wed, Aug 18, 2021 at 3:45 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:
> > I was looking into this, so if we want to do that I think the outline
> > will look like this
> >
> > - There will be a fileset.c and fileset.h files, and we will expose a
> > new structure FileSet, which will be the same as SharedFileSet, except
> > mutext and refcount.  The fileset.c will expose FileSetInit(),
> > FileSetCreate(), FileSetOpen(), FileSetDelete() and FileSetDeleteAll()
> > interfaces.
> >
> > - sharefileset.c will internally call the fileset.c's interfaces.  The
> > SharedFileSet structure will also contain FileSet and other members
> > i.e. mutex and refcount.
> >
> > - the buffile.c's interfaces which are ending with Shared e.g.
> > BufFileCreateShared, BufFileOpenShared, should be converted to
> > BufFileCreate and BufFileOpen respectively.  And the input to these
> > interfaces can be converted to FileSet instead of SharedFileSet.
> 
> Here is the first draft based on the idea we discussed, 0001, splits
> sharedfileset.c in sharedfileset.c and fileset.c and 0002 is same patch I
> submitted earlier(use single fileset throughout the worker), just it is rebased on
> top of 0001.  Please let me know your thoughts.

Hi,

Here are some comments for the new version patches.

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 ?

2)
I think we can remove or adjust the following comments in sharedfileset.c.

----
 * SharedFileSets can be used by backends when the temporary files need to be
 * opened/closed multiple times and the underlying files need to survive across
 * transactions.
----
 * We can also use this interface 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.  For
----

3)
The 0002 patch still used the word "shared fileset" in some places, I think we
should change it to "fileset".

4)
-extern File SharedFileSetCreate(SharedFileSet *fileset, const char *name);
-extern File SharedFileSetOpen(SharedFileSet *fileset, const char *name,
-							  int mode);
-extern bool SharedFileSetDelete(SharedFileSet *fileset, const char *name,
-								bool error_on_failure);
 extern void SharedFileSetDeleteAll(SharedFileSet *fileset);
-extern void SharedFileSetUnregister(SharedFileSet *input_fileset);

I noticed the patch delete part of public api, is it better to keep the old api and
let them invoke new api internally ? Having said that, I didn’t find any open source
extension use these old api, so it might be fine to delete them.

Best regards,
Hou zj


view thread (53+ messages)  latest in thread

Message-ID: <OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com>
Permalink:  ../OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com/
Also on:    postgresql.org/message-id/OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: houzj.fnst@fujitsu.com, dilipbalaut@gmail.com, andres@anarazel.de, thomas.munro@gmail.com, pgsql-hackers@postgresql.org, sawada.mshk@gmail.com, tgl@sss.pgh.pa.us, amit.kapila16@gmail.com
  Subject: Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o
  In-Reply-To: <OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com>
  References: <CAD21AoAjrg5EuWM9qNApKRLC2LP+G18=u8xE=qbm2smmMzGC-A@mail.gmail.com> <CAFiTN-uzNeU+cO-JZW6WCNAXu0qZgOoqzGrsP8y+k2BKu4SHdQ@mail.gmail.com> <CAA4eK1JHUoE997NdUXbS9ikHk1oOtPupnNpGGnN_P3pn+jb6LQ@mail.gmail.com> <20210812082237.in7l5x3rc4gxhgjh@alap3.anarazel.de> <CAA4eK1L=fepiRg8PCx7_0z2Xgcu3bohzs=zMS6qutq0oD07wSQ@mail.gmail.com> <20210812124819.5mrurb6ueizmqgru@alap3.anarazel.de> <CAA4eK1Khx7nvqSS-inKB0WGbYxX1sy6EkzzxR-QmnVmFqnmmXw@mail.gmail.com> <20210813155940.kp7mdg3ynl2hodqk@alap3.anarazel.de> <CAFiTN-v7kyWA3EZ_btNqLrwFoD0xwuX8eZ3CNaupN-JJircLaQ@mail.gmail.com> <CAA4eK1+gfd3tCLgYUbLYK+U-1r=DSO1-kfFS+QEDVBb0KZbF1A@mail.gmail.com> <20210817110427.yd5i7iostgqf5gvt@alap3.anarazel.de> <CAA4eK1+qsCEXuxd3sGyF29CiEaBA98SjuPuC8P7d5ZsUpc-JzQ@mail.gmail.com> <CAFiTN-sWv5Pxx+Cvsa37368f5gi49R6uWLyQzH3WEzbdP9JNnQ@mail.gmail.com> <CAFiTN-vPEB4FbD4kLitQSiYXWVPr_KN62jEOV_Z6nc1UbUF5zw@mail.gmail.com> <OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com>

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

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