Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bRgmU-0006nJ-Vl for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2016 14:22:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bRgmU-0005GJ-J6 for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Jul 2016 14:22:54 +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.84_2) (envelope-from ) id 1bRgl7-0003eB-Pl for pgsql-hackers@postgresql.org; Mon, 25 Jul 2016 14:21:29 +0000 Received: from bay.acenet.us ([173.230.252.50]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bRgl4-0008Mq-23 for pgsql-hackers@postgresql.org; Mon, 25 Jul 2016 14:21:29 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=anastigmatix.net; s=default; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:Cc:References:To:Subject:Sender :Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=gq+cSHeAwqXzWjC9Zq5PQcyq447SbpjIa7lf8FdG2kA=; b=Rlmn62Tu973DC3DaxiHRnZlNK+ ymkbKygBrHSd7erGOLkLWy55V2FREJWSqXXaHukBFR8MvHCR518P+MqoJsfkCzaOlKJUjFliOjqMU 3GgcZUNMtP8a1E1h6PMfh6lTzcmlMTXPgFJuRW4jmVW8O7rLbjtfMBPhULs+IsgofqotUu4kNpf0P zxtnr+srdxg+08JgEH3t036fOX7ihfi89CJIfUcTzJKL4lzhNIOcVJiAZup6B4/1vqQ9D8Rm616Zz D3XIPB77VXI8GBkPMQLexoxAR7K1xqPbp/egDXWeJvNs6FgP4T8hYZIz5SaZMFVqs9cMxZGVaz+/X sz6s34cg==; Received: from banach.math.purdue.edu ([128.210.3.16]:36220) by bay.acenet.us with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.87) (envelope-from ) id 1bRgl0-001F6E-PW; Mon, 25 Jul 2016 10:21:22 -0400 Subject: Re: AdvanceXLInsertBuffer vs. WAL segment compressibility To: Amit Kapila References: <579297F8.7020107@anastigmatix.net> Cc: PostgreSQL Hackers From: Chapman Flack Message-ID: <57962061.9010506@anastigmatix.net> Date: Mon, 25 Jul 2016 10:21:21 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - bay.acenet.us X-AntiAbuse: Original Domain - postgresql.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - anastigmatix.net X-Get-Message-Sender-Via: bay.acenet.us: authenticated_id: chap+anastigmatix.net/only user confirmed/virtual account not confirmed X-Authenticated-Sender: bay.acenet.us: chap@anastigmatix.net X-Source: X-Source-Args: X-Source-Dir: X-Pg-Spam-Score: -1.8 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org On 07/23/2016 08:25 AM, Amit Kapila wrote: > On Sat, Jul 23, 2016 at 3:32 AM, Chapman Flack wrote: >> >> Would it then be possible to go back to the old behavior (or make >> it selectable) of not overwriting the full 16 MB every time? >> > > I don't see going back to old behaviour is an improvement, because as > as you pointed out above that it helps to improve the compression > ratio of WAL files for tools like gzip and it doesn't seem advisable > to loose that capability. I think providing an option to select that > behaviour could be one choice, but use case seems narrow to me > considering there are tools (pglesslog) to clear the tail. Do you > find any problems with that tool which makes you think that it is not > reliable? It was a year or so ago when I was surveying tools that attempted to do that. I had found pg_clearxlogtail, and I'm sure I also found pglesslog / pg_compresslog ... my notes from then simply refer to "contrib efforts like pg_clearxlogtail" and observed either a dearth of recent search results for them, or a predominance of results of the form "how do I get this to compile for PG x.x?" pg_compresslog is mentioned in a section, Compressed Archive Logs, of the PG 9.1 manual: https://www.postgresql.org/docs/9.1/static/continuous-archiving.html#COMPRESSED-ARCHIVE-LOGS That section is absent in the docs any version > 9.1. The impression that leaves is of tools that relied too heavily on internal format knowledge to be viable outside of core, which have had at least periods of incompatibility with newer PG versions, and whose current status, if indeed any are current, isn't easy to find out. It seems a bit risky (to me, anyway) to base a backup strategy on having a tool in the pipeline that depends so heavily on internal format knowledge, can become uncompilable between PG releases, and isn't part of core and officially supported. And that, I assume, was also the motivation to put the zeroing in AdvanceXLInsertBuffer, eliminating the need for one narrow, specialized tool like pg{_clear,_compress,less}log{,tail}, so the job can be done with ubiquitous, bog standard (and therefore *very* exhaustively tested) tools like gzip. So it's just kind of unfortunate that there used to be a *further* factor of 100 (nothing to sneeze at) possible using rsync (another non-PG-specific, ubiquitous, exhaustively tested tool) but a trivial feature of the new behavior has broken that. Factors of 100 are enough to change the sorts of things you think about, like possibly retaining years-long unbroken histories of transactions in WAL. What would happen if the overwriting of the log tail were really done with just zeros, as the git comment implied, rather than zeros with initialized headers? Could the log-reading code handle that gracefully? That would support all forms of non-PG-specific, ubiquitous tools used for compression; it would not break the rsync approach. Even so, it still seems to me that a cheaper solution is a %e substitution in archive_command: just *tell* the command where the valid bytes end. Accomplishes the same thing as ~ 16 MB of otherwise-unnecessary I/O at the time of archiving each lightly-used segment. Then the actual zeroing could be suppressed to save I/O, maybe with a GUC variable, or maybe just when archive_command is seen to contain a %e. Commands that don't have a %e continue to work and compress effectively because of the zeroing. -Chap -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers