Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzQMw-0003hx-Ge for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2017 16:48:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dzQMv-0005yh-EE for pgsql-hackers@arkaria.postgresql.org; Tue, 03 Oct 2017 16:48:29 +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 1dzQMt-0005yV-OD for pgsql-hackers@postgresql.org; Tue, 03 Oct 2017 16:48:27 +0000 Received: from mail-wm0-x233.google.com ([2a00:1450:400c:c09::233]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dzQMp-0003xW-Fd for pgsql-hackers@postgresql.org; Tue, 03 Oct 2017 16:48:26 +0000 Received: by mail-wm0-x233.google.com with SMTP id q124so18008188wmb.0 for ; Tue, 03 Oct 2017 09:48: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=oEwmUpx7koXMxayn2dz0aI8lvp3/0aX9RCGouqDHYYc=; b=mtLKrauGEW2/oClrhhUxQwn6cbDrQG6f5Oe02OWsUBqox2yCb7dezYaW13kf74tp4d Rn9z9uXUdJ3RxAQodzGrX0vhotqZbECSeLY70cG0H/mh0B+7ZTGeTd9+w06vcHusKRJ6 Kjy6tQwU88r7xPWwtSarNlPdlYeWYMk55LjhU/NoNB48r/ESN+b3KY5dhVJbCxOFcjOu JqIZDYzpxE9haC/OO/kRGFX8UUuBQ9AjLwHXw/xOypAz9pbfcYw7Kp9uwQvp3BZOm1XD oeHfs75DwRvPhBxXSeziA4kaKkvDkBAUC7879QdXCyCprDk4IhaD2EjEg+X1UmNwvF+r +p7g== 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=oEwmUpx7koXMxayn2dz0aI8lvp3/0aX9RCGouqDHYYc=; b=s9vO234HNGNp5HQqwQ0gRlC+jk4IERFECGskcMZRO8NsINH3inBB4x1XoI174lIM8v lVWwhIPdya5QVDAx1FC9nMYcQw6qj86wMkD2cVN9yREjVFKdwynhaTB0bMFo/KDbFcMT DAMvXnoVyui6y9R/dMhfR4T15aS4mJdFoM1ihF/Z1Z78YGXhvDyqgckkkHtQKunRWodE lKlctKv8dSNlQMwQvZ/uPbIBif3zsXB2BUrRguEe8aBDe05FmpzefOyLYhiQWiDWopuj i7JRo0bPVeo6EYuIsXDeh3uVe3t08vHKFYICwoivxFvYHA0sMn/wTtEU4H9ZZA673ZOD E9IA== X-Gm-Message-State: AHPjjUgK/3hhoBPYqIi9/1/34xDIGZx6W5e8EB5rH8DmjgB8RSNI+bmY TTC2Igad8CVCy9JUEtaPrsYagQ== X-Google-Smtp-Source: AOwi7QBjtYYMxPuNvYU/wfxnuSAXrdf8B2xUJUmDy142S0kJNGV0PlMFoI0qWwpleeuN5GlmvxeXrw== X-Received: by 10.80.131.6 with SMTP id 6mr25145412edh.138.1507049301826; Tue, 03 Oct 2017 09:48:21 -0700 (PDT) Received: from alvin.alvh.no-ip.org ([109.131.231.247]) by smtp.gmail.com with ESMTPSA id h45sm12111837eda.92.2017.10.03.09.48.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 03 Oct 2017 09:48:21 -0700 (PDT) Received: by alvin.alvh.no-ip.org (Postfix, from userid 1000) id 8B1B9798; Tue, 3 Oct 2017 18:48:20 +0200 (CEST) Date: Tue, 3 Oct 2017 18:48:20 +0200 From: Alvaro Herrera To: Peter Geoghegan Cc: pgsql-hackers@postgresql.org, "Wood, Dan" Subject: Re: [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple Message-ID: <20171003164820.lmohsuyf7hygafdq@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: NeoMutt/20170306-137-4415bd-dirty (1.8.0) 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 So here's my attempt at an explanation for what is going on. At one point, we have this: select lp, lp_flags, t_xmin, t_xmax, t_ctid, to_hex(t_infomask) as infomask, to_hex(t_infomask2) as infomask2 from heap_page_items(get_raw_page('t', 0)); lp | lp_flags | t_xmin | t_xmax | t_ctid | infomask | infomask2 ----+----------+--------+--------+--------+----------+----------- 1 | 1 | 2 | 0 | (0,1) | 902 | 3 2 | 0 | | | | | 3 | 1 | 2 | 19928 | (0,4) | 3142 | c003 4 | 1 | 14662 | 19929 | (0,5) | 3142 | c003 5 | 1 | 14663 | 19931 | (0,6) | 3142 | c003 6 | 1 | 14664 | 19933 | (0,7) | 3142 | c003 7 | 1 | 14665 | 0 | (0,7) | 2902 | 8003 (7 filas) which shows a HOT-update chain, where the t_xmax are multixacts. Then a vacuum freeze comes, and because the multixacts are below the freeze horizon for multixacts, we get this: select lp, lp_flags, t_xmin, t_xmax, t_ctid, to_hex(t_infomask) as infomask, to_hex(t_infomask2) as infomask2 from heap_page_items(get_raw_page('t', 0)); lp | lp_flags | t_xmin | t_xmax | t_ctid | infomask | infomask2 ----+----------+--------+--------+--------+----------+----------- 1 | 1 | 2 | 0 | (0,1) | 902 | 3 2 | 0 | | | | | 3 | 1 | 2 | 14662 | (0,4) | 2502 | c003 4 | 1 | 2 | 14663 | (0,5) | 2502 | c003 5 | 1 | 2 | 14664 | (0,6) | 2502 | c003 6 | 1 | 2 | 14665 | (0,7) | 2502 | c003 7 | 1 | 2 | 0 | (0,7) | 2902 | 8003 (7 filas) where the xmin values have all been frozen, and the xmax values are now regular Xids. I think the HOT code that walks the chain fails to detect these as chains, because the xmin values no longer match the xmax values. I modified the multixact freeze code, so that whenever the update Xid is below the cutoff Xid, it's set to FrozenTransactionId, since keeping the other value is invalid anyway (even though we have set the HEAP_XMAX_COMMITTED flag). But that still doesn't fix the problem; as far as I can see, vacuum removes the root of the chain, not yet sure why, and then things are just as corrupted as before. -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers