cassandra-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From anuya joshi <>
Subject Re: Unable to add columns to empty row in Column family: Cassandra
Date Thu, 19 May 2011 20:06:23 GMT
Thank you Narendra/Aaron. Sorry for late respponse.  PFB further information
on this.

1) How do you delete the data in the cli ? Is it a row delete e.g. del
    *[Anuya]:* Yeach. Exactly the same way.

2) What client are you using the insert the row the second time ? e.g.
custom thrift wrapper or pycassa
    *[Anuya]:* I am using Thrift APIs in JAVA code directly. No high level
Cassandra client. I am using Cassandra client's INSERT and REMOVE methods
to insert and delete rows programmatically.

3) How is the second read done, via the cli ?
    *[Anuya]:* Operations are as follows:
                  1) INSERT #1: Programmatically
                  2) DELETE #1: Command line
                  3) INSERT #2: Programmatically

    A READ opeation, after each of the above steps, is done using CLI

4) Does the same test work when you only use your app ?
    *[Anuya]:* Exactly, INSERT -> DELETE -> INSERT scenario with same
row key works well if executed only from command line OR  only
programmatically. Basically, over here, I am trying to resuse the row key.
So, I create a row with a specific key, delete that row (But, Cassandra
delete does not delete a row key.  Only deletes all columns in a row.) and
then I want to insert the columns in a same row with same row id.  Correct
me if I go wrong, reusing the row key should work as per Cassandra data
model definition/structure.

5) Cassandra-cli will be using the current time as it's time stamp for the
delete. If I had to guess what was happening it would be a problem with the
timestamps your app is creating.
    *[Anuya]:* Well, regarding timestamps......
    My JAVA code to generate timstamps is simply: System.currentTimeMillis();
So, I also use current time as a timestamp similar to Cassandra as you
mentioned. Then, irrespective of which client was used for insert/delete
operations, this INSERT -> DELETE -> INSERT scenario should work. Because,
as per the sequence of these operations (INSERT -> DELETE -> INSERT) the
timestamp condition *TS[INSERT #2] > TS[DELETE  #1] > TS[INSERT  #1] will be
obviously satisfied. *
    But, the fact is, this scenario does not work while switching between
clients for INSERT and DELETE opeations as mentioned in point #3 above.

    So, is this a clock synchronization issue? I mean the clock used by
program to generate timstamps is out of sync with clock used by CLI?

    On this, FYI, I am running linux based VMs which in turn run a Cassandra
servers. The command line client is obviously on VM and the JAVA program is
on host machine running a VM.  If the clocks of these two machines are in
sync then, I think, switching between clients should not matter?

    Before I hit the send button, :), I scrutinized the clocks on VM and
host m/c. The clock on VM is exactly 4 seconds behind the clock on host m/c.

    I welcome your comments on above.


On Thu, May 12, 2011 at 4:31 PM, Narendra Sharma

> Can u share the code?
> On Mon, May 2, 2011 at 11:34 PM, anuya joshi <> wrote:
>> Hello,
>> I am using Cassandra for my application.My Cassandra client uses Thrift
>> APIs directly. The problem I am facing currently is as follows:
>> 1) I added a row and columns in it dynamically via Thrift API Client
>> 2) Next, I used command line client to delete row which actually deleted
>> all the columns in it, leaving empty row with original row id.
>> 3) Now, I am trying to add columns dynamically using client program into
>> this empty row with same row key
>>     However, columns are not being inserted.
>>     But, when tried from command line client, it worked correctly.
>> Any pointer on this would be of great use
>> Thanks in  advance,
>> Regards,
>> Anuya
> --
> Narendra Sharma
> Solution Architect
> **
> **

View raw message