Transaction Exceptions and Retries

It's a common pattern for database drivers/clients to have specialized exceptions for failed transactions that provide the necessary context for knowing whther or not to retry the exception due to conflicts. Does Tinkerpop have any of this? Right now basically it seems like users need to unpack the layers of the exceptions that the server feeds back to the client, and then just string parse completely based off of a string the graph provider tells them to look for (if there even is one) in order to do this very common-used pattern with transactions in a database.
5 Replies
Andrea
Andrea2mo ago
There is some documentation about temporary exceptions here: https://tinkerpop.apache.org/docs/current/reference/#request-retry but this is not specific to transactions. Does your question apply to general error handling is it specifically for transaction error handling?
Rice
RiceOP5w ago
This is specifically for transactions. I'm basically looking for something like a Java TinkerpopTransactionException or something like that I can throw in my Graph implementation that gremlin-server knows how to serialize, and then GLVs will deserialize into their specific language exception types that a user can consume. So they can do seomthing like
gtx.foo().bar().iterate
try {
gtx.commit()
} catch (TinkerpopGLVSpecificTransactionException e) {
if (e.isRetryable) {
... retry the entire txn
} else {
gtx.rollback()
}
}
gtx.foo().bar().iterate
try {
gtx.commit()
} catch (TinkerpopGLVSpecificTransactionException e) {
if (e.isRetryable) {
... retry the entire txn
} else {
gtx.rollback()
}
}
Transactions failing due to collisions on the same items and then needing to be retried is a super common thing so I'm baffled right now that there doesn't seem to be a way to do this...
Rice
RiceOP5w ago
Yeah, basically that isn't doing anything though. We currently throw it when our transaction has problems, but that just allows the gremlin-server to handle some internals. It doesnt actually give something useful to the user of a GLV client.
Andrea
Andrea5w ago
Which GLV are you using and what kind of error are you receiving when that transaction exception occurs? Is the GLV just returning a generic exception in this case?

Did you find this page helpful?