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.94.2) (envelope-from ) id 1tmeYr-008SlJ-4y for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2025 19:56:17 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tmeYp-007PQ1-3c for pgsql-hackers@arkaria.postgresql.org; Mon, 24 Feb 2025 19:56:15 +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.94.2) (envelope-from ) id 1tmeVe-007KaN-46 for pgsql-hackers@lists.postgresql.org; Mon, 24 Feb 2025 19:52:58 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tmeVb-000atX-1X for pgsql-hackers@postgresql.org; Mon, 24 Feb 2025 19:52:57 +0000 Received: by mail-io1-xd2d.google.com with SMTP id ca18e2360f4ac-855a095094fso126761539f.1 for ; Mon, 24 Feb 2025 11:52:55 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740426774; x=1741031574; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=58dU0+ucfA2IcN+bT/jmBqqh/WxQJjP74o+ns+6LDZA=; b=AKDinH5e+uFXj3SNa0c2/YyJWs5UCXLnnR/xRG9Xt2tsLYbAJTFG3+u0C06yrBBdhs W9kV2BKMLpSSnhrogYHQa6zPPDSzwVCzl/z2nSof/g+sxVpe2mHLzo9sx8OlDkGTjMpA bFpmCNMlDVkB7ZwSmqSqCXACzV6MbpJxevKF4pYToz6A7UFiGebGqXrUjIt2oooVJRJT JE5hN7T6YNg6G6xegCB+87zFbIAvsu8/aF571HrFeqiOi4Tfu/mue/twNvPg0qPQzbZP MAoFgQqFgulAcPqP6lSORq+OoANpG/TIqVOP09kqexE8Axur0qwQTVL3KAsg+bdvaqvJ sZpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740426774; x=1741031574; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=58dU0+ucfA2IcN+bT/jmBqqh/WxQJjP74o+ns+6LDZA=; b=ntFMWBsspwNUGKE7E0DbwcDCbbWBFf+6Uk6GfIkH1Gqt+0c4ISIV5pxmEOTWEEId+L NKzZVipVefKg5c6HgVHiA3GhqvZfhstmWDNrrrGqE372UNBlXC+9y1t+TyP/kwjF/eLo ua+eicYtRtsoGjmHH7kUxQ5CHS0mdjcZT0XVgQTtQ6BcjSSrc+1QYRrtNzQqJNZmXAq2 dqqYOnYqH91AEseLXc5S+mV7lBievHwglzMpdPRWnlN/EFuYN4yel0dcQv2RyU9Oo2Bx kl+owf3yoWXDbO6iPxtuaw5jxRHdYU5haljKY5cwS1VM4RMrvee0UsQPACwGP5Wso5jF eQxA== X-Forwarded-Encrypted: i=1; AJvYcCU6J7kCb7zVGl98g3KTYTqTJWWcZVxicGh/Vl5+CB3vragKBt7fAEG4ABqAPKp0IJfGYqEc87eaZgdi/Rlz@postgresql.org X-Gm-Message-State: AOJu0YxnkE2cOvo+htdJNBKFe8+k6UgQmjMuOscohFB7JSiTA0XQ3FpL hSvE56xO4Wp1R2sWHeq0jTZKrAXHiAXieVY4vDcN00cZHJdb+yLx X-Gm-Gg: ASbGncuLhx42QY20tJI6/1SLn/9gCQtVIjBgK8R8ZVeEyFxJ5i3+V2adjEvVsqJbImc GpRYnpVhuC7qFPflkaaz60CvMPWSd+TjPUFcn5KUC23omMvDbRMCcba4ms1F60x+mEVKtKuP1r1 EFslR5TbAzGZGaleCO4hOpN8cK2YKheTSUY7WWEbu+Ck+nPUa2FPdFUZbyt9AzHXnsrSqUSOBbp 8hLbMSWZitWHnvyhqDqudbqhIeV76P2ShY7b/8NrukqD+8NA7t/fs66qxxu7uc6D0yNNAz5B2nt 4Yf0o/kAyyk6ogf6exJlc0Z4f+7wNu0zIm3vpN7M6LtES/2Gr6KiZLiVG+zgWkKt8HNHNnpUfCl V5zfEbkAuRLIrDkqM X-Google-Smtp-Source: AGHT+IF0BS4UKFM5xOO/eLxY4ns9CbD+F79C7YjZTxM9/VvPn+S50toCs5GI7aFg8IrxCp6OL2n9Tg== X-Received: by 2002:a05:6e02:156e:b0:3d1:968a:6d46 with SMTP id e9e14a558f8ab-3d2cae6b841mr132247315ab.6.1740426773787; Mon, 24 Feb 2025 11:52:53 -0800 (PST) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-4f04752dd55sm41990173.113.2025.02.24.11.52.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 24 Feb 2025 11:52:53 -0800 (PST) Date: Mon, 24 Feb 2025 13:52:51 -0600 From: Nathan Bossart To: Andres Freund Cc: Thomas Munro , Jacob Brazeal , pgsql-hackers@postgresql.org Subject: Re: MAX_BACKENDS size (comment accuracy) Message-ID: References: <7bye3hvkdk7ybt4ofigimr4ahshsj657aqatfc5trd5pbp5qd4@dir2wsx2lgo6> <6gs5nstss3fgb5gxd7vl6wszituul7damayktsypolmbx6hzei@2uxvnjnq3xy6> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="QnVX/ru2RzJGDjUg" Content-Disposition: inline In-Reply-To: <6gs5nstss3fgb5gxd7vl6wszituul7damayktsypolmbx6hzei@2uxvnjnq3xy6> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --QnVX/ru2RzJGDjUg Content-Type: text/plain; charset=us-ascii Content-Disposition: inline The recent commits for this drew my attention to the comment for MAX_BACKENDS. Specifically, it says we check the value in RegisterBackgroundWorker() (which appears to have been untrue since we added max_worker_processes) and relevant GUC check hooks (which I removed last year in commit 0b1fe14). I wrote a short patch to fix this, which I intend to commit soon unless there is feedback. -- nathan --QnVX/ru2RzJGDjUg Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Fix-comment-for-MAX_BACKENDS.patch" From 5038a5256942999bd544879d25312338686dddf2 Mon Sep 17 00:00:00 2001 From: Nathan Bossart Date: Mon, 24 Feb 2025 13:40:30 -0600 Subject: [PATCH v1 1/1] Fix comment for MAX_BACKENDS. This comment mentions that we check the configured number of backends does not exceed MAX_BACKENDS in RegisterBackgroundWorker() and relevant GUC check hooks, neither of which is true anymore. To fix, adjust this comment to state that we do the check in InitializeMaxBackends(). Oversights in commits 6bc8ef0b7f and 0b1fe1413e. --- src/include/storage/procnumber.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/include/storage/procnumber.h b/src/include/storage/procnumber.h index 75c2c7a17c0..2ddaaf0c646 100644 --- a/src/include/storage/procnumber.h +++ b/src/include/storage/procnumber.h @@ -32,8 +32,8 @@ typedef int ProcNumber; * currently realistic configurations. Even if that limitation were removed, * we still could not a) exceed 2^23-1 because inval.c stores the ProcNumber * as a 3-byte signed integer, b) INT_MAX/4 because some places compute - * 4*MaxBackends without any overflow check. This is rechecked in the - * relevant GUC check hooks and in RegisterBackgroundWorker(). + * 4*MaxBackends without any overflow check. We check that the configured + * number of backends does not exceed MAX_BACKENDS in InitializeMaxBackends(). */ #define MAX_BACKENDS_BITS 18 #define MAX_BACKENDS ((1U << MAX_BACKENDS_BITS)-1) -- 2.39.5 (Apple Git-154) --QnVX/ru2RzJGDjUg--