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 1vpppq-00H52T-33 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Feb 2026 15:39:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vpppo-00Fxdp-0C for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Feb 2026 15:39:27 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vpppn-00Fxdh-29 for pgsql-hackers@lists.postgresql.org; Tue, 10 Feb 2026 15:39:27 +0000 Received: from meesny.iki.fi ([2001:67c:2b0:1c1::201]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1vpppk-00000001Sz3-23GF for pgsql-hackers@postgresql.org; Tue, 10 Feb 2026 15:39:26 +0000 Received: from [10.0.2.15] (unknown [130.41.208.2]) (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 meesny.iki.fi (Postfix) with ESMTPSA id 4f9Qhy1RFLzyPj; Tue, 10 Feb 2026 17:39:14 +0200 (EET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1770737955; 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=r7tdPnlB6MB275aFuk67AArguHutxeBbg8aFEATyh+c=; b=se0dDeg6MSQsGcTImZ+tEg+vtMK3XWTFzdqJ7dsTm0oMmcRSPIaAypzdWQ1QCzsrOxZP2w ljReI9zYmIbdKuk5YQ7FqU7G6t4J40VMrthxKau0cyaDfrjkm8qN5hTshnZ3IV8G0ac0X3 zf7pd9ELEQk/4dcJYaVgT+C9LTOVVPY= ARC-Seal: i=1; a=rsa-sha256; d=iki.fi; s=meesny; cv=none; t=1770737955; b=pbObxgsoxwgrFL1QBTwpOw4t4pB6sc/7RXdOGG92KgrWS5HQlJ/du1RCCWOO/M8mwKTUxL Q+ors9zoy0d0zqwXLiTUHNdHU/ypAA/cDhm+xoyK0vouWiuM2xMHcfAoitY/mmaMIeq0jy VEoV3WrcQ9s34sREpbmnteGZelurboo= 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=meesny; t=1770737955; 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=r7tdPnlB6MB275aFuk67AArguHutxeBbg8aFEATyh+c=; b=ymtyJ3dHEJEpkNJATvYRBxuPapWJPI7Q5qpwjHucbiOKE2flF3ij/nBr0Gyw27WLNjW721 yHZXGOa1w2pqrDtP/gzoSkGGi5lUITYEgngTUct3I1klzNE6mXkC2LLFE9niRktHjdhXuZ tE0theW7tvWqGJDYWnR04/FiXqJvj24= Message-ID: Date: Tue, 10 Feb 2026 17:39:13 +0200 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Changing shared_buffers without restart To: Ashutosh Bapat Cc: Tomas Vondra , Peter Eisentraut , Thomas Munro , Dmitry Dolgov <9erthalion6@gmail.com>, pgsql-hackers@postgresql.org, Robert Haas , chaturvedipalak1911@gmail.com, Andres Freund References: <9ac6082a-2e30-4462-a260-1507452aa962@iki.fi> <91265854-b3ba-45c6-aa44-7e8dcdd51470@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 10/02/2026 17:23, Ashutosh Bapat wrote: > I didn't look too deeply but what's broken in the EXEC_BACKEND case? Dunno, I didn't look too deeply either :-D. But I think it's just some silly bug, i.e. the design should work with EXEC_BACKEND. >> -------------- >> >> /* This struct lives in shared memory */ >> typedef struct >> { >> int field; >> } FoobarSharedCtlData; >> >> static void FoobarShmemInit(void *arg); >> >> /* Descriptor for the shared memory area */ >> ShmemStructDesc FoobarShmemDesc = { >> .name = "Foobar subsystem", >> .size = sizeof(FoobarSharedCtlData), >> .init_fn = FoobarShmemInit, >> }; >> >> /* Pointer to the shared memory struct */ >> #define FoobarCtl ((FoobarSharedCtlData *) FoobarShmemDesc.ptr) >> > > I don't like this much since it limits the ability to debug. A macro > is not present in the symbol table. True, although FoobarShmemDesc would still be present in the symbol table. > How about something like attached? > Once we do that we can make the ShmemStructDesc local to > ShmemRegisterStruct() calls and construct them on the fly. There's no > other use for them. Works for me. > LGTM. > > One more comment. > /* estimated size of the shmem index table (not a hard limit) */ > #define SHMEM_INDEX_SIZE (64) > > What do you mean by "not a hard limit"? That was just copy-pasted from existing code. (Don't look too deeply ;-) ) > We will be limited by the number of entries in the array; a limit that > doesn't exist in the earlier implementation. I mean one can easily > have 100s of extensions loaded, each claiming a couple shared memory > structures. How large do we expect the array to be? Maybe we should > create a linked list which is converted to an array at the end of > registration. The array and its size can be easily passed to the child > through the launch backend as compared to the list. Looking at > launch_backend changes, even that doesn't seem to be required since > SubPostmasterMain() calls RegisterShmemStructs(). Or you can also just repalloc() a larger array if it fills up. > Also, do we want to discuss this in a thread of its own? Makes sense. - Heikki