can delete action rollback now ?(cassandra1.1.6)
I find that delete action can not rollback now in the sample code .(by using cassandra) in kundera 2.3 , can delete action rollback?
If you work within Transaction boundary and explicitly invoke rollback before "commit", it can be rolled back. Or if any runtime exception it will implicitly rollback( if transaction has been begun)
Have a look at: https://github.com/impetus-opensource/Kundera/wiki/Transaction-Management
For it's usage.
-Vivek
thanks for your answer! but, i know that only cassandra 1.2 can surrport atomic. Please look at it: http://www.datastax.com/dev/blog/atomic-batches-in-cassandra-1-2
How kundera do it? kundera do the transaction only in the client's cache not by the cassandra db. is it right? so before commit, the table is not locked really by db?
Cassandra does not supports transaction, so in case of sucessful commit in "commit log" will be persisted.
What kundera does, maintains an event log of such processes and if opted for transaction, will flush them down in one go. So if something fails after, it can be immediately rollback by Kundera. This is useful when you consider "poly glot" persistence.
Yes, Kundera do the transaction at client side as cassandra does not support it!(server side). Table is not locked till you explicitly commit!
For Atomic batches, kundera wraps it with "batch.size" property, if you enable it in your persistence.xml, have a look at: https://github.com/impetus-opensource/Kundera/wiki/Batch-insert-update
-Vivek
i see now. by the way, when commit, is kundera use batch to save data to cassandra db now or in the future? i know that Atomic batches is ok in cassandra 1.2.
If you define "batch.size" property, it will save data in atomic batches in cassandra.
-Vivek
begin() ..update data ..insert data commit();
↑ when commit, kundera flush data by batch or atomic batch?
Define:
<property name="kundera.batch.size" value="5000" />
in persistence.xml
This will enable batch operation within kundera.
Now, if want to run within transaction, then you need to:
begin() ..update data ..insert data commit();
-Vivek
it means that i can only select one mode(transaction or batch) in my program?
:) You can select both !
Consider a scenario where you are dealing with multiple data sources then atomicity can not be guaranteed by cassandra!, but using transaction within kundera, you can.
-Vivek
i see, by the way , the batch size can be set in program? like, client.setBatchSize(),
No. this is one time setting for each emf.
-Vivek
i see,thank you very much. by the way , in No.247 row of fellow file, it says that delete can not rollback now, is it really?
https://github.com/impetus-opensource/Kundera/trunk/kundera-cassandra/src/test/java/com/impetus/client/crud/EntityTransactionTest.java
This is because, Cassandra does not allow you to reuse delete row key(at that time)! Not sure if it is enabled now
-Vivek
i see. thank you!!! let me close this issue!