From user-return-17403-apmail-cassandra-user-archive=cassandra.apache.org@cassandra.apache.org Mon Jun 6 16:08:03 2011 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 592CA44BB for ; Mon, 6 Jun 2011 16:08:03 +0000 (UTC) Received: (qmail 78475 invoked by uid 500); 6 Jun 2011 16:08:01 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 78435 invoked by uid 500); 6 Jun 2011 16:08:01 -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 78427 invoked by uid 99); 6 Jun 2011 16:08:01 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jun 2011 16:08:01 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of pjulien@gmail.com designates 209.85.212.44 as permitted sender) Received: from [209.85.212.44] (HELO mail-vw0-f44.google.com) (209.85.212.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jun 2011 16:07:55 +0000 Received: by vws12 with SMTP id 12so3640882vws.31 for ; Mon, 06 Jun 2011 09:07:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type:content-transfer-encoding; bh=pEVQba84WmHGNnuixoXFOJQh/c3JSDmCsXiPRIYxyTY=; b=xd4LsNIfD0H17/F/IAOAz6W3BLF6RWufVe0DIsgScEj4E277Hn7qQhnkccHLXfK9Ds okwuyQgw4DOCJVbjS5tWdxBhay/NDVi18fEHa/2gxP+POJbUeq14O3BE9XZh5sWcCnDR d2DBTWRmQwD29xtlR/6ovabCBNcsV14OsR9YA= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=wLOT/9a0S6R4IC/1yIbvHAfh8ka3GH7pC3njr4y1q7gffK+SY84RLI33wdkg1alZC2 qybmPcqVLLz1O/FtUo5G/EZBKU+Zu8sDsIJOxHSBQHUZoYmQMnmPhFglR8px6J2YktrB fsNGrYBcsPg2nGvLIf1od85Ga0DWZ08LpEWsQ= MIME-Version: 1.0 Received: by 10.52.179.131 with SMTP id dg3mr5972289vdc.9.1307376453967; Mon, 06 Jun 2011 09:07:33 -0700 (PDT) Received: by 10.52.155.99 with HTTP; Mon, 6 Jun 2011 09:07:33 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Jun 2011 12:07:33 -0400 Message-ID: Subject: Re: working with time uuid From: Patrick Julien To: user@cassandra.apache.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Virus-Checked: Checked by ClamAV on apache.org thanks On Mon, Jun 6, 2011 at 11:52 AM, Paul Loy wrote: > private static int compareTimestampBytes(ByteBuffer o1, ByteBuffer o2= ) > { > int o1Pos =3D o1.position(); > int o2Pos =3D o2.position(); > > int d =3D (o1.get(o1Pos+6) & 0xF) - (o2.get(o2Pos+6) & 0xF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos+7) & 0xFF) - (o2.get(o2Pos+7) & 0xFF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos+4) & 0xFF) - (o2.get(o2Pos+4) & 0xFF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos+5) & 0xFF) - (o2.get(o2Pos+5) & 0xFF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos) & 0xFF) - (o2.get(o2Pos) & 0xFF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos+1) & 0xFF) - (o2.get(o2Pos+1) & 0xFF); > if (d !=3D 0) return d; > > d =3D (o1.get(o1Pos+2) & 0xFF) - (o2.get(o2Pos+2) & 0xFF); > if (d !=3D 0) return d; > > return (o1.get(o1Pos+3) & 0xFF) - (o2.get(o2Pos+3) & 0xFF); > } > > Looks like it's only comparing the timestamp bytes. > > On Mon, Jun 6, 2011 at 4:06 PM, Patrick Julien wrote: >> >> How does this work exactly? =A0If you're using generation 1 time uuids >> for your keys to get ordering, doesn't this mean the keys need to be >> generated all on the same host when you either query or insert? =A0Or >> does cassandra only inspect the bits that represent the time stamp of >> the UUID when performing a lookup? > > > > -- > --------------------------------------------- > Paul Loy > paul@keteracel.com > http://uk.linkedin.com/in/paulloy >