Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgQZ8-0007Ey-HF for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 08:15:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fgQZ6-0006VP-ME for pgsql-hackers@arkaria.postgresql.org; Fri, 20 Jul 2018 08:15:04 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgQZ6-0006VI-5k for pgsql-hackers@lists.postgresql.org; Fri, 20 Jul 2018 08:15:04 +0000 Received: from mail.taisia.fi ([2001:1bc8:100:6::a101]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fgQZ3-0007Dl-J1 for pgsql-hackers@postgresql.org; Fri, 20 Jul 2018 08:15:03 +0000 Received: by mail.taisia.fi (Postfix, from userid 1001) id 11AB3A476C; Fri, 20 Jul 2018 11:14:59 +0300 (EEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ohmu.fi; s=taisial1; t=1532074499; bh=Li7lgEc+m+GFyel7pdKqEJw0PLdVb0fRD6f2CFMmmik=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ANcmlNEozKQeQceW6c5a3/+8Cf1KsWqfbaFgG9BaiCrAV7hmAe9nskab3KA3g1AFb ZkDqFz8KJDeTEgXGjMbyYdAWxDZ8Fj/OE4Uv6h5qJBaI3V2FsJr0HRPnWnA7XaZc1t sU90FdWXoEiyCRyhBy2TMw/Iwwjh1LqcLovserd0= Date: Fri, 20 Jul 2018 11:14:59 +0300 From: Oskari Saarenmaa To: Thomas Munro Cc: pgsql-hackers@postgresql.org, Tobias Oberstein Subject: Re: pread() and pwrite() Message-ID: <20180720081459.GC22214@saarenmaa.fi> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jul 12, 2018 at 01:55:31PM +1200, Thomas Munro wrote: > A couple of years ago, Oskari Saarenmaa proposed a patch[1] to adopt > $SUBJECT. Last year, Tobias Oberstein argued again that we should do > that[2]. At the end of that thread there was a +1 from multiple > committers in support of getting it done for PostgreSQL 12. Since > Oskari hasn't returned, I decided to dust off his patch and start a > new thread. Thanks for picking this up - I was meaning to get back to this, but have unfortunately been too busy with other projects. > 1. FileRead() and FileWrite() are replaced with FileReadAt() and > FileWriteAt(), taking a new offset argument. Now we can do one > syscall instead of two for random reads and writes. > [...] I'm not even sure I'd bother adding "At" to the > function names. If there are any extensions that want the old > interface they will fail to compile either way. Note that the BufFile > interface remains the same, so hopefully that covers many use cases. IIRC I used the "At" suffixes in my first version of the patch before completely removing the functions which didn't take an offset argument Now that they're gone I agree that we could just drop the "At" suffix; "at" suffix is also used by various POSIX functions to operate in a specific directory which may just add to confusion. > I guess the only remaining reason to use FileSeek() is to get the file > size? So I wonder why SEEK_SET remains valid in the patch... if my > suspicion is correct that only SEEK_END still has a reason to exist, > perhaps we should just kill FileSeek() and add FileSize() or something > instead? I see you did this in your updated patch :+1: Happy to see this patch move forward. / Oskari