Re: fix typo in guc.c - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: fix typo in guc.c
Date
Msg-id 54C63BDB.6090201@vmware.com
Whole thread Raw
In response to fix typo in guc.c  (Sawada Masahiko <sawada.mshk@gmail.com>)
Responses Re: fix typo in guc.c
List pgsql-hackers
On 01/26/2015 02:56 PM, Sawada Masahiko wrote:
> Hi,
>
> Attached patch fixes the typo in guc.c.
> It's typo, I think.
>
> diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
> index f6df077..f4f1965 100644
> --- a/src/backend/utils/misc/guc.c
> +++ b/src/backend/utils/misc/guc.c
> @@ -3880,7 +3880,7 @@ build_guc_variables(void)
>       }
>
>       /*
> -     * Create table with 20% slack
> +     * Create table with 25% slack
>        */
>       size_vars = num_vars + num_vars / 4;

No, I think that's intentional. After the creation, indeed 20% of the 
table is empty. For example, if num_vars is 100, size_vars is 125. And 
100/125 = 0.80.

In add_guc_variable, where the table is enlarged, it says:

>         /*
>          * Increase the vector by 25%
>          */
>         int            size_vars = size_guc_variables + size_guc_variables / 4;

That's correct too. The table is enlarged by 25%, so after the 
operation, 20% of it is again free. Subtle ;-)

(Although I don't think "increase" is the correct term here. Should be 
"enlarge", or "increase the *size* of the vector by 25%".)

- Heikki




pgsql-hackers by date:

Previous
From: Marko Tiikkaja
Date:
Subject: Re: PL/pgSQL, RAISE and error context
Next
From: Sawada Masahiko
Date:
Subject: Re: fix typo in guc.c