Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fUyVx-0001M4-RJ for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 18:04:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fUyVw-0007iK-Hm for pgsql-hackers@arkaria.postgresql.org; Mon, 18 Jun 2018 18:04:28 +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.89) (envelope-from ) id 1fUyVw-0007iA-2n for pgsql-hackers@lists.postgresql.org; Mon, 18 Jun 2018 18:04:28 +0000 Received: from mail-qk0-x243.google.com ([2607:f8b0:400d:c09::243]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fUyVr-0000AN-Lp for pgsql-hackers@postgresql.org; Mon, 18 Jun 2018 18:04:26 +0000 Received: by mail-qk0-x243.google.com with SMTP id r66-v6so9876814qkr.7 for ; Mon, 18 Jun 2018 11:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=rmdGcf2VTZBefaBH99cTFYm4cTLFdClikEfT05NDsTk=; b=BbEIP+JCO18na5tKKlkonGZsx3cN8Rvu4vxA5US7WdJpMjtErtkn9zskLm1gPvhQBO ge974TV6ZNlwJavql/qCrN+jNFoJQdqr57pa7Y3lNY4/W16FWdkI8izla29Im83BTYRb 0vgjD8rFGiZzhSpQUD3XBhFr+gMz43cNWCpwmTExcec0I/MRQjch1lISbL263kX6fTRz tC8VSAaNPuB4QlJpd73jBxWOvtrNcr7yf8daWV119ywydCE79kacWLiLCVwgKPDCwz5c EWPlzEEA34j8/rXwdh/05UrWNeCsPmqUDxBuC7vNSU9IUn9On0YDE1yGc7R3zoh0p3mw FggQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=rmdGcf2VTZBefaBH99cTFYm4cTLFdClikEfT05NDsTk=; b=lLqhfk5+9MFuEo3VEfUcyVcjvyK4+KXfErr2Y9svSmZMDRZfgxwnLzng8DAl1xKNPY 1ENBlfV2kMarLggWL3QuUU53JH1MogfbuX6QjFQhv7+d0NN/AGHZoOngMthXWVYKlMFr /CynK3cuYLyE6EBP6v11BkNQVAJ+zpaSq4MBaXuS/NcwwSV6MLuaE8hzF/gBwvXFDefM 57x4JTrSv/B4AQYFgxA2lKzwzHwMf/Qun3Ftz0SQHsx/Fm9akgNSHFxzcJtL578I7n53 FosTqtP09FggP/sNZ9cBxUj6qDHDgfiZ24+OWI8ppHexgedrFZ+r5kzY3MyFjo5lZR3z /lXw== X-Gm-Message-State: APt69E193AshV5tETu3mYOk11sW+e84ThDLAQp1zdbTwNBsO5Swfusen ay2fALFWceEwlu9U8YhVzDRhh/2R X-Google-Smtp-Source: ADUXVKKZr4tqPDqIjDvH8p3+/hVpwu8VzPGxxGoIM4JNJIF2U3UduYOc5xmLt6cW00LRdktxlsR/Ww== X-Received: by 2002:a37:5a47:: with SMTP id o68-v6mr11559933qkb.226.1529345062195; Mon, 18 Jun 2018 11:04:22 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id p50-v6sm12988217qtf.48.2018.06.18.11.04.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 18 Jun 2018 11:04:21 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8C199942; Mon, 18 Jun 2018 14:04:19 -0400 (-04) Date: Mon, 18 Jun 2018 14:04:19 -0400 From: Alvaro Herrera To: Antonin Houska Cc: Arseny Sher , pgsql-hackers Subject: Re: Fix slot's xmin advancement and subxact's lost snapshots in decoding. Message-ID: <20180618180419.mysc6nxvntgvfgg2@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <15387.1528700867@localhost> User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2018-Jun-11, Antonin Houska wrote: > Arseny Sher wrote: > > Please see detailed description of the issues, tests which reproduce > > them and fixes in the attached patch. > > I've played with your tests and gdb for a while, both w/o and with your > patch. I think I can understand both problems. I could not invent simpler way > to fix them. > > One comment about the coding: since you introduce a new transaction list and > it's sorted by LSN, I think you should make the function AssertTXNLsnOrder() > more generic and use it to check the by_base_snapshot_lsn list too. For > example call it after the list insertion and deletion in > ReorderBufferPassBaseSnapshot(). I've been going over this patch also, and I've made a few minor edits of the patch and the existing code as I come to understand what it's all about. > Also I think it makes no harm if you split the diff into two, although both > fixes use the by_base_snapshot_lsn field. Please don't. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services