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 1uRvhf-000tDd-HN for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jun 2025 16:31:59 +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 1uRvhd-002ePe-KK for pgsql-hackers@arkaria.postgresql.org; Wed, 18 Jun 2025 16:31:58 +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 1uRvhd-002ePW-An for pgsql-hackers@lists.postgresql.org; Wed, 18 Jun 2025 16:31:57 +0000 Received: from mail-io1-xd31.google.com ([2607:f8b0:4864:20::d31]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uRvhb-002n66-38 for pgsql-hackers@postgresql.org; Wed, 18 Jun 2025 16:31:57 +0000 Received: by mail-io1-xd31.google.com with SMTP id ca18e2360f4ac-87404493fd2so639320539f.3 for ; Wed, 18 Jun 2025 09:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750264313; x=1750869113; 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=UGVTO1iS90E+UNAlig+SmnE3s9FVgcaoInMhdL8hMmI=; b=RZBJyrC8BlYI9idV8MBbkFjAafBVqIxPK+v3h2f55EjKb3DSwbUh4DAP0glG21zq8N UEXVMsRamXPenMfGt2JBgX/JpDctNKXcssfCD/7DSyVrw/7waQEoo3STqJhhqfUWvtJC VyJEIOosHzq9UUgeTm01CvHwlQkQxslDGztYMp2+Lw8Rbuhh4uFNUoFhE6IA9CI+Rr40 UTDAiuZm4yHRXZq7lOzOiN7gJvGDdVO3LEgr0xi0w97jXj90rckxB25DS3tPSfWrDQXe GK9lcV1fjX/CRy0hqzSrqZayfL1Q+7WTEZ2iMF7GfCUGIDVak809Lrc+zn0pPtn1d7Sw 8SnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750264313; x=1750869113; 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=UGVTO1iS90E+UNAlig+SmnE3s9FVgcaoInMhdL8hMmI=; b=Q1WuJ+wXeMMVmaqJvC59SOnL2z5GT9OBrq2gUhe0kQG9IBhWUbMb9lH4Ycv3Jv1THj AM6YJSoMEuhtCAi0ToirM5cROHvtFgk6odZZgLUH8a3ifFxVjuDmFBjCXQPOqWlXEFxc qj3KlAB8LKJJeO7HPYZ6X63pmLeCoCw5tS+UweVhJzzOR2VJFyp6y+L0xHJAtyg3boh6 TiUJVEUj4dI0nsYVMkg6CmbSCmeH+V2GItZ46khprAwP2VzjFdyruVptHs32FAWfyYUV K4OkFsFqbOv35qdkuGF3JKTqRIOxe3VQQ87WqJkchsuYpIMJBW6fANlYgsHcYN4VbEBF AdWQ== X-Gm-Message-State: AOJu0YygwqeJy0Tvl2YdjiRj81jls0JeRgo0hSpbT35KJeq0JqRQYssI z/71NA4cOPUUo3mM1xIX/ICYlcyCMxyzHAeiNy7z18MTYYqjL4B+1EKj X-Gm-Gg: ASbGncvaRp+YAsUaPrIPqKpsadgVhHXev1A7riWc/h6eviEDoPbFkBOTx8peEqSUs3e d2IjKa2ERn5WyuvqyfGOJcGh4quRp0til7cW8MROeBB6XUJdfo1Sf4WfsEt2b+j/l8bM4MFpF9b RoJ8n4SrAoJaAanhDMNq19WL0/Hn707t3o761c0pq5lWfVWbB873BgFw3i7L7vakGA3p5iZV+XO /I6Zqun8Vqmge9m/pgA9ie8a3R0VJ9NSHNt9c5+GhRW95ofujHzxXiaP1rFVovCt3cmfmcywvgQ ifsOB609Sm2ScZJu0v5z2nPvpoCXDIIplSyqB6KK+zDY8lgZKQq0lVk/mr/gu2gzPQ7vp/jvaQ5 EbUZgiCO5v1HZTBDOJVjDVLT669ljcIZVLo8GV68Ij47BKJO+4GWcJEX6Fg== X-Google-Smtp-Source: AGHT+IEGNN0poMEhoXugFqdCW0dW0oCola6BNJIgv5GpyiXQjspd9LLqrO+p/WwGbmA7WO2mGPdKNw== X-Received: by 2002:a05:6602:6415:b0:864:4a1b:dfc5 with SMTP id ca18e2360f4ac-875dee05912mr2172149139f.9.1750264312821; Wed, 18 Jun 2025 09:31:52 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id 8926c6da1cb9f-5016f03afafsm1262584173.120.2025.06.18.09.31.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Jun 2025 09:31:52 -0700 (PDT) Date: Wed, 18 Jun 2025 11:31:50 -0500 From: Nathan Bossart To: shihao zhong Cc: PostgreSQL-development Subject: Re: Fixes inconsistent behavior in vacuum when it processes multiple relations Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Jun 18, 2025 at 11:15:31AM -0400, shihao zhong wrote: > I investigated the code and found a small bug with how we're passing > the VacuumParams pointer. > > The call flow is > ExecVacuum -> vacuum -> vacuum_rel > > The initial VaccumParams pointer is set in ExecVacuum > In vacuum_rel, this pointer might change because it needs to determine > whether to truncate and perform index_cleanup. Nice find! My first reaction is to wonder whether we should 1) also make a similar change to vacuum() for some future-proofing or 2) just teach vacuum_rel() to make a local copy of the parameters that it can scribble on. In the latter case, we might want to assert that the parameters don't change after calls to vacuum() and vacuum_rel() to prevent this problem from recurring. That leads me to think (1) might be the better option, although I'm not too wild about the subtlety of the fix. -- nathan