Return-Path: X-Original-To: apmail-cassandra-commits-archive@www.apache.org Delivered-To: apmail-cassandra-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 28F6A10C4D for ; Thu, 27 Feb 2014 12:34:28 +0000 (UTC) Received: (qmail 24314 invoked by uid 500); 27 Feb 2014 12:34:27 -0000 Delivered-To: apmail-cassandra-commits-archive@cassandra.apache.org Received: (qmail 24103 invoked by uid 500); 27 Feb 2014 12:34:25 -0000 Mailing-List: contact commits-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cassandra.apache.org Delivered-To: mailing list commits@cassandra.apache.org Received: (qmail 23801 invoked by uid 99); 27 Feb 2014 12:34:21 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 27 Feb 2014 12:34:21 +0000 Date: Thu, 27 Feb 2014 12:34:21 +0000 (UTC) From: "Sylvain Lebresne (JIRA)" To: commits@cassandra.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Created] (CASSANDRA-6778) FBUtilities.singleton() should use the CF comparator MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 Sylvain Lebresne created CASSANDRA-6778: ------------------------------------------- Summary: FBUtilities.singleton() should use the CF comparator Key: CASSANDRA-6778 URL: https://issues.apache.org/jira/browse/CASSANDRA-6778 Project: Cassandra Issue Type: Bug Reporter: Sylvain Lebresne Assignee: Sylvain Lebresne Fix For: 2.0.6 We sometimes use FBUtilities.singleton() to created a SortedSet for NamesQueryFilter. However, the set created by that method does not use the CF comparator, so that it use ByteBuffer comparison/equality for methods like contains(). And this might not be ok if it turns that the comparator is so that 2 column name can be equal without their binary representation being equal, and as it turns out at least IntegerType, DecimalType (because they let you put arbitrary many zeros in front of the binary encoding) have such property (BooleanType should also have that property though it doesn't in practice which I think that's a bug, but that's for another ticket). I'll note that CASSANDRA-6733 contains an example where this matter. However, in practice, only SELECT on compact tables that select just one column can ever ran into that and you'd only run into it if your client insert useless zeros in its IntegerType/DecimalType binary representation, which ought to be not common in the first place. It's still wrong and should be fixed. Patch attached to include the comparator in FBUtilities.singleton. I also found 2 other small places where we were using ByteBuffer.equals() where the comparator should be used instead and attaching a 2nd patch for those. -- This message was sent by Atlassian JIRA (v6.1.5#6160)