Обсуждение: fix typo in guc.c

Поиск
Список
Период
Сортировка

fix typo in guc.c

От
Sawada Masahiko
Дата:
Hi,

Attached patch fixes the typo in guc.c.
It's typo, I think.

Regards,

-------
Sawada Masahiko

Вложения

Re: fix typo in guc.c

От
Heikki Linnakangas
Дата:
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




Re: fix typo in guc.c

От
Sawada Masahiko
Дата:
On Mon, Jan 26, 2015 at 10:06 PM, Heikki Linnakangas
<hlinnakangas@vmware.com> wrote:
> 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%".)
>

Oh I see. Thank you for explain!
I think so too, 'enlarged' should be used in here.

Regards,

-------
Sawada Masahiko