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 1vSdOQ-002JvM-0v for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Dec 2025 15:43:18 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vSdOO-000DJ0-34 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Dec 2025 15:43:17 +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 1vSdOO-000DIs-25 for pgsql-hackers@lists.postgresql.org; Mon, 08 Dec 2025 15:43:16 +0000 Received: from mail-wm1-x333.google.com ([2a00:1450:4864:20::333]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1vSdON-003s2C-0U for pgsql-hackers@lists.postgresql.org; Mon, 08 Dec 2025 15:43:16 +0000 Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-47755de027eso32861645e9.0 for ; Mon, 08 Dec 2025 07:43:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1765208594; x=1765813394; darn=lists.postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ismfXtl8jgw0F0y51pZEFv5fZp/EHqEYrqhae41sZII=; b=Gc46k2mP4FnZ7ByhMiGs921h+hWLzKixiRGnU3XwBaxg0hFJ0KQhR2i5Sh92yd1FBW IDTSEA7fukD4ms5QHi8CM+OO/GH+AqdWAuf1OKvioP4dISAMTnF29XT0UGrkHINBIX2a 8eR96baSMU9ZICsdxa6olMvHcIcDqeqAfRD7CqDYnitfLMBkc3toJVtOgF0w5YsDk4a8 E8e9dBCMPMt8bRGwpBkYGu8LYnXPJb81s5szKvQaDm1ReXr4k0T2ocBmfVH28jI8Gmcq +zI2JvbrZyKGHIVzKIQtsR26T1TcM7tIb7b2A0Vk0cNno6waLoSuZSV0aOD1AtEUC9Zi 773g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1765208594; x=1765813394; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=ismfXtl8jgw0F0y51pZEFv5fZp/EHqEYrqhae41sZII=; b=cTcXM8gM5CvUrC9cFidSlB5K3c4MHOVfCJ8vzhAotZNTGsBrMT4IuGkzYS6q9Ew8LT dtU862+cBYGP8sWuDgReSdTnBzeQPbqqrhScrowWk/DYB5VByBTftd5yIfrZQDP3muZz SDnrT2WMlmcCDrEzq1Ez0x7C5Dn/HSQvpUjXePq2vHNQGx4XEe93RNyNQT0BwEn0YDiH 4EuSHkIqW8Y2E1OJSYNp2IsfLKs40A2pF7HV/98oRHPues3RSlGqXanXXKZGq1/yHIBk TRAWz2615yYXiXzM/kSjTZMZYnDZLECjM1553Wy7xt49lki6Pdbe2chJFj4hmnOfiNoE 9wQw== X-Forwarded-Encrypted: i=1; AJvYcCWLGN4jgxdGrHUZDKyVOw3MXaPh5zE092uYnp9L8NxZnPwjkb1JHMXIA6cnnHiMczJHlJi5hw0ONP+YNtRq@lists.postgresql.org X-Gm-Message-State: AOJu0Yypp0fJ6FuMol0SV+LnOVIZ35Q3bYStpK509w1QtGaKWMvWaPRT SVGtB/6HSNsWteSWs4XiykhqPgFNL+aNYQOgVnf1HfotwHpuBJnLQbS2+706yt+VITfz1Q9MVkD uqIKaI4ou10Eu7UphY0P/TNquSzzy9Mo= X-Gm-Gg: ASbGncvtAbXEGDTe7NxXuEnAWqwAWusu69yC0pZnxn933tiVzUHh5F0N8wfEMH/OdYk 51ff6hP47bPPzPrVIQeMvoAE+c39W+m6LPZ99/6PGSmDFva0ji2nugcfgjWlyuIOmdSMzduzEeA C29YzzrBFgYp92GkbqfaCGp7HVxV7sqo87ubS3Czr36tt+wfSGgKwS0l4oADz+SDP8giT29Gvrz 5qlOomkm7AR7W/NIa6YgsnhbvvXximrhk9SDyKnyAJWViPJFKYg23JX5LT3dYLF4JnnG0QG X-Google-Smtp-Source: AGHT+IETGjebv/PoAOs6D72NnRow43HZC7tSj9R5HP3pG1LeNxqWQSiaIeDuiFUyMZrzK3m2KLo2bTDGk9C6jsOrFPg= X-Received: by 2002:a05:6000:2284:b0:429:d170:b3ac with SMTP id ffacd0b85a97d-42f89f09a53mr9330798f8f.13.1765208593711; Mon, 08 Dec 2025 07:43:13 -0800 (PST) MIME-Version: 1.0 References: <2bc58592-9d74-4af0-bdd1-1a88e8683f7c@iki.fi> <36531c0e-292c-409d-bbc7-a252cf6e910a@iki.fi> <54aa8f65-f0e4-4464-b543-e0399c1cab1e@iki.fi> <4a9dda70-0af7-41a4-9636-b168f2fc48ef@iki.fi> <46cc45e9-fddd-44bc-bcb3-96889aafd921@iki.fi> <6c298bc4-7029-4c1d-bf16-3e094842ce32@iki.fi> <2c62322e-a0e3-49cd-b369-370718a8efd8@iki.fi> In-Reply-To: <2c62322e-a0e3-49cd-b369-370718a8efd8@iki.fi> From: Ashutosh Bapat Date: Mon, 8 Dec 2025 21:13:00 +0530 X-Gm-Features: AQt7F2qmnb2NL5OtAN9pNDY5o00lJAkqY3IPRYF9yyTgkevUr43VZNnzLMDw9MM Message-ID: Subject: Re: POC: make mxidoff 64 bits To: Heikki Linnakangas Cc: Maxim Orlov , Alvaro Herrera , Alexander Korotkov , wenhui qiu , Postgres hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, Dec 6, 2025 at 5:06=E2=80=AFAM Heikki Linnakangas = wrote: > On 05/12/2025 15:42, Ashutosh Bapat wrote: > > > 007_multixact_conversion.pl fires thousands of queries through > > BackgroundPsql which prints debug output for each of the queries. When > > running this file with oldinstall set, > > 2.2M regress_log_007_multixact_conversion (size of file) > > 77874 regress_log_007_multixact_conversion (wc -l output) > > > > > > Since this output is also copied in testlog.txt, the effect is two-fold= . > > > > > > Most, if not all, of this output is useless. It also makes it hard to > > find the output we are looking for. PFA patch which reduces this > > output. The patch adds a flag verbose to query_safe() and query() to > > toggle this output. With the patch the sizes are > > 27K regress_log_007_multixact_conversion > > 588 regress_log_007_multixact_conversion > > > > > > And it makes the test faster by about a second or two on my laptop. > > Something on those lines or other is required to reduce the output > > from query_safe(). > > Nice! That log bloat was the reason I bundled together the "COMMIT; > BEGIN; SELECT ...;" steps into one statement in the loop. Your solution > addresses it more directly. Now we can call query_safe() separately on each of those. That will be more readable and marginally less code. > > I turned 'verbose' into a keyword parameter, for future extensibility of > those functions, so you now call it like "$node->query_safe("SELECT 1", > verbose =3D> 0);". I also set "log_statements=3Dnone" in those connection= s, > to reduce the noise in the server log too. keyword parameter is better. also +1 for log_statements. > > > Some more comments > > +++ b/src/bin/pg_upgrade/multixact_old.c > > > > > > We may need to introduce new _new and then _old will become _older. > > Should we rename the files to have pre19 and post19 or some similar > > suffixes which make it clear what is meant by old and new? > > +1. I renamed multixact_old.c to multixact_pre_v19.c. And > multixact_new.c to multixact_rewrite.c. I also moved the > "convert_multixact" function that drives the conversion to > multixact_rewrite.c. The idea is that if in the future we change the > format again, we will have: > > multixact_pre_v19.c # for reading -v19 files > multixact_pre_v24.c # for reading v19-v23 files > multixact_rewrite.c # for writing new files > > Hard to predict what a possible future format might look like and how > we'd want to organize the code then, though. This can be changed then if > needed, but it makes sense now. +1. > > > +static inline int64 > > +MultiXactIdToOffsetPage(MultiXactId multi) > > > > > > The prologue mentions that the definitions are copy-pasted from > > multixact.c from version 18, but they share the names with functions > > in the current version. I think that's going to be a good source of > > confusion especially in a file which is a few hundred lines long. Can > > we rename them to have "Old" prefix or something similar? > > Fair. On the other hand, having the same names makes it easier to see > what the real differences with the server functions are. Not sure what's > best here.. > > As long as we use the same names, it's important that > multixact_pre_v19.c doesn't #include the new definitions. I added some > comments on that, and also this safeguard: > > #define MultiXactOffset should_not_be_used > > That actually caught one (harmless) instance in the file where we had > not renamed MultiXactOffset to OldMultiXactOffset. > That looks useful, and has proved to be useful already. > I'm not entirely happy with the "Old" prefix here, because as you > pointed out, we might end up needing "older" or "oldold" in the future. > I couldn't come up with anything better though. "PreV19MultiXactOffset" > is quite a mouthful. How about MultiXactOffset32? Thanks for addressing rest of the comments. > > > + > > + note ">>> case #${tag}\n" > > + . " oldnode mxoff from ${start_mxoff} to ${finish_mxoff}\n" > > + . " newnode mxoff ${new_next_mxoff}\n"; > > > > > > Should we check that some condition holds between finish_mxoff and > > new_next_mxoff? > > Got something in mind that we could check? > I have always seen that finish_mxoff is very high compared to newnode mxoff - given that we write only one member per mxid, is newnode mxoff going to be always something like 4K or so? Then we can check that value. But I will experiment more to see if I can come up with something, if possible. --=20 Best Wishes, Ashutosh Bapat