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 1tzgIi-0059gz-3C for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 18:25:28 +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 1tzgIg-0051u8-Ra for pgsql-hackers@arkaria.postgresql.org; Tue, 01 Apr 2025 18:25:26 +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.94.2) (envelope-from ) id 1tzgIg-0051tz-Dn for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 18:25:26 +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.96) (envelope-from ) id 1tzgId-002ObK-1Q for pgsql-hackers@lists.postgresql.org; Tue, 01 Apr 2025 18:25:25 +0000 Received: from [192.168.1.112] (iptv-hkibng21-58c090-167.dhcp.inet.fi [88.192.144.167]) (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 4ZRxHx2BSdzyR6; Tue, 1 Apr 2025 21:25:17 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1743531917; 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=Q4x22p7urHwH32ww9lRqQel/wrJ+1cWKUqisncZx7s0=; b=a+MfOeMXPZXq+ddreya8VsDdB9PWOaQUFHGAdMZs1iMzKOVCLXGk/UkB9QIpARsWunYaOv wjap+JMgZ26cLIMScJfZ79YYgCSARf8jth0BhI+F1t99PLIiIH3K6D6jkS4ZA4GxHUloSq tI5zqQCfJCqPJkRAnPU5jZ9NYRrXhwk= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; s=meesny; t=1743531917; 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=Q4x22p7urHwH32ww9lRqQel/wrJ+1cWKUqisncZx7s0=; b=fkCZTDrYy+tJ5IO5Ch8iSGuOqqL2aXxuRTuSdzFiw75W5XfStZUG1sy0xsAoW9FHZ4AtqF h4ITK+LMhBH0ki2OtEH7Cwy0Q4cXsiWOKsrdboFIQWMWuTuxhSkIGD0H8j+xSLB63Cs5iu 6fLJzgf8Q8FJDrfxvtYKAogfwgoxvk0= ARC-Authentication-Results: i=1; ORIGINATING; auth=pass smtp.auth=hlinnaka smtp.mailfrom=hlinnaka@iki.fi ARC-Seal: i=1; s=meesny; d=iki.fi; t=1743531917; a=rsa-sha256; cv=none; b=dkAyUTM/6yvSCXoewktz6WuzyvE+7ibrL6AchfHPfv2AE12MhmzvGZj8wwQcvLRm70Wxw4 ux5iS/zK64N39sobf/BkjwseoCKqFvX5xnsiHUncIQAA1mVcNc5XGLUb3wIQR4eb69uFkO zs89AEc2wIoMeCQtPaxbg8DvkyxwUGE= Message-ID: <36531c0e-292c-409d-bbc7-a252cf6e910a@iki.fi> Date: Tue, 1 Apr 2025 21:25:16 +0300 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: POC: make mxidoff 64 bits To: Maxim Orlov , wenhui qiu Cc: Alexander Korotkov , Postgres hackers References: <24b3deb6-a732-4256-847a-560f4bf39d59@iki.fi> <4535f3aa-3220-4760-b1f5-2bc91f248e03@iki.fi> <2bc58592-9d74-4af0-bdd1-1a88e8683f7c@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 07/03/2025 13:30, Maxim Orlov wrote: > Here is a rebase, v14. Thanks! I did some manual testing of this. I created a little helper function to consume multixids, to test the autovacuum behavior, and found one issue: If you consume a lot of multixid members space, by creating lots of multixids with huge number of members in each, you can end up with a very bloated members SLRU, and autovacuum is in no hurry to clean it up. Here's what I did: 1. Installed attached test module 2. Ran "select consume_multixids(10000, 100000);" many times 3. ran: $ du -h data/pg_multixact/members/ 26G data/pg_multixact/members/ When I run "vacuum freeze; select * from pg_database;", I can see that 'datminmxid' for the current database is advanced. However, autovacuum is in no hurry to vacuum 'template0' and 'template1', so pg_multixact/members/ does not get truncated. Eventually, when autovacuum_multixact_freeze_max_age is reached, it presumably will, but you will run out of disk space before that. There is this check for members size at the end of SetOffsetVacuumLimit(): > > /* > * Do we need autovacuum? If we're not sure, assume yes. > */ > return !oldestOffsetKnown || > (nextOffset - oldestOffset > MULTIXACT_MEMBER_AUTOVAC_THRESHOLD); And the caller (SetMultiXactIdLimit()) will in fact signal the autovacuum launcher after "vacuum freeze" because of that. But autovacuum launcher will look at the datminmxid / relminmxid values, see that they are well within autovacuum_multixact_freeze_max_age, and do nothing. This is a very extreme case, but clearly the code to signal autovacuum launcher, and the freeze age cutoff that autovacuum then uses, are not in sync. This patch removed MultiXactMemberFreezeThreshold(), per my suggestion, but we threw this baby with the bathwater. We discussed that in this thread, but didn't come up with any solution. But ISTM we still need something like MultiXactMemberFreezeThreshold() to trigger autovacuum freezing if the members have grown too large. -- Heikki Linnakangas Neon (https://neon.tech)