Re: pgbench - refactor init functions with buffers

From: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>
To: Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>
Cc: Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgbench - refactor init functions with buffers
Date: 2019-10-24 06:33:06
Message-ID: alpine.DEB.2.21.1910240817210.32142@lancre
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Hello Jeevan,

> +static void
> +executeStatementExpect(PGconn *con, const char *sql, const ExecStatusType
> expected, bool errorOK)
> +{
>
> I think some instances like this need 80 column alignment?

Yep. Applying the pgindent is kind-of a pain, so I tend to do a reasonable
job by hand and rely on the next global pgindent to fix such things. I
shorten the line anyway.

> + resetPQExpBuffer(&query);
> + appendPQExpBufferStr(&query, DDLINDEXes[i]);
>
> I think you can simply use printfPQExpBuffer() for the first append,
> similar to what you have used in createPartitions(), which is a
> combination of both reset and append.

It could, but it would mean switching to using a format which is not very
useful here as it uses the simpler append*Str variant.

While looking at it, I noticed the repeated tablespace addition just
afterwards, so I factored it out as well in a function.

Attached v3 shorten some lines and adds "append_tablespace".

--
Fabien.

Attachment Content-Type Size
pgbench-buffer-3.patch text/x-diff 11.4 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dilip Kumar 2019-10-24 08:27:45 Re: Fix of fake unlogged LSN initialization
Previous Message Dilip Kumar 2019-10-24 06:21:45 Re: [HACKERS] Block level parallel vacuum