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>
Cc: houzj.fnst@fujitsu.com <houzj.fnst@fujitsu.com>
Subject: RE: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o
Date: Wed, 18 Aug 2021 02:52:57 +0000
Message-ID: <OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <OS3PR01MB5718A7EE97B4E42FBAA9BD5794FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com>
References: <20210808022435.svp4spxlrfoi3w4p@alap3.anarazel.de>
	<CAD21AoCCAa+J1-udHRo5-Hbtv=D38WdZDAaXZGDbQQ_Vg_d3bQ@mail.gmail.com>
	<CAA4eK1LYw4J+BmYza+1VWF3QGo5NaV7goXFJ8g5gfA3WZRo6Xw@mail.gmail.com>
	<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>
	<CAFiTN-sYqy3O_ZEX4=HxomYQWwoo4f8moKKPLO6BxiM_jYeQig@mail.gmail.com>
	<OS3PR01MB5718A7EE97B4E42FBAA9BD5794FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com>

On Wed, Aug 18, 2021 9:17 AM houzj.fnst@fujitsu.com wrote:
> Hi,
> 
> I took a quick look at the v2 patch and noticed a typo.
> 
> + * backends and render it read-only.  If missing_ok is true then it will return
> + * NULL if file doesn not exist otherwise error.
>   */
> doesn not=> doesn't
>

Here are some other comments:

1).
+BufFileOpenShared(SharedFileSet *fileset, const char *name, int mode,
+				  bool missing_ok)
 {
 	BufFile    *file;
 	char		segment_name[MAXPGPATH];
	...
	files = palloc(sizeof(File) * capacity);
	...
@@ -318,10 +320,15 @@ BufFileOpenShared(SharedFileSet *fileset, const char *name, int mode)
 	 * name.
 	 */
 	if (nfiles == 0)
+	{
+		if (missing_ok)
+			return NULL;
+

I think it might be better to pfree(files) when return NULL.


2).
 	/* Delete the subxact file and release the memory, if it exist */
-	if (ent->subxact_fileset)
-	{
-		subxact_filename(path, subid, xid);
-		SharedFileSetDeleteAll(ent->subxact_fileset);
-		pfree(ent->subxact_fileset);
-		ent->subxact_fileset = NULL;
-	}
-
-	/* Remove the xid entry from the stream xid hash */
-	hash_search(xidhash, (void *) &xid, HASH_REMOVE, NULL);
+	subxact_filename(path, subid, xid);
+	SharedFileSetDelete(xidfileset, path, true);

Without the patch it doesn't throw an error if not exist,
But with the patch, it pass error_on_failure=true to SharedFileSetDelete().
Was it intentional ?

Best regards,
Houzj




view thread (53+ messages)  latest in thread

Message-ID: <OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com>
Permalink:  ../OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com/
Also on:    postgresql.org/message-id/OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.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: <OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com>
  References: <20210808022435.svp4spxlrfoi3w4p@alap3.anarazel.de> <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> <CAFiTN-sYqy3O_ZEX4=HxomYQWwoo4f8moKKPLO6BxiM_jYeQig@mail.gmail.com> <OS3PR01MB5718A7EE97B4E42FBAA9BD5794FF9@OS3PR01MB5718.jpnprd01.prod.outlook.com> <OS3PR01MB57181F8CB007691A36BAD1B194FF9@OS3PR01MB5718.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