Re: Refactoring pgbench.c

From: Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Refactoring pgbench.c
Date: 2015-06-28 12:44:05
Message-ID: 558FEC15.90209@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

On 06/28/2015 08:10 AM, Fabien COELHO wrote:
>
> Hello Tatsuo,
>
>> Main pgbench logic consists of single file pgbench.c which is 4036
>> lines of code as of today. This is not a small number and I think
>> it would be nice if it is divided into smaller files because it
>> will make it easier to maintain, add or change features of pgbench.
>
> I do not think that this large file is a so big a problem (good
> editors help navigation in the code), and I'm not sure that splitting
> it would achieve much: there are not that many functions, some of
> them are maybe long (main, threadRun, doCustom) but mostly for good
> reasons.

My thoughts, exactly. I don't think just splitting the file into
multiple pieces will achieve anything - the problem is that we've
extended the original pgbench code in rather hackish way, without any
major design changes, so IMHO what should be done is refactoring ...

> I've submitted a patch to remove "fork-emulation", which I think
> would really help simplify the code (maybe -10% source in
> "pgbench.c", less #ifs, avoid double implementations or
> more-complex-than-necessary implementations or not-implemented
> features).

... and cleanup of dead code.

--
Tomas Vondra http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2015-06-28 12:50:11 Re: proposal: condition blocks in psql
Previous Message Tomas Vondra 2015-06-28 12:39:49 Re: proposal: condition blocks in psql