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 1vvR0j-001iIv-16 for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 02:21:53 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vvR0i-009LhO-0c for pgsql-hackers@arkaria.postgresql.org; Thu, 26 Feb 2026 02:21: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 1vvR0h-009LhF-2h for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 02:21:51 +0000 Received: from mail-pl1-x62c.google.com ([2607:f8b0:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1vvR0e-00000001JbO-1pYV for pgsql-hackers@lists.postgresql.org; Thu, 26 Feb 2026 02:21:51 +0000 Received: by mail-pl1-x62c.google.com with SMTP id d9443c01a7336-2a7a9b8ed69so3003045ad.2 for ; Wed, 25 Feb 2026 18:21:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772072506; x=1772677306; 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=ujdujRjo6byotq/Rgwz0Lp5lVCKQzD+9Rxcy72AUR9o=; b=ZIV+rokfgOlTvMg7paPnkYJw/MU1X1R9BwNXqV5rWVNiYdIcXyBItBHyTf9e1HIs7T +ZWVTITn+MKC1yXiRHed7+yHjxRfdK54iTojMLnHxDWFanwaPw0lbxqp4dl4vnXAoCax icy53Mrg1Tn+8/VsliS+NkhRYeJO2FL94QNFskYchtJKjbOHn53Ld/OcMEoN5Gx73TSo aXEs52pbQoSgvP8LWAr5iWvyXr5ljxb7SoHQh7BVu1Gms3H91dIv10MxtAk6dcH6VShw 9m8KJs+XyXS7o9EWjpgw5kuOZjATH825OOUQB4xLUyrj4zk4aufKF184kjL3KPGrTHPD 2xTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772072506; x=1772677306; 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=ujdujRjo6byotq/Rgwz0Lp5lVCKQzD+9Rxcy72AUR9o=; b=UG3dIs9wu0Pkp61wgvRiHg1bd63kqOGua0RYdYcpnQ/giwg5aIUhGe94mdBmtuxcmi +8/DoiNDTsiyc0ESnHxojj5sRgmRtfnrHijRf3PPNyc1Q8MPYpCWxir8ygVFdpWLjAvn fdpzplsv1QtJzgnkiYOAveP4FMsziRfv/lwkWc/GSHYe7m650E94M5G7TtTtrBPmMvUv W5nhyC7MK4j5+zDRGROpo5AF8oHKsziMmGddZ1lrP0U+SjjJYcbf+7U8kSPKjbo3RnHn yiEP4nPAD1pSj2XNgSq0420GqAQj88l7v0FUJkQJdXIinwNi9pSJtnHtC8h8E0pWK8kZ kVVw== X-Gm-Message-State: AOJu0YxFV3etN0Fbv44/aEWCEXkVH2cNCXd4HK0hkLx06p4hqmMNnV47 2QKNp0HqW9P1+bgdNPKkbz5GWRQ3kCF8otFt1nuMuOPvLx013vL7Q/qO X-Gm-Gg: ATEYQzxz0OU1SKMVHoFGVWOtGhHoiJ33jOsCNdsE+78Yfh7+8yFN1Gq9ox6HAgxlFCl 6lKnymz66qFpr05E1cZgNsXfWK/sPbkFI5VFJNHLVoMtOAUd2r7DerEJCuTfHuA84L3ustBH1EP aAMOIBnYWrCfegEbHOBS8D4oyxW/FZqtNB383ZbROa2T4oZVzVTlHISmqNQfnQE76Id4SzI9rU7 TdkC7dZY0vYFrCJ8QLxGLLQy81rqafSuS6tqP04iozl/bAFcjwdLAjfXEGE3aWis0KeIh8+PTGp 8gRKuPr18wqMW/uiZ65SDu5+5hWYkzz0GYWiiYKaaxl00ip1Ii5n0/obQK8RRBpOCAn1W9sUdSD fC2XQ4JTjyVs6KzdA2ERJVhyumaNSqksdmgbd0jTUsYQViUnupLLrLChsQl9AaNK1ZkundgSwRU Y2Ea8fQkNomPRisAFhnjyDVagc4uOjTQaqznoNpfgo X-Received: by 2002:a17:903:41cb:b0:2a9:6414:71a4 with SMTP id d9443c01a7336-2ae02a76430mr6076725ad.16.1772072505851; Wed, 25 Feb 2026 18:21:45 -0800 (PST) Received: from smtpclient.apple ([203.10.98.27]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-2adfb5b22f3sm6439625ad.12.2026.02.25.18.21.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 25 Feb 2026 18:21:45 -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: Thu, 26 Feb 2026 10:21:10 +0800 Cc: "pgsql-hackers@lists.postgresql.org" , Heikki Linnakangas , Andres Freund , Sami Imseih Content-Transfer-Encoding: quoted-printable Message-Id: References: <7acc94b0-ea82-4657-b1b0-77842cb7a60c@postgrespro.ru> <93F0BD0A-0B8B-4592-9D4B-53F405A86F6A@gmail.com> To: Yura Sokolov 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 Feb 25, 2026, at 23:16, Yura Sokolov = wrote: >=20 > Good day. >=20 > Chao Li and Sami Imseih, thank you for looking at. >=20 > After thinking a bit, I've decided to make sizes of arrays precise: > - OldestMemberMXactId's size remains MaxBackends + max_prepared_xacts. > Instead of changing its size, procno is now adjusted to not include > auxiliary procs. > - OldestVisibleMXactId contains only MaxBackends elemenents now. > It is used only for real backends and not prepared transactions. >=20 > All accesses are validated with asserts certainly. >=20 > I believe, index transformation in access of OldestMemberMXactId will = not > cost much since all this operations are quite rare. > In the loops arrays are accessed directly since limiting loop index is = enough. >=20 > --=20 > regards > Yura Sokolov aka = funny-falcon Actually, while I reviewing v1, I was thinking over the same way as v3, = as the NUM_AUXILIARY_PROCS portions in OldestMemberMXactId and = OldestVisibleMXactId arrays are not used at all. I didn=E2=80=99t raise = the idea because that given these code are in hot paths, I wasn't sure = if the complexity was worth the shared memory optimization. It=E2=80=99s = a classic trade-off, and I=E2=80=99m curious to see which direction the = senior committers prefer. However, I agree that the new helper function names in v3 are a = significant improvement over v1. Best regards, -- Chao Li (Evan) HighGo Software Co., Ltd. https://www.highgo.com/