So problem solved!

On Sun, Nov 13, 2016 at 1:37 PM, Ali Akhtar <ali.rac...@gmail.com> wrote:

> Yeah, I am using set<label> (not set<text> though)
>
> On Sun, Nov 13, 2016 at 5:36 PM, DuyHai Doan <doanduy...@gmail.com> wrote:
>
>> Yes you'd have to know the UDT values since it's part of the primary key
>> to query your data.
>>
>> If I were you I would stick to using a set<text> and use UPDATE my_table
>> SET labels = labels + <new_label>;
>>
>> It does work well with concurrent updates.
>>
>> On Sun, Nov 13, 2016 at 1:32 PM, Ali Akhtar <ali.rac...@gmail.com> wrote:
>>
>>> But then how would you query it? You'd need to know all the values of
>>> the udt, right?
>>>
>>> On Sun, Nov 13, 2016 at 5:30 PM, DuyHai Doan <doanduy...@gmail.com>
>>> wrote:
>>>
>>>> "Also can you make a UDT a clustered key?" --> yes if it's frozen
>>>>
>>>> On Sun, Nov 13, 2016 at 1:25 PM, Ali Akhtar <ali.rac...@gmail.com>
>>>> wrote:
>>>>
>>>>> 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 <
>>>>> khangaon...@gmail.com> 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 <ali.rac...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> I have a table where each record contains a list<string> 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/
>>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>

Reply via email to