Background
Astyanax Entity Persister stores an object map in multiple columns. Format: mapVariable.key
Problem:
Astyanax Entity Persister does not remove deleted key / value pairs from cassandra when updating a map in an object
The solution I'm using right now (bad approach)
I delete the whole line and then insert it again
Additional Information
I save my java objects in cassandra using astyanax Entity Persister (com.netflix.astyanax.entitystore).
I noticed that when an object map is saved, say, with two values: testkey: testvalue and testkey2: testvalue2, and the next time the same object map is saved with one value (one key / value pair was deleted): testkey : testvalue, testkey2: testvalue2 is not removed from the column family.
So, as a workaround, I need to delete the entire line and then insert it again.
My insert code:
final EntityManager<T, String> entityManager = new DefaultEntityManager.Builder<T, String>() .withEntityType(clazz) .withKeyspace(getKeyspace()) .withColumnFamily(columnFamily) .build(); entityManager.put(entity);
What am I missing? This is really inefficient, and I think the astyanax entity persister should take care of this on its own.
Any thoughts?
source share