Re: PATCH: pgbench - merging transaction logs - Mailing list pgsql-hackers

From Fabien COELHO
Subject Re: PATCH: pgbench - merging transaction logs
Date
Msg-id alpine.DEB.2.10.1503212044330.14445@sto
Whole thread Raw
In response to Re: PATCH: pgbench - merging transaction logs  (Andres Freund <andres@2ndquadrant.com>)
List pgsql-hackers
> Well, fprintf() doesn't have to acquire the lock for the entirety of
> it's operation - just for the access to the stream buffer.

Yep. If it is implemented by appending stuff to the stream as the format 
is processed, this would still mean the whole time of its operation.

Hence preprocessing the string as you suggested may be desirable.

> 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

Thanks for the pointer!

-- 
Fabien.



pgsql-hackers by date:

Previous
From: "Joshua D. Drake"
Date:
Subject: Re: Remove fsync ON/OFF as a visible option?
Next
From: Gavin Flower
Date:
Subject: Re: Remove fsync ON/OFF as a visible option?