Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Amit Langote
On Fri, Aug 7, 2020 at 1:21 PM Justin Pryzby wrote: > On Fri, Aug 07, 2020 at 01:13:51PM +0900, Amit Langote wrote: > > On Fri, Aug 7, 2020 at 1:05 PM Justin Pryzby wrote: > > > On Fri, Aug 07, 2020 at 12:16:11PM +0900, Amit Langote wrote: > > > > Curiously, Justin mentioned upthread that the

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Justin Pryzby
On Fri, Aug 07, 2020 at 01:13:51PM +0900, Amit Langote wrote: > On Fri, Aug 7, 2020 at 1:05 PM Justin Pryzby wrote: > > On Fri, Aug 07, 2020 at 12:16:11PM +0900, Amit Langote wrote: > > > Curiously, Justin mentioned upthread that the crash occurred during > > > BIND of a prepared query, so it

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Amit Langote
On Fri, Aug 7, 2020 at 1:05 PM Justin Pryzby wrote: > > On Fri, Aug 07, 2020 at 12:16:11PM +0900, Amit Langote wrote: > > Curiously, Justin mentioned upthread that the crash occurred during > > BIND of a prepared query, so it better had been that a custom plan was > > being executed, because a

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Justin Pryzby
On Fri, Aug 07, 2020 at 12:16:11PM +0900, Amit Langote wrote: > Curiously, Justin mentioned upthread that the crash occurred during > BIND of a prepared query, so it better had been that a custom plan was > being executed, because a generic one based on fewer partitions would > be thrown away due

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Justin Pryzby
On Fri, Aug 07, 2020 at 12:16:11PM +0900, Amit Langote wrote: > Curiously, Justin mentioned upthread that the crash occurred during > BIND of a prepared query, so it better had been that a custom plan was > being executed, I'm looking at how to check that ... can you give a hint ? -- Justin

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Tom Lane
Amit Langote writes: > On Fri, Aug 7, 2020 at 9:32 AM Tom Lane wrote: >> ... Amit's recipe for reproducing the bug works because there are >> other relation lock acquisitions (and hence AcceptInvalidationMessages >> calls) later in planning than where he asked us to wait. So this >>

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Amit Langote
On Fri, Aug 7, 2020 at 9:32 AM Tom Lane wrote: > Andy Fan writes: > > Attached is the v2 patch. Thanks Andy and Tom for this. > Forgot to mention that I'd envisioned adding this as a src/test/modules/ > module; contrib/ is for things that we intend to expose to users, which > I think this

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Tom Lane
Andy Fan writes: > I am not sure if we need to limit the scope to "between parsing and > execution", Yeah, there might be reason to add similar functionality in other places later. I'm not sure where yet --- but that idea does make me slightly unhappy with the "delay_execution" moniker. I

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Andy Fan
On Fri, Aug 7, 2020 at 8:32 AM Tom Lane wrote: > Andy Fan writes: > > Attached is the v2 patch. > > Forgot to mention that I'd envisioned adding this as a src/test/modules/ > module; contrib/ is for things that we intend to expose to users, which > I think this isn't. > > I played around with

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Tom Lane
Andy Fan writes: > Attached is the v2 patch. Forgot to mention that I'd envisioned adding this as a src/test/modules/ module; contrib/ is for things that we intend to expose to users, which I think this isn't. I played around with this and got the isolation test I'd experimented with yesterday

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Andy Fan
On Thu, Aug 6, 2020 at 10:42 PM Tom Lane wrote: > Andy Fan writes: > > On Thu, Aug 6, 2020 at 12:02 PM Tom Lane wrote: > >> See my straw-man proposal downthread. > > > Thanks for your explanation, I checked it again and it looks a very clean > > method. The attached is a draft patch based on

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Tom Lane
Andy Fan writes: > On Thu, Aug 6, 2020 at 12:02 PM Tom Lane wrote: >> See my straw-man proposal downthread. > Thanks for your explanation, I checked it again and it looks a very clean > method. The attached is a draft patch based on my understanding. Hope > I didn't misunderstand you.. Ah,

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-06 Thread Andy Fan
On Thu, Aug 6, 2020 at 12:02 PM Tom Lane wrote: > Andy Fan writes: > > On Thu, Aug 6, 2020 at 2:22 AM Tom Lane wrote: > >> In the longer term, it's annoying that we have no test methodology > >> for this other than "manually set a breakpoint here". > > > One of the methods I see is we can just

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Tom Lane
Andy Fan writes: > On Thu, Aug 6, 2020 at 2:22 AM Tom Lane wrote: >> In the longer term, it's annoying that we have no test methodology >> for this other than "manually set a breakpoint here". > One of the methods I see is we can just add some GUC variable for some > action injection.

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Andy Fan
On Thu, Aug 6, 2020 at 2:22 AM Tom Lane wrote: > Robert Haas writes: > > On Wed, Aug 5, 2020 at 1:30 PM Tom Lane wrote: > >> I'm strongly tempted to convert the trailing Assert to an actual > >> test-and-elog, too, but didn't do so here. > > > I was thinking about that, too. +1 for taking that

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Amit Langote
On Thu, Aug 6, 2020 at 2:30 AM Tom Lane wrote: > Amit Langote writes: > > The attached patch should fix that. > > I don't like this patch at all though; I do not think it is being nearly > careful enough to ensure that it's matched the surviving relation OIDs > correctly. In particular it

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Robert Haas
On Wed, Aug 5, 2020 at 4:19 PM Tom Lane wrote: > After thinking about it for a little bit, I'm envisioning a test module > that can be loaded into a session, and then it gets into the planner_hook, > and what it does is after each planner execution, take and release an > advisory lock with some

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Tom Lane
Robert Haas writes: > On Wed, Aug 5, 2020 at 2:22 PM Tom Lane wrote: >> In the longer term, it's annoying that we have no test methodology >> for this other than "manually set a breakpoint here". If we're going >> to allow plan-relevant DDL changes to happen with less than full table >> lock, I

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Robert Haas
On Wed, Aug 5, 2020 at 2:22 PM Tom Lane wrote: > In the longer term, it's annoying that we have no test methodology > for this other than "manually set a breakpoint here". If we're going > to allow plan-relevant DDL changes to happen with less than full table > lock, I think we need to improve

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Tom Lane
Robert Haas writes: > On Wed, Aug 5, 2020 at 1:30 PM Tom Lane wrote: >> I'm strongly tempted to convert the trailing Assert to an actual >> test-and-elog, too, but didn't do so here. > I was thinking about that, too. +1 for taking that step. Will do. In the longer term, it's annoying that we

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Robert Haas
On Wed, Aug 5, 2020 at 1:30 PM Tom Lane wrote: > I don't like this patch at all though; I do not think it is being nearly > careful enough to ensure that it's matched the surviving relation OIDs > correctly. In particular it blithely assumes that a zero in relid_map > *must* match the

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-05 Thread Tom Lane
Amit Langote writes: > The crash reported here is in the other case where the concurrently > added partitions cause the execution-time PartitionDesc to have more > partitions than the one that PartitionedRelPruneInfo is based on. > I was able to reproduce such a crash as follows: Yeah, I can

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Amit Langote
On Wed, Aug 5, 2020 at 10:04 AM Justin Pryzby wrote: > On Wed, Aug 05, 2020 at 09:53:44AM +0900, Amit Langote wrote: > > On Wed, Aug 5, 2020 at 9:52 AM Amit Langote wrote: > > > On Wed, Aug 5, 2020 at 9:32 AM Justin Pryzby wrote: > > > > On Wed, Aug 05, 2020 at 09:26:20AM +0900, Amit Langote

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Justin Pryzby
On Wed, Aug 05, 2020 at 09:53:44AM +0900, Amit Langote wrote: > On Wed, Aug 5, 2020 at 9:52 AM Amit Langote wrote: > > On Wed, Aug 5, 2020 at 9:32 AM Justin Pryzby wrote: > > > On Wed, Aug 05, 2020 at 09:26:20AM +0900, Amit Langote wrote: > > > > On Wed, Aug 5, 2020 at 12:11 AM Justin Pryzby >

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Amit Langote
On Wed, Aug 5, 2020 at 9:52 AM Amit Langote wrote: > On Wed, Aug 5, 2020 at 9:32 AM Justin Pryzby wrote: > > On Wed, Aug 05, 2020 at 09:26:20AM +0900, Amit Langote wrote: > > > On Wed, Aug 5, 2020 at 12:11 AM Justin Pryzby > > > wrote: > > > > > > > > On Tue, Aug 04, 2020 at 08:12:10PM +0900,

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Robert Haas
On Mon, Aug 3, 2020 at 12:11 PM Justin Pryzby wrote: > (gdb) p *pinfo->relid_map@414 > (gdb) p *partdesc->oids@415 Whoa, I didn't know about using @ in gdb to print multiple elements. Wild! Anyway, these two arrays differ in that the latter array has 22653702 inserted at the beginning and

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Justin Pryzby
On Tue, Aug 04, 2020 at 08:12:10PM +0900, Amit Langote wrote: > It may be this commit that went into PG 12 that is causing the problem: Thanks for digging into this. > to account for partitions that were pruned by the planner for which we > decided to put 0 into relid_map, but it only considered

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-04 Thread Amit Langote
On Tue, Aug 4, 2020 at 1:11 AM Justin Pryzby wrote: > > On Mon, Aug 03, 2020 at 11:41:37AM -0400, Robert Haas wrote: > > On Sun, Aug 2, 2020 at 2:11 PM Justin Pryzby wrote: > > > Based on commit logs, I suspect this may be an "older bug", specifically > > > maybe > > > with: > > > > > > |commit

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-03 Thread Justin Pryzby
On Mon, Aug 03, 2020 at 11:41:37AM -0400, Robert Haas wrote: > On Sun, Aug 2, 2020 at 2:11 PM Justin Pryzby wrote: > > Based on commit logs, I suspect this may be an "older bug", specifically > > maybe > > with: > > > > |commit 898e5e3290a72d288923260143930fb32036c00c > > |Author: Robert Haas >

Re: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-03 Thread Robert Haas
On Sun, Aug 2, 2020 at 2:11 PM Justin Pryzby wrote: > Based on commit logs, I suspect this may be an "older bug", specifically maybe > with: > > |commit 898e5e3290a72d288923260143930fb32036c00c > |Author: Robert Haas > |Date: Thu Mar 7 11:13:12 2019 -0500 > | > |Allow ATTACH PARTITION with

FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689)

2020-08-02 Thread Justin Pryzby
Core was generated by `postgres: telsasoft ts [local] BIND '. (gdb) bt #0 0x7f0951303387 in raise () from /lib64/libc.so.6 #1 0x7f0951304a78 in abort () from /lib64/libc.so.6 #2 0x00921005 in ExceptionalCondition