Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyc3Y-0002Cu-SM for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Feb 2020 13:46:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iyc3V-0006bu-PF for pgsql-bugs@arkaria.postgresql.org; Mon, 03 Feb 2020 13:46:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iyc3V-0006bn-Cj for pgsql-bugs@lists.postgresql.org; Mon, 03 Feb 2020 13:46:25 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1iyc3R-00087S-Rc for pgsql-bugs@lists.postgresql.org; Mon, 03 Feb 2020 13:46:24 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 708F321C57DE; Mon, 3 Feb 2020 16:46:20 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from ars-thinkpad (nat03-43-2.netorn.net [188.35.130.88]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id ED81521C57D8; Mon, 3 Feb 2020 16:46:19 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1580737580; bh=rYdl7JI23CxYdgsJU7MU9ArtkR6jIzIngaNGoV90Tq0=; h=References:From:To:Cc:Subject:In-reply-to:Date; b=UbFyS7uABT+Ai59OthTGBbVPMlGnzeQ0/8a3kXyxUt9/hXjkBcwx8Oy9iU/2rtBJE Rm65ib+GfnTU5q3gV3gtiUE23qRmHpzXUPB4F0D7iD6OoKsu3D5VlAwoJXdp/p8MCa yfkfuwAoY5OE+TT0kbfAraYSiEDj8ElBgWhmZyYk= References: <87ftjifoql.fsf@ars-thinkpad> <20191024213157.7pm6niybfxgpvmgg@alap3.anarazel.de> <87eez1fh48.fsf@ars-thinkpad> <8736bs81sx.fsf@ars-thinkpad> User-agent: mu4e 1.1.0; emacs 26.0.50 From: Arseny Sher To: Amit Kapila Cc: Andres Freund , "Hsu\, John" , "pgsql-bugs\@lists.postgresql.org" Subject: Re: ERROR: subtransaction logged without previous top-level txn record In-reply-to: Date: Mon, 03 Feb 2020 16:46:05 +0300 Message-ID: <871rrb942q.fsf@ars-thinkpad> MIME-Version: 1.0 Content-Type: text/plain List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Amit Kapila writes: > So, doesn't this mean that it started occurring after the fix done in > commit 96b5033e11 [1]? Because before that fix we wouldn't have > allowed processing XLOG_XACT_ASSIGNMENT records unless we are in > SNAPBUILD_FULL_SNAPSHOT state. I am not telling the fix in that > commit is wrong, but just trying to understand the situation here. Nope. Consider again example of WAL above triggering the error: [ ] Decoder starting reading WAL at where he immediately reads from disk snapshot serialized earlier, which makes it jump to SNAPBUILD_CONSISTENT right away. It doesn't read xl_xact_assignment_1, but it reads xl_xact_assignment_2 already in SNAPBUILD_CONSISTENT state, so catches the error regardless of this commit. >> Well, almost. This is true as long initial snapshot construction process >> goes the long way of building the snapshot by itself. If it happens to >> pick up from disk ready snapshot pickled there by another decoding >> session, it fast path'es to SNAPBUILD_CONSISTENT, which is technically a >> bug as described in >> https://www.postgresql.org/message-id/87ftjifoql.fsf%40ars-thinkpad >> > > Can't we deal with this separately? If so, I think let's not mix the > discussions for both as the root cause of both seems different. These issues are related: before removing the check it would be nice to ensure that there is no bugs it might protect us from (and it turns out there actually is, though it won't always protect, and though this bug has very small probability). Moreover, they are about more or less subject -- avoiding partially decoded xacts -- and once you dived deep enough to deal with one, it is reasonable to deal with another instead of doing that twice. But as a practical matter, removing the check is simple one-liner, and its presence causes people troubles -- so I'd suggest doing that first and then deal with the rest. I don't think starting new thread is worthwhile here, but if you think it does, I can create it. -- Arseny Sher Postgres Professional: http://www.postgrespro.com The Russian Postgres Company