Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAAQb-0056vO-Li for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Dec 2023 15:00:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rAAQa-00HQlC-Ao for pgsql-hackers@arkaria.postgresql.org; Mon, 04 Dec 2023 15:00:08 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAAQZ-00HQl4-TK for pgsql-hackers@lists.postgresql.org; Mon, 04 Dec 2023 15:00:08 +0000 Received: from mail-lj1-x231.google.com ([2a00:1450:4864:20::231]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAAQX-008lTa-Do for pgsql-hackers@lists.postgresql.org; Mon, 04 Dec 2023 15:00:06 +0000 Received: by mail-lj1-x231.google.com with SMTP id 38308e7fff4ca-2ca0c36f5beso7414031fa.1 for ; Mon, 04 Dec 2023 07:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701702004; x=1702306804; darn=lists.postgresql.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=XTo3gnVNI1GEUJn39k8E41iAQi/BmGMs0cBwbxkR4yI=; b=dopZhK0CsHO7zCPob8Yg4dI+9g6lYKGPd69inRggaCIi6QJgAKz2MvgZ6pmxVvnN+x Qeqp3ZB3Hps+1p+GyuiQ23IN7ahlUf4P+IEbOwGe4dicxfrSSx+31Ddmw9WEAo147OZz avGC/sTn15TtnkpGO4P9dp3kqeVV2nwV5g+0FGQK6v6IrJqBz3wjJOL+RoYpa1GYE4xJ 0AGzE2XxxRnoAHq6UFatMs5wGz4KlM15q5cxQUDDWCW7rRoP7+RjBgDYD5lY5urdVit3 efVsj1yWFOnMu9VCB3/prQFN3Av3k/BM3jq47xFRS9xuhFfxppurVVQQq/Iz84/kRy/H deCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701702004; x=1702306804; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=XTo3gnVNI1GEUJn39k8E41iAQi/BmGMs0cBwbxkR4yI=; b=cbKYsLzQAifaIeG/sOUHDbmdUHvhuiySgmh7lEv3npG1QHr3n6cMAMEaP9AuDasOLz M0wGJ1w18p6c+ts8A43V5zqDaylMflQDKrhncRvn5NAgVKv8ozwlyqmNuHd3d0jlOtuU IGS7lLKNjOQi4MuZln1wTRfsszz5kstwToObrgNu726voqvyRpXnccDZwN4xU8dwI0p1 L1iBzttF/vF/VOHNMTeAmzSboBi0OkIFPud+5IwF2BTxq9jO6h2wP7B2TCq+AGF93+M5 vE9cqMLuotYxEjrgMnMSkqUiNpPN3G/p9RAJkL09q450HvKF8xeJ1TjCZyY/S15o8izv jfjA== X-Gm-Message-State: AOJu0YwtWJBuoCMptoFhzPiO72VX6icMjqstYD6XgY6wsy3/f/g3wDGD 1hrOFROWAljW9+cy6uy74C8= X-Google-Smtp-Source: AGHT+IGgyHZbOo4uVEKnCPPWKNUvtRrWCPmAhn4sk3V8Jyyls8l73LCl19IyvLVLjUPXKDwA9LT6Og== X-Received: by 2002:a2e:95d3:0:b0:2ca:2d1:9f07 with SMTP id y19-20020a2e95d3000000b002ca02d19f07mr800188ljh.5.1701702003393; Mon, 04 Dec 2023 07:00:03 -0800 (PST) Received: from [1.0.0.7] ([178.155.18.102]) by smtp.gmail.com with ESMTPSA id z23-20020a05651c023700b002c9f8d8e5f4sm595093ljn.41.2023.12.04.07.00.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 04 Dec 2023 07:00:02 -0800 (PST) Message-ID: Date: Mon, 4 Dec 2023 18:00:00 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: PATCH: Add REINDEX tag to event triggers Content-Language: en-US To: Michael Paquier , jian he Cc: Ajin Cherian , Jim Jones , Garrett Thornburg , pgsql-hackers@lists.postgresql.org References: <28176fb8-5169-ecf7-9b3c-82748dde76f0@uni-muenster.de> From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Michael, 04.12.2023 04:04, Michael Paquier wrote: > Anyway, I've been working on the patch for the last few days, and > applied it after tweaking a bit its style, code and comments. Please look at the assertion failure triggered when REINDEX processed by an event trigger: CREATE FUNCTION etf() RETURNS EVENT_TRIGGER AS $$ BEGIN PERFORM 1; END $$ LANGUAGE plpgsql; CREATE EVENT TRIGGER et ON ddl_command_end EXECUTE FUNCTION etf(); CREATE TABLE t (i int); REINDEX (CONCURRENTLY) TABLE t; Core was generated by `postgres: law regression [local] REINDEX                                      '. Program terminated with signal SIGABRT, Aborted. warning: Section `.reg-xstate/338911' in core file too small. #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140462399108928) at ./nptl/pthread_kill.c:44 44      ./nptl/pthread_kill.c: No such file or directory. (gdb) bt #0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140462399108928) at ./nptl/pthread_kill.c:44 #1  __pthread_kill_internal (signo=6, threadid=140462399108928) at ./nptl/pthread_kill.c:78 #2  __GI___pthread_kill (threadid=140462399108928, signo=signo@entry=6) at ./nptl/pthread_kill.c:89 #3  0x00007fbff2c09476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26 #4  0x00007fbff2bef7f3 in __GI_abort () at ./stdlib/abort.c:79 #5  0x000055d88b8bb8de in ExceptionalCondition (conditionName=0x55d88baac6c0 "portal->portalSnapshot == NULL", fileName=0x55d88baac2c4 "pquery.c", lineNumber=1796) at assert.c:66 #6  0x000055d88b6d6186 in EnsurePortalSnapshotExists () at pquery.c:1796 #7  0x000055d88b47d21a in _SPI_execute_plan (plan=0x55d88bfd2a80, options=0x7ffdc53b94c0, snapshot=0x0, crosscheck_snapshot=0x0, fire_triggers=true) at spi.c:2579 #8  0x000055d88b479f37 in SPI_execute_plan_with_paramlist (plan=0x55d88bfd2a80, params=0x0, read_only=false, tcount=0) at spi.c:749 #9  0x00007fbfe6de57ed in exec_run_select (estate=0x7ffdc53b97c0, expr=0x55d88bfba7f8, maxtuples=0, portalP=0x0) at pl_exec.c:5815 #10 0x00007fbfe6dddce9 in exec_stmt_perform (estate=0x7ffdc53b97c0, stmt=0x55d88bfba950) at pl_exec.c:2171 #11 0x00007fbfe6ddd87c in exec_stmts (estate=0x7ffdc53b97c0, stmts=0x55d88bfbad90) at pl_exec.c:2023 #12 0x00007fbfe6ddd5f8 in exec_stmt_block (estate=0x7ffdc53b97c0, block=0x55d88bfbade0) at pl_exec.c:1942 #13 0x00007fbfe6ddccff in exec_toplevel_block (estate=0x7ffdc53b97c0, block=0x55d88bfbade0) at pl_exec.c:1633 #14 0x00007fbfe6ddbb6a in plpgsql_exec_event_trigger (func=0x55d88bf66840, trigdata=0x7ffdc53b9b00) at pl_exec.c:1198 #15 0x00007fbfe6df74c7 in plpgsql_call_handler (fcinfo=0x7ffdc53b9aa0) at pl_handler.c:272 #16 0x000055d88b34f592 in EventTriggerInvoke (fn_oid_list=0x55d88beffa40, trigdata=0x7ffdc53b9b00) at event_trigger.c:1087 #17 0x000055d88b34edea in EventTriggerDDLCommandEnd (parsetree=0x55d88bed6000) at event_trigger.c:803 #18 0x000055d88b6d9a41 in ProcessUtilitySlow (pstate=0x55d88beff930, pstmt=0x55d88bed60b0, queryString=0x55d88bed54f0 "REINDEX (CONCURRENTLY) TABLE t;", context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x55d88bed6370,     qc=0x7ffdc53ba310) at utility.c:1937 #19 0x000055d88b6d7ae9 in standard_ProcessUtility (pstmt=0x55d88bed60b0, queryString=0x55d88bed54f0 "REINDEX (CONCURRENTLY) TABLE t;", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0,     dest=0x55d88bed6370, qc=0x7ffdc53ba310) at utility.c:1074 #20 0x000055d88b6d69ea in ProcessUtility (pstmt=0x55d88bed60b0, queryString=0x55d88bed54f0 "REINDEX (CONCURRENTLY) TABLE t;", readOnlyTree=false, context=PROCESS_UTILITY_TOPLEVEL, params=0x0, queryEnv=0x0, dest=0x55d88bed6370,     qc=0x7ffdc53ba310) at utility.c:530 #21 0x000055d88b6d52b8 in PortalRunUtility (portal=0x55d88bf509f0, pstmt=0x55d88bed60b0, isTopLevel=true, setHoldSnapshot=false, dest=0x55d88bed6370, qc=0x7ffdc53ba310) at pquery.c:1158 #22 0x000055d88b6d552f in PortalRunMulti (portal=0x55d88bf509f0, isTopLevel=true, setHoldSnapshot=false, dest=0x55d88bed6370, altdest=0x55d88bed6370, qc=0x7ffdc53ba310) at pquery.c:1315 #23 0x000055d88b6d4979 in PortalRun (portal=0x55d88bf509f0, count=9223372036854775807, isTopLevel=true, run_once=true, dest=0x55d88bed6370, altdest=0x55d88bed6370, qc=0x7ffdc53ba310) at pquery.c:791 #24 0x000055d88b6cd74a in exec_simple_query (query_string=0x55d88bed54f0 "REINDEX (CONCURRENTLY) TABLE t;") at postgres.c:1273 #25 0x000055d88b6d26f6 in PostgresMain (dbname=0x55d88bf0c860 "regression", username=0x55d88bf0c848 "law") at postgres.c:4653 #26 0x000055d88b5f2014 in BackendRun (port=0x55d88bf00f80) at postmaster.c:4425 #27 0x000055d88b5f1636 in BackendStartup (port=0x55d88bf00f80) at postmaster.c:4104 #28 0x000055d88b5edcf6 in ServerLoop () at postmaster.c:1772 #29 0x000055d88b5ed5f3 in PostmasterMain (argc=3, argv=0x55d88becf700) at postmaster.c:1471 #30 0x000055d88b49d2ca in main (argc=3, argv=0x55d88becf700) at main.c:198 Best regards, Alexander