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.

4

1 回答 1

0

我在重写同一个专栏时遇到了类似的事情,这让我发疯了!
Cassandra 中的一列有一个隐含的时间戳......只是举个例子

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.
}

表示,如果执行以下操作:

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

当您完成以下操作后,您希望在 cf 中找到该列,但它不会存在,因为有一个时间戳高于您尝试写入的列时间戳的删除操作。要使其正常工作,您应该再次创建该列...

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,卡罗

于 2014-07-28T13:30:28.933 回答