From user-return-29364-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Mon Oct 8 19:15:17 2012 Return-Path: X-Original-To: apmail-cassandra-user-archive@www.apache.org Delivered-To: apmail-cassandra-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 D7E3C9094 for ; Mon, 8 Oct 2012 19:15:17 +0000 (UTC) Received: (qmail 82979 invoked by uid 500); 8 Oct 2012 19:15:15 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 82960 invoked by uid 500); 8 Oct 2012 19:15:15 -0000 Mailing-List: contact user-help@cassandra.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@cassandra.apache.org Delivered-To: mailing list user@cassandra.apache.org Received: (qmail 82952 invoked by uid 99); 8 Oct 2012 19:15:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2012 19:15:15 +0000 X-ASF-Spam-Status: No, hits=2.2 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [208.113.200.5] (HELO homiemail-a94.g.dreamhost.com) (208.113.200.5) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 08 Oct 2012 19:15:09 +0000 Received: from homiemail-a94.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTP id 3322338A059 for ; Mon, 8 Oct 2012 12:14:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=thelastpickle.com; h=from :content-type:message-id:mime-version:subject:date:references:to :in-reply-to; s=thelastpickle.com; bh=5Ai3MXJc4/AHvfow0l+M4M4ZY8 I=; b=nMMhJvzK5AtZAi3x+DY0fv+sDEU6XudxQAzlgeNuW/aYcFIb/0O8Y1DNJ7 AtGyPOpHApvZtu5hu6NuGF4hoKw8WxlablAnxmCZM+0mmyV+Hw/5zjMZPgV+1SsN pEKaqeqcc9aoNXMqi1d2XLnJwu0wIHCpigpqIgtw8cZXsmccc= Received: from [172.16.1.10] (unknown [203.86.207.101]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) (Authenticated sender: aaron@thelastpickle.com) by homiemail-a94.g.dreamhost.com (Postfix) with ESMTPSA id 2889438A058 for ; Mon, 8 Oct 2012 12:14:46 -0700 (PDT) From: aaron morton Content-Type: multipart/alternative; boundary="Apple-Mail=_C6D6E2DE-637C-4790-BEEF-BF4E581F2FDC" Message-Id: <48F9C2E3-FD7C-4873-9B37-6A1EF6AEE897@thelastpickle.com> Mime-Version: 1.0 (Mac OS X Mail 6.1 \(1498\)) Subject: Re: RandomPartitioner and the token limits Date: Tue, 9 Oct 2012 08:14:44 +1300 References: To: user@cassandra.apache.org In-Reply-To: X-Mailer: Apple Mail (2.1498) X-Virus-Checked: Checked by ClamAV on apache.org --Apple-Mail=_C6D6E2DE-637C-4790-BEEF-BF4E581F2FDC Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=iso-8859-1 AFAIK in the code the minimum exclusive value token is -1, so as a = signed integer the maxmium value is 2**127 Cheers ----------------- Aaron Morton Freelance Developer @aaronmorton http://www.thelastpickle.com On 4/10/2012, at 3:19 AM, Carlos P=E9rez Miguel = wrote: > Hello, >=20 > Reading the wiki of operations > (http://wiki.apache.org/cassandra/Operations) I noticed something > strange. When using RandomPartitioner, tokens are integers in the > range [0,2**127] (both limits included) but keys are converted into > this range using MD5. MD5 has 128 bits, so, tokens should not be in > the range [0, (2**128)-1]? >=20 > Anyway, if Cassandra uses only 127 bits of that 128 bits because it > tries to convert this 128 bit into a signed int, tokens should not be > in the range [0, 2**127) (first limit included, last not included)? >=20 > Thank you >=20 > Carlos P=E9rez Miguel --Apple-Mail=_C6D6E2DE-637C-4790-BEEF-BF4E581F2FDC Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=iso-8859-1 AFAIK = in the code the minimum exclusive value token is -1, so as a signed = integer the maxmium value is = 2**127

Cheers

http://www.thelastpickle.com

On 4/10/2012, at 3:19 AM, Carlos P=E9rez Miguel <cperezmig@gmail.com> = wrote:

Hello,

Reading the wiki of operations
(http://wiki.apache.or= g/cassandra/Operations) I noticed something
strange. When using = RandomPartitioner, tokens are integers in the
range [0,2**127] (both = limits included) but keys are converted into
this range using MD5. = MD5 has 128 bits, so, tokens should not be in
the range [0, = (2**128)-1]?

Anyway, if Cassandra uses only 127 bits of that 128 = bits because it
tries to convert this 128 bit into a signed int, = tokens should not be
in the range [0, 2**127) (first limit included, = last not included)?

Thank you

Carlos P=E9rez = Miguel

= --Apple-Mail=_C6D6E2DE-637C-4790-BEEF-BF4E581F2FDC--