Return-Path: X-Original-To: apmail-hbase-issues-archive@www.apache.org Delivered-To: apmail-hbase-issues-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6B7D1DFF5 for ; Thu, 13 Dec 2012 18:20:13 +0000 (UTC) Received: (qmail 53434 invoked by uid 500); 13 Dec 2012 18:20:13 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 53260 invoked by uid 500); 13 Dec 2012 18:20:12 -0000 Mailing-List: contact issues-help@hbase.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list issues@hbase.apache.org Received: (qmail 53250 invoked by uid 99); 13 Dec 2012 18:20:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 13 Dec 2012 18:20:12 +0000 Date: Thu, 13 Dec 2012 18:20:12 +0000 (UTC) From: "Ted Yu (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-7342) Split operation without split key incorrectly finds the middle key in off-by-one error 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/HBASE-7342?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13531272#comment-13531272 ] Ted Yu commented on HBASE-7342: ------------------------------- I extracted testBasicSplit from patch v2 and it passed. {code} Running org.apache.hadoop.hbase.regionserver.TestSplitTransactionOnCluster 2012-12-13 10:17:06.866 java[69043:1903] Unable to load realm mapping info from SCDynamicStore Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 29.711 sec {code} @Aleksandr: Can you refine your test case to show us the problem ? Thanks > Split operation without split key incorrectly finds the middle key in off-by-one error > -------------------------------------------------------------------------------------- > > Key: HBASE-7342 > URL: https://issues.apache.org/jira/browse/HBASE-7342 > Project: HBase > Issue Type: Bug > Components: HFile, io > Affects Versions: 0.94.1, 0.94.2, 0.94.3, 0.96.0 > Reporter: Aleksandr Shulman > Assignee: Aleksandr Shulman > Priority: Minor > Fix For: 0.96.0, 0.94.4 > > Attachments: HBASE-7342-v1.patch, HBASE-7342-v2.patch > > > I took a deeper look into issues I was having using region splitting when specifying a region (but not a key for splitting). > The midkey calculation is off by one and when there are 2 rows, will pick the 0th one. This causes the firstkey to be the same as midkey and the split will fail. Removing the -1 causes it work correctly, as per the test I've added. > Looking into the code here is what goes on: > 1. Split takes the largest storefile > 2. It puts all the keys into a 2-dimensional array called blockKeys[][]. Key i resides as blockKeys[i] > 3. Getting the middle root-level index should yield the key in the middle of the storefile > 4. In step 3, we see that there is a possible erroneous (-1) to adjust for the 0-offset indexing. > 5. In a result with where there are only 2 blockKeys, this yields the 0th block key. > 6. Unfortunately, this is the same block key that 'firstKey' will be. > 7. This yields the result in HStore.java:1873 ("cannot split because midkey is the same as first or last row") > 8. Removing the -1 solves the problem (in this case). -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira