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 1wx0iQ-002M3j-31 for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2026 11:13:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1wx0iP-008fyJ-1V for pgsql-hackers@arkaria.postgresql.org; Thu, 20 Aug 2026 11:13:45 +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 1wx0iP-008fyB-0V for pgsql-hackers@lists.postgresql.org; Thu, 20 Aug 2026 11:13:45 +0000 Received: from mail-pj1-x102f.google.com ([2607:f8b0:4864:20::102f]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.98.2) (envelope-from ) id 1wx0iM-00000000Hzs-1mrN for pgsql-hackers@postgresql.org; Thu, 20 Aug 2026 11:13:44 +0000 Received: by mail-pj1-x102f.google.com with SMTP id 98e67ed59e1d1-38e3efab7e0so618253a91.0 for ; Thu, 20 Aug 2026 04:13:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1787224419; x=1787829219; darn=postgresql.org; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:from:to:cc :subject:date:message-id:reply-to:content-type; bh=mLY7YaWrOM2nB8LedhlN9Xy6gXHq3TyBCuuDdhgYRdg=; b=sFuPvwPetBStE9a14Mmj2CyYszuIHyMp/bDZuNQjj6UcuXIX/zqI0giHU04fOZA3np xv3Gi+sEQcoMZxdYJ7kkY5P65T1C5dGBfHg1LLKqntq47wTaYn5xfQGz0UZFX9uQyJGc hxzKK5MKun7C3FDIfe7os9lRRDJ/e5RfEDdGXUoHxr0OXp9fmU3iZoxf3YPFztUILh72 WLcuObeD1WfgdkioMs7FPQcxe8iaeVGGXfy8V7giLIkvSEaXzsrNPRLW8Lxhdh6veuc4 DBsM1ZgwZ1FwktoZO66S0qd3D1gYl9ne4a9uZwFo6kWZIwcQv3LbKgBL1kKrg2hvxxIm t/5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1787224419; x=1787829219; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:content-type:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=mLY7YaWrOM2nB8LedhlN9Xy6gXHq3TyBCuuDdhgYRdg=; b=KUhHt6LckqU4mWUo5Q/r2QxbwFYnUW71ODXmrjbbWsIq+8yHSelF+1OzWN7a+bkNGq GRI0+4zDS5dYIFcFLjNBuELjEOGcASmQj1Z12P23VuinmP27l6Dd0yZnc1YUOzfmhOfr RZGGfY2FrzOaLpDt2kyIwg0gugCoajnGEZcpsU6F8sd/NSsF7j4rXCJijke+Y5llxU4s uYhZcTbypZszPBSHSOdJHpNWxaBe3ipkEQ4qeK1iBRFY5JIHgg5rjAmPF3rR+l/wh2sg 7n13KT6E1U+jPtxM77sBqJL+DalWfKP8owVlMNY96qYpp14fbSUeJdCZwqx0tZ24qPQe XR7Q== X-Gm-Message-State: AFuF++kMTObQ7pHs7JnvW/DYrOY/NuwiPkINmDvsAzGHPC1wHEEHB/rL PXZBYJlKeRTsGjUgoiJ94xMjHbu3WfPDoRQLcL9P69wa8pvp2pA2nsiw X-Gm-Gg: AR+sD11LbrQzLvajdlDHVl1wTBeGEh4yS443mxpvAblg1tFtbsg8mMY8nvcZFIUjouj DrTOR3ZAHn+D8qXb2Z9p47ovwXtDp6PH4MULNqDUG6DbgOZh8CnsobVJtF2zcMV1owmJd/TlJuS zISln6/vNcrLwPPCBHOlxqRfC7JThKmq4/mDf7VGolWRh4poFyOIo0UKC0Ws1LLiPmKeknTMSVu 06CtBUazeCAbpylwpX4tiy+N6LoQoJBWN46uOZ9QJ7jqJNGQAU3J8yBJUa/gk8gdbBWABNXQXkn /2ZZUKy21O3z7nCkFnAPRV/laoCERDH3W6NPzjtMgDy4+QN6ZC71KJLEwRTCL6TYiZRYHrcTLwn d6Tx0b83b2pUYpUNjW/jb+87ltIMLEob46hzeIG752LDP355efHEgBeCCjp6l3tEkHHWljF/oTL BfqyK2iz6sHFj1mz1PmKXocxPTbzV8R76Kq3fI+pdyHtmtHWDQhOqoX0L88QE9L7G76K8uJNQ8c XJbQoQ= X-Received: by 2002:a17:90b:38c8:b0:37f:e5b1:ec4b with SMTP id 98e67ed59e1d1-395a04b80eamr7365634a91.5.1787224418557; Thu, 20 Aug 2026 04:13:38 -0700 (PDT) Received: from smtpclient.apple ([128.14.188.156]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-327bf1970b0sm16398172eec.29.2026.08.20.04.13.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Aug 2026 04:13:37 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3864.700.51.1.1\)) Subject: Re: Changing shared_buffers without restart From: Yuhang Qiu In-Reply-To: Date: Thu, 20 Aug 2026 19:13:22 +0800 Cc: pgsql-hackers@postgresql.org, Heikki Linnakangas , Haoyu Huang , Tomas Vondra , Peter Eisentraut , Thomas Munro , Dmitry Dolgov <9erthalion6@gmail.com>, Robert Haas , chaturvedipalak1911@gmail.com, Andres Freund , Jakub Wartak Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Ashutosh Bapat X-Mailer: Apple Mail (2.3864.700.51.1.1) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi Ashutosh, I reviewed the v20260817 patches, and here is what I found: 0003 / 0004: BufTableGetContents() holds all mapping partition locks for the whole = scan, with no CHECK_FOR_INTERRUPTS. pg_buffercache_lookup_table is a view = whose name ends in "table", which is ambiguous. What about pg_buffercache_mappings? With a resize pending, pg_settings.setting reads "16384 (pending: = 32768)", could break pg_size_bytes(current_setting('shared_buffers')). Maybe we = need a new GUC rather than a composite one. 0006: configure hasn't been regenerated. The feature might not be compiled by = default. Shrinking PANICs, whenever max_shared_buffers > shared_buffers. The range handed to madvise(MADV_REMOVE) in ShmemResizeStruct() ends at maximum_size rather than at the current size, so it covers the PROT_NONE = tail and fails with EACCES. There are now six read-only shared_memory_* values, and the names are = getting long. A function might fit better than that many GUCs. shared_memory_size_in_huge_pages is gone, it might break compatibility. MADV_POPULATE_WRITE requires a new OS kernel version. #ifdef is needed = in PGSharedMemoryEnsureAllocated. "could not protect shared memory" is emitted from two places, so it's = not possible to tell which one failed. 0007: EvictExtraBuffers() checks BM_VALID, but BM_TAG_VALID is the flag that = means there's a mapping table entry, so buffers with IO in flight are skipped = by the precheck. "shared buffer resizing to %d buffers failed" doesn't say why it failed. Some values like MaxProportionalPins aren't recomputed on resize. 001_resize_fault_tolerance.pl never reaches madvise(): with max_shared_buffers =3D 32 buffers and huge pages still on for the TAP = cluster, the range rounds away at 2MB granularity, so everything passes with = nothing freed. That is also why the shrink problem above goes unnoticed. Best Regards, Yuhang Qiu.