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 1obizQ-00086e-AN for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Sep 2022 13:45:12 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1obizO-0003zl-JQ for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Sep 2022 13:45:10 +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 1obizO-0003yL-2x for pgsql-hackers@lists.postgresql.org; Fri, 23 Sep 2022 13:45:10 +0000 Received: from mail-ed1-x544.google.com ([2a00:1450:4864:20::544]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1obizJ-0000Ij-PK for pgsql-hackers@lists.postgresql.org; Fri, 23 Sep 2022 13:45:09 +0000 Received: by mail-ed1-x544.google.com with SMTP id y8so258241edc.10 for ; Fri, 23 Sep 2022 06:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20210112.gappssmtp.com; s=20210112; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date; bh=P9/uoEFNyQmSE6S+OX4ufYuHFIszO7W0/70xLYIhai8=; b=dUDSSbX9s+r9M7Gdyk+75Gz+xUa2H/zrSDYf/dBSZAJFFl5KLtaljdpxIb2tICSGX0 PvbQnTiqO4JEnEnhnQUhWmaJBClnhKV3z7HV9qkLjAgE+vTkuKhbJXKPysOUJgv0Ar0r nE3fv8FfIjBt0nT5O92x5MXTxcpIGi0cZ/7pMsqZSc+JZDat7Fxpq8btuJm+JJiM1Fh3 VNlF7KBVAMycZbiqPyYxnn4x01fK3COxMRw4oDion2GKuLyp8fmYiOaJg36UwNQk47UV 2doPftJlZ89/65g8JiEjnsnEXg1lSHt+TNaTVRmce9YKYsy18ZOtohQ1jZMaGKNYus2i BQEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:date:content-transfer-encoding:mime-version:comments :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date; bh=P9/uoEFNyQmSE6S+OX4ufYuHFIszO7W0/70xLYIhai8=; b=KSrKM1gkKgs7pz0VyjUb4zfu7auYUKdxi9hM3xLGn+Voo7utVop8MYH5zMJP/7hXUl MeKnvXyN2omGMR1G11zLSMp2sWF0lF1CEzgTPMzhmV8gCM2xP83rDjd+rNrkuLSt28so cwTHHAFkreURnkyYqacOhkD2JF1dgbgHYzLa2AJm0DAikfl60nWMm1Ja/PJ9V5BDrAUT in0IxdcRBOsJB8GaV7K/AQ22sYraomTHVIBxRDq4T6yEbFWMW0tMSWpMcjVcMh3T0ZGS yUhMeJKJrUNSCuzShQl8CaKKg9Zd3jYU8U1CAh7Geo1QaiHGP4Yi54EseWaxnozs+JGl HoCg== X-Gm-Message-State: ACrzQf0ULS33c7+wn42FkWPJGL8uhba/eCOEtFmXdyeC2zpHm+FJauTJ 26vak4iSV6OB4f+g684aQDjenw== X-Google-Smtp-Source: AMsMyM7y9k+OMthfnQ3hWwWpOaGp2k0Zy+9VTRv2lkoCQJcjaL7Sp8AY70BM1KIQ4ULZ83hZ3bgcpA== X-Received: by 2002:a05:6402:350b:b0:452:2b68:90db with SMTP id b11-20020a056402350b00b004522b6890dbmr8534561edd.255.1663940704219; Fri, 23 Sep 2022 06:45:04 -0700 (PDT) Received: from antos (90-183-80-80.rcq.o2.cz. [90.183.80.80]) by smtp.gmail.com with ESMTPSA id j18-20020aa7de92000000b0044657ecfbb5sm546374edv.13.2022.09.23.06.45.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 23 Sep 2022 06:45:03 -0700 (PDT) From: Antonin Houska To: John Morris cc: Robert Haas , PostgreSQL Hackers , Peter Eisentraut , Stephen Frost Subject: Re: Temporary file access API In-reply-to: References: <4987.1644323098@antos> <20220301143431.GT10577@tamriel.snowman.net> <27013.1646738099@antos> <3146.1649408068@antos> <2132.1649664364@antos> <3690.1649755839@antos> <24759.1650466826@antos> <60402.1656952546@antos.home> <46aa800a-dad7-5080-ee9f-371cc2797b36@enterprisedb.com> <85651.1657027465@antos.home> <56024.1659109053@antos.home> <5037.1659983247@antos.home> Comments: In-reply-to John Morris message dated "Thu, 22 Sep 2022 15:42:13 -0000." X-Mailer: MH-E 8.6+git; nmh 1.7+dev; GNU Emacs 27.2.50 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 23 Sep 2022 15:45:58 +0200 Message-ID: <17018.1663940758@antos> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, John Morris wrote: > I=E2=80=99m a latecomer to the discussion, but as a word of introduction,= I=E2=80=99m working with Stephen, and I have started looking over the temp= file proposal with the idea of helping it move along. >=20=20 > I=E2=80=99ll start by summarizing the temp file proposal and its goals. >=20=20 > From a high level, the proposed code: >=20 > * Creates an fread/fwrite replacement (BufFileStream) for buffering data = to a single file. >=20 > * Updates BufFile, which reads/writes a set of files, to use BufFileStrea= m internally. >=20 > * Does not impact the normal (page cached) database I/O. >=20 > * Updates all the other places where fread/fwrite and read/write are used. Not really all, just those where the change seemed reasonable (i.e. where it does not make the code more complex) > * Creates and removes transient files. The "stream API" is rather an additional layer on top of files that user ne= eds to create / remove at lower level. > I see the following goals: >=20 > * Unify all the =E2=80=9Cother=E2=80=9D file accesses into a single, cons= istent API. >=20 > * Integrate with VFDs. >=20 > * Integrate transient files with transactions and tablespaces. If you mean automatic closing/deletion of files on transaction end, this is also the lower level thing that I didn't try to change. > * Create a consolidated framework where features like encryption and comp= ression can be more easily added. >=20 > * Maintain good streaming performance. >=20 > Is this a fair description of the proposal?=20 Basically that's it. > For myself, I=E2=80=99d like to map out how features like compression and= encryption would fit into the framework, more as a sanity check than anyth= ing else, and I=E2=80=99d like to look closer at some of the implementation= details. But at the moment, I want to make sure I have the > proper high-level view of the temp file proposal. I think the high level design (i.e. how the API should be used) still needs discussion. In particular, I don't know whether it should aim at the encryption adoption or not. If it does, then it makes sense to base it on buffile.c, because encryption essentially takes place in memory. But if buffering itself (w/o encryption) is not really useful at other places (see Robert's comments in [1]), then we can design something simpler, w/o touchi= ng buffile.c (which, in turn, won't be usable for encryption, compression or s= o). So I think that code simplification and easy adoption of in-memory data changes (such as encryption or compression) are two rather distinct goals. admit that I'm running out of ideas how to develop a framework that'd be useful for both. [1] https://www.postgresql.org/message-id/CA%2BTgmoZWP8UtkNVLd75Qqoh9VGOVy_0xBK= %2BSHZAdNvnfaikKsQ%40mail.gmail.com > From: Robert Haas > Date: Wednesday, September 21, 2022 at 11:54 AM > To: Antonin Houska > Cc: PostgreSQL Hackers , Peter Eisent= raut , Stephen Frost > Subject: Re: Temporary file access API >=20 > On Mon, Aug 8, 2022 at 2:26 PM Antonin Houska wrote: > > > I don't think that (3) is a separate advantage from (1) and (2), so I > > > don't have anything separate to say about it. > > > > I thought that the uncontrollable buffer size is one of the things you > > complaint about in > > > > https://www.postgresql.org/message-id/CA+TgmoYGjN_f=3DFCErX49bzjhNG+Goc= tY+a+XhNRWCVvDY8U74w@mail.gmail.com >=20 > Well, I think that email is mostly complaining about there being no > buffering at all in a situation where it would be advantageous to do > some buffering. But that particular code I believe is gone now because > of the shared-memory stats collector, and when looking through the > patch set, I didn't see that any of the cases that it touched were > similar to that one. >=20 > --=20 > Robert Haas > EDB: http://www.enterprisedb.com >=20 --=20 Antonin Houska Web: https://www.cybertec-postgresql.com