Open rotemfogel opened 11 years ago
Mark as duplicate #367
@rotemfogel are you seeing following ? If yes, then it's an expected behavior.
cqlsh:myks> select * from users;
user_name | emails -----------+------------------------ r3 | {'e@y.com', 'f@y.com'} r2 | {'c@y.com', 'd@y.com'}
cqlsh:myks> delete emails from users where user_name = 'r3'; cqlsh:myks> select * from users;
user_name | emails -----------+------------------------ r3 | null r2 | {'c@y.com', 'd@y.com'}
This is not the case. What you are showing me here is a perfectly understandable behavior due to tombstone in Cassandra. I am talking about the case when removing the last value in a list object, the data still resides in the database, although list is saved as empty. I bypassed the bug by deleting the row, if list is empty. However it is not the correct behavior. I expect the client to cope with this change.
Hi astyanaxes, I am using astyanax with Apache Cassandra 1.2. I have stumbled upon a strange behavior and I want to ask if it's Cassandra issue or Astyanax issue: A user object has a set. the set is part of the user data. user is saved using entitypersister. when set is empty, record is not deleted in Cassandra.
@Entity public static class User { @Id final private String id = "1"; @Column protected Set likes;
}
// create user User user = new User(); user.like(COCA_COLA); System.out.println("initial user: " + user); // save user final EntityManager<User, String> userManager = new DefaultEntityManager.Builder<User, String>().withEntityType(User.class).withKeyspace(keyspace).withColumnFamily(CF_TEST).build(); userManager.put(user);
// fetch user user = userManager.get(ID); System.out.println("db user: " + user);
// modify && save user.unlike(COCA_COLA); userManager.put(user); System.out.println("modified user: " + user);
// fetch user - expected - empty set user = userManager.get(ID); System.out.println("final user: " + user);