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 0174F493D for ; Mon, 6 Jun 2011 15:52:38 +0000 (UTC) Received: (qmail 36401 invoked by uid 500); 6 Jun 2011 15:52:35 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 36371 invoked by uid 500); 6 Jun 2011 15:52:35 -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 36363 invoked by uid 99); 6 Jun 2011 15:52:35 -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 15:52:35 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=FREEMAIL_FROM,HTML_MESSAGE,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 keteracel@gmail.com designates 209.85.161.44 as permitted sender) Received: from [209.85.161.44] (HELO mail-fx0-f44.google.com) (209.85.161.44) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Jun 2011 15:52:29 +0000 Received: by fxm15 with SMTP id 15so2927329fxm.31 for ; Mon, 06 Jun 2011 08:52:09 -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; bh=U664hUDcXnUrboC3e+EZhEQmfFFxcw0sIckzYqdiwBw=; b=BsOVm+SP6p7wZuYrad4GCVp8Ka7gyVgLpOjcVueLXUERMiFbkQiWKHUzKLMTAWOQGK 4AF7D1FfJebhywnIPUooC69IwdwzwF86GiPecnkne7Dh17i9pcdDtGNPsxVJ+9oqZ3pJ eJ0IAUcKziWK+EkJ+NSrRDDx8mllCCQ+qrRLY= 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; b=JkmR+3H1GTrtQN2LpjjPYUepxF5TERd3aEkJ7/RR4yqlomaG7ARYgeuvkyK7FHm1ne fUsUcChIfLYWwNE4VnEAJztwV3RwK/LhcDRWd7rSv0Oc1apLf0m/lfHbxYi29lwsSVha d9u1dmXb18TI2kj/A8IvTLwWqwDbzJJ6ZzTEA= MIME-Version: 1.0 Received: by 10.223.55.78 with SMTP id t14mr5474299fag.43.1307375529427; Mon, 06 Jun 2011 08:52:09 -0700 (PDT) Received: by 10.223.122.71 with HTTP; Mon, 6 Jun 2011 08:52:09 -0700 (PDT) In-Reply-To: References: Date: Mon, 6 Jun 2011 16:52:09 +0100 Message-ID: Subject: Re: working with time uuid From: Paul Loy To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=001517447b3e05050804a50d16ac X-Virus-Checked: Checked by ClamAV on apache.org --001517447b3e05050804a50d16ac Content-Type: text/plain; charset=ISO-8859-1 private static int compareTimestampBytes(ByteBuffer o1, ByteBuffer o2) { int o1Pos = o1.position(); int o2Pos = o2.position(); int d = (o1.get(o1Pos+6) & 0xF) - (o2.get(o2Pos+6) & 0xF); if (d != 0) return d; d = (o1.get(o1Pos+7) & 0xFF) - (o2.get(o2Pos+7) & 0xFF); if (d != 0) return d; d = (o1.get(o1Pos+4) & 0xFF) - (o2.get(o2Pos+4) & 0xFF); if (d != 0) return d; d = (o1.get(o1Pos+5) & 0xFF) - (o2.get(o2Pos+5) & 0xFF); if (d != 0) return d; d = (o1.get(o1Pos) & 0xFF) - (o2.get(o2Pos) & 0xFF); if (d != 0) return d; d = (o1.get(o1Pos+1) & 0xFF) - (o2.get(o2Pos+1) & 0xFF); if (d != 0) return d; d = (o1.get(o1Pos+2) & 0xFF) - (o2.get(o2Pos+2) & 0xFF); if (d != 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? If 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? Or > 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 --001517447b3e05050804a50d16ac Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
    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.
<= br>
On Mon, Jun 6, 2011 at 4:06 PM, Patrick Julie= n <pjulien@gmail.= com> wrote:
How does this work exactly? =A0If you'r= e 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
--001517447b3e05050804a50d16ac--