pg.ddx.io pgsql-committers@postgresql.org mailing list archive
help / color / mirror / Atom feedpgsql: Add general purpose hasing functions to pgbench.
5+ messages / 4 participants
[nested] [flat]
* pgsql: Add general purpose hasing functions to pgbench.
@ 2018-03-21 15:01 Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 15:32 ` Re: pgsql: Add general purpose hasing functions to pgbench. Tom Lane <tgl@sss.pgh.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Teodor Sigaev @ 2018-03-21 15:01 UTC (permalink / raw)
To: pgsql-committers@lists.postgresql.org
Add general purpose hasing functions to pgbench.
Hashing function is useful for simulating real-world workload in test like
WEB workload, as an example - YCSB benchmarks.
Author: Ildar Musin with minor editorization by me
Reviewed by: Fabien Coelho, me
Discussion: https://www.postgresql.org/message-id/flat/0e8bd39e-dfcd-2879-f88f-272799ad7ef2@postgrespro.ru
Branch
------
master
Details
-------
https://git.postgresql.org/pg/commitdiff/e51a04840a1c45db101686bef0b7025d5014c74b
Modified Files
--------------
doc/src/sgml/ref/pgbench.sgml | 59 ++++++++++++++--
src/bin/pgbench/exprparse.y | 98 +++++++++++++++++++-------
src/bin/pgbench/pgbench.c | 101 +++++++++++++++++++++++++--
src/bin/pgbench/pgbench.h | 4 +-
src/bin/pgbench/t/001_pgbench_with_server.pl | 11 +++
5 files changed, 239 insertions(+), 34 deletions(-)
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Add general purpose hasing functions to pgbench.
2018-03-21 15:01 pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
@ 2018-03-22 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-22 16:16 ` Re: pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
0 siblings, 1 reply; 5+ messages in thread
From: Tom Lane @ 2018-03-22 15:32 UTC (permalink / raw)
To: Teodor Sigaev <teodor@sigaev.ru>; +Cc: pgsql-committers@lists.postgresql.org, Fabien COELHO <coelho@cri.ensmp.fr>
Teodor Sigaev <teodor@sigaev.ru> writes:
> Add general purpose hasing functions to pgbench.
The 32-bit members of the buildfarm aren't very happy with this,
eg on dromedary:
cache gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -g -O2 -ansi -I. -I. -I../../../src/interfaces/libpq -I../../../src/include -DCOPY_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -c -o command.o command.c
pgbench.c: In function 'getHashFnv1a':
pgbench.c:945: warning: integer constant is too large for 'long' type
pgbench.c:952: warning: integer constant is too large for 'long' type
pgbench.c: In function 'getHashMurmur2':
pgbench.c:967: warning: integer constant is too large for 'long' type
pgbench.c:970: warning: integer constant is too large for 'long' type
pgbench.c:972: warning: integer constant is too large for 'long' type
pgbench.c:975: warning: integer constant is too large for 'long' type
pgbench.c:978: warning: integer constant is too large for 'long' type
Looks to me like the constants need to be written with INT64CONST().
Also, the fact that the added regression test is passing makes me
wonder whether it's actually exercising these functions meaningfully.
regards, tom lane
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Add general purpose hasing functions to pgbench.
2018-03-21 15:01 pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 15:32 ` Re: pgsql: Add general purpose hasing functions to pgbench. Tom Lane <tgl@sss.pgh.pa.us>
@ 2018-03-22 16:16 ` Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 16:31 ` Re: pgsql: Add general purpose hasing functions to pgbench. Fabien COELHO <coelho@cri.ensmp.fr>
0 siblings, 1 reply; 5+ messages in thread
From: Teodor Sigaev @ 2018-03-22 16:16 UTC (permalink / raw)
To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-committers@lists.postgresql.org, Ildar Musin <i.musin@postgrespro.ru>
will fix,
Tom Lane wrote:
> Teodor Sigaev <teodor@sigaev.ru> writes:
>> Add general purpose hasing functions to pgbench.
>
> The 32-bit members of the buildfarm aren't very happy with this,
> eg on dromedary:
>
> cache gcc -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -g -O2 -ansi -I. -I. -I../../../src/interfaces/libpq -I../../../src/include -DCOPY_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -c -o command.o command.c
> pgbench.c: In function 'getHashFnv1a':
> pgbench.c:945: warning: integer constant is too large for 'long' type
> pgbench.c:952: warning: integer constant is too large for 'long' type
> pgbench.c: In function 'getHashMurmur2':
> pgbench.c:967: warning: integer constant is too large for 'long' type
> pgbench.c:970: warning: integer constant is too large for 'long' type
> pgbench.c:972: warning: integer constant is too large for 'long' type
> pgbench.c:975: warning: integer constant is too large for 'long' type
> pgbench.c:978: warning: integer constant is too large for 'long' type
>
> Looks to me like the constants need to be written with INT64CONST().
> Also, the fact that the added regression test is passing makes me
> wonder whether it's actually exercising these functions meaningfully.
>
> regards, tom lane
>
--
Teodor Sigaev E-mail: teodor@sigaev.ru
WWW: http://www.sigaev.ru/
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Add general purpose hasing functions to pgbench.
2018-03-21 15:01 pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 15:32 ` Re: pgsql: Add general purpose hasing functions to pgbench. Tom Lane <tgl@sss.pgh.pa.us>
2018-03-22 16:16 ` Re: pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
@ 2018-03-22 16:31 ` Fabien COELHO <coelho@cri.ensmp.fr>
2018-03-22 18:52 ` Re: pgsql: Add general purpose hasing functions to pgbench. Ildar Musin <i.musin@postgrespro.ru>
0 siblings, 1 reply; 5+ messages in thread
From: Fabien COELHO @ 2018-03-22 16:31 UTC (permalink / raw)
To: Teodor Sigaev <teodor@sigaev.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers@lists.postgresql.org, Ildar Musin <i.musin@postgrespro.ru>
> will fix,
A blind attempt, if it helps.
>> The 32-bit members of the buildfarm aren't very happy with this,
>> eg on dromedary:
>>
>> cache gcc -Wall -Wmissing-prototypes -Wpointer-arith
>> -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute
>> -Wformat-security -fno-strict-aliasing -fwrapv -g -O2 -ansi -I. -I.
>> -I../../../src/interfaces/libpq -I../../../src/include
>> -DCOPY_PARSE_PLAN_TREES -DRAW_EXPRESSION_COVERAGE_TEST -c -o command.o
>> command.c
>> pgbench.c: In function 'getHashFnv1a':
>> pgbench.c:945: warning: integer constant is too large for 'long' type
>> pgbench.c:952: warning: integer constant is too large for 'long' type
>> pgbench.c: In function 'getHashMurmur2':
>> pgbench.c:967: warning: integer constant is too large for 'long' type
>> pgbench.c:970: warning: integer constant is too large for 'long' type
>> pgbench.c:972: warning: integer constant is too large for 'long' type
>> pgbench.c:975: warning: integer constant is too large for 'long' type
>> pgbench.c:978: warning: integer constant is too large for 'long' type
>>
>> Looks to me like the constants need to be written with INT64CONST().
>> Also, the fact that the added regression test is passing makes me
>> wonder whether it's actually exercising these functions meaningfully.
I think that there is at least some coverage
(https://coverage.postgresql.org/src/bin/pgbench/pgbench.c.gcov.html)
and the function results are also checked for some values in the perl
script output.
--
Fabien.
Attachments:
pgbench-hash-fix-1.patch (text/plain, 517B) download
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 894571e..5e88192 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -64,9 +64,9 @@
/*
* Hashing constants
*/
-#define FNV_PRIME 0x100000001b3
-#define FNV_OFFSET_BASIS 0xcbf29ce484222325
-#define MM2_MUL 0xc6a4a7935bd1e995
+#define FNV_PRIME INT64CONST(0x100000001b3)
+#define FNV_OFFSET_BASIS INT64CONST(0xcbf29ce484222325)
+#define MM2_MUL INT64CONST(0xc6a4a7935bd1e995)
#define MM2_ROT 47
/*
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: pgsql: Add general purpose hasing functions to pgbench.
2018-03-21 15:01 pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 15:32 ` Re: pgsql: Add general purpose hasing functions to pgbench. Tom Lane <tgl@sss.pgh.pa.us>
2018-03-22 16:16 ` Re: pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 16:31 ` Re: pgsql: Add general purpose hasing functions to pgbench. Fabien COELHO <coelho@cri.ensmp.fr>
@ 2018-03-22 18:52 ` Ildar Musin <i.musin@postgrespro.ru>
0 siblings, 0 replies; 5+ messages in thread
From: Ildar Musin @ 2018-03-22 18:52 UTC (permalink / raw)
To: Fabien COELHO <coelho@cri.ensmp.fr>; Teodor Sigaev <teodor@sigaev.ru>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-committers@lists.postgresql.org
Hello all,
22/03/2018 19:31, Fabien COELHO пишет:
>>>
>>> Looks to me like the constants need to be written with INT64CONST().
>>> Also, the fact that the added regression test is passing makes me
>>> wonder whether it's actually exercising these functions meaningfully.
>
> I think that there is at least some coverage
> (https://coverage.postgresql.org/src/bin/pgbench/pgbench.c.gcov.html)
> and the function results are also checked for some values in the perl
> script output.
>
As Fabien said output values for some particular inputs are checked in
tests. The fact that test passed apparently shows that compiler is smart
enough to recognize those constants as 'long long' and use them
accordingly in expressions.
--
Ildar Musin
Postgres Professional: http://www.postgrespro.com
Russian Postgres Company
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-03-22 18:52 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-03-21 15:01 pgsql: Add general purpose hasing functions to pgbench. Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 15:32 ` Tom Lane <tgl@sss.pgh.pa.us>
2018-03-22 16:16 ` Teodor Sigaev <teodor@sigaev.ru>
2018-03-22 16:31 ` Fabien COELHO <coelho@cri.ensmp.fr>
2018-03-22 18:52 ` Ildar Musin <i.musin@postgrespro.ru>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox