Return-Path: X-Original-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Delivered-To: apmail-hadoop-common-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id BCB7B98FB for ; Sat, 10 Dec 2011 22:07:01 +0000 (UTC) Received: (qmail 86534 invoked by uid 500); 10 Dec 2011 22:07:01 -0000 Delivered-To: apmail-hadoop-common-issues-archive@hadoop.apache.org Received: (qmail 86480 invoked by uid 500); 10 Dec 2011 22:07:01 -0000 Mailing-List: contact common-issues-help@hadoop.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: common-issues@hadoop.apache.org Delivered-To: mailing list common-issues@hadoop.apache.org Received: (qmail 86472 invoked by uid 99); 10 Dec 2011 22:07:01 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Dec 2011 22:07:01 +0000 X-ASF-Spam-Status: No, hits=-2001.2 required=5.0 tests=ALL_TRUSTED,RP_MATCHES_RCVD X-Spam-Check-By: apache.org Received: from [140.211.11.116] (HELO hel.zones.apache.org) (140.211.11.116) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 10 Dec 2011 22:07:00 +0000 Received: from hel.zones.apache.org (hel.zones.apache.org [140.211.11.116]) by hel.zones.apache.org (Postfix) with ESMTP id 3276E10BD01 for ; Sat, 10 Dec 2011 22:06:40 +0000 (UTC) Date: Sat, 10 Dec 2011 22:06:40 +0000 (UTC) From: "Niels Basjes (Commented) (JIRA)" To: common-issues@hadoop.apache.org Message-ID: <1558923151.62089.1323554800208.JavaMail.tomcat@hel.zones.apache.org> In-Reply-To: <1307689929.61915.1323543579998.JavaMail.tomcat@hel.zones.apache.org> Subject: [jira] [Commented] (HADOOP-7909) Implement Splittable Gzip based on a signature in a gzip header field MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/HADOOP-7909?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13166989#comment-13166989 ] Niels Basjes commented on HADOOP-7909: -------------------------------------- If I understand PIG-42 and your description correctly this type of making gzip splittable is based upon working with an input file that has been specially crafted. A "normal" gzipped file won't become splittable with this codec. The way I interpret what I've read so far is that this comes very close to defining a new fileformat: a block compressed deflate file that due to the clever way it is stored can also be read by any existing gzip decompression tool. So I dare to ask: # how does the Hadoop job system know that it should try to create splits for the input file? # should the files use the .gz file extension? Or perhaps something like .sgz (splittable gz) instead? # what will be the advantages over the existing splittable compression options we have now (LZO/Snappy/Bzip2/...)? Why would I as a Hadoop developer/administrator want to choose this codec? > Implement Splittable Gzip based on a signature in a gzip header field > --------------------------------------------------------------------- > > Key: HADOOP-7909 > URL: https://issues.apache.org/jira/browse/HADOOP-7909 > Project: Hadoop Common > Issue Type: New Feature > Components: io > Reporter: Tim Broberg > Priority: Minor > Original Estimate: 672h > Remaining Estimate: 672h > > I propose to take the suggestion of PIG-42 extend it to > - add a more robust header such that false matches are vanishingly unlikely > - repeat initial bytes of the header for very fast split searching > - break down the stream into modest size chunks (~64k?) for rapid parallel encode and decode > - provide length information on the blocks in advance to make block decode possible in hardware > An optional extra header would be added to the gzip header, adding 36 bytes. > := > := 1 byte version field allowing us to later adjust the deader definition > := 23 byte signature of the form aaaaaaabcdefghijklmnopr where each letter represents a randomly generated byte > := 32-bit length of the data compressed into this record > := 32-bit length of this record as compressed, including all headers, trailers > If multiple extra headers are present and the split header is not the first header, the initial implementation will not recognize the split. > Input streams would be broken down into blocks which are appended, much as BlockCompressorStream does. Non-split-aware decoders will ignore this header and decode the appended blocks without ever noticing the difference. > The signature has >= 132 bits of entropy which is sufficient for 80+ years of Moore's law before collisions become a significant concern. > The first 7 bytes are repeated for speed. When splitting, the signature search will look for the 32-bit value aaaa every 4 bytes until a hit is found, then the next 4 bytes identify the alignment of the header mod 4 to identify a potential header match, then the whole header is validated at that offset. So, there is a load, compare, branch, and increment per 4 bytes searched. > The existing gzip implementations do not provide access to the optional header fields (nor comment nor filename), so the entire gzip header will have to be reimplemented and compression will need to be done using the raw deflate options of the native library / built in deflater. > There will be some degradation when using splittable gzip: > - The gzip headers will each be 36 bytes larger. (4 byte extra header header, 32 byte extra header) > - There will be one gzip header per block. > - History will have to be reset with each block to allow starting from scratch at that offset resulting in some uncompressed bytes that would otherwise have been strings. > Issues to consider: > - Is the searching fast enough without the repeating 7 bytes in the signature? > - Should this be a patch to the existing gzip classes to add a switch, or should this be a whole new class? > - Which level does this belong at? CompressionStream? Compressor? > - Is it more advantageous to encode the signature into the less dense comment field? > - Optimum block size? Smaller splits faster and may conserve memory, larger provides slightly better compression ratio. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira