Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 4988B1337B8B for ; Thu, 2 Dec 2010 03:49:57 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 27178-08 for ; Thu, 2 Dec 2010 07:49:50 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from exprod7og119.obsmtp.com (exprod7og119.obsmtp.com [64.18.2.16]) by mail.postgresql.org (Postfix) with SMTP id 482E61337B55 for ; Thu, 2 Dec 2010 03:49:48 -0400 (AST) Received: from source ([209.85.215.54]) by exprod7ob119.postini.com ([64.18.6.12]) with SMTP ID DSNKTPdPmwXOPxb3VkUOzglbj0yVgaY4Eyd2@postini.com; Wed, 01 Dec 2010 23:49:49 PST Received: by ewy24 with SMTP id 24so31179113ewy.27 for ; Wed, 01 Dec 2010 23:49:47 -0800 (PST) Received: by 10.213.15.129 with SMTP id k1mr407149eba.21.1291276186872; Wed, 01 Dec 2010 23:49:46 -0800 (PST) Received: from [192.168.1.183] (dsl-hkibrasgw2-ff7ac300-240.dhcp.inet.fi [88.195.122.240]) by mx.google.com with ESMTPS id q58sm222889eeh.15.2010.12.01.23.49.46 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 01 Dec 2010 23:49:46 -0800 (PST) Message-ID: <4CF74F99.4050008@enterprisedb.com> Date: Thu, 02 Dec 2010 09:49:45 +0200 From: Heikki Linnakangas User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; fi-FI; rv:1.9.1.15) Gecko/20101030 Icedove/3.0.10 MIME-Version: 1.0 To: Joachim Wieland CC: Tom Lane , =?ISO-8859-1?Q?Jos=E9_Arthur_Beneta?= =?ISO-8859-1?Q?sso_Villanova?= , pgsql-hackers@postgresql.org Subject: Re: directory archive format for pg_dump References: <4CEA9F29.5060106@enterprisedb.com> <28890.1290445623@sss.pgh.pa.us> <4CEAD61A.6060207@enterprisedb.com> <4CF40B5F.1010407@enterprisedb.com> <4CF655A3.4090308@enterprisedb.com> <4CF6562E.60506@enterprisedb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.2 tagged_above=-5 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3 X-Spam-Level: X-Archive-Number: 201012/143 X-Sequence-Number: 175405 On 02.12.2010 04:35, Joachim Wieland wrote: > There is one thing however that I am not in favor of, which is the > removal of the "sizeHint" parameter for the read functions. The reason > for this parameter is not very clear now without LZF but I have tried > to put in a few comments to explain the situation (which you have > taken out as well :-) ). > > The point is that zlib is a stream based compression algorithm, you > just stuff data in and from time to time you get data out and in the > end you explicitly flush the compressor. The read function can just > return as many bytes as it wants and we can just hand it all over to > zlib. Other compression algorithms however are block based and first > write a block header that contains the information on the next data > block, including uncompressed and compressed sizes. Now with the > sizeHint parameter I used, the compressor could tell the read function > that it just wants to read the fixed size header (6 bytes IIRC). In > the header it would look up the compressed size for the next block and > would then ask the read function to get exactly this amount of data, > decompress it and go on with the next block, and so forth... > > Of course you can possibly do that memory management inside the > compressor with an extra buffer holding what you got in excess but > it's a pain. If you removed that part on purpose on the grounds that > there is no block based compression algorithm in core and probably > never will be, then that's okay :-) Yeah, we're not going to have lzf built-in anytime soon. The external command approach seems like the best way to support additional compression algorithms, and I don't think it could do anything with sizeHint. And the custom format didn't obey sizeHint anyway, because it reads one custom-format block at a time. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com