Re: Fix for segfault in logical replication on master

2021-06-28 Thread Amit Kapila
On Tue, Jun 22, 2021 at 9:18 AM osumi.takami...@fujitsu.com wrote: > > On Tuesday, June 22, 2021 11:08 AM Japin Li wrote: > > > Your patch appears to be on the lines we discussed but I would prefer > > > to get it done after Beta2 as this is just a minor code improvement. > > > Can you please sen

RE: Fix for segfault in logical replication on master

2021-06-21 Thread osumi.takami...@fujitsu.com
On Tuesday, June 22, 2021 11:08 AM Japin Li wrote: > On Mon, 21 Jun 2021 at 19:06, Amit Kapila wrote: > > On Mon, Jun 21, 2021 at 4:09 PM Japin Li wrote: > >> > >> On Mon, 21 Jun 2021 at 17:54, Amit Kapila > wrote: > >> > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: > >> >> > >> >> On Mon,

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 19:06, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 4:09 PM Japin Li wrote: >> >> On Mon, 21 Jun 2021 at 17:54, Amit Kapila wrote: >> > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: >> >> >> >> On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: >> >> > On Mon, Jun 21, 2

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Amit Kapila
On Mon, Jun 21, 2021 at 4:09 PM Japin Li wrote: > > On Mon, 21 Jun 2021 at 17:54, Amit Kapila wrote: > > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: > >> > >> On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: > >> > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: > >> >> > >> >> On Sat, 19

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 17:54, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: >> >> On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: >> > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: >> >> >> >> On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: >> >> > On Fri, Jun 18,

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Amit Kapila
On Mon, Jun 21, 2021 at 2:06 PM Japin Li wrote: > > On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: > > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: > >> > >> On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: > >> > On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila > >> > wrote: > >> > >> Or we

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Mon, 21 Jun 2021 at 16:22, Amit Kapila wrote: > On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: >> >> On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: >> > On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila >> > wrote: >> >> Or we can free the memory owned by indexoidlist after check whether it

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Amit Kapila
On Mon, Jun 21, 2021 at 1:30 PM Japin Li wrote: > > On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: > > On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila wrote: > > Or we can free the memory owned by indexoidlist after check whether it is NIL, > because we do not use it in the later. > Valid point.

Re: Fix for segfault in logical replication on master

2021-06-21 Thread Japin Li
On Sat, 19 Jun 2021 at 17:18, Amit Kapila wrote: > On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila wrote: >> >> > I thought it was cheap enough to check that the relation we open is an >> > index, because if it is not, we'll segfault when accessing fields of the >> > relation->rd_index struct. I

Re: Fix for segfault in logical replication on master

2021-06-19 Thread Amit Kapila
On Fri, Jun 18, 2021 at 9:18 AM Amit Kapila wrote: > > > I thought it was cheap enough to check that the relation we open is an > > index, because if it is not, we'll segfault when accessing fields of the > > relation->rd_index struct. I wouldn't necessarily advocate doing any > > really expen

Re: Fix for segfault in logical replication on master

2021-06-17 Thread Amit Kapila
On Thu, Jun 17, 2021 at 9:26 PM Mark Dilger wrote: > > > On Jun 17, 2021, at 6:40 AM, Amit Kapila wrote: > > > > I think such a problem won't happen because we are using historic > > snapshots in this context. We rely on that in a similar way in > > reorderbuffer.c, see ReorderBufferProcessTXN. >

Re: Fix for segfault in logical replication on master

2021-06-17 Thread Mark Dilger
> On Jun 17, 2021, at 6:40 AM, Amit Kapila wrote: > > I think such a problem won't happen because we are using historic > snapshots in this context. We rely on that in a similar way in > reorderbuffer.c, see ReorderBufferProcessTXN. I think you are right, but that's the part I have trouble ful

Re: Fix for segfault in logical replication on master

2021-06-17 Thread Amit Kapila
On Thu, Jun 17, 2021 at 6:50 PM Mark Dilger wrote: > > > On Jun 17, 2021, at 3:39 AM, osumi.takami...@fujitsu.com wrote: > > > > For the 1st check, isn't it better to use RelationIsValid() ? > > Yes, you are right. > > > Additionally, In what kind of actual scenario, did you think that > > we come

Re: Fix for segfault in logical replication on master

2021-06-17 Thread Mark Dilger
> On Jun 17, 2021, at 3:39 AM, osumi.takami...@fujitsu.com wrote: > > For the 1st check, isn't it better to use RelationIsValid() ? Yes, you are right. > Additionally, In what kind of actual scenario, did you think that > we come to the part to "log a complaint" ? The way that RelationGetInd

Re: Fix for segfault in logical replication on master

2021-06-17 Thread Amit Kapila
On Thu, Jun 17, 2021 at 4:09 PM osumi.takami...@fujitsu.com wrote: > > On Thursday, June 17, 2021 2:43 PM Mark Dilger > wrote: > > > On Jun 16, 2021, at 10:19 PM, osumi.takami...@fujitsu.com wrote: > > > > > > I started to analyze your report and > > > will reply after my idea to your modificati

RE: Fix for segfault in logical replication on master

2021-06-17 Thread osumi.takami...@fujitsu.com
On Thursday, June 17, 2021 2:43 PM Mark Dilger wrote: > > On Jun 16, 2021, at 10:19 PM, osumi.takami...@fujitsu.com wrote: > > > > I started to analyze your report and > > will reply after my idea to your modification is settled. > > Thank you. I'll share my first analysis. > In commit e7eea52b

Re: Fix for segfault in logical replication on master

2021-06-16 Thread Mark Dilger
> On Jun 16, 2021, at 10:19 PM, osumi.takami...@fujitsu.com wrote: > > I started to analyze your report and > will reply after my idea to your modification is settled. Thank you. — Mark Dilger EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company

RE: Fix for segfault in logical replication on master

2021-06-16 Thread osumi.takami...@fujitsu.com
On Thursday, June 17, 2021 1:31 PM Mark Dilger wrote: > In commit e7eea52b2d, you introduced a new function, > RelationGetIdentityKeyBitmap(), which uses some odd logic for determining > if a relation has a replica identity index. That code segfaults under certain > conditions. A test case to d

Fix for segfault in logical replication on master

2021-06-16 Thread Mark Dilger
Hi Amit, In commit e7eea52b2d, you introduced a new function, RelationGetIdentityKeyBitmap(), which uses some odd logic for determining if a relation has a replica identity index. That code segfaults under certain conditions. A test case to demonstrate that is attached. Prior to patching th