Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting error while using BatchExecutor for multible tables using condition IF NOT EXIST #66

Open
rahulsrivastava71 opened this issue Aug 4, 2015 · 4 comments
Labels

Comments

@rahulsrivastava71
Copy link

Dear Eugene,
I wanted to use batchexecutor for executing multiple queries on multiple tables with IF NOT EXIST (@Version in mapper) condition as i when i am running the batchexecutor i am getting error "Batch with Condition cannot span multiple tables".
While when i am executing batch on single table with IF NOT EXIST(@Version in mapper) condition its is executing but when i am changing the partition key it gives error "Batch with condition cannot span same partition key ".
As i have to perform batch execution with different partition key keeping IF NOT EXIST feature is there any way out to do this.
Or have i got any alternate solution to execute batch on multiple table keeping IF NOT EXIST feature.

@valchkou
Copy link
Owner

valchkou commented Aug 4, 2015

Hi Rahul,
There is no rules inside my module,
but Cassandra has certain restrictions and limitations and we have to live with it.
The one you are faced is something I can't control from my module.
Batch is very dumb. I just construct CQL statements from the Entities and pass them over to Datastax Driver batch executor.
All I think of is to split your batch statements so that you don't brake Cassandra rules.

Btw, what is the main reason for you to use batch?

@rahulsrivastava71
Copy link
Author

Dear Eugene ,
We were trying to execute queries through Batch because we needed Atomicity for roll-back as we need roll-back scenario which we can use using batch as if single query in batch fails then all queries of my batch gets overturned.

@rahulsrivastava71
Copy link
Author

Can you please help me out in finding the reason that why do you have used synchronised(lock) block while executing the batch executor as there is any specific reason behind it .

@valchkou
Copy link
Owner

Not sure where you see synchronized while executing batch
https://github.com/valchkou/cassandra-driver-mapping/blob/master/src/main/java/com/datastax/driver/mapping/MappingSession.java
lines 695, 705

The only place where synchronized used is when my module have to generate the schema from the entity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants