Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Started by Peter Eisentrautalmost 15 years ago9 messages
#1Peter Eisentraut
peter_e@gmx.net

We use small "k" in postgresql.conf, so pg_test_fsync should use the
same. Using "kB" would be more accurate in any case.

#2Bruce Momjian
bruce@momjian.us
In reply to: Peter Eisentraut (#1)
1 attachment(s)
Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Peter Eisentraut wrote:

We use small "k" in postgresql.conf, so pg_test_fsync should use the
same. Using "kB" would be more accurate in any case.

OK, done with the attached applied patch.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

Attachments:

/rtmp/fsync.difftext/x-diffDownload
diff --git a/contrib/pg_test_fsync/pg_test_fsync.c b/contrib/pg_test_fsync/pg_test_fsync.c
index 23800d6..d075483 100644
*** a/contrib/pg_test_fsync/pg_test_fsync.c
--- b/contrib/pg_test_fsync/pg_test_fsync.c
*************** test_sync(int writes_per_op)
*** 175,183 ****
  	bool		fs_warning = false;
  
  	if (writes_per_op == 1)
! 		printf("\nCompare file sync methods using one %dK write:\n", XLOG_BLCKSZ_K);
  	else
! 		printf("\nCompare file sync methods using two %dK writes:\n", XLOG_BLCKSZ_K);
  	printf("(in wal_sync_method preference order, except fdatasync\n");
  	printf("is Linux's default)\n");
  
--- 175,183 ----
  	bool		fs_warning = false;
  
  	if (writes_per_op == 1)
! 		printf("\nCompare file sync methods using one %dkB write:\n", XLOG_BLCKSZ_K);
  	else
! 		printf("\nCompare file sync methods using two %dkB writes:\n", XLOG_BLCKSZ_K);
  	printf("(in wal_sync_method preference order, except fdatasync\n");
  	printf("is Linux's default)\n");
  
*************** static void
*** 391,404 ****
  test_open_syncs(void)
  {
  	printf("\nCompare open_sync with different write sizes:\n");
! 	printf("(This is designed to compare the cost of writing 16K\n");
  	printf("in different write open_sync sizes.)\n");
  
! 	test_open_sync("16K open_sync write", 16);
! 	test_open_sync(" 8K open_sync writes", 8);
! 	test_open_sync(" 4K open_sync writes", 4);
! 	test_open_sync(" 2K open_sync writes", 2);
! 	test_open_sync(" 1K open_sync writes", 1);
  }
  
  /*
--- 391,404 ----
  test_open_syncs(void)
  {
  	printf("\nCompare open_sync with different write sizes:\n");
! 	printf("(This is designed to compare the cost of writing 16kB\n");
  	printf("in different write open_sync sizes.)\n");
  
! 	test_open_sync("16kB open_sync write", 16);
! 	test_open_sync(" 8kB open_sync writes", 8);
! 	test_open_sync(" 4kB open_sync writes", 4);
! 	test_open_sync(" 2kB open_sync writes", 2);
! 	test_open_sync(" 1kB open_sync writes", 1);
  }
  
  /*
*************** test_non_sync(void)
*** 517,523 ****
  	/*
  	 * Test a simple write without fsync
  	 */
! 	printf("\nNon-Sync'ed %dK writes:\n", XLOG_BLCKSZ_K);
  	printf(LABEL_FORMAT, "write");
  	fflush(stdout);
  
--- 517,523 ----
  	/*
  	 * Test a simple write without fsync
  	 */
! 	printf("\nNon-Sync'ed %dkB writes:\n", XLOG_BLCKSZ_K);
  	printf(LABEL_FORMAT, "write");
  	fflush(stdout);
  
#3Bruce Momjian
bruce@momjian.us
In reply to: Bruce Momjian (#2)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Bruce Momjian wrote:

Peter Eisentraut wrote:

We use small "k" in postgresql.conf, so pg_test_fsync should use the
same. Using "kB" would be more accurate in any case.

OK, done with the attached applied patch.

FYI, I had used 'k' because this page suggests that k is 1000 and K is
1024, at least by the JEDEC memory standards:

http://en.wikipedia.org/wiki/Kilo

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#4Nicolas Barbier
nicolas.barbier@gmail.com
In reply to: Bruce Momjian (#3)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

2011/1/27 Bruce Momjian <bruce@momjian.us>:

Bruce Momjian wrote:

Peter Eisentraut wrote:

We use small "k" in postgresql.conf, so pg_test_fsync should use the
same.  Using "kB" would be more accurate in any case.

OK, done with the attached applied patch.

FYI, I had used 'k' because this page suggests that k is 1000 and K is
1024, at least by the JEDEC memory standards:

       http://en.wikipedia.org/wiki/Kilo

I can't find any reference to that on this page? The following does indeed say:

<URL:http://en.wikipedia.org/wiki/JEDEC_memory_standards&gt;

<quote>
kilo (K): A multiplier equal to 1,024 [..] The specification notes
that these prefixes are included in the document only to reflect
common usage. It refers to the IEEE/ASTM SI 10-1997 standard as
stating, that "this practice frequently leads to confusion and is
deprecated".
</quote>

If you want to make the difference explicit, consider using "KiB"
(1024, note the extra "i") vs. "kB" (1000); although doing so is
probably not consistent with any other uses in PostgreSQL.

<URL:http://en.wikipedia.org/wiki/Kibibyte&gt;

<quote>
The unit symbol for the kibibyte is KiB. The unit was established by
the International Electrotechnical Commission (IEC) in 1999 and has
been accepted for use by all major standards organizations.
</quote>

Nicolas

#5Bruce Momjian
bruce@momjian.us
In reply to: Nicolas Barbier (#4)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Nicolas Barbier wrote:

2011/1/27 Bruce Momjian <bruce@momjian.us>:

Bruce Momjian wrote:

Peter Eisentraut wrote:

We use small "k" in postgresql.conf, so pg_test_fsync should use the
same. ?Using "kB" would be more accurate in any case.

OK, done with the attached applied patch.

FYI, I had used 'k' because this page suggests that k is 1000 and K is
1024, at least by the JEDEC memory standards:

? ? ? ?http://en.wikipedia.org/wiki/Kilo

I can't find any reference to that on this page? The following does indeed say:

Sorry, I posed the wrong URL; it should have been:

http://en.wikipedia.org/wiki/Bytes#Unit_symbol

You can see the chart on the right. However, I agree 'kB' is the best.

---------------------------------------------------------------------------

<URL:http://en.wikipedia.org/wiki/JEDEC_memory_standards&gt;

<quote>
kilo (K): A multiplier equal to 1,024 [..] The specification notes
that these prefixes are included in the document only to reflect
common usage. It refers to the IEEE/ASTM SI 10-1997 standard as
stating, that "this practice frequently leads to confusion and is
deprecated".
</quote>

If you want to make the difference explicit, consider using "KiB"
(1024, note the extra "i") vs. "kB" (1000); although doing so is
probably not consistent with any other uses in PostgreSQL.

<URL:http://en.wikipedia.org/wiki/Kibibyte&gt;

<quote>
The unit symbol for the kibibyte is KiB. The unit was established by
the International Electrotechnical Commission (IEC) in 1999 and has
been accepted for use by all major standards organizations.
</quote>

Nicolas

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#6Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Bruce Momjian (#5)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Bruce Momjian <bruce@momjian.us> wrote:

http://en.wikipedia.org/wiki/Bytes#Unit_symbol

You can see the chart on the right.

According to which, the JEDEC standard requires KB and the IEC
standard requires KiB. What standard led us to use kB instead? It
seems to generally mean 1000 instead of 1024.

However, I agree 'kB' is the best.

Why?

-Kevin

#7Bruce Momjian
bruce@momjian.us
In reply to: Kevin Grittner (#6)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Kevin Grittner wrote:

Bruce Momjian <bruce@momjian.us> wrote:

http://en.wikipedia.org/wiki/Bytes#Unit_symbol

You can see the chart on the right.

According to which, the JEDEC standard requires KB and the IEC
standard requires KiB. What standard led us to use kB instead? It
seems to generally mean 1000 instead of 1024.

I assume Peter did lots of research when he added 'kB' to
postgresql.conf.

However, I agree 'kB' is the best.

Why?

No idea.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +

#8Alvaro Herrera
alvherre@commandprompt.com
In reply to: Kevin Grittner (#6)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Excerpts from Kevin Grittner's message of jue ene 27 13:22:12 -0300 2011:

Bruce Momjian <bruce@momjian.us> wrote:

http://en.wikipedia.org/wiki/Bytes#Unit_symbol

You can see the chart on the right.

According to which, the JEDEC standard requires KB and the IEC
standard requires KiB. What standard led us to use kB instead? It
seems to generally mean 1000 instead of 1024.

http://en.wikipedia.org/wiki/International_System_of_Units#Writing_unit_symbols_and_the_values_of_quantities

--
Álvaro Herrera <alvherre@commandprompt.com>
The PostgreSQL Company - Command Prompt, Inc.
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

#9Kevin Grittner
Kevin.Grittner@wicourts.gov
In reply to: Alvaro Herrera (#8)
Re: Re: In pg_test_fsync, use K(1024) rather than k(1000) for write size units.

Alvaro Herrera <alvherre@commandprompt.com> wrote:

Excerpts from Kevin Grittner's message of jue ene 27 13:22:12

-0300 2011:

Bruce Momjian <bruce@momjian.us> wrote:

http://en.wikipedia.org/wiki/Bytes#Unit_symbol

You can see the chart on the right.

According to which, the JEDEC standard requires KB and the IEC
standard requires KiB. What standard led us to use kB instead?
It seems to generally mean 1000 instead of 1024.

http://en.wikipedia.org/wiki/International_System_of_Units#Writing_unit_symbols_and_the_values_of_quantities

That seems to agree with the other page that k means 10^3, not 2^10
-- or am I missing something? We are treating it as 2^10 in our
GUCs, aren't we?

-Kevin