Retry CloseAuctions procedure in AuctionMark on rollback#354
Retry CloseAuctions procedure in AuctionMark on rollback#354nuno-faria wants to merge 1 commit intocmu-db:mainfrom
Conversation
apavlo
left a comment
There was a problem hiding this comment.
I don't think we want to accept this.
| done = true; | ||
| } | ||
| catch (SQLException e) { | ||
| if (e.getSQLState().startsWith("40")) { |
There was a problem hiding this comment.
What is "40"? Is this DBMS specific?
There was a problem hiding this comment.
SQL states starting with 40 are related to transactional conflicts, such as "serialization failure" and "integrity constraint violation". As far as I know, it is standard across SQL systems.
| while (!done) { | ||
| try { | ||
| results = proc.run(conn, benchmarkTimes, startTime, endTime); | ||
| done = true; | ||
| } | ||
| catch (SQLException e) { | ||
| if (e.getSQLState().startsWith("40")) { | ||
| conn.rollback(); | ||
| } |
There was a problem hiding this comment.
Can this get stuck in an infinite loop?
There was a problem hiding this comment.
I don't think so, because sooner or later the transaction will be able to complete. Any other type of error other than transactional conflicts will raise an exception to the worker.
| while (!done) { | ||
| try { | ||
| results = proc.run(conn, benchmarkTimes, startTime, endTime); | ||
| done = true; | ||
| } |
There was a problem hiding this comment.
I actually don't think we want to do this because we can't keep track of the # of times that a txn is submitted. So this can cause BenchBase to exceed the defined submission rate. Also, by retrying inside of the benchmark worker we can't keep track of the # failed txns.
There was a problem hiding this comment.
I also agree that this is not the best approach. I also thought about adding an update method to the "TransactionType" class, so we can update the original "txnType" when we switch it in the "executeWork" function, making the worker deal with retries. This also would mean that the CloseAuctions procedure would be correctly logged in the results, since right now, as far as the worker knows, no CloseAuctions procedure is executed.
The current way the CloseAuctions procedure is issued is with custom code in the executeWork method, instead of scheduled by the worker. This means that if the transaction fails on concurrency-induced conflicts, when the worker tries to retry, it will retry a different one:
Since this procedure is executed sparsely, it would be useful to guarantee that it succeeds.