Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lL29Q-00021p-A6 for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Mar 2021 11:09:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lL29P-0001GK-3Y for pgsql-hackers@arkaria.postgresql.org; Sat, 13 Mar 2021 11:09:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lL29O-0001ED-SR for pgsql-hackers@lists.postgresql.org; Sat, 13 Mar 2021 11:09:42 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lL29M-0005M3-GF for pgsql-hackers@postgresql.org; Sat, 13 Mar 2021 11:09:42 +0000 Received: from pseudo (185.141.6.84.rev.sfr.net [84.6.141.185]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 2BDE4C0290; Sat, 13 Mar 2021 12:11:02 +0100 (CET) Date: Sat, 13 Mar 2021 12:09:37 +0100 (CET) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Thomas Munro cc: Marina Polyakova , pgsql-hackers , kuroda.hayato@fujitsu.com, David Rowley Subject: Re: pgbench: option delaying queries till connections establishment? In-Reply-To: Message-ID: References: <20200227180100.zyvjwzcpiokfsqm2@alap3.anarazel.de> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-1155515829-1615633778=:771005" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-1155515829-1615633778=:771005 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT Hello Thomas, >> I must say that I'm not a big fan of the macro-based all-in-capitals API >> for threads because it exposes some platform specific uglyness (eg >> THREAD_FUNC_CC) and it does not look much like clean C code when used. I >> liked the previous partial pthread implementation better, even if it was >> not the real thing, obviously. > > But we were using macros already, to support --disable-thread-safety > builds. Yep, but the look and feel was still C code. > I just changed them to upper case and dropped the 'p', because I didn't > like to pretend to do POSIX threads, but do it so badly. Hmmm. From the source code point of view it was just like actually using posix threads, even if the underlying machinery was not quite that on some systems. I value looking at "beautiful" and "standard" code if possible, even if there is some cheating involved, compared to exposing macros. I made some effort to remove the pretty ugly and inefficient INSTR_TIME macros from pgbench, replaced with straightforward arithmetic and inlined functions. Now some other macros just crept back in:-) Anyway, this is just "les goƻts et les couleurs" (just a matter of taste), as we say here. > Perhaps we should drop --disable-thread-safety soon, and perhaps it is > nearly time to create a good thread abstraction in clean C code, for use > in the server and here? Then we won't need any ugly macros. +1. >> ISTM that with the current approach threads are always used on Windows, >> i.e. pgbench does not comply to "ENABLE_THREAD_SAFETY" configuration on >> that platform. Not sure whether this is an issue that need to be >> addressed, though. > > The idea of that option, as I understand it, is that in ancient times > there were Unix systems with no threads (that's of course the reason > PostgreSQL is the way it is). I don't think that was ever the case > for Windows NT, and we have no build option for that on Windows > AFAICS. Ok, fine with me. -- Fabien. --2056645051-1155515829-1615633778=:771005--