Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzDa9-0001g7-30 for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 07:59:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mzDa7-0003wQ-SX for pgsql-hackers@arkaria.postgresql.org; Mon, 20 Dec 2021 07:59:39 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzDa7-0003t2-BM for pgsql-hackers@lists.postgresql.org; Mon, 20 Dec 2021 07:59:39 +0000 Received: from mail-he1eur04lp2050.outbound.protection.outlook.com ([104.47.13.50] helo=EUR04-HE1-obe.outbound.protection.outlook.com) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mzDa0-0001Bn-IC for pgsql-hackers@lists.postgresql.org; Mon, 20 Dec 2021 07:59:38 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=BC7f1QIQ0U98MEFMTymWp0yg5y9BTZ0qxkk+PQ8yHRJUNrUXpFl1WKnIzLJ7EYA3SosbPFyJ+sJigkELkvhrvqlN/UE+IiGOGXnndT9VTtQS+7Jcz5eseWbO5MOSmg1rt+PFen/hEVOcLjnO/l/p9OGE+SPFzl8pSPtpeWWgNMOBkZFSmcHpQsEjL98RNY1iHURf4k55un0+YZLqS0l1ssxQV8DNQA/Zy0pvBOfXkk3Ok/5UWGyT2xWwSjSDV3t9W3VKtCt/7iIFxMkC60w8ZRJYa9C9wrcgSHwyqbDkc6I4dCXxDfjDMZOk69DIJrFBX7m+NDsxNkDef1mdUV2ryw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=EsTUyz3EW3T0CY96fLKz0+AvYoPAeZv1N8HsYGTCeLk=; b=UQapcAEt7kC0BClK99f1jMt3WTRPiE4rHMnLishcYO+J6V4lBa1smucTr9A66hCA8pBAAtQMTFTGClwHsFRny2D7oiZd+zoZhsYOa+nvKWlM+4uw0hwROKqNWDR5qrjwGtQL3tvHvNY4QfOjuAYEYCHYUkQKBFsvVgu00WY6c0S+S1S1AbC2/kzBUcKQweJITzUxs/1Gsi4pikNkclNYJSVS/Lx6VHDqUloHbIbb2PITNsmkLmnGJ78Z6VitJ1n/Ig4HuNck6RmqOyZlbn9gZnvliS1fHJ7XsuZrXj2PZl4/RSMaNurzWed5mA6LdPbX3G+ldHX3WVmjd8RC7lsa2w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=tomtom.com; dmarc=pass action=none header.from=tomtom.com; dkim=pass header.d=tomtom.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tomtom.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=EsTUyz3EW3T0CY96fLKz0+AvYoPAeZv1N8HsYGTCeLk=; b=cDM9q2zWxIUUrJYu1AV37pew/UDZKVJVpxIQJVtqLfNh8pb/xDs8dwSU4cdaKsrnU1KqvFenpRfALPqDV77yCeqxeC8i/8xP1J7q8hTBp2tq5hplIdM56HQsib1tu9kt42mlWXHc3tF4+ggIClwOBisNGERw8iNSLXmg0hQlajE= Received: from AM8PR07MB8248.eurprd07.prod.outlook.com (2603:10a6:20b:327::12) by DB6PR0701MB3015.eurprd07.prod.outlook.com (2603:10a6:4:74::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4823.14; Mon, 20 Dec 2021 07:59:30 +0000 Received: from AM8PR07MB8248.eurprd07.prod.outlook.com ([fe80::2528:d124:2a1e:6174]) by AM8PR07MB8248.eurprd07.prod.outlook.com ([fe80::2528:d124:2a1e:6174%4]) with mapi id 15.20.4823.011; Mon, 20 Dec 2021 07:59:30 +0000 From: Jakub Wartak To: Kyotaro Horiguchi CC: "tsunakawa.takay@fujitsu.com" , "osumi.takamichi@fujitsu.com" , "sfrost@snowman.net" , "masao.fujii@oss.nttdata.com" , "ashutosh.bapat.oss@gmail.com" , "pgsql-hackers@lists.postgresql.org" Subject: RE: In-placre persistance change of a relation Thread-Topic: In-placre persistance change of a relation Thread-Index: AQHWuAVeo56RaA8LA0Wy6+ngHR+ctqnFeQaAgAAnc4CAAAkSgIAAEt0AgCD3ggCAH3JAAIABDyoAgBZeBICAADPEgIAGW7QAgAMMrYCAbcolgIAAAfKAgaPXqwCABJJJgIAACYDQ Date: Mon, 20 Dec 2021 07:59:29 +0000 Message-ID: References: <20210325.140805.1356865766630580851.horikyota.ntt@gmail.com> <20210325.141503.245781197327278199.horikyota.ntt@gmail.com> <20211220.152823.1386247767464518843.horikyota.ntt@gmail.com> In-Reply-To: <20211220.152823.1386247767464518843.horikyota.ntt@gmail.com> Accept-Language: en-US Content-Language: pl-PL X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=tomtom.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: fd50cf55-6ce3-4c27-1b1a-08d9c38ea6cb x-ms-traffictypediagnostic: DB6PR0701MB3015:EE_ x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:10000; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: EX6k/cGPM32nVFqzw7ucyKyr4MLOe6iXuTSY4b6FZdzL+VSZrQK+NnvzVm6kfFVF+DYJYhMfMi36eat+LB9bcH7fC78K0li7Yu4RcjxMxQ27maJbCX3ZxH6TNjVRag/xIpnnCv49eCvyrbb+roSXiTtkFXNbP0CgND//jDyChaVukWZm4tCzu/LhZL69s3/bBrDgXATdLKtY2BGzt7/0sXy6mFMDe6q3VA4r7LXDLH7OUnqzkBQnOsueHRABtwZRdMHKkb5GkIMNVTs4gP6NNKajUGFBqMGNyJS4T3XxDqHvB0BDaeGQEMuilagifPAN+kwrYopwgF81V2zplEUFheC5qgsrx+5MQuLcOFRvBvgj3jTK/MMjOtRJheXq0+KjoT0QO6Stk/VV1akmgBusYhz4+KEhDbGO24EqrvGscM78/w7AYhlzRarr9n5y0zH0RfFerytD5fLZiXyDt2RloEThMi2ZWzQO4TofepGm1XxKy6kX1GpOKZCTbT3Fxf8EQ60iBnbn66O2X0QMeb90twWMOTS2hRu3guQZqOKzGkuJMOwcCv6xFpWw6+Ysgm11UaWqr+CieLY8arjQNjFeDzV67/IDv3A7VEq5E2Jr18tZUlpX7XZ0m9S4WfBd18qCiDQ7uPtf6hKldPjR6jHSQCPon6USzr1drmvFL89zb1lRYuu5RpNACWFRTXokzapXB1WRDCA69/HMdHTCtMJH2A== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM8PR07MB8248.eurprd07.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(4636009)(366004)(55016003)(83380400001)(33656002)(2906002)(122000001)(38100700002)(54906003)(7696005)(26005)(76116006)(508600001)(66946007)(5660300002)(186003)(38070700005)(86362001)(9686003)(71200400001)(6506007)(8936002)(52536014)(6916009)(316002)(66476007)(4326008)(66446008)(64756008)(66556008)(8676002)(20210929001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?uHG08JQKHbJm5PV3V1qc3xJA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ascii?Q?ShiEG5H7lCLEmD+eVmqEXvrkRhPodkmhnqqBvBFd0/dlbBMkwRFE/RDlwTPq?= =?us-ascii?Q?Q/X6uKX8A2WTeYZoRvfA5gmrpE1aLIMSKcAdrdCvzc5Mmjr/UJhFCORZQhtN?= =?us-ascii?Q?F9BZgMrNlwhMr4V/dH+QaXG+j+lxJiylMpFiA/AyC0MjpTgQ+nxwPS/Q0WqH?= =?us-ascii?Q?Ltr3rIfNypuyRSBBc+z63ni1ym2siiY/PeFu5pFCC0vf88D4w58xroDS53vR?= =?us-ascii?Q?8ihruMZ6Xo29rkrJXkMzQSqEyRp3hLwXP1q0L9kDYGWFZj80FCLhN1CizHs7?= =?us-ascii?Q?aa6iHvcZQnnqHRYheyViIp9L0zVjwADXCWWnrxluqyDoFBPR2WfysVtrKjUy?= =?us-ascii?Q?nL0OsLG1KBGUdgGe4TbnmhqInjSenGSreLNjy+tvjCMbf9/PHVZdc+zQzqQI?= =?us-ascii?Q?PLb864jA2TsPrh7M1KG4fJ2pQrcPQ8/fdvy9vTL5DeOh0Ks9YqWLkiBo7Z+y?= =?us-ascii?Q?gkBzpKiKrMpz8EmcSCDQuUe71DHYC9xACLhMFr7zjJmMcngcNasFIvMtc+h5?= =?us-ascii?Q?aXPAtPM0uedHIE/C7EXOpO8RBqd3zv5CXb0VaFCl0/YeeEFnI2BbJnWiDbHr?= =?us-ascii?Q?CgaFR863r++irR/802SFchYM6cbgH43YFH94rcCC7h7jG6uWz8MB54XGsrV1?= =?us-ascii?Q?31uhYdTYR8x0sZ3EkTDuU3nH5fLIYnX3GZ6u/4/yzZiG1Fcmn+AZfRHwgR7K?= =?us-ascii?Q?mw=3D=3D?= Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: tomtom.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: AM8PR07MB8248.eurprd07.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd50cf55-6ce3-4c27-1b1a-08d9c38ea6cb X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Dec 2021 07:59:29.9643 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 374f8026-7b54-4a3a-b87d-328fa26ec10d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: nLj/nIM3iS/she/Qkjel6eI3ZOcH767ih6G3t63j29xzPGEQ/ZlU8c9L4GVWqYE9uOIzvmiPBnmwSFcY6d2buw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB6PR0701MB3015 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Kyotaro, I'm glad you are still into this > I didn't register for some reasons. Right now in v8 there's a typo in ./src/backend/catalog/storage.c : storage.c: In function 'RelationDropInitFork': storage.c:385:44: error: expected statement before ')' token pending->unlink_forknum !=3D INIT_FORKNUM)) <-- here, one ) too much > 1. I'm not sure that we want to have the new mark files. I can't help with such design decision, but if there are doubts maybe then = add checking return codes around: a) pg_fsync() and fsync_parent_path() (??) inside mdcreatemark() b) mdunlinkmark() inside mdunlinkmark() and PANIC if something goes wrong? > 2. Aside of possible bugs, I'm not confident that the crash-safety of > this patch is actually water-tight. At least we need tests for some > failure cases. > > 3. As mentioned in transam/README, failure in removing smgr mark files > leads to immediate shut down. I'm not sure this behavior is acceptabl= e. Doesn't it happen for most of the stuff already? There's even data_sync_ret= ry GUC. > 4. Including the reasons above, this is not fully functionally. > For example, if we execute the following commands on primary, > replica dones't work correctly. (boom!) >=20 > =3D# CREATE UNLOGGED TABLE t (a int); > =3D# ALTER TABLE t SET LOGGED; >=20 >=20 > The following fixes are done in the attched v8. >=20 > - Rebased. Referring to Jakub and Justin's work, I replaced direct > access to ->rd_smgr with RelationGetSmgr() and removed calls to > RelationOpenSmgr(). I still separate the "ALTER TABLE ALL IN > TABLESPACE SET LOGGED/UNLOGGED" statement part. >=20 > - Fixed RelationCreate/DropInitFork's behavior for non-target > relations. (From Jakub's work). >=20 > - Fixed wording of some comments. >=20 > - As revisited, I found a bug around recovery. If the logged-ness of a > relation gets flipped repeatedly in a transaction, duplicate > pending-delete entries are accumulated during recovery and work in a > wrong way. sgmr_redo now adds up to one entry for a action. >=20 > - The issue 4 above is not fixed (yet). Thanks again, If you have any list of crush tests ideas maybe I'll have som= e minutes=20 to try to figure them out. Is there is any goto list of stuff to be checked= to add confidence to this patch (as per point #2) ? BTW fast feedback regarding that ALTER patch (there were 4 unlogged tables= ): # ALTER TABLE ALL IN TABLESPACE tbs1 set logged; WARNING: unrecognized node type: 349 -J.