fix typo in guc.c

Started by Sawada Masahikoalmost 11 years ago3 messages
#1Sawada Masahiko
sawada.mshk@gmail.com
1 attachment(s)

Hi,

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

Regards,

-------
Sawada Masahiko

Attachments:

fix_typo_guc_c.patchapplication/octet-stream; name=fix_typo_guc_c.patchDownload
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;
 
#2Heikki Linnakangas
hlinnakangas@vmware.com
In reply to: Sawada Masahiko (#1)
Re: fix typo in guc.c

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Sawada Masahiko
sawada.mshk@gmail.com
In reply to: Heikki Linnakangas (#2)
Re: fix typo in guc.c

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers