Re: PATCH: pgbench - merging transaction logs

From: Andres Freund <andres(at)2ndquadrant(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: PATCH: pgbench - merging transaction logs
Date: 2015-03-21 10:04:22
Message-ID: 20150321100422.GB3075@awork2.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2015-03-17 11:50:28 -0400, Robert Haas wrote:
> On Tue, Mar 17, 2015 at 11:27 AM, Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> > The fprintf we are talking about occurs at most once per pgbench
> > transaction, possibly much less when aggregation is activated, and this
> > transaction involves networks exchanges and possibly disk writes on the
> > server.
>
> random() was occurring four times per transaction rather than once,
> but OTOH I think fprintf() is probably a much heavier-weight
> operation. The way to know if there's a real problem here is to test
> it, but I'd be pretty surprised if there isn't.

Well, fprintf() doesn't have to acquire the lock for the entirety of
it's operation - just for the access to the stream buffer.

Note that posix 2001 *does* guarantee that FILE* style IO is thread
safe:
"All functions that reference (FILE *) objects, except those with names
ending in _unlocked, shall behave as if they use flockfile() and
funlockfile() internally to obtain ownership of these (FILE *) objects."

Hilariously that tidbit hidden in the documentation about
flockfile. Very, err, easy to find:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/flockfile.html

But I agree that we simply need to test this on a larger machine.

Greetings,

Andres Freund

--
Andres Freund http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2015-03-21 11:13:00 Re: GIN code managing entry insertion not able to differentiate fresh and old indexes
Previous Message Andres Freund 2015-03-21 09:50:06 Re: PATCH: pgbench - merging transaction logs