cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrew Baker <baker...@gmail.com>
Subject Re: Inserting list data
Date Thu, 13 Oct 2016 18:26:17 GMT
I saw evidence of this behavior, but when we created a test to try to make
it happen it never did, we assumed it was UDT related and lost interest,
since it didn't have a big impact. I will try to carve some time to look
into this some more and let you know if I find anything.

On Wed, Oct 12, 2016 at 9:24 PM Vladimir Yudovin <vladyu@winguzone.com>
wrote:

> The data is actually appended. not overwritten.
> Strange, can you send exactly operators?
>
> Here is example I do:
> CREATE KEYSPACE events WITH replication = {'class': 'SimpleStrategy',
> 'replication_factor': 1};
> CREATE TABLE events.data (id int primary key, events list<text>);
> INSERT INTO events.data (id, events) VALUES ( 0, ['a']);
> SELECT * FROM events.data ;
>  id | events
> ----+--------
>   0 |  ['a']
>
> (1 rows)
>
> INSERT INTO events.data (id, events) VALUES ( 0, ['b']);
> SELECT * FROM events.data ;
>  id | events
> ----+--------
>   0 |  ['b']
>
> (1 rows)
>
> As you see, 'a' was overwritten by 'b'
>
>
> Best regards, Vladimir Yudovin,
>
> *Winguzone <https://winguzone.com?from=list> - Hosted Cloud Cassandra on
> Azure and SoftLayer.Launch your cluster in minutes.*
>
>
> ---- On Wed, 12 Oct 2016 23:58:23 -0400*Aoi Kadoya <cadyan.aoi@gmail.com
> <cadyan.aoi@gmail.com>>* wrote ----
>
> yes, that's what I thought. but, when I use these forms,
> INSERT ... ['A']
> INSERT ... ['B']
>
> The data is actually appended. not overwritten.
> so I guess this is something unexpected?
>
> Thanks,
> Aoi
>
> 2016-10-12 20:55 GMT-07:00 Vladimir Yudovin <vladyu@winguzone.com>:
> > If you use form
> > INSERT ... ['A']
> > INSERT ... ['B']
> >
> > latest INSERT will overwrite first, because this insert the whole list.
> It's
> > better to use UPDATE like:
> > UPDATE ... SET events = events + ['A']
> > UPDATE ... SET events = events + ['B']
> > These operations add new elements to the end of existing list.
> >
> >
> > From here
> https://docs.datastax.com/en/cql/3.0/cql/cql_using/use_list_t.html
> > :
> >
> > These update operations are implemented internally without any
> > read-before-write. Appending and prepending a new element to the list
> writes
> > only the new element.
> >
> >
> > Best regards, Vladimir Yudovin,
> > Winguzone - Hosted Cloud Cassandra on Azure and SoftLayer.
> > Launch your cluster in minutes.
> >
> >
> > ---- On Wed, 12 Oct 2016 17:39:46 -0400Aoi Kadoya <cadyan.aoi@gmail.com>
>
> > wrote ----
> >
> > Hi,
> >
> > When inserting different data into a list type column from different
> > clients at the same time, is data supposed to be combined into one
> > list?
> >
> > For example, if these 2 queries were requested from clients at the
> > same timing, how events list should look like after?
> >
> > INSERT INTO cycling.upcoming_calendar (year, month, events) VALUES
> > (2015, 06, ['A']);
> > INSERT INTO cycling.upcoming_calendar (year, month, events) VALUES
> > (2015, 06, ['B']);
> >
> > In my understanding, each operation should be treated as atomic, which
> > makes me think that even if client throw the queries at the same time,
> > cassandra would take them separately and the last insert would update
> > the events list. (= data should be either ['A'] or ['B'])
> >
> > In my environment, I found that some data was saved as like ['A',B']
> > in the case like above.
> > Is this expected behavior of list data type?
> >
> > I am still new to cassandra and trying to make myself understood how
> > this happened.
> > Appreciate if you could help me with figuring this out!
> >
> > Thanks,
> > Aoi
> >
> >
>
>

Mime
View raw message