pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
pgsql: pgbench: Refactor thread portability support.
7+ messages / 3 participants
[nested] [flat]

* pgsql: pgbench: Refactor thread portability support.
@ 2021-03-10 04:52 Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 04:52 UTC (permalink / raw)
  To: pgsql-committers@lists.postgresql.org

pgbench: Refactor thread portability support.

Instead of maintaining an incomplete emulation of POSIX threads for
Windows, let's use an extremely minimalist macro-based abstraction for
now.  A later patch will extend this, without the need to supply more
complicated pthread emulation code.  (There may be a need for a more
serious portable thread abstraction in later projects, but this is not
it.)

Minor incidental problems fixed: it wasn't OK to use (pthread_t) 0 as a
special value, it wasn't OK to compare thread_t values with ==, and we
incorrectly assumed that pthread functions set errno.

Discussion: https://postgr.es/m/20200227180100.zyvjwzcpiokfsqm2%40alap3.anarazel.de

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/b1d6a8f86813772b9198367a34c8ff8bff7fef9e

Modified Files
--------------
src/bin/pgbench/pgbench.c | 126 ++++++++++++----------------------------------
1 file changed, 31 insertions(+), 95 deletions(-)



^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
@ 2021-03-10 07:10 ` Michael Paquier <michael@paquier.xyz>
  2021-03-10 07:14   ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Michael Paquier @ 2021-03-10 07:10 UTC (permalink / raw)
  To: Thomas Munro <tmunro@postgresql.org>; +Cc: pgsql-committers@lists.postgresql.org

Hi Thomas,

On Wed, Mar 10, 2021 at 04:52:01AM +0000, Thomas Munro wrote:
> pgbench: Refactor thread portability support.
> 
> Instead of maintaining an incomplete emulation of POSIX threads for
> Windows, let's use an extremely minimalist macro-based abstraction for
> now.  A later patch will extend this, without the need to supply more
> complicated pthread emulation code.  (There may be a need for a more
> serious portable thread abstraction in later projects, but this is not
> it.)

This one is causing a failure in whelk:
https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=whelk&dt=2021-03-10%2006%3A41%3A53
src/bin/pgbench/pgbench.c(6154): warning C4024: '_beginthreadex' :
different types for formal and actual parameter 3 [C:\\buildfarm\\buildenv\\HEAD\\pgsql.build\\pgbench.vcxproj]
--
Michael

Attachments:

  signature.asc (application/pgp-signature, 832B) download

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
@ 2021-03-10 07:14   ` Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 07:51     ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 07:14 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Mar 10, 2021 at 8:10 PM Michael Paquier <michael@paquier.xyz> wrote:
> On Wed, Mar 10, 2021 at 04:52:01AM +0000, Thomas Munro wrote:
> > pgbench: Refactor thread portability support.
> >
> > Instead of maintaining an incomplete emulation of POSIX threads for
> > Windows, let's use an extremely minimalist macro-based abstraction for
> > now.  A later patch will extend this, without the need to supply more
> > complicated pthread emulation code.  (There may be a need for a more
> > serious portable thread abstraction in later projects, but this is not
> > it.)
>
> This one is causing a failure in whelk:
> https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=whelk&dt=2021-03-10%2006%3A41%3A53
> src/bin/pgbench/pgbench.c(6154): warning C4024: '_beginthreadex' :
> different types for formal and actual parameter 3 [C:\\buildfarm\\buildenv\\HEAD\\pgsql.build\\pgbench.vcxproj]

Thanks, looking at this and the others.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
  2021-03-10 07:14   ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
@ 2021-03-10 07:51     ` Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 08:38       ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 07:51 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Mar 10, 2021 at 8:14 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Mar 10, 2021 at 8:10 PM Michael Paquier <michael@paquier.xyz> wrote:
> > On Wed, Mar 10, 2021 at 04:52:01AM +0000, Thomas Munro wrote:
> > > pgbench: Refactor thread portability support.
> > >
> > > Instead of maintaining an incomplete emulation of POSIX threads for
> > > Windows, let's use an extremely minimalist macro-based abstraction for
> > > now.  A later patch will extend this, without the need to supply more
> > > complicated pthread emulation code.  (There may be a need for a more
> > > serious portable thread abstraction in later projects, but this is not
> > > it.)
> >
> > This one is causing a failure in whelk:
> > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=whelk&dt=2021-03-10%2006%3A41%3A53
> > src/bin/pgbench/pgbench.c(6154): warning C4024: '_beginthreadex' :
> > different types for formal and actual parameter 3 [C:\\buildfarm\\buildenv\\HEAD\\pgsql.build\\pgbench.vcxproj]
>
> Thanks, looking at this and the others.

whelk is complaining about a missing __stdcall (not clear why various
other Windows systems in CI, real life and the BF didn't mind, but I
have an attempt at a fix ready to push soon).  lapwing is just a silly
%ld where INT64_FORMAT was wanted, repro'd and fixed here in a -m32
build.  I'm now contemplating what's up with hoverfly (some AIX header
problem)...





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
  2021-03-10 07:14   ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 07:51     ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
@ 2021-03-10 08:38       ` Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 08:49         ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 08:38 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Mar 10, 2021 at 8:51 PM Thomas Munro <thomas.munro@gmail.com> wrote:
>...  I'm now contemplating what's up with hoverfly (some AIX header
> problem)...

Pushed something for the other two failures seen, but for this one I'm
temporarily stumped.  We managed to compile all kinds of stuff that
surely includes the modified header, and then we get to plpython and
we show an error that implies that HAVE_CLOCK_GETTIME is defined and
that we included <time.h>, and yet the compiler has never heard of
clock_gettime().  It's like someone clobbered someone's include
guards, or something of that level of murkiness.  Thinking.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
  2021-03-10 07:14   ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 07:51     ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 08:38       ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
@ 2021-03-10 08:49         ` Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 10:21           ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 08:49 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Mar 10, 2021 at 9:38 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Mar 10, 2021 at 8:51 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> >...  I'm now contemplating what's up with hoverfly (some AIX header
> > problem)...
>
> Pushed something for the other two failures seen, but for this one I'm
> temporarily stumped.  We managed to compile all kinds of stuff that
> surely includes the modified header, and then we get to plpython and
> we show an error that implies that HAVE_CLOCK_GETTIME is defined and
> that we included <time.h>, and yet the compiler has never heard of
> clock_gettime().  It's like someone clobbered someone's include
> guards, or something of that level of murkiness.  Thinking.

Hrrmph.  src/pl/plpython/plpython.h's use of #undef _POSIX_C_SOURCE
looks a bit suspicious.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: pgsql: pgbench: Refactor thread portability support.
  2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
  2021-03-10 07:10 ` Re: pgsql: pgbench: Refactor thread portability support. Michael Paquier <michael@paquier.xyz>
  2021-03-10 07:14   ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 07:51     ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 08:38       ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
  2021-03-10 08:49         ` Re: pgsql: pgbench: Refactor thread portability support. Thomas Munro <thomas.munro@gmail.com>
@ 2021-03-10 10:21           ` Thomas Munro <thomas.munro@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Thomas Munro @ 2021-03-10 10:21 UTC (permalink / raw)
  To: Michael Paquier <michael@paquier.xyz>; +Cc: Thomas Munro <tmunro@postgresql.org>; pgsql-committers <pgsql-committers@lists.postgresql.org>

On Wed, Mar 10, 2021 at 9:49 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> On Wed, Mar 10, 2021 at 9:38 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> > On Wed, Mar 10, 2021 at 8:51 PM Thomas Munro <thomas.munro@gmail.com> wrote:
> > >...  I'm now contemplating what's up with hoverfly (some AIX header
> > > problem)...
> >
> > Pushed something for the other two failures seen, but for this one I'm
> > temporarily stumped.  We managed to compile all kinds of stuff that
> > surely includes the modified header, and then we get to plpython and
> > we show an error that implies that HAVE_CLOCK_GETTIME is defined and
> > that we included <time.h>, and yet the compiler has never heard of
> > clock_gettime().  It's like someone clobbered someone's include
> > guards, or something of that level of murkiness.  Thinking.
>
> Hrrmph.  src/pl/plpython/plpython.h's use of #undef _POSIX_C_SOURCE
> looks a bit suspicious.

Fix pushed.





^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2021-03-10 10:21 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-10 04:52 pgsql: pgbench: Refactor thread portability support. Thomas Munro <tmunro@postgresql.org>
2021-03-10 07:10 ` Michael Paquier <michael@paquier.xyz>
2021-03-10 07:14   ` Thomas Munro <thomas.munro@gmail.com>
2021-03-10 07:51     ` Thomas Munro <thomas.munro@gmail.com>
2021-03-10 08:38       ` Thomas Munro <thomas.munro@gmail.com>
2021-03-10 08:49         ` Thomas Munro <thomas.munro@gmail.com>
2021-03-10 10:21           ` Thomas Munro <thomas.munro@gmail.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox