Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2IT3-0002cy-3H for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Aug 2020 18:12:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1k2ISW-0004qr-2r for pgsql-hackers@arkaria.postgresql.org; Sun, 02 Aug 2020 18:11:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1k2ISV-0004qk-Ll for pgsql-hackers@lists.postgresql.org; Sun, 02 Aug 2020 18:11:43 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1k2ISN-00014Q-QV for pgsql-hackers@postgresql.org; Sun, 02 Aug 2020 18:11:42 +0000 Received: by mail-io1-xd2e.google.com with SMTP id w12so22782878iom.4 for ; Sun, 02 Aug 2020 11:11:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=Bcbo8+P1Geyfz7SSRvG2Ey3Zh9U5oczdK5WUtltxNcA=; b=GHUsyYn5Du5KzXh44n0d9R5jXACvpTHIdmyN4bnp40OYJWqCWP0BNz5qKOlSEARNY1 WkDyPc+1G9cFSQMnaeQVudulY12RBwOS0wu66hXLSU8kAhXE28T186qlt1CkjFzhTJUB zbt2O4LsS6Q2/QtoGJsSVhDYrMQKiozoacnCfJblLFbp9kkxMhGTAtl5Fv5tWIoJDS4q 45FOwAzuwaAw7l8oJ9q8zWFvjAAxu9n23w6HohXa+l09o1WjLEA7yDX4WkUMpb3mvk9g jO6cUyS6lNF5k2uhrCuCoN2B1NEJUVjzhKvZvMhYtJUE1fazq+SnMsPF9WixewlnCYx/ FfPg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=Bcbo8+P1Geyfz7SSRvG2Ey3Zh9U5oczdK5WUtltxNcA=; b=OJODuwttVZH0HBz2qdVNApBJKP+MiLgxru20Srw4v+HXesag1AXbg0y6Sgd8Q9ut8/ cKrWbt+U2/EOUlFojZuuFZ0InfqVPDCEHMGwaKAafKslNmVg6cW0OSMgZPC2ss/P3B5r dhiYOgAHkgDjLe7mtlsXoyPDw2djoViJ6U/m6BxNGobpOAyFCnK+tS08sh3bh9R4BdFy sPfaPelx7RhbhPNQ6C0G1sGQqxv2pv+/WxI7iJPoKxlFsIFfdQDka8z8WF4KoyDsd1uM jgt2qr+qfItVOns8WgD6Nr1LYW1xkQ9ZgIifdzfX8sxCoPyuBWW0hOkPpTzP7CdsnbUj KVjQ== X-Gm-Message-State: AOAM5305QX8t8CoqiSDxKVkm+7LKnMAyCU9TfFAukY0cxt1MJxtt2kWs Dyfy7+qsHsEuamTABqRQc7jU18X9WvQ= X-Google-Smtp-Source: ABdhPJyH0NFkzzY8Z0uZB8GR7V/IPMxFtiiZH0U1Fg5fGGCVcN5E49DdSo/LXq8eagMcZkpU64+I8g== X-Received: by 2002:a6b:b555:: with SMTP id e82mr13194207iof.56.1596391893716; Sun, 02 Aug 2020 11:11:33 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id r15sm9221034ilq.16.2020.08.02.11.11.32 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Aug 2020 11:11:33 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 19F13800171; Sun, 2 Aug 2020 13:11:32 -0500 (CDT) Date: Sun, 2 Aug 2020 13:11:31 -0500 From: Justin Pryzby To: pgsql-hackers@postgresql.org Cc: Robert Haas Subject: FailedAssertion("pd_idx == pinfo->nparts", File: "execPartition.c", Line: 1689) Message-ID: <20200802181131.GA27754@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Core was generated by `postgres: telsasoft ts [local] BIND '. (gdb) bt #0 0x00007f0951303387 in raise () from /lib64/libc.so.6 #1 0x00007f0951304a78 in abort () from /lib64/libc.so.6 #2 0x0000000000921005 in ExceptionalCondition (conditionName=conditionName@entry=0xa5db3d "pd_idx == pinfo->nparts", errorType=errorType@entry=0x977389 "FailedAssertion", fileName=fileName@entry=0xa5da88 "execPartition.c", lineNumber=lineNumber@entry=1689) at assert.c:67 #3 0x0000000000672806 in ExecCreatePartitionPruneState (planstate=planstate@entry=0x908f6d8, partitionpruneinfo=) at execPartition.c:1689 #4 0x000000000068444a in ExecInitAppend (node=node@entry=0x7036b90, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeAppend.c:132 #5 0x00000000006731fd in ExecInitNode (node=0x7036b90, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:179 #6 0x000000000069d03a in ExecInitResult (node=node@entry=0x70363d8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeResult.c:210 #7 0x000000000067323c in ExecInitNode (node=0x70363d8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:164 #8 0x000000000069e834 in ExecInitSort (node=node@entry=0x7035ca8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeSort.c:210 #9 0x0000000000672ff0 in ExecInitNode (node=0x7035ca8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:313 #10 0x00000000006812e8 in ExecInitAgg (node=node@entry=0x68311d0, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeAgg.c:3292 #11 0x0000000000672fb1 in ExecInitNode (node=0x68311d0, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:328 #12 0x000000000068925a in ExecInitGatherMerge (node=node@entry=0x6830998, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeGatherMerge.c:110 #13 0x0000000000672f33 in ExecInitNode (node=0x6830998, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:348 #14 0x00000000006812e8 in ExecInitAgg (node=node@entry=0x682eda8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at nodeAgg.c:3292 #15 0x0000000000672fb1 in ExecInitNode (node=node@entry=0x682eda8, estate=estate@entry=0x11563f0, eflags=eflags@entry=16) at execProcnode.c:328 #16 0x000000000066c8e6 in InitPlan (eflags=16, queryDesc=) at execMain.c:1020 #17 standard_ExecutorStart (queryDesc=, eflags=16) at execMain.c:266 #18 0x00007f0944ca83b5 in pgss_ExecutorStart (queryDesc=0x1239b08, eflags=) at pg_stat_statements.c:1007 #19 0x00007f09117e4891 in explain_ExecutorStart (queryDesc=0x1239b08, eflags=) at auto_explain.c:301 #20 0x00000000007f9983 in PortalStart (portal=0xeff810, params=0xfacc98, eflags=0, snapshot=0x0) at pquery.c:505 #21 0x00000000007f7370 in PostgresMain (argc=, argv=argv@entry=0xeb8500, dbname=0xeb84e0 "ts", username=) at postgres.c:1987 #22 0x000000000048916e in BackendRun (port=, port=) at postmaster.c:4523 #23 BackendStartup (port=0xeb1000) at postmaster.c:4215 #24 ServerLoop () at postmaster.c:1727 #25 0x000000000076ec85 in PostmasterMain (argc=argc@entry=13, argv=argv@entry=0xe859b0) at postmaster.c:1400 #26 0x000000000048a82d in main (argc=13, argv=0xe859b0) at main.c:210 #3 0x0000000000672806 in ExecCreatePartitionPruneState (planstate=planstate@entry=0x908f6d8, partitionpruneinfo=) at execPartition.c:1689 pd_idx = pp_idx = pprune = 0x908f910 partdesc = 0x91937f8 pinfo = 0x7d6ee78 partrel = partkey = 0xfbba28 lc2__state = {l = 0x7d6ee20, i = 0} partrelpruneinfos = 0x7d6ee20 lc2 = npartrelpruneinfos = prunedata = 0x908f908 j = 0 lc__state = {l = 0x7d6edc8, i = 0} estate = 0x11563f0 prunestate = 0x908f8b0 n_part_hierarchies = lc = i = 0 (gdb) p *pinfo $2 = {type = T_PartitionedRelPruneInfo, rtindex = 7, present_parts = 0x7d6ef10, nparts = 414, subplan_map = 0x7d6ef68, subpart_map = 0x7d6f780, relid_map = 0x7d6ff98, initial_pruning_steps = 0x7d707b0, exec_pruning_steps = 0x0, execparamids = 0x0} (gdb) p pd_idx $3 = < 2020-08-02 02:04:17.358 SST >LOG: server process (PID 20954) was terminated by signal 6: Aborted < 2020-08-02 02:04:17.358 SST >DETAIL: Failed process was running: INSERT INTO child.cdrs_data_users_per_cell_20200801 (...list of columns elided...) ( SELECT ..., $3::timestamp, $2, MODE() WITHIN GROUP (ORDER BY ...) AS ..., STRING_AGG(DISTINCT ..., ',') AS ..., ... This crashed at 2am, which at first I thought was maybe due to simultaneously creating today's partition. Aug 2 02:04:08 telsasoftsky abrt-hook-ccpp: Process 19264 (postgres) of user 26 killed by SIGABRT - dumping core Aug 2 02:04:17 telsasoftsky abrt-hook-ccpp: Process 20954 (postgres) of user 26 killed by SIGABRT - ignoring (repeated crash) Running: postgresql13-server-13-beta2_1PGDG.rhel7.x86_64 Maybe this is a problem tickled by something new in v13. However, this is a new VM, and at the time of the crash I was running a shell loop around pg_restore, in reverse-chronological order. I have full logs, and I found that just CREATEd was a table which the crashing process would've tried to SELECT FROM: | 2020-08-02 02:04:01.48-11 | duration: 106.275 ms statement: CREATE TABLE child.cdrs_huawei_sgwrecord_2019_06_14 ( That table *currently* has: |Number of partitions: 416 (Use \d+ to list them.) And the oldest table is still child.cdrs_huawei_sgwrecord_2019_06_14 (since the shell loop probably quickly spun through hundreds of pg_restores, failing to connect to the database "in recovery"). And today's partition was already created, at: 2020-08-02 01:30:35. So I think 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 only ShareUpdateExclusiveLock. I don't think it matters, but the process surrounding the table being INSERTed INTO is more than a little special, involving renames, detaches, creation, re-attaching within a transaction. I think that doesn't matter though, and the issue is surrounding the table being SELECTed *from*, which is actually behind a view.