Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dzacL-0007kn-KE for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Oct 2017 03:45:05 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dzacK-0007W1-63 for pgsql-hackers@arkaria.postgresql.org; Wed, 04 Oct 2017 03:45:04 +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_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dzaal-0004no-Kh for pgsql-hackers@postgresql.org; Wed, 04 Oct 2017 03:43:27 +0000 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dzaad-0008Qe-Aq for pgsql-hackers@postgresql.org; Wed, 04 Oct 2017 03:43:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1507088599; x=1538624599; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=/yUdRxiNcYawlH2WUI2D3XHduSvimhuTVwmTmnzw4xI=; b=qrFaSX9eDSI2xBrRihrPja6/24SojPBAuXt+hnLpQZqVfCOt+LfIkxhS mN57atnlArQqtA2U5VdknJugkdjZc1q6daRHqnq5NmT7EvcciqdDBHMSl SVAwvfqXSEkyPgE/qufytxbSTFolfsmC42m8wowpqCUF4aKPOi3g1K/e1 A=; X-IronPort-AV: E=Sophos;i="5.42,476,1500940800"; d="scan'208";a="705561359" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1d-98acfc19.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Oct 2017 03:43:03 +0000 Received: from EX13MTAUWB001.ant.amazon.com (iad55-ws-svc-p15-lb9-vlan3.iad.amazon.com [10.40.159.166]) by email-inbound-relay-1d-98acfc19.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id v943gxlM097338 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=FAIL); Wed, 4 Oct 2017 03:43:01 GMT Received: from EX13D11UWB002.ant.amazon.com (10.43.161.20) by EX13MTAUWB001.ant.amazon.com (10.43.161.207) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 4 Oct 2017 03:43:00 +0000 Received: from EX13D04UWA001.ant.amazon.com (10.43.160.47) by EX13D11UWB002.ant.amazon.com (10.43.161.20) with Microsoft SMTP Server (TLS) id 15.0.1236.3; Wed, 4 Oct 2017 03:43:00 +0000 Received: from EX13D04UWA001.ant.amazon.com ([10.43.160.47]) by EX13D04UWA001.ant.amazon.com ([10.43.160.47]) with mapi id 15.00.1236.000; Wed, 4 Oct 2017 03:43:00 +0000 From: "Wong, Yi Wen" To: Peter Geoghegan , "Wood, Dan" CC: Michael Paquier , Alvaro Herrera , PostgreSQL Hackers Subject: Re: [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple Thread-Topic: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updated tuple Thread-Index: AQHTPGdrRGLhgwhTD0yOTJUfb3MqMKLSwMIAgAASRQCAAA8igIAAAs4AgAAjHd4= Date: Wed, 4 Oct 2017 03:43:00 +0000 Message-ID: <1507088579842.74063@amazon.com> References: <20171003164820.lmohsuyf7hygafdq@alvherre.pgsql> <10CE2AE7-B1AC-4E81-BF00-E9EF4BA855EE@amazon.com>, In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.43.161.65] Content-Type: text/plain; charset="Windows-1252" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.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 My interpretation of README.HOT is the check is just to ensure the chain is= continuous; in which case the condition should be: > if (TransactionIdIsValid(priorXmax) && > !TransactionIdEquals(priorXmax, HeapTupleHeaderGe= tRawXmin(htup))) > break; So the difference is GetRawXmin vs GetXmin, because otherwise we get the Fr= eezeId instead of the Xmin when the transaction happened The interesting consequence of changing that is the prune seems to get the = entire chain altogether with Dan's repro... I've run it a couple of times a= nd have consistently gotten the following page lp | t_ctid | lp_off | lp_flags | t_infomask | t_infomask2=20 ----+--------+--------+----------+------------+------------- 1 | (0,1) | 8152 | 1 | 2818 | 3 2 | | 7 | 2 | |=20=20=20=20=20=20=20=20=20= =20=20=20 3 | | 0 | 0 | |=20=20=20=20=20=20=20=20=20= =20=20=20 4 | | 0 | 0 | |=20=20=20=20=20=20=20=20=20= =20=20=20 5 | | 0 | 0 | |=20=20=20=20=20=20=20=20=20= =20=20=20 6 | | 0 | 0 | |=20=20=20=20=20=20=20=20=20= =20=20=20 7 | (0,7) | 8112 | 1 | 11010 | 32771 (7 rows) I've made this change to conditions in both heap_prune_chain and heap_get_r= oot_tuples and this seems to cause things to pass my smoke tests. I'll look into this deeper tomorrow. Yi Wen ________________________________________ From: Peter Geoghegan Sent: Tuesday, October 3, 2017 6:19 PM To: Wood, Dan Cc: Michael Paquier; Alvaro Herrera; PostgreSQL Hackers; Wong, Yi Wen Subject: Re: [HACKERS] [COMMITTERS] pgsql: Fix freezing of a dead HOT-updat= ed tuple On Tue, Oct 3, 2017 at 6:09 PM, Wood, Dan wrote: > I=92ve just started looking at this again after a few weeks break. > if (TransactionIdIsValid(priorXmax) && > !TransactionIdEquals(priorXmax, HeapTupleHeaderGe= tXmin(htup))) > break; > We need to understand why these TXID equal checks exist. Can we differen= tiate the cases they are protecting against with the two exceptions I=92ve = found? I haven't read your remarks here in full, since I'm about to stop working for the day, but I will point out that src/backend/access/heap/README.HOT says a fair amount about this, under "Abort Cases". -- Peter Geoghegan --=20 Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers