Re: pgbench stats per script & other stuff

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgbench stats per script & other stuff
Date: 2016-02-01 16:46:45
Message-ID: alpine.DEB.2.10.1602011704430.13459@sto
Views: Raw Message | Whole Thread | Download mbox
Thread:
Lists: pgsql-hackers


Hello Michaël,

Two rebase attached.

>> - 15-e: prefix selection for -b

> - if (strncmp(builtin_script[i].name, name,
> - strlen(builtin_script[i].name)) == 0)
> + if (strncmp(builtin_script[i].name, name, len) == 0)
>
> I agree with Alvaro here: this should remain unchanged. It seems to be
> a rebase mistake.

I do not understand. I tested it and it works as expected. If I put the
above strlen instead the suffix detection does not work:

fabien(at)sto:bin/pgbench> git diff
diff --git a/src/bin/pgbench/pgbench.c b/src/bin/pgbench/pgbench.c
index 783cbf9..0c33012 100644
--- a/src/bin/pgbench/pgbench.c
+++ b/src/bin/pgbench/pgbench.c
@@ -2684,7 +2684,7 @@ findBuiltin(const char *name, char **desc)

for (i = 0; i < N_BUILTIN; i++)
{
- if (strncmp(builtin_script[i].name, name, len) == 0)
+ if (strncmp(builtin_script[i].name, name, strlen(builtin_script[i].name)) == 0)
{
*desc = builtin_script[i].desc;
commands = builtin_script[i].commands;

./pgbench -b t
no builtin script found for name "t"
Available builtin scripts:
tpcb-like
simple-update
select-only

Indeed, then it can only match if the provided "name" is as long as the
recorded len. The point of the "suffix" selection is to align to the short
supplied string.

--
Fabien.

Attachment Content-Type Size
pgbench-script-stats-16-d.patch text/x-diff 8.2 KB
pgbench-script-stats-16-e-prefix.patch text/x-diff 1.9 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Artur Zakirov 2016-02-01 17:12:03 Re: Fuzzy substring searching with the pg_trgm extension
Previous Message Pavel Stehule 2016-02-01 16:37:35 Re: proposal: PL/Pythonu - function ereport