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 1w9SJZ-001Rv5-1z for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 18:35:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w9SJX-004Ja9-39 for pgsql-hackers@arkaria.postgresql.org; Sun, 05 Apr 2026 18:35:16 +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 1w9SJX-004Ja1-2E for pgsql-hackers@lists.postgresql.org; Sun, 05 Apr 2026 18:35:16 +0000 Received: from lahtoruutu.iki.fi ([2a0b:5c81:1c1::37]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w9SJV-00000000lb3-2kau for pgsql-hackers@postgresql.org; Sun, 05 Apr 2026 18:35:15 +0000 Received: from [10.0.2.15] (unknown [130.41.208.1]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange x25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: hlinnaka) by lahtoruutu.iki.fi (Postfix) with ESMTPSA id 4fph2z2cgpz49Pxf; Sun, 05 Apr 2026 21:35:07 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1775414108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Srw+BSMJ2GAimCkxFeGKq6RzjjRQzbWV4o5y68A7HvI=; b=DagvRCrDMezlomQuzk0j728ee8cvS/2iakZbHC6LfFK7dk/p3ldn5+94hNvMzc/smWEpOq z+fspq1y9iwuF5wj8YICiAq0rWFlciIA4Jd8Tp0nWlWYZ5gMOEU66XRgYYrnKoxu/vGZti 0jiD32JLN3CEN2a+jWPZzJcNbZGn4Atg72qXie4lJSBxKFkHMTO7c6MVX1x34hm2m8AdHy R805MQ8vo6cTJcsIMShIDtEvRSiZX/EZE7l/TEM0HvQ5DFGTpNkIUZVzXJzJ5y0p/Y0qTf bG67qcuVTxgKMs63XLM6cAS3DwBgQqRtk6CzpZxfd6Yz7V70DSGTOWTuczISRw== ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=lahtoruutu; cv=none; t=1775414108; b=XHoLenzdO2PYgIoBaVtJqHEP6kbNHuwcxGf6C9vOpnG4iJKsZvWs42qLYX92d+hUfMHgdJ p2Os6nmCcu6u43TtsoqJ9QQG/gdiGdmb2IR6OxBsEGQuhAcJ7BJqTsBpkpk9Eo3eBGUIWl 8UfF60RYhQwO6aE4rp+kUF0IzSsNhzqN4EPQ40TZJNlMO3F6oaoSGw0sg/z/r9/iywEtoi XzFvfLBRHsHBY9Nab2ByUalyKzrG1BFfViUSzlf+nHb0xPQ41YE5QlgyGKjNcoBkpsQxwp AMySmjB+phMFn/P23AxBDamZyI/Hx5YtkjO/1E9+okU4HmhDkpWKawHfpqqSyg== ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=lahtoruutu; t=1775414108; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Srw+BSMJ2GAimCkxFeGKq6RzjjRQzbWV4o5y68A7HvI=; b=vu7ybcLdvc2kIszJJlEuPzYNggZwX6j3LwH9wQn3417G+qCzUHEfPK34GSgW8ak2+qMuDY v7+u8ANyOK/+9qqWCH2P9pguy3SVrrAPgaOFYaV8CT/BOqZC+jV7bqQnGKlZ+3VcMrQfdL JY0sGcbFvRNyI03tqfRgWyuL5ZNVa75iEDxLZEHSNN4ZsBdBSFQzrwOBxVxVFZGVAQHWAb +RU7EhXxsTSZH15VCd3tpsOJ2dSwir/dn6kX3dENdTvJFqaRjW+qEydNRaqkVeAUuLJA/r KhKG0pKebcyDoy53qo1jVog1Z2PuJVBq5YrkEFeyVJkJ1nMu5P/RN3J16GO3Ng== Message-ID: Date: Sun, 5 Apr 2026 21:35:06 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Better shared data structure management and resizable shared data structures To: Ashutosh Bapat Cc: Matthias van de Meent , Robert Haas , Andres Freund , pgsql-hackers , chaturvedipalak1911@gmail.com References: <791c3f18-f4de-4d84-ac6b-c7ccc074dd38@iki.fi> <9d919bd9-94dd-4bda-8ccf-ebced4178c53@iki.fi> <7d3ba240-9350-4dfc-bbe1-be6584aee236@iki.fi> <1c3a07a7-158d-4800-927c-2641c73277d8@iki.fi> Content-Language: en-US From: Heikki Linnakangas In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 05/04/2026 19:23, Ashutosh Bapat wrote: >> Both MultiXactShmemInit and MultiXactShmemAttach set >> OldestMemberMXactId, OldestVisibleMXactId. In future if we add another >> global variable to point to the shared memory, somebody needs to >> remember to initialize it in both these functions. Maybe deduplicate >> it with something like attached? Similarly for PredicateLock related >> changes. > > Sorry, I attached the wrong patch. Here's the right patch. Gotcha, yeah I've thought about that too. I even considered making ShmemInitRequested() automatically call all the attach callbacks after initialization, even in !EXEC_BACKEND builds. That way, you could put the backend-private steps only in the attach function, and have automatically be called in the postmaster too. I decided against it, because only few subsystems need the attach callback at all, and many of them need to do the "local" steps earlier in the init callback anyway. For example, XLOGShmemInit() uses the WALInsertLocks variable inside the function already. In the end I decided it's OK as it is. I'm not too worried about the duplicated code in multixact.c and predicate.c, they fit in the same screen in an editor so it's pretty easy to see that they are duplicated for a reason. With more complicated logic it would be a different story. - Heikki