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

Question: PreparedBatch RollBack #10

Open
smahad786 opened this issue Jun 24, 2019 · 1 comment
Open

Question: PreparedBatch RollBack #10

smahad786 opened this issue Jun 24, 2019 · 1 comment

Comments

@smahad786
Copy link

smahad786 commented Jun 24, 2019

I am using a preparedBatch() [insert] and is it possible for the auto-commit to fail after the code enters the async response (ar). If so, under what conditions?

repository.preparedBatch(this.cteSQL, batch, ar -> {
if (ar.succeeded()) {
res = getResult(ar.result());
emitter.onSuccess(res);
} else {
/*** Some other code ****/
});

I am having a situation where I am making calls to two repositories (one is Cassandra and other PostGres) using Flowable.fromArray(repos) and will return to the caller when I get the first successful result or the last error (using firstOrError()). When the Cassandra comes faster, under some condition, I see PostGres successful logging (after successful preparedBatch insert, aka after ar.succeeded()) but on querying the DBMS, I dont see the record in PostGres.

It is only happening at high volume. I am using PostGres CTE in my insert SQL statement. I am unable to recreate this in a standalone mode (once I recreate using a sample code, I will send them). I created a dummy class (Cassandra's equivalent) and when I return the dummy class, say in 10 ms, even before the PostGres call starts (before the execution of the preparedBatch statement), I can see the PostGres call getting abandoned. This is not an issue, as as long as I get a successful response from one of them, I am OK.

What is concerning is that I see logs that looks like PostGres returned successfully but something caused the rollback to happen after ar.succeeded() was executed. Is it possible?

Any help here will be a great support.

@smahad786
Copy link
Author

smahad786 commented Jun 27, 2019

Julien Viet, would like to hear your response. What we need to understand is the following "We need to understand the timing of the auto-commit in relation to the result-set return and the rollback when disconnect occurs".

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

No branches or pull requests

1 participant