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 5507BDEE8 for ; Wed, 16 Jan 2013 15:54:17 +0000 (UTC) Received: (qmail 56034 invoked by uid 500); 16 Jan 2013 15:54:17 -0000 Delivered-To: apmail-hbase-issues-archive@hbase.apache.org Received: (qmail 55686 invoked by uid 500); 16 Jan 2013 15:54:16 -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 55569 invoked by uid 99); 16 Jan 2013 15:54:15 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 16 Jan 2013 15:54:15 +0000 Date: Wed, 16 Jan 2013 15:54:15 +0000 (UTC) From: "Matteo Bertozzi (JIRA)" To: issues@hbase.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (HBASE-7579) HTableDescriptor equals method fails if results are returned in a different order 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-7579?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13555144#comment-13555144 ] Matteo Bertozzi commented on HBASE-7579: ---------------------------------------- Add a unit test, to verify equals() and compareTo(). {code} result = families.size() - other.families.size(); + + if(result!=0 ) { + return result; + } } if (result == 0 && families.size() != other.families.size()) { {code} There're lots of redundant check here... why we check two times for families.size()? why we check for == 0 when we return on != 0? > HTableDescriptor equals method fails if results are returned in a different order > --------------------------------------------------------------------------------- > > Key: HBASE-7579 > URL: https://issues.apache.org/jira/browse/HBASE-7579 > Project: HBase > Issue Type: Bug > Components: Admin > Reporter: Aleksandr Shulman > Assignee: Aleksandr Shulman > Priority: Minor > Fix For: 0.96.0, 0.94.5 > > Attachments: HBASE-7579-v1.patch > > > HTableDescriptor's compareTo function compares a set of HColumnDescriptors against another set of HColumnDescriptors. It iterates through both, relying on the fact that they will be in the same order. > In my testing, I may have seen this issue come up, so I decided to fix it. > It's a straightforward fix. I convert the sets into a hashset for O(1) lookups (at least in theory), then I check that all items in the first set are found in the second. > Since the sizes are the same, we know that if all elements showed up in the second set, then they must be equal. -- 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