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 1vwuaK-003WoB-2L for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Mar 2026 04:08:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vwuaJ-00FISH-1h for pgsql-hackers@arkaria.postgresql.org; Mon, 02 Mar 2026 04:08:43 +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 1vwuaJ-00FIS7-0j for pgsql-hackers@lists.postgresql.org; Mon, 02 Mar 2026 04:08:43 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vwuaF-00000001y2K-3oHS for pgsql-hackers@lists.postgresql.org; Mon, 02 Mar 2026 04:08:42 +0000 Received: by mail-pl1-x62e.google.com with SMTP id d9443c01a7336-2ae56f8776dso935045ad.3 for ; Sun, 01 Mar 2026 20:08:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772424519; x=1773029319; darn=lists.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=EKkR3M2gLG2WEjaYxYzmt7RMgWz5kzsje5YnvbxnM7E=; b=T1c+IpYcXK18gaYrOiC2lk29WPsXoEqTVLK25sObNHWXCSxOlXxErdv8hRFXsXwUWB 7fiHhLnC5chJ/d7NnqA4H1PaNivRlZsWOIn5JGXvaA0vUjXgnV32jnV2CavTmje3fJKy Ke3PdRxP9Y1UzRPHochPo1OTWWIcd9mqWdQOlW9CYl+JDc4ErdR8HUVlCiu9X+KI6KGt g/kARDLDYtD0qkQ8tDWsW7hb9EaMnq8LyYrh9Rb/BPrilh1yeLY7T22DhAQmal+lq9DU RUFjRFEOqfXVd7POCnDuY7mkjJauCkbXvc84iDC81ly4mTqwoYkuAtv/75yKtLHiUgyn urQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772424519; x=1773029319; 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=EKkR3M2gLG2WEjaYxYzmt7RMgWz5kzsje5YnvbxnM7E=; b=DlErXc8/ocj/wGCqq2C9mJjPp08mnK6Fls6YndQI1uwJnONuUF5E8cYbevJm1qKz6e VKyMgSu0hTqA1ArFB00bo3Sz1Cz/30yOOZKw4zGDrBk7ftJzRb53gr/dy1o9WFWhkIia YC87WoiKhk8NtZx8mv/4ryH7eM95Ms0uAetd8pHe3TeNuyf6lT27osRV7aOLWDDeoUBs I+qeYM3RDKrkJ+QbTPG2r2a+vTkJDRdpoD248QtKAE5fqdloCjfcO3+CEzlncbwkfM7q /9OHwSm407VJIx72NgwSYAHUrREHGnjhiO51FxTNN1Lw2uqtssd/m+sZKwBlfpwyKwVa DD4w== X-Forwarded-Encrypted: i=1; AJvYcCVftr5GrnB7ocij/tWNcBoyO5zKhKexE+y8prtrsx+JIAay7Tt2CygJDIvlHcf53u3dv6xaOY9s+IANlbIo@lists.postgresql.org X-Gm-Message-State: AOJu0Yz+wAJLSVPQMoGsBHBK230Z/zkzBhwggUIVT5254AS7L6ikPwxC fX9snuvWn1s7SM7LhFoUZey0CSGX1lmMLpvUWG6cmY2+5SJBBlqluzFx8OJiP+MYo5s= X-Gm-Gg: ATEYQzwGdfjepTAhJ7pVUjjibpqtvCbAtBr9hyQtolJkITo+jqSL1sTU4obtEl7xxNB n25wX/w+CBbsu8B2HWQXDjXKwbLpE+OrsthwTypGGCn28zTCAyPKSIMv70AFSYRj+maHxo8RMgu MSAs24dr0KWRbAsDXmGudNNYE3NnQrohtAshXVr+XELi+XdchzTocU4DSuUuJny4/b3prQcl6CG WrpksSKwaDhzI8JqFB4d6fLbI7pmMKuSGu/iFNy6rUZc16USrYh9o5hDKXGpNX6FLzQFOXEc455 V5TbWr0I9caPVDAJF16K5jvDd2m7YeGITguo/ksTxdXVB2GFbAXg8loRvDeHhPfq2B57vBNY9lt WoPT7XWMYgWhmRhRs6JCMzBrJTITvMlHPfo2VtREQMUL8RWRBvQcosdnpJedpIZx2hcaaSjAUU4 pt7WiYSN1sAz76doGHuPauFunpTGtEfjxPSAiOlcKTzQ== X-Received: by 2002:a17:903:46cc:b0:2ae:5426:da49 with SMTP id d9443c01a7336-2ae5426dcf7mr10300475ad.34.1772424518639; Sun, 01 Mar 2026 20:08:38 -0800 (PST) Received: from smtpclient.apple ([203.76.245.26]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2ae4cd40e4dsm25399785ad.92.2026.03.01.20.08.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 01 Mar 2026 20:08:38 -0800 (PST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.400.21\)) Subject: Re: Fix bug in multixact Oldest*MXactId initialization and access From: Chao Li In-Reply-To: Date: Mon, 2 Mar 2026 12:08:02 +0800 Cc: Yura Sokolov , "pgsql-hackers@lists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <7acc94b0-ea82-4657-b1b0-77842cb7a60c@postgrespro.ru> <93F0BD0A-0B8B-4592-9D4B-53F405A86F6A@gmail.com> <3d7a2207-0e61-4d95-bc00-e5248956a32b@postgrespro.ru> <366b6f95-613d-4ef8-82e4-bb2fd06d9c4d@iki.fi> <231cd950-73e9-4db5-a516-c5216af7b93a@iki.fi> <944d7897-3ec3-47bb-9e93-b99f2ef3124a@postgrespro.ru> To: Sami Imseih , Heikki Linnakangas X-Mailer: Apple Mail (2.3864.400.21) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On Mar 2, 2026, at 10:34, Sami Imseih wrote: >=20 >> New version attached. >=20 > The comment here: >=20 > +static inline MultiXactId * > +PreparedXactOldestMemberMXactIdSlot(ProcNumber procno) > +{ > + /* > + * The entries with indexes >=3D MaxBackends in the = OldestMemberMXactId > + * array are reserved for regular backends. >=20 > should say "array are reserved for prepared transactions" >=20 +1 And I saw the other code comment in multixact.c around line 162 needs an = update because of this patch: ``` * Per-backend data starts here. We have two arrays stored in the area * immediately following the MultiXactStateData struct. Each is indexed = by * ProcNumber. ``` It says =E2=80=9CEach is indexed by ProcNumber=E2=80=9D, but it=E2=80=99s = no longer accurate for OldestMemberMXactId prepared-xact entries, which = now use index (procno - FIRST_PREPARED_XACT_PROC_NUMBER). Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/