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 1piFmr-0003hs-Sg for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Mar 2023 14:31:29 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1piFmq-0004Qx-IW for pgsql-hackers@arkaria.postgresql.org; Fri, 31 Mar 2023 14:31:28 +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 1piFmq-0004QW-32 for pgsql-hackers@lists.postgresql.org; Fri, 31 Mar 2023 14:31:28 +0000 Received: from mail-pj1-x1033.google.com ([2607:f8b0:4864:20::1033]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1piFmk-0001Ag-Sz for pgsql-hackers@postgresql.org; Fri, 31 Mar 2023 14:31:26 +0000 Received: by mail-pj1-x1033.google.com with SMTP id x15so20591498pjk.2 for ; Fri, 31 Mar 2023 07:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1680273082; x=1682865082; 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=AAHyzmlCXF+X82ik7GKx+G8oqGlOYiI4qatzMPBhDh0=; b=Zyl+jPQPrRRL1CSsKMS1/ZHevJoXxby8L8v4YCgYOnUD2sEHD2ZThhgWjvK0/YnNZd axYLIh/aZ20BtkaLqyeoowVfDjxYeu68DWU0ZVd8Y45bNZzWVhOn5wsKL5hggm0DLEHa ICcWalIN+6JZKvWxyC4k4WCad3XhxwdsvSrp7nIU8gNFeLZgsUYokgdUnLLbUvsGgtH1 6IMEOUPi922iVdgW+bELrvwk+/FdpvgiOUGW8tGoBB2NlfvgKNfKxgQ5gb+NMifWOwMu z/gSJFvsbaolieHL59f6Cab2gLuf4Xx/W8FXT5DfXKsVvT67MdHJLfkO8tNFhAAU2XpN 4wNw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1680273082; x=1682865082; 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=AAHyzmlCXF+X82ik7GKx+G8oqGlOYiI4qatzMPBhDh0=; b=XQGiqlcwwfBOLQONmHju/Ebx6nhsrsQXbaahXsP2JKr0dI5Dm8B55plxWfqji+IaIl 7jZAVJJ85iw/bp7oQM6y69krCSgvuOHp6MPwW7omlWiadynV0/fSdNxYL6zYylQ9/xt7 PM+LHF3Hc7ATCYC9fjPOz5X8K2Q5GH3L9tmuxNHW38LqbiMmzI4Yzp3Jgb5HcRbM2LZ0 3r0onLPYLO5YK6SzYPfnN8wp/fjNMKAkmPe2E2gOOUSJsa+HfNIyJBO3QpNUxm07WqDH SetVA0YZMQZYD6niJsQQ7dWAImv8bOM+PZObCk2TZEka65t/if3/EfFjPE8xIuKagehM x1aQ== X-Gm-Message-State: AAQBX9fSEmUmbIHJpSGZwAUBPKkxW0GyP+naS8wnjLxqbkDaTxh+o8YS jjDEpZ+Ppp6xCSIMKREfo76D5nTWekkRoXXKrZU= X-Google-Smtp-Source: AKy350Zm2a3vzq0omMo7OdAMCdJxG8FrxtFjIZtJexIVaduGouKLU7AfDk9G1FhMEKNrKwaKOodApoJ5M4E9xkS3Wzw= X-Received: by 2002:a17:90a:bd93:b0:240:d452:195f with SMTP id z19-20020a17090abd9300b00240d452195fmr1567677pjr.4.1680273081499; Fri, 31 Mar 2023 07:31:21 -0700 (PDT) MIME-Version: 1.0 References: <20230329.120908.350115307125624430.horikyota.ntt@gmail.com> <20230329.132155.629765142788133576.horikyota.ntt@gmail.com> <20230329.173456.1185961934810139447.horikyota.ntt@gmail.com> <935191FB-083B-4060-89FC-466F61FAA391@yesql.se> In-Reply-To: <935191FB-083B-4060-89FC-466F61FAA391@yesql.se> From: Melanie Plageman Date: Fri, 31 Mar 2023 10:31:10 -0400 Message-ID: Subject: Re: Should vacuum process config file reload more often To: Daniel Gustafsson Cc: Masahiko Sawada , Kyotaro Horiguchi , PostgreSQL Hackers , Andres Freund , amit.kapila16@gmail.com 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 Thu, Mar 30, 2023 at 3:26=E2=80=AFPM Daniel Gustafsson = wrote: > > > On 30 Mar 2023, at 04:57, Masahiko Sawada wrote= : > > > As another idea, why don't we use macros for that? For example, > > suppose VacuumCostStatus is like: > > > > typedef enum VacuumCostStatus > > { > > VACUUM_COST_INACTIVE_LOCKED =3D 0, > > VACUUM_COST_INACTIVE, > > VACUUM_COST_ACTIVE, > > } VacuumCostStatus; > > VacuumCostStatus VacuumCost; > > > > non-vacuum code can use the following macros: > > > > #define VacuumCostActive() (VacuumCost =3D=3D VACUUM_COST_ACTIVE) > > #define VacuumCostInactive() (VacuumCost <=3D VACUUM_COST_INACTIVE) // > > or we can use !VacuumCostActive() instead. > > I'm in favor of something along these lines. A variable with a name that > implies a boolean value (active/inactive) but actually contains a tri-val= ue is > easily misunderstood. A VacuumCostState tri-value variable (or a better = name) > with a set of convenient macros for extracting the boolean active/inactiv= e that > most of the code needs to be concerned with would more for more readable = code I > think. The macros are very error-prone. I was just implementing this idea and mistakenly tried to set the macro instead of the variable in multiple places. Avoiding this involves another set of macros, and, in the end, I think the complexity is much worse. Given the reviewers' uniform dislike of VacuumCostInactive, I favor going back to two variables (VacuumCostActive + VacuumFailsafeActive) and moving LVRelState->failsafe_active to the global VacuumFailsafeActive. I will reimplement this in the next version. On the subject of globals, the next version will implement Horiguchi-san's proposal to separate GUC variables from the globals used in the code (quoted below). It should hopefully reduce the complexity of this patchset. > Although it's somewhat unrelated to the goal of this patch, I think we > should clean up the code tidy before proceeding. Shouldn't we separate > the actual parameters from the GUC base variables, and sort out the > all related variaghble? (something like the attached, on top of your > patch.) - Melanie