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 1kqlk1-0001Xg-Va for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Dec 2020 23:34:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kqljy-0005T2-Ee for pgsql-hackers@arkaria.postgresql.org; Sat, 19 Dec 2020 23:34:22 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqljy-0005SP-6j for pgsql-hackers@lists.postgresql.org; Sat, 19 Dec 2020 23:34:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kqljw-0003RT-1a for pgsql-hackers@postgresql.org; Sat, 19 Dec 2020 23:34:21 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 0BJNYHAP341498; Sat, 19 Dec 2020 18:34:17 -0500 From: Tom Lane To: Thomas Munro cc: pgsql-hackers Subject: Re: pg_preadv() and pg_pwritev() In-reply-to: References: Comments: In-reply-to Thomas Munro message dated "Sun, 20 Dec 2020 11:38:51 +1300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <341496.1608420857.1@sss.pgh.pa.us> Date: Sat, 19 Dec 2020 18:34:17 -0500 Message-ID: <341497.1608420857@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Thomas Munro writes: > I want to be able to do synchronous vectored file I/O, so I made > wrapper macros for preadv() and pwritev() with fallbacks for systems > that don't have them. Following the precedent of the pg_pread() and > pg_pwrite() macros, the "pg_" prefix reflects a subtle contract > change: the fallback paths might have the side effect of changing the > file position. In a quick look, seems OK with some nits: 1. port.h cannot assume that has already been included; nor do I want to fix that by including there. Do we really need to define a fallback value of IOV_MAX? If so, maybe the answer is to put the replacement struct iovec and IOV_MAX in some new header. 2. I'm not really that happy about loading into every compilation we do, which would be another reason for a new specialized header that either includes or provides fallback definitions. 3. The patch as given won't prove anything except that the code compiles. Is it worth fixing at least one code path to make use of pg_preadv and pg_pwritev, so we can make sure this code is tested before there's layers of other new code on top? regards, tom lane