From: | Thomas Munro <thomas(dot)munro(at)gmail(dot)com> |
---|---|
To: | Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> |
Cc: | Marina Polyakova <m(dot)polyakova(at)postgrespro(dot)ru>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, kuroda(dot)hayato(at)fujitsu(dot)com |
Subject: | Re: pgbench: option delaying queries till connections establishment? |
Date: | 2021-01-17 21:54:38 |
Message-ID: | CA+hUKGJgFZmchtseDs7B9ptxWU_aHZr2KU4dprga_Rbg-TSmnw@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jan 9, 2021 at 8:13 AM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> On Sun, Jan 3, 2021 at 9:49 AM Fabien COELHO <coelho(at)cri(dot)ensmp(dot)fr> wrote:
> > > Just for fun, the attached 0002 patch is a quick prototype of a
> > > replacement for that stuff that seems to work OK on a Mac here. (I'm
> > > not sure if the Windows part makes sense or works.)
> >
> > Thanks! That will definitely help because I do not have a Mac. I'll do
> > some cleanup.
>
> I think the main things to clean up are:
I’m supposed to be on vacation this week, but someone left a shiny new
Arm Mac laptop near me, so here’s a cleaned up version.
> 1. pthread_barrier_init() should check for errors from
> pthread_cond_init() and pthread_mutex_init(), and return -1.
Done.
> 2. pthread_barrier_destroy() should call pthread_cond_destroy() and
> pthread_mutex_destroy().
Done.
> 3 . Decide if it's sane for the Windows-based emulation to be in here
> too, or if it should stay in pgbench.c. Or alternatively, if we're
> emulating pthread stuff on Windows, why not also put the other pthread
> emulation stuff from pgbench.c into a "ports" file; that seems
> premature and overkill for your project. I dunno.
I decided to solve only the macOS problem for now. So in this
version, the A and B patches are exactly as you had them in your v7,
except that B includes “port/pg_pthread.h” instead of <pthread.h>.
Maybe it’d make sense to move the Win32 pthread emulation stuff out of
pgbench.c into src/port too (the pre-existing stuff, and the new
barrier stuff you added), but that seems like a separate patch, one
that I’m not best placed to write, and it’s not clear to me that we’ll
want to be using pthread APIs as our main abstraction if/when thread
usage increases in the PG source tree anyway. Other opinions welcome.
> 4. cfbot shows that it's not building on Windows because
> HAVE_PTHREAD_BARRIER_WAIT is missing from Solution.pm.
Fixed, I think.
Attachment | Content-Type | Size |
---|---|---|
v8-0001-A.patch | application/octet-stream | 33.2 KB |
v8-0002-Add-missing-pthread_barrier_t.patch | application/octet-stream | 7.8 KB |
v8-0003-B.patch | application/octet-stream | 4.8 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Justin Pryzby | 2021-01-17 21:59:40 | pg_collation_actual_version() ERROR: cache lookup failed for collation 123 |
Previous Message | Tomas Vondra | 2021-01-17 21:32:49 | Re: COPY FREEZE and setting PD_ALL_VISIBLE/visibility map bits |