Hi shaurya,

Thanks for the response! I am using cassandra 3.11.4, but I have observed
the same nature on Cassandra 3.0.15 as well. I think by cqlsh command you
mean the updare statements. I gather the update statements mentioned by me
were rather rudimentary (for explanation purposes) but for that sake they
would look like..

UPDATE "<tableName>" USING TTL 31536000 SET "firstname"="firstname"+?,
"lastname"="lastname" + ? with params: ["leonardo","dicaprio"]

UPDATE "<tableName>" USING TTL 31536000 SET "firstname"="firstname"+?,
"lastname"="lastname" + ? with params: ["brad","pitt"]

and so on...

you can also refer to my original post on reddit,
https://www.reddit.com/r/cassandra/comments/be5vac/cassandra_update_add_ordering_issue/
For an even more informative discussion around the same.

Will appreciate any help here from the cassadnra community :)

Thanks,
Naman

On Mon, Apr 22, 2019 at 9:29 PM Shaurya Gupta <shaurya.n...@gmail.com>
wrote:

> Which version of Cassandra are you using?
> https://docs.datastax.com/en/cql/3.3/cql/cql_using/useInsertList.html and
> many other relevant pages do not mention any thing of the CQLSH command
> mentioned by you above.
>
> --
> Shaurya
>
> On Mon, Apr 22, 2019 at 6:51 PM Naman Gupta <naman.gu...@girnarsoft.com>
> wrote:
>
>> I am facing issue with cassandra ordering in the tables for column types
>> of list.
>>
>> Suppose I have a table as follows...
>> FirstName: <list> of string
>> LastName:  <list> of string
>>
>> now if were to Issue
>> update <tableName> (FirstName,LastName) add values ("Leonardo","DiCaprio")
>> update <tableName> (FirstName,LastName) add values ("Brad","Pitt")
>> update <tableName> (FirstName,LastName) add values ("mathhew","mcconehey")
>> update <tableName> (FirstName,LastName) add values ("Kate","Beckinsale")
>> update <tableName> (FirstName,LastName) add values ("Eva","Green")
>>
>>
>> If I use the upserts with some time gap in between I get expected results
>> i.e
>>
>> cqlsh output:->
>> Firsname: Leonardo | Brad | Matthew  | Kate        | Eva
>> LastName: DiCaprio | Pitt | Mcconahey | Beckinsale | Green
>>
>>
>> But If I updsert in a quick burst (Imagine in a for loop), I get
>> unexpected results
>>
>> cqlsh
>> Firstname: Leonardo | brad    | Matthew  | Kate        | Eva
>> Lastname:  pitt    | dicaprio  | Mcconahey | Beckinsale | Green
>>
>> As you can see above, generally two or so values in a column (here
>> lastname) are interchanged. When the data is more, the tendency of
>> unordering increases than 5 upsert queries
>>
>> When I flushed the db tables and took a ssTable dump using sstabledump
>> <sstableName>, I observed that the ordering reflected in the cqlsh output
>> is exactly the way it is written in the sstable. Which means that in the
>> example 2 above, for column "firstname" leonardo was written before brad
>> and for column "lastname" pitt was written before dicarpio.
>>
>> Now I am confused as to why writes which should be one one at a time are
>> seemed to be written in an unordered fashion across columns. Please note
>> that a write where the whole pair (firstname,lastname) TOGETHER changes
>> it's position is still acceptable i.e.
>>
>> cqlsh
>> Firstname: brad | leonardo    | Matthew  | Kate        | Eva
>> Lastname:  pitt    | dicaprio  | Mcconahey | Beckinsale | Green
>>
>> ... would have been completely acceptable provided the fact I will
>> retrieve them by using the indedx [0] would mean brad pitt and [1] would
>> mean leonardo dicaprio in my applications
>> But the same indexed based retrieval would fail in case 2 where [0] would
>> mean leonardo pitt and [1] would mean brad dicaprio.
>>
>> Please help with any insights, I would be really grateful.
>>
>
>
> --
> Shaurya Gupta
>
>
>

Reply via email to