Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2ckN-0003Rq-8M for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 18:32:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p2ckL-0002Lg-Oe for pgsql-hackers@arkaria.postgresql.org; Tue, 06 Dec 2022 18:32:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2ckL-0002LV-F4 for pgsql-hackers@lists.postgresql.org; Tue, 06 Dec 2022 18:32:49 +0000 Received: from out5-smtp.messagingengine.com ([66.111.4.29]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1p2ckJ-0000CI-1f for pgsql-hackers@lists.postgresql.org; Tue, 06 Dec 2022 18:32:48 +0000 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.nyi.internal (Postfix) with ESMTP id 7B3B05C00E2; Tue, 6 Dec 2022 13:32:46 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute5.internal (MEProxy); Tue, 06 Dec 2022 13:32:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to; s=fm1; t=1670351566; x= 1670437966; bh=4R2ykgVQW4J783PnQhdM0aKy1P2KfzsNmY9cyURI9kc=; b=i mOJZRQKrcL5NK4BXNWHUvJw8u/yNt+vfgMbl5AoQhppiRt9/iA2hjy7a+Bkulc7O Pg1g8g2J3MeOneHheqXlGaBNqPdS3fJfY4DSqNtw5HjIMrNIMOz0aaatWnhA/KvK pH6fXWhPS3rHqK9pt9HQgPjOktopBUmU6z4FVEl/zdUtoyQD/JBx1izntOcDHgUN hR8A+ngibNjiYNNoU5XUDkFFCn+gGFWTrI65N5/N1wLtc372n5QklW/YlpK4sFHk I4n7xWcHyxXXeV2NatgxQA9t+386EtWIT/s+1oFqAk5sfsVTM/cfnmQnSzkHpzp3 9SFvzm1q0fPfdD4P5I18g== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:sender:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1670351566; x= 1670437966; bh=4R2ykgVQW4J783PnQhdM0aKy1P2KfzsNmY9cyURI9kc=; b=B kSJXvY+MC4oh6Su2tojP90APzCq+MuEWoDuVwGHVEOh2JP3V/WY4xtp6LePKg5bp YtuopQS/xtRcI9bPGInZuHeFXiZES1WlZfpzqVifOrTQIjEX7qkdar/fUNKR4ykB pXwZIcn/WwGndGNSdr+mQZsLR8oskHroh9pJXjulQW5Q8AThSzE3VEfw09ii2Uee XuAP3Q4bVSSUYUyM+NvRYbIDHPJ0dw8SbxQTeGbHr6uOJTpt/NV0CCFQiw4E8+J4 0385bobMcS1fjcqhFuht6X3QyDYG2yImpS3P+wR4WrGyi+MaBpRaXka15K5mCdpJ wsgHGAGTB76M2X0+jCixw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvhedrudeigdduudegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkfhggtggugfgjsehtkeertddttdejnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpeeuleeiuefhtdeitdekheekieeutdehkeejleelkefhkeehueettdet udeffedtvdenucffohhmrghinheptghirhhruhhsqdgtihdrtghomhenucevlhhushhtvg hrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrnhgurhgvshesrghnrghr rgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 6 Dec 2022 13:32:45 -0500 (EST) Date: Tue, 6 Dec 2022 10:32:44 -0800 From: Andres Freund To: Reid Thompson Cc: Arne Roland , "pgsql-hackers@lists.postgresql.org" , Justin Pryzby , Ibrar Ahmed Subject: Re: Add the ability to limit the amount of memory that can be allocated to backends. Message-ID: <20221206183244.howaxkwg4tm4bnkp@awork3.anarazel.de> References: <9e7969b9f6cbd2494705c7a5a21e7de0171727bb.camel@crunchydata.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-11-26 22:22:15 -0500, Reid Thompson wrote: > rebased/patched to current master && current pg-stat-activity-backend-memory-allocated This version fails to build with msvc, and builds with warnings on other platforms. https://cirrus-ci.com/build/5410696721072128 msvc: [20:26:51.286] c:\cirrus\src\include\utils/backend_status.h(40): error C2059: syntax error: 'constant' mingw cross: [20:26:26.358] from /usr/share/mingw-w64/include/winsock2.h:23, [20:26:26.358] from ../../src/include/port/win32_port.h:60, [20:26:26.358] from ../../src/include/port.h:24, [20:26:26.358] from ../../src/include/c.h:1306, [20:26:26.358] from ../../src/include/postgres.h:47, [20:26:26.358] from controldata_utils.c:18: [20:26:26.358] ../../src/include/utils/backend_status.h:40:2: error: expected identifier before numeric constant [20:26:26.358] 40 | IGNORE, [20:26:26.358] | ^~~~~~ [20:26:26.358] In file included from ../../src/include/postgres.h:48, [20:26:26.358] from controldata_utils.c:18: [20:26:26.358] ../../src/include/utils/backend_status.h: In function ‘pgstat_report_allocated_bytes’: [20:26:26.358] ../../src/include/utils/backend_status.h:365:12: error: format ‘%ld’ expects argument of type ‘long int’, but argument 3 has type ‘uint64’ {aka ‘long long unsigned int’} [-Werror=format=] [20:26:26.358] 365 | errmsg("Backend %d deallocated %ld bytes, exceeding the %ld bytes it is currently reporting allocated. Setting reported to 0.", [20:26:26.358] | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [20:26:26.358] 366 | MyProcPid, allocated_bytes, *my_allocated_bytes)); [20:26:26.358] | ~~~~~~~~~~~~~~~ [20:26:26.358] | | [20:26:26.358] | uint64 {aka long long unsigned int} Due to windows having long be 32bit, you need to use %lld. Our custom to deal with that is to cast the argument to errmsg as long long unsigned and use %llu. Btw, given that the argument is uint64, it doesn't seem correct to use %ld, that's signed. Not that it's going to matter, but ... Greetings, Andres Freund