Return-Path: X-Original-To: apmail-hbase-user-archive@www.apache.org Delivered-To: apmail-hbase-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 145FE933B for ; Tue, 6 Mar 2012 17:01:46 +0000 (UTC) Received: (qmail 809 invoked by uid 500); 6 Mar 2012 17:01:44 -0000 Delivered-To: apmail-hbase-user-archive@hbase.apache.org Received: (qmail 755 invoked by uid 500); 6 Mar 2012 17:01:44 -0000 Mailing-List: contact user-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@hbase.apache.org Delivered-To: mailing list user@hbase.apache.org Received: (qmail 746 invoked by uid 99); 6 Mar 2012 17:01:44 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Mar 2012 17:01:44 +0000 X-ASF-Spam-Status: No, hits=-0.5 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of yongyong313@gmail.com designates 209.85.160.41 as permitted sender) Received: from [209.85.160.41] (HELO mail-pw0-f41.google.com) (209.85.160.41) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 06 Mar 2012 17:01:37 +0000 Received: by pbcup15 with SMTP id up15so1855618pbc.14 for ; Tue, 06 Mar 2012 09:01:17 -0800 (PST) Received-SPF: pass (google.com: domain of yongyong313@gmail.com designates 10.68.233.168 as permitted sender) client-ip=10.68.233.168; Authentication-Results: mr.google.com; spf=pass (google.com: domain of yongyong313@gmail.com designates 10.68.233.168 as permitted sender) smtp.mail=yongyong313@gmail.com; dkim=pass header.i=yongyong313@gmail.com Received: from mr.google.com ([10.68.233.168]) by 10.68.233.168 with SMTP id tx8mr53096673pbc.72.1331053277212 (num_hops = 1); Tue, 06 Mar 2012 09:01:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=P7U6hgc2hCpA5lQcaUUlMYpZjlXriGtd1Dt2/qpwaJQ=; b=XzcAQh8cmyJauMZJ5AXj0aau/KzLW7xGWxPyGDT4mO3oQqqORT3TFml2O7J8fnD0Xf 9S3spGD52D5Uj0IfSxL4rBhU7ys4tBfQJPpmq084/sNX/PfembNARDg47+dEMzOmaler Vz+a5SSVWO8bc9R/fd7fR6mQppNKGZaUu7EMaSCfC/j6Dl809UW1oaPgAbcGlqC4Zu9u adjkxnVlNFmHArski/uZx0BwadLDaDZNua/9MYViWfiDexaH2iajTSVs+qj8KgYHYtqL fqmA4gJO4pc7S8fwWvJyjT1fF/x/83p54b03V/HtConLoMv20pVkGd4uDcqrDpGrmbE2 7akw== MIME-Version: 1.0 Received: by 10.68.233.168 with SMTP id tx8mr45549532pbc.72.1331053277139; Tue, 06 Mar 2012 09:01:17 -0800 (PST) Received: by 10.68.131.36 with HTTP; Tue, 6 Mar 2012 09:01:17 -0800 (PST) Date: Tue, 6 Mar 2012 18:01:17 +0100 Message-ID: Subject: a question about append operation of HFile.Writer From: yonghu To: user@hbase.apache.org Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org Hello, One HFile consists of many blocks. Suppose we have two blocks, b1 and b2. The size of each block is 2K. In b1, we have two key-value pairs, whose keys are t1 and t2, separately. Each key-value pair is 1K. So the b1 is full. Suppose that now we insert a new tuple which key is also t1. The HBase will call the HFile.Writer.append(kv) method to insert t1 into b2, because b1 is full. This is how I understand HFile.Writer.append() operation. But when I write a test program as follows: //block size is 2K HFile.Writer hwriter = new HFile.Writer(fs, new Path("hdfs://localhost:8020/huyong/test"), 2, (Compression.Algorithm)null, null); //key-value 1K byte[] key2 = "Bim".getBytes(); byte[] value2 = new byte[1024]; for(int i=0;i<1024;i++){ value2[i] = 'b'; } hwriter.append(key2, value2); byte[] key3 = "Cim".getBytes(); byte[] value3 = new byte[1024]; for(int i=0;i<1024;i++){ value3[i] = 'c'; } hwriter.append(key3, value3); byte[] key4 = "Bim".getBytes(); byte[] value4 = new byte[1024]; for(int i=0;i<1024;i++){ value4[i] = 'b'; } hwriter.append(key4, value4); Then, I get the following error information: Added a key not lexically larger than previous key=Bim, lastkey=Cim So it seems that the key order in all blocks is ascendant, the key in the first block is smaller than the second one. But if I want to insert a tuple which key is as same as the previous block, but previous block has no room for that key-value, what will happen? Thanks! Yong