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 1248910240 for ; Tue, 21 Jan 2014 19:45:00 +0000 (UTC) Received: (qmail 60279 invoked by uid 500); 21 Jan 2014 19:44:57 -0000 Delivered-To: apmail-cassandra-user-archive@cassandra.apache.org Received: (qmail 60237 invoked by uid 500); 21 Jan 2014 19:44:56 -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 60229 invoked by uid 99); 21 Jan 2014 19:44:56 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jan 2014 19:44:56 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy includes SPF record at spf.trusted-forwarder.org) Received: from [209.85.223.172] (HELO mail-ie0-f172.google.com) (209.85.223.172) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 21 Jan 2014 19:44:52 +0000 Received: by mail-ie0-f172.google.com with SMTP id e14so10484511iej.3 for ; Tue, 21 Jan 2014 11:44:31 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:content-type; bh=sBUBKdAz1P0CTpC2kTLTikUUvjbl0gbTYMkZWsSa1bY=; b=ULWvLzWJ/abdT5Q4XAr+X8H8whYDUoQlWz5KmLf+Ef3qz7A15m9/MbAkt7RHK2iNKA zc7viRzFoNAWNDvwNvYs28XXomJLckdHodFCfC9ubQV/inP4kpXJI2LCUrg3js0xGZ7e Fo7z7oNFoVjkSTBX/EoR76ACJMlrdztFscBff2Ey0QRW+j6GRmoIvL7o5seWmjnuudnn 0vbL7VzwFJ3LJxN/6doYJCUOi/KYe6Ruv8BrM8ozFUD0hSm4aGEtq4iQ/cA8cH4k3wUE F98KrlCWgqK51Q7toyhE53RbgzD8HI7bDpwztln/BEZouXuc+D/Q265X3tDkqLbh31EY yrEA== X-Gm-Message-State: ALoCoQkv6WN+4JiLSTYQ2pj3GhoBtK46OXY9wJiZPRHNU7onjbhxBtAtIU8Ywx/vqJAqjO2ZBCyt MIME-Version: 1.0 X-Received: by 10.50.50.70 with SMTP id a6mr19595874igo.1.1390333471377; Tue, 21 Jan 2014 11:44:31 -0800 (PST) Received: by 10.64.23.5 with HTTP; Tue, 21 Jan 2014 11:44:31 -0800 (PST) X-Originating-IP: [107.0.165.2] Received: by 10.64.23.5 with HTTP; Tue, 21 Jan 2014 11:44:31 -0800 (PST) In-Reply-To: References: <2BD9AA00-B00C-4E0A-9225-046A387B8591@venarc.com> <27C7F754-9CF4-4F63-A03F-0A8A52E11323@venarc.com> Date: Tue, 21 Jan 2014 11:44:31 -0800 Message-ID: Subject: Re: Data modeling users table with CQL From: Tupshin Harper To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=089e010d9d40ae96f004f0803cc3 X-Virus-Checked: Checked by ClamAV on apache.org --089e010d9d40ae96f004f0803cc3 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable It's a broad topic, but I mean all of the best practices alluded to by writeups like this. http://www.technicalinfo.net/papers/WebBasedSessionManagement.html -Tupshin On Jan 21, 2014 11:37 AM, "Drew Kutcharian" wrote: > Cool. BTW, what do you mean by have additional session tracking ids? > What=92d that be for? > > - Drew > > On Jan 21, 2014, at 10:48 AM, Tupshin Harper wrote: > > It does sound right. > > You might want to have additional session tracking id's, separate from > the user id, but that is an additional implementation detail, and could b= e > external to Cassandra. But the approach you describe accurately describe= s > what I would do as a first pass, at least. > > -Tupshin > On Jan 21, 2014 10:41 AM, "Drew Kutcharian" wrote: > >> Thanks, I was actually thinking of doing that. Something along the lines >> of >> >> CREATE TABLE user ( >> id timeuuid PRIMARY KEY, >> email text, >> name text, >> ... >> ); >> >> CREATE TABLE user_email_index ( >> email text, >> id timeuuid, >> PRIMARY KEY (email, id) >> ); >> >> And during registration, I would just use LWT on the user_email_index >> table first and insert the record and then insert the actual user record >> into user table w/o LWT. Does that sound right to you? >> >> - Drew >> >> >> >> On Jan 21, 2014, at 10:01 AM, Tupshin Harper wrote= : >> >> One CQL row per user, keyed off of the UUID. >> >> Another table keyed off of email, with another column containing the UUI= D >> for lookups in the first table. Only registration will require a >> lightweight transaction, and only for the purpose of avoiding duplicate >> email registration race conditions. >> >> -Tupshin >> On Jan 21, 2014 9:17 AM, "Drew Kutcharian" wrote: >> >>> A shameful bump ;) >>> >>> > On Jan 20, 2014, at 2:14 PM, Drew Kutcharian wrote: >>> > >>> > Hey Guys, >>> > >>> > I=92m new to CQL (but have been using C* for a while now). What would= be >>> the best way to model a users table using CQL/Cassandra 2.0 Lightweight >>> Transactions where we would like to have: >>> > - A unique TimeUUID as the primary key of the user >>> > - A unique email address used for logging in >>> > >>> > In the past I would use Zookeeper and/or Astyanax=92s "Uniqueness >>> Constraint=94 but I want to see how can this be handled natively. >>> > >>> > Cheers, >>> > >>> > Drew >>> > >>> >> >> > --089e010d9d40ae96f004f0803cc3 Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable

It's a broad topic, but I mean all of the best practices= alluded to by writeups like this.

http://www.technicalinfo.net/papers/WebBasedSessionManag= ement.html

-Tupshin

On Jan 21, 2014 11:37 AM, "Drew Kutcharian&= quot; <drew@venarc.com> wrote:=
Cool. BTW, what do you mean by have add= itional session tracking ids? What=92d that be for?

- Dr= ew

On Jan 21, 2014, at 10:48 AM, Tupshin Harper <<= a href=3D"mailto:tupshin@tupshin.com" target=3D"_blank">tupshin@tupshin.com= > wrote:

It does sound right.=A0

You might want to have additional session tracking id's,= =A0 separate from the user id, but that is an additional implementation det= ail, and could be external to Cassandra.=A0 But the approach you describe a= ccurately describes what I would do as a first pass, at least.

-Tupshin

On Jan 21, 2014 10:41 AM, "Drew Kutcharian&= quot; <drew@venarc.= com> wrote:
Thanks, I was actually thinking of doin= g that. Something along the lines of=A0

CREATE TABL= E user (
=A0 id =A0 =A0timeuuid PRIMARY KEY,
=A0 email = =A0 =A0text,
=A0 name =A0 =A0text,
=A0 ...
);
<= br>
CREATE TABLE user_email_index (
=A0 email =A0t= ext,
=A0 id =A0timeuuid,
=A0 PRIMARY KEY (email, id)
);

And during registration, I would just use LWT on = the user_email_index table first and insert the record and then insert the = actual user record into user table w/o LWT. Does that sound right to you?

- Drew



On Jan 21, 2014, at 10:01 AM, Tupshin Harper <tupshin@tupshin.com> wrote:

One CQL row per user, keyed of= f of the UUID.=A0

Another table keyed off of email, with= another column containing the UUID for lookups in the first table.=A0 Only= registration will require a lightweight transaction, and only for the purp= ose of avoiding duplicate email registration race conditions.

-Tupshin

On Jan 21, 2014 9:17 AM, "Drew Kutcharian&q= uot; <drew@venarc.c= om> wrote:
A shameful bump ;)

> On Jan 20, 2014, at 2:14 PM, Drew Kutcharian <drew@venarc.com> wrote:
>
> Hey Guys,
>
> I=92m new to CQL (but have been using C* for a while now). What would = be the best way to model a users table using CQL/Cassandra 2.0 Lightweight = Transactions where we would like to have:
> - A unique TimeUUID as the primary key of the user
> - A unique email address used for logging in
>
> In the past I would use Zookeeper and/or Astyanax=92s "Uniqueness= Constraint=94 but I want to see how can this be handled natively.
>
> Cheers,
>
> Drew
>


--089e010d9d40ae96f004f0803cc3--