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: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)
Date: Fri, 27 Aug 2021 05:26:17 +0000
Message-ID: <OS0PR01MB57161A77F0A091A6AD27F16E94C89@OS0PR01MB5716.jpnprd01.prod.outlook.com> (raw)
In-Reply-To: <CAFiTN-tQCumJqZme1eDeMBx0-GsspK7M0ZUPSBEt5-k8ZxuBvA@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>
	<OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com>
	<CAFiTN-uWX=QCQv_hJCf6G86nsXCwznM=2cRQimGcLv4x08zuZQ@mail.gmail.com>
	<CAA4eK1JEOQp_P_Ot0BfH5KKS=8JLcAVsd2ar1CiY69rMJ=C1Gg@mail.gmail.com>
	<CAFiTN-s78Bdk1a9Ly30UnoFJFidh8b4XS61WFw0OSxbqZo+C+w@mail.gmail.com>
	<CAA4eK1KHisc9=idx=cwiUZ6id-XAGYENBSMqJd5yQ+J2KAFozQ@mail.gmail.com>
	<CAFiTN-tVo8=BWiRZPhKi5zVZtnWqGMnOLXeSJqS58w_HGWYrnA@mail.gmail.com>
	<CAA4eK1JUvDMqdiOUKn5G1QemBxwHKaEE2au2vxs5LfgnwxdN5g@mail.gmail.com>
	<CAFiTN-t=mc9=S+DO2V9N1YO+pUnmiqYY-7aA0PkuzmBGRVL0aw@mail.gmail.com>
	<CAA4eK1KLu4PeHXH4Ud6CL5KVm61pQiLH+4CLPJUrDOU3HuCTwQ@mail.gmail.com>
	<CAFiTN-tQCumJqZme1eDeMBx0-GsspK7M0ZUPSBEt5-k8ZxuBvA@mail.gmail.com>

On Thu, Aug 26, 2021 2:18 PM Dilip Kumar <dilipbalaut@gmail.com> wrote:

> The patch looks good to me, I have rebased 0002 atop
> this patch and also done some cosmetic fixes in 0002. 

Here are some comments for the 0002 patch.

1)

- * toplevel transaction. Each subscription has a separate set of files.
+ * toplevel transaction. Each subscription has a separate files.

a separate files => a separate file

2)
+	 * Otherwise, just open it file for writing, in append mode.
 	 */

open it file => open the file


3)
 	if (subxact_data.nsubxacts == 0)
 	{
-		if (ent->subxact_fileset)
-		{
-			cleanup_subxact_info();
-			FileSetDeleteAll(ent->subxact_fileset);
-			pfree(ent->subxact_fileset);
-			ent->subxact_fileset = NULL;
-		}
+		cleanup_subxact_info();
+		BufFileDeleteFileSet(stream_fileset, path, true);
+


Before applying the patch, the code only invoke cleanup_subxact_info() when the
file exists. After applying the patch, it will invoke cleanup_subxact_info()
either the file exists or not. Is it correct ?


4)
 	/*
-	 * If this is the first streamed segment, the file must not exist, so make
-	 * sure we're the ones creating it. Otherwise just open the file for
-	 * writing, in append mode.
+	 * If this is the first streamed segment, create the changes file.
+	 * Otherwise, just open it file for writing, in append mode.
 	 */
 	if (first_segment)
-	{
	...
-		if (found)
-			ereport(ERROR,
-					(errcode(ERRCODE_PROTOCOL_VIOLATION),
-					 errmsg_internal("incorrect first-segment flag for streamed replication transaction")));
	...
-	}
+		stream_fd = BufFileCreateFileSet(stream_fileset, path);


Since the function BufFileCreateFileSet() doesn't check the file's existence,
the change here seems remove the file existence check which the old code did.


Best regards,
Hou zj


view thread (26+ messages)  latest in thread

Message-ID: <OS0PR01MB57161A77F0A091A6AD27F16E94C89@OS0PR01MB5716.jpnprd01.prod.outlook.com>
Permalink:  ../OS0PR01MB57161A77F0A091A6AD27F16E94C89@OS0PR01MB5716.jpnprd01.prod.outlook.com/
Also on:    postgresql.org/message-id/OS0PR01MB57161A77F0A091A6AD27F16E94C89@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: Separate out FileSet from SharedFileSet (was Re: pgsql: pgstat: Bring up pgstat in BaseInit() to fix uninitialized use o)
  In-Reply-To: <OS0PR01MB57161A77F0A091A6AD27F16E94C89@OS0PR01MB5716.jpnprd01.prod.outlook.com>
  References: <CAD21AoAjrg5EuWM9qNApKRLC2LP+G18=u8xE=qbm2smmMzGC-A@mail.gmail.com> <CAFiTN-vPEB4FbD4kLitQSiYXWVPr_KN62jEOV_Z6nc1UbUF5zw@mail.gmail.com> <OS0PR01MB57161AAB7BCA4184EBDD11CC94C49@OS0PR01MB5716.jpnprd01.prod.outlook.com> <CAFiTN-uWX=QCQv_hJCf6G86nsXCwznM=2cRQimGcLv4x08zuZQ@mail.gmail.com> <CAA4eK1JEOQp_P_Ot0BfH5KKS=8JLcAVsd2ar1CiY69rMJ=C1Gg@mail.gmail.com> <CAFiTN-s78Bdk1a9Ly30UnoFJFidh8b4XS61WFw0OSxbqZo+C+w@mail.gmail.com> <CAA4eK1KHisc9=idx=cwiUZ6id-XAGYENBSMqJd5yQ+J2KAFozQ@mail.gmail.com> <CAFiTN-tVo8=BWiRZPhKi5zVZtnWqGMnOLXeSJqS58w_HGWYrnA@mail.gmail.com> <CAA4eK1JUvDMqdiOUKn5G1QemBxwHKaEE2au2vxs5LfgnwxdN5g@mail.gmail.com> <CAFiTN-t=mc9=S+DO2V9N1YO+pUnmiqYY-7aA0PkuzmBGRVL0aw@mail.gmail.com> <CAA4eK1KLu4PeHXH4Ud6CL5KVm61pQiLH+4CLPJUrDOU3HuCTwQ@mail.gmail.com> <CAFiTN-tQCumJqZme1eDeMBx0-GsspK7M0ZUPSBEt5-k8ZxuBvA@mail.gmail.com> <OS0PR01MB57161A77F0A091A6AD27F16E94C89@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