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 1uSd0E-00AidV-RC for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 14:46:02 +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 1uSd0C-002DKO-V4 for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jun 2025 14:46:01 +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 1uSd0C-002DJq-LD for pgsql-hackers@lists.postgresql.org; Fri, 20 Jun 2025 14:46:01 +0000 Received: from mail-ej1-x630.google.com ([2a00:1450:4864:20::630]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1uSd09-0034XA-0a for pgsql-hackers@postgresql.org; Fri, 20 Jun 2025 14:46:00 +0000 Received: by mail-ej1-x630.google.com with SMTP id a640c23a62f3a-adb2e9fd208so388645766b.3 for ; Fri, 20 Jun 2025 07:45:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1750430756; x=1751035556; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=Ivj+U0ByaTvu2B0fYMspCFzXh5aXOSoi7nov8k7Jz6w=; b=mXUghn2X0W99sxJn/OZA5V9ha317flArwKEf5aV3A8PlzuJz437cVvMrBIW4mD/lzF qQIfXdSCWTkkRPiJBkZfHuxdedb6SEGYKgYtUEFItTPqTYjbc3ttErJVsOABDuiJiXml cd3/8rF0kfTUVCAKxcOm/EjuaoRhnfCb8uf6MD4q+oZm0uISOrsvLz3wnmpcVH0BYsKv bdxI/D1zk++ss1nMLr+FOkYSQutvdCbcMZ9jlqnyN7GHKFyCUnLDh/2ME9MQRxZTZIKO VqOwEn+2nrUisyANPp7H8vZNAraWEULRSlicU3vcKKfFTfjOxMledbfUz7lQUWKAoKCh gkiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1750430756; x=1751035556; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=Ivj+U0ByaTvu2B0fYMspCFzXh5aXOSoi7nov8k7Jz6w=; b=KS0zDUkvL/xc7zt1pIwoPbyt2b5NEMItLjgPrTwHWnjUCuYEQHBdpnBKvgNwp7HeLb 211n9K9o0qPrEeGiamDaiVabprGKT5Tt8DY4/nxhXbiwWwMIpSKG9p61qX0rC6Qivjn9 DB5AGk5akrBfSbJ921UJBNe//7D4CTr2Si3OpbUUfwta727zHk+MO0uuPM2IcpvaS0cq fDUZiu5kd2EXbFuhpF9T4ZtSCg7g2C3AXMIwmeLEpPTswtOXuF733InepQieQ7RsJKo7 7TTdX5BTN9ZgqFaK6rckw3GqQLtK1tRAypyO45hocwhSYAMF4STM5nd7vfCoQ8BDK+93 ka0A== X-Forwarded-Encrypted: i=1; AJvYcCXdKWRMsQmt2RSF28DA0QOM4XerJCHV463h35dz9ACz6C9vbcmZHHzb7d5pp+yhMkKEr+EHQh4f0Igm3V4Y@postgresql.org X-Gm-Message-State: AOJu0YwUsjx/cd+qUjZX/3PZPKgwYnqLc/nDhG4H+Tns84Ov/ggXflfO EaNNoenKYpj1Ha3bT8x1L0bz0RrB6F2c/lO+sPUaRWrVJEAWJoldJOh/qKRczch9TmgnZEJo9c/ GUbrGywv6KGvivvC1ySgwT5FljP+vr4A= X-Gm-Gg: ASbGnctGyPMQOtHnq0eTdqRyuVOFPlKgFsX9tb5WhUUYa+4ZSpJMGlbRPCFSfC6Y2VX wKEUw0Jkefa+h/Rf99en6fs/8QWc6mMuiirK/F2ZNp4g+aB+Gjg7nuOJXPItqxd4GNiFjmQbAKO iMjzYwVe9eW6YHlAgVAH3TgCfl6GZuwDcu37gE7ZTlERIn X-Google-Smtp-Source: AGHT+IH3UAJTAojPM6bIliuQtcg1KNrig0/U14fWKkkGJ2ijF15oQcSoqWJMPvl+1kX377+zo6TpZgHvZpW+MMSfy8Y= X-Received: by 2002:a17:906:6a09:b0:ae0:4820:2452 with SMTP id a640c23a62f3a-ae057acb7e0mr298317266b.33.1750430755531; Fri, 20 Jun 2025 07:45:55 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Junwang Zhao Date: Fri, 20 Jun 2025 22:45:44 +0800 X-Gm-Features: Ac12FXzaUXs4dDiAw5SWDHKPSX5b89QGfCLIK9tYLXJk5QqnOXnIhV3V5-LXJDI Message-ID: Subject: Re: Fixes inconsistent behavior in vacuum when it processes multiple relations To: shihao zhong Cc: Michael Paquier , Nathan Bossart , PostgreSQL-development Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jun 20, 2025 at 10:14=E2=80=AFPM shihao zhong wrote: > > >> However, Option 1) would be my go-to option for HEAD ... > > Updated my patch to apply the same rules to all VacuumParams. Also I > am seeing clusterParams as a pass reference, not sure if we should > also change that to prevent future issues. But that should be another > patch. static inline void -table_relation_vacuum(Relation rel, struct VacuumParams *params, +table_relation_vacuum(Relation rel, struct VacuumParams params, BufferAccessStrategy bstrategy) { rel->rd_tableam->relation_vacuum(rel, params, bstrategy); diff --git a/src/include/commands/vacuum.h b/src/include/commands/vacuum.h index bc37a80dc74..9a8c63352da 100644 --- a/src/include/commands/vacuum.h +++ b/src/include/commands/vacuum.h @@ -336,7 +336,7 @@ extern PGDLLIMPORT int64 parallel_vacuum_worker_delay_n= s; /* in commands/vacuum.c */ extern void ExecVacuum(ParseState *pstate, VacuumStmt *vacstmt, bool isTopLevel); -extern void vacuum(List *relations, VacuumParams *params, +extern void vacuum(List *relations, VacuumParams params, BufferAccessStrategy bstrategy, MemoryContext vac_context, bool isTopLevel); extern void vac_open_indexes(Relation relation, LOCKMODE lockmode, @@ -357,7 +357,7 @@ extern void vac_update_relstats(Relation relation, bool *frozenxid_updated, bool *minmulti_updated, bool in_outer_xact); -extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams *params, +extern bool vacuum_get_cutoffs(Relation rel, const VacuumParams params, struct VacuumCutoffs *cutoffs); extern bool vacuum_xid_failsafe_check(const struct VacuumCutoffs *cutoffs)= ; extern void vac_update_datfrozenxid(void); @@ -398,7 +398,7 @@ extern void parallel_vacuum_main(dsm_segment *seg, shm_toc *toc); /* in commands/analyze.c */ extern void analyze_rel(Oid relid, RangeVar *relation, - VacuumParams *params, List *va_cols, bool in_outer_xact, + VacuumParams params, List *va_cols, bool in_outer_xact, It's a bit odd that we have both `VacuumParams *params` and `struct VacuumParams *params`. Perhaps you could remove the struct keyword in this patch to make it consistent. --=20 Regards Junwang Zhao