Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFO0B-0000VR-AO for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2017 17:30:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1eFO0A-00038H-8C for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Nov 2017 17:30:58 +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 1eFO0A-00037p-33 for pgsql-hackers@lists.postgresql.org; Thu, 16 Nov 2017 17:30:58 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1eFO05-00007c-NC for pgsql-hackers@postgresql.org; Thu, 16 Nov 2017 17:30:57 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 59D854D565; Thu, 16 Nov 2017 18:30:52 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by spamfilter02.heinlein-hosting.de (spamfilter02.heinlein-hosting.de [80.241.56.116]) (amavisd-new, port 10030) with ESMTP id 9WqiJm-LB5ee; Thu, 16 Nov 2017 18:30:50 +0100 (CET) From: Antonin Houska To: pgsql-hackers@postgresql.org cc: Oleg Ivanov Subject: Re: [HACKERS] Proposal: generic WAL compression In-reply-to: <59F90ABF.2060407@postgrespro.ru> References: <59F90ABF.2060407@postgrespro.ru> Comments: In-reply-to Oleg Ivanov message dated "Wed, 01 Nov 2017 02:43:59 +0300." MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 16 Nov 2017 18:31:23 +0100 Message-ID: <23990.1510853483@localhost> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Oleg Ivanov wrote: > In order to overcome that issue, I would like to propose the patch, which > provides possibility to use another approach of the WAL record > construction. After having spent several hours reviewing this patch I dare to send the following comments: * writeToPtr() and readFromPtr() are applied to the existing code. I think this is a reason for a separate diff, to be applied before the actual pat= ch. BTW, if you're going to do any refactoring of the existing code, I think the "Begin" and "Start" words should be used consistently, see "fragmentBegin" = vs "validStart" in computeRegionBaseDelta(). * What's the reason for changing FRAGMENT_HEADER_SIZE ? I see no change in the data layout that writeFragment() produces. * alignRegions() ** typo in the prologue: "mismathing". ** "An O(ND) Difference Algorithm and Its Variations" - I think the referen= ce should contain more information, e.g. name of the author(s). I think I e= ven saw URLs to scientific papers in the PG source but I'm not 100% sure rig= ht now. ** As for the algorithm itself: Although I didn't have enough patience (and time) to follow it in every detail for this first review, I think I can imagine what it is about. Yet I think reading would be easier if the concepts of alignment and "diff delta" were depicted in the comments, perhaps using some sort of "ASCII graphics". ** DiffDeltaOperations enumeration: the individual values should be describ= ed. * computeRegionDiffDelta() ** Does "previous delta" in one of the comments refer to "base delta", i.e. the delta computation w/o your patch? If so, the comment should mention it explicitly. ** If you use Min() to initialize the for-loop, it'd be more consistent if = you also used Max() when checking the limits: for (i =3D Min(validStart, targetStart); i < Max(validEnd, targetEnd); ++i) And similarly you can simplify the body of the loop. * computeDelta() As the expresssion *((bool *) pageData->delta) is used more than once, I think a separate (bool *) variable should be used. --=20 Antonin Houska Cybertec Sch=C3=B6nig & Sch=C3=B6nig GmbH Gr=C3=B6hrm=C3=BChlgasse 26 A-2700 Wiener Neustadt Web: http://www.postgresql-support.de, http://www.cybertec.at