Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXW9J-00DFPB-1I for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Dec 2025 02:59:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vXW9I-00CvjG-03 for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Dec 2025 02:59:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vXW9H-00Cvj8-2J for pgsql-hackers@lists.postgresql.org; Mon, 22 Dec 2025 02:59:52 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vXW9F-0020DH-19 for pgsql-hackers@postgresql.org; Mon, 22 Dec 2025 02:59:51 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-bf1b402fa3cso3630876a12.3 for ; Sun, 21 Dec 2025 18:59:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1766372387; x=1766977187; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Vz+jVzL1r9NbrGKV8SY1L4EQo0O+0HcwmLE3sEXvU/Y=; b=cxGVRiCACFSZZSuiD6PrOQa5DQljjoyFw68M11/JfNHEDbf1i2hNsjmcUsVv0I8LZ5 GF0S9N9ApVwdoXUH7tHeqkOvrSN8roN+7hxheXCX2ah6u4dHGeX/fJ+w3aDnBzpy7gNy djRPaxPIAkD4HvozybPfDAjBRGQPqJAdH+m0AWfsuuVaNk0PnPfTJWEtRW1hnyLpmIpg //H4cpV8c3c4oCfLPko9JGuC34v+waRzvp11DwdCRZm1yBSPu8qZxhcGZ7UTyqW702QK n7jGPndsT9u/h1dt1odwnmBxfGVC/advGA6hx6csY8rve8NTQKuj98/tuQrM/rXT7DQ9 1yNA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1766372387; x=1766977187; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=Vz+jVzL1r9NbrGKV8SY1L4EQo0O+0HcwmLE3sEXvU/Y=; b=lSyajCVDspKRkU7/Lx/cg0Zf8lsIGIQT2hJLm1tNZ8yvyoghm7rJ4ddc2XXnljTTl5 q0ll5LfnIUQcsNJGBk1LT6dimW6nzBVCRAjBzGcTI2dIlHk7HekECWcAqwo+h/75tYnf hhcg4opc36mdDU83gS1lKXf2AnJGy3cQd/oq6MDaKRlwEp+ipYtW0R9mn9F7SJwAxwEe /IPjZfvlTpnsBviWHSeApGvekdHQDmsSIp4ob7hxUvY6GTQ0cr08tan3xN3j2RjlXugg Dkz84dzr4iPznv1xmRQQFcKrn19Qd06VAFimstNDyJ64YiPGrZ45U7OWezVoHxDjqQV4 T/RQ== X-Gm-Message-State: AOJu0Ywr8H5gyp1oDX8GaPa23ihWZY+gaLPaIrKg1e0s7imi9wu1qb/L /AQLqzBAB8H/MV+8WxDsNTitoyNfEqhSW/t0AkeBCKs12J2VftGnhr1B X-Gm-Gg: AY/fxX5IJAxGkSJvJmGRD2B2B2UNvZK02y+9uiRIzenmDLYGhmGJLEKqemMU1GoOmDu BMvPdmEqmyxEfPem7QvQlVTiob+rR1kc4OoF132r/ZEsG2VlHSAKBGOT50JSyJhpbVy+quZtgbg QT9XKXVzHEncbiCnrogr9PDKp6BWKkWiYfqIHptbwfzf0QG3odGcidahno438Z/GMXWEM7T3u7j Ft8vOQj4jcuRdfZHEozmPbsiP6CAzObcpwAvy8TdCX9fVGxY7Vkd3FKpYLfHQi+tteG867kejbJ ltyO3LK6O2wQ7JCvC9i99kxZLALEH+HUKZGJAx0SLGcYwfOhQ7IEswTrluaa2gfFKYPMIC8srsL d9+umJ8dRBVIxFFGvV9dQNsER53t31TRBjxnBTOok/cCjj77UnzxLYnE10tNJsGwM3gzVxbzjfG 4td6gsvyZQ7jqOeBVHUI3X X-Google-Smtp-Source: AGHT+IEQacyd7i8qh+Y8IUCl4kp9qfs4bUCSJf2EO0XYSlvak0yPAmvHoSYmb4/wUAF4w87OB7QMGg== X-Received: by 2002:a05:7022:2481:b0:11b:9386:a37e with SMTP id a92af1059eb24-1217230ea4amr10743819c88.45.1766372387099; Sun, 21 Dec 2025 18:59:47 -0800 (PST) Received: from smtpclient.apple ([142.171.105.12]) by smtp.gmail.com with ESMTPSA id a92af1059eb24-1217253c058sm41539860c88.11.2025.12.21.18.59.45 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 21 Dec 2025 18:59:46 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3826.700.81\)) Subject: Re: A few patches to clarify snapshot management, part 2 From: Chao Li In-Reply-To: <1c83dd8a-3756-404f-bf8a-4a03d9fd8059@iki.fi> Date: Mon, 22 Dec 2025 10:59:12 +0800 Cc: "pgsql-hackers@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <08cbaeb5-aaaf-47b6-9ed8-4f7455b0bc4b@iki.fi> <229C9534-5DF4-4A0F-BA02-EDE31A359984@gmail.com> <1c83dd8a-3756-404f-bf8a-4a03d9fd8059@iki.fi> To: Heikki Linnakangas X-Mailer: Apple Mail (2.3826.700.81) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Dec 19, 2025, at 19:51, Heikki Linnakangas wrote: >=20 >> +/* >> + * Generic union representing all kind of possible snapshots. Some = have >> + * type-specific structs. >> + */ >> +typedef union SnapshotData >> +{ >> + SnapshotType snapshot_type; /* type of snapshot */ >> + >> + MVCCSnapshotData mvcc; >> + DirtySnapshotData dirty; >> + HistoricMVCCSnapshotData historic_mvcc; >> + NonVacuumableSnapshotData nonvacuumable; >> } SnapshotData; >> ``` >> > And my big concern is here. This union definition looks unusual, >> snapshot_type shares the same space with real snapshot bodies, so >> that once snapshot is assigned to the union, that type info is lost, >> there would be no way to decide what exact snapshot is stored in >> SnapshotData. >=20 > Each of the structs, MVCCSnapshotData, DirtySnapshotData, etc., = contain 'snapshot_type' as the first field, so it's always available. Oh, I didn=E2=80=99t notice each of the structs contain = =E2=80=9Csnapshot_type=E2=80=9D, in that case, maybe we can just define = SnapshotData as a structure with a single field =E2=80=9Csnapshot_type=E2=80= =9D, in the same way as =E2=80=9CNode=E2=80=9D. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/