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 1rAltC-0089T2-5q for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 07:00:10 +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 1rAltA-007xni-Pi for pgsql-hackers@arkaria.postgresql.org; Wed, 06 Dec 2023 07: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 1rAltA-007xna-GG for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 07:00:08 +0000 Received: from mail-lf1-x12a.google.com ([2a00:1450:4864:20::12a]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rAlt7-0092Xe-Nu for pgsql-hackers@lists.postgresql.org; Wed, 06 Dec 2023 07:00:07 +0000 Received: by mail-lf1-x12a.google.com with SMTP id 2adb3069b0e04-50bf69afa99so4063815e87.3 for ; Tue, 05 Dec 2023 23:00:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1701846004; x=1702450804; 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=A0jszmPGqqPgand40BVlizvHzQFhejuAFRc7zTInD6M=; b=ROhK3HhpBLXMJHW/E8SDll0qKTYKs4A70uqmp+iBnvTvcgZiuaAxApSMY4MXdbi7du kNxWkEJmmpTGWHMOJ+SlAaPpKUxtfkQIwxT+iytJIl5PZy7dwCNI0s5IaxIlgsjt8l4U 9+CTi6sTzFT+wwGG24g32vKzHym9lZD37nVrd4R9bQn2aVYYJNKx6QhwbTEyDk/yS2up yd2luFp47Icdhjl7jQJwqFAkkZvTy+bz37eZZY6vift7AdR007G7YE/j42peQ2F+ob7c QdNIADw7zi4PGaB9MIqGM9koeKTWR7qe3ko04At5k+nkkztCD2wS2R0seBrKCf8JDPXi RHMQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701846004; x=1702450804; 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=A0jszmPGqqPgand40BVlizvHzQFhejuAFRc7zTInD6M=; b=UTdSzwLeqMs1Anw3pnguMj/opTyTI5LFioait0EHnrCQXu61mKP75WPipEAXmdKAA8 qJopRex/H0HPHRPy7ZEOn2f1LWe+/SQwYoE3PYgh8MVSiA/R8F0njCwanYST+qcwqu3G bMaAB7kT5o/Qgw4Mumozl17W/WGrnjNchXcJAQGQagnJnbzwDdxWUSIprL3rgPfd0/+P CXCjO8DqsuavnmP8RP512JitBUkfFmabDbO4MzjzlHePiKhpAZdo/rjcTwH/eAwia2M1 chI95EFLdQQEi8kednw+I2yLvJiDxo85KgxZlvFYI1w06dBNuNinM+YTVR3tzZUqB3ON oBOQ== X-Gm-Message-State: AOJu0YzqM8PmJMuQ6L+oZN1xMOCljN3hCk4KWWmBFKvteAcgQnBNK35V 0gt6c7q/BH7bcQ/7r6zjksSixLNUt7VSDA== X-Google-Smtp-Source: AGHT+IHff4lfOUMOX1jzoIUV1aTZbdCAlvU0X0c+xeIO9VZKo+yCDVL4JUrb0+AWHxcxO9T3JVKt/g== X-Received: by 2002:a19:ac09:0:b0:50b:d764:9689 with SMTP id g9-20020a19ac09000000b0050bd7649689mr232369lfc.109.1701846003712; Tue, 05 Dec 2023 23:00:03 -0800 (PST) Received: from [1.0.0.7] ([178.155.18.102]) by smtp.gmail.com with ESMTPSA id m15-20020a0565120a8f00b0050bfda10057sm634779lfu.85.2023.12.05.23.00.02 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 05 Dec 2023 23:00:02 -0800 (PST) Message-ID: Date: Wed, 6 Dec 2023 10:00:01 +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: From: Alexander Lakhin In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Michael, 05.12.2023 02:45, Michael Paquier wrote: > Popping a snapshot at this stage when there are no indexes has been a > decision taken by the original commit in 5dc92b844e68 because we had > no need for it yet, but we may do now depending on the function > triggered. I have been looking at the whole stack and something like > the attached to make a pop conditional seems to be sufficient to > satisfy all the cases I've been able to come up with, including the > one reported here. > > Alexander, do you see any hole in that? Perhaps the snapshot push > should be more aggressive at the end of ReindexRelationConcurrently() > as well (in the last transaction when rebuilds happen)? Thank you for the fix proposed! I agree with it. I had worried a bit about ReindexRelationConcurrently() becoming twofold for callers (it can leave the snapshot or pop it), but I couldn't find a way to hide this twofoldness inside without adding more complexity. On the other hand, ReindexRelationConcurrently() now satisfies EnsurePortalSnapshotExists() in all cases. Best regards, Alexander