Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dGB6k-0002JD-W3 for pgsql-hackers@arkaria.postgresql.org; Wed, 31 May 2017 21:24:47 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dGB6j-0005Ww-0U for pgsql-hackers@arkaria.postgresql.org; Wed, 31 May 2017 21:24:45 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dGB6h-0005WR-QW; Wed, 31 May 2017 21:24:44 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dGB6e-0008Nx-VI; Wed, 31 May 2017 21:24:42 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 025A520B70; Wed, 31 May 2017 17:24:40 -0400 (EDT) Received: from frontend2 ([10.202.2.161]) by compute5.internal (MEProxy); Wed, 31 May 2017 17:24:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc:x-sasl-enc; s=fm1; bh=M6rSjYl9WFH7+P2t1e j7EZELpMR8BvW3JpC6d2XGg/8=; b=EDj01oID1BEKMo3vyK7awSAHAcSuEG9MO4 3YhnVm9n6I/KQIxsDBvK7wuQyY5N0uRG9VC2GJts3odx9QjYWK5G4/LLLAVVHvPQ X6CYXnZyjtlC7iclMbhpAKA/4S5lHpBnP4qj4Yu0SagwAGjOLtMiz2Hs33qvv8uF WiYn32ssuhN4/mZEze8KbGzgUMqAGMV8xuMxB9klJsqe9z6sORR7Q07mGRnQYwRQ 2ME4dqQ2DQjne2Vt3GHWMzKIZGv52b6zVU+BMN/ZhHjKqTu1WlYlmudvv59AzSL6 f40UYEWMm1327E2zNau5FTmp+paVKQ7+9FoQiv5B88UK50WnmtPQ== X-ME-Sender: X-Sasl-enc: V4iHYTj9J1WRMt1X4XKdoCSVhgE+6ABBAqJLFblYfTjL 1496265879 Received: from intern.anarazel.de (unknown [208.72.138.107]) by mail.messagingengine.com (Postfix) with ESMTPA id AE3592445F; Wed, 31 May 2017 17:24:39 -0400 (EDT) Date: Wed, 31 May 2017 14:24:38 -0700 From: Andres Freund To: Robert Haas , Peter Eisentraut Cc: "pgsql-hackers@postgresql.org" , Michael Paquier , Noah Misch , Jason Petersen , PostgreSQL mailing lists Subject: Re: [BUGS] Concurrent ALTER SEQUENCE RESTART Regression Message-ID: <20170531212438.rup2qyphp3ig4mvs@alap3.anarazel.de> References: <20170518205428.kxxtsdl6wswnz3e3@alap3.anarazel.de> <20170522154227.nvafbsm62sjpbxvd@alap3.anarazel.de> <20170524032516.rsggec2yrd4cqvv2@alap3.anarazel.de> <54DD1674-B9FC-4723-AC3E-890373889E25@anarazel.de> <20170524143239.2dzn3hq3k5wt6shf@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 2017-05-24 10:52:37 -0400, Robert Haas wrote: > On Wed, May 24, 2017 at 10:32 AM, Andres Freund wrote: > > Well, but then we should just remove minval/maxval if we can't rely on > > it. > > That seems like a drastic overreaction to me. Well, either they work, or they don't. But since it turns out to be easy enough to fix anyway... > > I wonder if that's not actually very little new code, and I think we > > might end up regretting having yet another inconsistent set of semantics > > in v10, which we'll then end up changing again in v11. > > I'm not exercised enough about it to spend time on it or to demand > that Peter do so, but feel free to propose something. This turns out to be fairly simple patch. We already do precisely what I describe when resetting a sequence for TRUNCATE, so it's an already tested codepath. It also follows a lot more established practice around transactional schema changes, so I think that's architecturally better too. Peter, to my understanding, agreed with that reasoning at pgcon. I just have two questions: 1) We've introduced, in 3d092fe540, infrastructure to avoid unnecessary catalog updates, in an attemt to fix the "concurrently updated" error. But that turned out to not be sufficient anyway, and it bulks up the code. I'd vote for just removing that piece of logic, it doesn't buy us anything meaningful, and it's bulky. 2) There's currently logic that takes a lower level lock for ALTER SEQUENCE RESET without other options. I think that's a bit confusing with the proposed change, because then it's unclear when ALTER SEQUENCE is transactional and when not. I think it's actually a lot easier to understand if we keep nextval()/setval() as non-transactional, and ALTER SEQUENCE as transactional. Comments? - Andres -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers