0

While trying to work on Casandra we Recently faced a strange issue. Our current implementation is Cassandra + Spring MVC + Kundera.

Issue:: We are trying to save the object via persist method of EntityManager. But the behaviour is very inconsistent, at times its not saving the details on DB. On checking the application logs there is no error or exception, rather it saves successfully.

Another issue which we are facing is, While trying to debug some test set, we deleted a row from Casandra. And made the application to reinsert it. But after deleting and saving the row multiple times, Now it is not able to show the new records..

The Casandra server I have is a single node server running on my machine.

Please suggest.

I Bajwa PHD
  • 1,708
  • 1
  • 20
  • 42
Puneet
  • 11
  • 1
  • 3

1 Answers1

0

I faced a similar things when re-writing the same column, it drove me crazy!
A Column in Cassandra has an implicit timestamp ... just to make an example

public class Column {  

   private final String key;
   private final String value;
   private final Long timeStamp;

    public Column(String key, String value) {
        this(key, value, System.currentTimeMillis());
    }   

    private Column(String key, String value, Long timeStamp) {
        this.key = key;
        this.value = value;
        this.timeStamp = timeStamp;
    }

    //other methods etc.
}

said that, if you perform the following operations:

Column col = new Column("akey", "avalue");
write(cf, col); 
delete(cf, col);
write(cf, col);

When you've finished the following operations you'd expect to find the column inside cf but it won't be there, since there is a delete operation with a timestamp higher than the column timestamp you're trying to write. To make it work you should create the column again ...

Column col = new Column("akey", "avalue");
write(cf, col); 
delete(cf, col);
Column col_new_timestamp = new Column("akey", "avalue");
write(cf, col_new_timestamp);

HTH, Carlo

Carlo Bertuccini
  • 19,615
  • 3
  • 28
  • 39
  • Hi, I am already doing this by creating a new object everytime... and i am deleting it via cqlsh direct query.. And after that asking the system to insert the object.. And it fails to do that.. – Puneet Jul 29 '14 at 05:54
  • Please update your post with some piece of code, like how you create the object and so on. I'm almost sure it's a timestamp issue – Carlo Bertuccini Jul 29 '14 at 06:54