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 1nDXRL-000063-6Y for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jan 2022 20:01:47 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nDXRJ-0000Rh-QC for pgsql-hackers@arkaria.postgresql.org; Fri, 28 Jan 2022 20:01:45 +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 1nDXRJ-0000RX-Ai for pgsql-hackers@lists.postgresql.org; Fri, 28 Jan 2022 20:01:45 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nDXRG-00017N-BJ for pgsql-hackers@postgresql.org; Fri, 28 Jan 2022 20:01:43 +0000 Received: by mail-pj1-x102d.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso11837360pjv.1 for ; Fri, 28 Jan 2022 12:01:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=k9w7DDHtrlOepLQwUfy7RB6imtkOY+m3UUO3X3nDrJM=; b=SR/PMNgAFLHryVwaMQ1iJVFpShREXfQv9uQ3tg9wSGoBGy2hCM5FHMr2qsDK1irZOI +CY0I7KbUvHsBGLL81FWUHYjU7gwO7NiFkavYuMS+sKxKvSkfV8fuTYRNeEGRwOSuTvZ QseTAyQrclsAQ6/Y9/XQ4AO/Lo+7EOrse2ZW35DJRvX2ugGLQb0xor4LclpN4QmpOwIO 2EdiTDqVQJiAMVI5v0RNHmKLIDgDTyXWjxBj1TEY6HdEGx1bk0mebG61y9XKAvffY4Rs X7htiWstolTLiUjUO6tfBnupUCsJlXgbDKcSd4d5lBFfSMAiEiXx2G/dC4mPMg434UF7 3l3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=k9w7DDHtrlOepLQwUfy7RB6imtkOY+m3UUO3X3nDrJM=; b=CGfrInHKyGL4y6T2isjaHgI9wFHvdxpyrf6hLcKrbJG4SWBDtBz3lqmwHvYFdnXKoL KBCU3UK2qXffhh/CUAHx33RhD7ncc3ATkauiUxzDFBz+AvIk2pteU3/wDF4mZpqO2m+q XYP+7ln1JwbT7yfMgp8YN0GiSDFoZmdhEDzGRZxi87hynVpHkzg8bzwPjs2tCe5UO6DY Gkphf32EnwkdqPv0a/k7Y7uKxRLDwvK+Krb4WhxUk42ppmn4B7Zkdx+/9t0j2iQOk18C LuMLmSd8VCgg+mpoKwQWmgszpaT/Gt2sl0ml4DQxJEDw08xrTjWz22/Ob7lwwRSrkTdV d2XA== X-Gm-Message-State: AOAM533zz4eti3iSTvmwoAvF6qcxKYmBiKM6sAb5jLmDhfnMtJVxJE9d PuTdbLq76c9BO1akRDpdqTo= X-Google-Smtp-Source: ABdhPJyromVveDqpmS9sWmxfltKWZ/dWAcV7I6iUdlfG2gIoHgcGy8k48nrYZNO9l6DVIsuAzyDF0A== X-Received: by 2002:a17:902:6942:: with SMTP id k2mr9691593plt.133.1643400101272; Fri, 28 Jan 2022 12:01:41 -0800 (PST) Received: from nathanxps13 ([50.54.155.70]) by smtp.gmail.com with ESMTPSA id mt14sm3058029pjb.21.2022.01.28.12.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 Jan 2022 12:01:40 -0800 (PST) Date: Fri, 28 Jan 2022 12:01:38 -0800 From: Nathan Bossart To: Robert Haas Cc: "Bossart, Nathan" , David Steele , Fujii Masao , "pgsql-hackers@postgresql.org" , Michael Paquier , Magnus Hagander , Stephen Frost Subject: Re: archive modules Message-ID: <20220128200138.GA3398@nathanxps13> References: <53a180a7-bf1b-38c5-7fb4-4088dc022b98@pgmasters.net> <4c01ce36-fbed-104a-ef9c-6046343dc845@pgmasters.net> <316CAF77-A0AC-49AE-A175-1C1ECF6C1981@amazon.com> <71E7A5D1-E418-4516-A21D-BD838BA759CE@amazon.com> <0CF39706-6952-49B1-987D-F012CDF5EEC4@amazon.com> <90D3CEE4-00C1-450C-80B1-88B69D9318DE@amazon.com> <3842CF04-528B-42A5-A12D-BA3970EF1E53@amazon.com> <5D92CC59-47C8-4463-9150-44033DDDD0D8@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Fri, Jan 28, 2022 at 02:06:50PM -0500, Robert Haas wrote: > I've committed 0001 now. I don't see anything particularly wrong with > the rest of this either, but here are a few comments: Thanks! > - I wonder whether it might be better to promote the basic archiving > module to contrib (as compared with src/test/modules) and try to > harden it to the extent that such hardening is required. I think a lot > of people would get good use out of that. It might not be a completely > baked solution, but a solution doesn't have to be completely baked to > be a massive improvement over the stupidity endorsed by our current > documentation. This has been suggested a few times in this thread, so I'll go ahead and move it to contrib. I am clearly outnumbered! :) I discussed the two main deficiencies I'm aware of with basic_archive earlier [0]. The first one is the issue with "incovenient" server crashes (mentioned below). The second is that there is no handling for multiple servers writing to the same location since the temporary file is always named "archtemp." I thought about a few ways to pick a unique file name (or at least one that is _probably_ unique), but that began adding a lot of complexity for something I intended as a test module. I can spend some more time on this if you think it's worth fixing for a contrib module. > - I wonder whether it's a good idea to silently succeed if the file > exists and has the same contents as the file we're trying to archive. > ISTR that being necessary behavior for robustness, because what if we > archive the file and then die before recording the fact that we > archived it? Yes. The only reason I didn't proceed with this earlier is because the logic became a sizable chunk of the module. I will add this in the next revision. > - If we load a new archive library, should we give the old one a > callback so it can shut down? And should the archiver considering > exiting since we can't unload? It isn't necessary but it might be > nicer. Good idea. I'll look into this. > - I believe we decided some time back to invoke function pointers > (*like)(this) rather than like(this) for clarity. It was judged that > something->like(this) was fine because that can only be a function > pointer, so no need to write (*(something->like))(this), but > like(this) could make you think that "like" is a plain function rather > than a function pointer. Will fix. [0] https://postgr.es/m/A30D8D33-8944-4898-BCA8-C77C18258247%40amazon.com -- Nathan Bossart Amazon Web Services: https://aws.amazon.com/