Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 24A9C200BBC for ; Sun, 13 Nov 2016 13:26:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 23197160AF8; Sun, 13 Nov 2016 12:26:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 468D3160AF2 for ; Sun, 13 Nov 2016 13:26:06 +0100 (CET) Received: (qmail 34442 invoked by uid 500); 13 Nov 2016 12:26:04 -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 34432 invoked by uid 99); 13 Nov 2016 12:26:04 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Sun, 13 Nov 2016 12:26:04 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id B0C5BC0595 for ; Sun, 13 Nov 2016 12:26:03 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 3.129 X-Spam-Level: *** X-Spam-Status: No, score=3.129 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, HTML_MESSAGE=2, KAM_LIVE=1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-us.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id jXjTnIxWNObB for ; Sun, 13 Nov 2016 12:26:01 +0000 (UTC) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by mx1-lw-us.apache.org (ASF Mail Server at mx1-lw-us.apache.org) with ESMTPS id 3B9875F2F2 for ; Sun, 13 Nov 2016 12:26:01 +0000 (UTC) Received: by mail-wm0-f49.google.com with SMTP id t79so53647740wmt.0 for ; Sun, 13 Nov 2016 04:26:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=RJAbfDTtpu0NyG4oJsBZMV6lpKi7sujOeW79WaI89eg=; b=T8uqJ34KzxbUhktDfuAmc/+FxIDp4gHd91EBb8IwvpDFLbWcFQOQ+IBT8Azh4hjPY2 g+sRE1zOFrpE95rl3DNK3LIlrij+V5INAMyKRxVUk4UR5F3khuiok9ohjyp+WdETOO4m hYZIhoY4YgoL7uHbbOIqDwh9ZHmD/KSBtCJoldlCj0y71GNnGjw3nkKjRO5B9ZZ2hxWT ibbP5oZB8iQeikmMdjhqtYWHz5Ua+xL2dk5hCS9G5bTqTnq9GsqJsAgMjCJCU+TlpNp2 KtxYApNx3gYYBeQZzeVTxMbclolpA5FFMmg1HUBSBiK1jbbjymH6vCPNRgMj7goUl6EW 9B5Q== 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:from:date :message-id:subject:to; bh=RJAbfDTtpu0NyG4oJsBZMV6lpKi7sujOeW79WaI89eg=; b=jvQ5AYBaMMyyA9YyBmFgctklq+h6QN96aod5w5KL0m0hBPU8fCOJ56SGWIQi/gDStg GzX1rAcgz/6sgrOac30X8LBAvjxJIgh+/ryzNF8r8ifvB0FRDSDL36Ff0YtU58qFX/HP ow0PR9wy4lLsZjFScq9klI/3qBmnUNpN2B09CVdMUHvLOv6obKxFcMO+xeZTZ4jcqnhS o+Ad+tH749ChJ9yWz1o1qUVY5dt7ma84/k6bqUkoA8QHLYQR4HJPJ67vD2PU47sQCcrH 9l+AR9SgvFmL+RFw6M7c9BaGHBEBpZvMSxi52o8D7mZPRCBXLN7ED5ZTa97tUuoc+zrQ 3q1Q== X-Gm-Message-State: ABUngvdDab6mynAio537iI4kIhhVSBIc9XP4AT4Lc3ZXwAV5GyjszH48rWwW7edovDkwqHiATmYMffWtUCAWdQ== X-Received: by 10.194.52.8 with SMTP id p8mr15553182wjo.38.1479039959783; Sun, 13 Nov 2016 04:25:59 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.50.197 with HTTP; Sun, 13 Nov 2016 04:25:58 -0800 (PST) In-Reply-To: References: From: Ali Akhtar Date: Sun, 13 Nov 2016 17:25:58 +0500 Message-ID: Subject: Re: Consistency when adding data to collections concurrently? To: user@cassandra.apache.org Content-Type: multipart/alternative; boundary=047d7b873f806961af05412dd334 archived-at: Sun, 13 Nov 2016 12:26:07 -0000 --047d7b873f806961af05412dd334 Content-Type: text/plain; charset=UTF-8 If I wanted to get all values for an item, including its labels, how would that be done in the above case? Also can you make a UDT a clustered key? On Sun, Nov 13, 2016 at 4:33 AM, Manoj Khangaonkar wrote: > Hi, > > Instead of using a collection, consider making label a clustered column. > > With this each request will essentially append a column (label) to the > partition. > > To get all labels would be a simple query > > select label from table where partitionkey = "value". > > In general , read + update of a column is an anti pattern in cassandra - > which is what you are doing. What I suggesting > above is appending more columns and not updating existing columns. > > regards > > regards > > On Sat, Nov 12, 2016 at 2:34 AM, Ali Akhtar wrote: > >> I have a table where each record contains a list of labels. >> >> I have an endpoint which responds to new labels being added to a record >> by the user. >> >> Consider the following scenario: >> >> - Record X, labels = [] >> - User selects 2 labels, clicks a button, and 2 http requests are >> generated. >> - The server receives request for Label 1 and Label 2 at the same time. >> - Both requests see the labels as empty, add 1 label to the collection, >> and send it. >> - Record state as label 1 request sees it: [1], as label 2 sees it: [2] >> >> How will the above conflict be resolved? What can I do so I end up with >> [1, 2] instead of either [1] or [2] after both requests have been processed? >> > > > > -- > http://khangaonkar.blogspot.com/ > --047d7b873f806961af05412dd334 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
If I wanted to get all values for an item, including its l= abels, how would that be done in the above case?

Also ca= n you make a UDT a clustered key?
On Sun, Nov 13, 2016 at 4:33 AM, Manoj Khangaon= kar <khangaonkar@gmail.com> wrote:
Hi,

I= nstead of using a collection, consider making label a clustered column.
=
With this each request will essentially append a column (label) t= o the partition.

To get all labels would be a simple query
=
select label from table where partitionkey =3D "value".=

In general , read + update=C2=A0 of a column is an anti = pattern in cassandra - which is what you are doing. What I suggesting
above is appending more columns and not updating existing columns.=

regards

regards

O= n Sat, Nov 12, 2016 at 2:34 AM, Ali Akhtar <ali.rac200@gmail.com>= ; wrote:
I have a= table where each record contains a list<string> of labels.

<= /div>
I have an endpoint which responds to new labels being added to a = record by the user.

Consider the following scenari= o:

- Record X, labels =3D []
- User sele= cts 2 labels, clicks a button, and 2 http requests are generated.
- The server receives request for Label 1 and Label 2 at the same time.
- Both requests see the labels as empty, add 1 label to the collect= ion, and send it.
- Record state as label 1 request sees it: [1],= as label 2 sees it: [2]

How will the above confli= ct be resolved? What can I do so I end up with [1, 2] instead of either [1]= or [2] after both requests have been processed?



--

--047d7b873f806961af05412dd334--