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 1j1UIy-0004La-PR for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Feb 2020 12:06:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1j1UIw-0007q2-Hg for pgsql-bugs@arkaria.postgresql.org; Tue, 11 Feb 2020 12:06:14 +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 1j1UIw-0007pv-3S for pgsql-bugs@lists.postgresql.org; Tue, 11 Feb 2020 12:06:14 +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 1j1UIs-0005s4-Vj for pgsql-bugs@lists.postgresql.org; Tue, 11 Feb 2020 12:06:13 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id EE8C921C580D; Tue, 11 Feb 2020 15:06:08 +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 (gw.postgrespro.ru [93.174.131.141]) (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 1BB7321C580C; Tue, 11 Feb 2020 15:06:07 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1581422768; bh=YZgA+ruCVYHByAobIDEFxowiM1DDYunFzQfXd0k/BXo=; h=References:From:To:Cc:Subject:In-reply-to:Date; b=Exb6Nvcf78BEPcvtNDQif1IFqh+DYoTFeyRJtloWd4+d8sQZPT/aJEIMQczc6WClO As9IQN5N92AFQY/21UlC1f+ohI+gF4reBu3ePR1xBKMaZVoi/CSFFyzCJElWH/pthf bc5aKk8Kfg+f3SK0ufC/iYRHfcLoTfQsCjImh6NU= References: <87ftjifoql.fsf@ars-thinkpad> <20191024213157.7pm6niybfxgpvmgg@alap3.anarazel.de> <87eez1fh48.fsf@ars-thinkpad> <8736bs81sx.fsf@ars-thinkpad> <871rrb942q.fsf@ars-thinkpad> <87zhdx76d5.fsf@ars-thinkpad> <8736bjoiax.fsf@ars-thinkpad> <87wo8ulhjl.fsf@ars-thinkpad> <87lfp9u4kp.fsf@ars-thinkpad> User-agent: mu4e 1.2.0; emacs 26.0.50 From: Arseny Sher To: Amit Kapila Cc: Arseny Sher , Andres Freund , "Hsu\, John" , "pgsql-bugs\@lists.postgresql.org" Subject: Re: ERROR: subtransaction logged without previous top-level txn record In-reply-to: Date: Tue, 11 Feb 2020 15:06:02 +0300 Message-ID: <87tv3x72hh.fsf@ars-thinkpad> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --=-=-= Content-Type: text/plain Amit Kapila writes: >> That's weird, it reliably fails with expected error for me. There are >> already two s2_checkpoint's: first establishes potential (broken) >> restart_lsn (serializes snapshot after first xl_xact_assignment of s0 >> xact, but before first record of s1 xact), the second ensures >> s2_get_changes directly following it will actually advance the slot, >> > > In my case, s2_get_changes doesn't seem to be advancing the restart > lsn because when it processed running_xact by s2_checkpoint, the slots > confirm flush location (slot->data.confirmed_flush) was behind it. As > confirmed_flush was behind running_xact of s2_checkpoint, it couldn't > update slot->candidate_restart_lsn (in function > LogicalIncreaseRestartDecodingForSlot). I think the confirmed_flush > location will only be updated at the end of get_changes. This is the > reason I need extra get_changes call to generate an error. > > I will think and investigate this more, but thought of sharing the > current situation with you. There is something different going on in > my system or maybe the nature of test is like that. Ah, I think I know what's happening -- you have one more xl_running_xacts which catches the advancement -- similar issue is explained in the comment in oldest_xmin.spec. Try attached. --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-Stop-demanding-that-top-xact-must-be-seen-before--v4.patch