Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1aW3Ux-0007nv-68 for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Feb 2016 14:54:35 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1aW3Uw-0002YU-P4 for pgsql-bugs@arkaria.postgresql.org; Wed, 17 Feb 2016 14:54:34 +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) (envelope-from ) id 1aW3Uw-0002Wz-Ch for pgsql-bugs@postgresql.org; Wed, 17 Feb 2016 14:54:34 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1aW3Ut-0006Mm-TT for pgsql-bugs@postgresql.org; Wed, 17 Feb 2016 14:54:33 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u1HEsUuO015748; Wed, 17 Feb 2016 09:54:30 -0500 From: Tom Lane To: Michael Paquier cc: PostgreSQL mailing lists Subject: Re: SIGQUIT and lost sequence WAL records In-reply-to: References: Comments: In-reply-to Michael Paquier message dated "Wed, 17 Feb 2016 13:55:16 +0000" Date: Wed, 17 Feb 2016 09:54:30 -0500 Message-ID: <15747.1455720870@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Michael Paquier writes: > Lately a couple of colleagues have pinged me regarding the fact that a > server signaled with SIGQUIT, or "pg_ctl stop -m immediate", may > ignore sequence WAL records. I've not gone through this in detail, but I think what is happening is that since the test case never commits any transactions, the sequence-advance WAL records may not get flushed to disk, and thus of course are not available for replay. This is not a bug IMO, as by the exact same token, no uses of those nextval() values can appear in any committed tuples, so no database inconsistency is possible. If an application is using nextval() results *externally to the database*, it's unsafe for it to rely on those values being unique unless/until it commits the nextval() calls. I seem to recall some past discussions about whether a transaction that commits after writing only a sequence advance (that is, it did nextval() and nothing else) needs to flush WAL. I think at one point it did not but we changed it because of this consideration. [ digs around... ] That was a long time ago: see 01747692f. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs