[CONCPP-95] Verified transaction Created: 2022-02-18  Updated: 2022-07-25

Status: Open
Project: MariaDB Connector/C++
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major
Reporter: Jochen Assignee: Lawrin Novitsky
Resolution: Unresolved Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Ubuntu 2004



 Description   

Sometimes a transaction fails because of a temporary reason, like 1213 (deadlock). The message tells us to try anew. I'd like to have a function like verified_transaction_name() that will automatically try again in cases like these instead of delegating that to the user.

I meant to post this for the C++-Connector, but wasn't able to choose it from the drop-down list.



 Comments   
Comment by Sergei Golubchik [ 2022-06-27 ]

it seems that the appropriate name should be "auto-retrying of transactions" or "auto-replaying".
And likely it should be implemented in Connector/C, where Connector/C++ would just invoke it from there.
Lawrin, thoughts?

Comment by Lawrin Novitsky [ 2022-07-08 ]

serg Maybe right in the server then? Then it will be everywhere, and server better knows what reasons are temporary(to track if new such error emerge), at least.

Does it feel like that is something belonging to C/C for you? I am not sure.

Also I am not sure about details. Like what if transaction fails again? Repeat till some till some time before some timeout? or some special timeout? or for configurable number of times? and what if it still fails? some new special error or same error? what if errors were different(I don't know if that is possible, ). Does it have to be applied to all transactions on the connection? Does it have to be applied to all such temporary reasons or to the configurable list of reasons. Also, different reasons might need different auto-replying pattern, like if we have deadlock, period of re-sending of commit should be somehow depend on the related server timeouts.
Well, most of the questions can be answered by "keep it simple" and at the end we will have smth like
if (error in <the_list_of_temporary_reasons>)
while (<replay_number_option>-- > 0) mysql_commit(conn_handle);

Comment by Sergei Golubchik [ 2022-07-25 ]

it's not just mysql_commit(conn_handle), one has to replay the whole transaction. There are different ways of doing it and they all can easily go horribly wrong. So this feature has a rather limited applicability. It does come handy is some specific use cases though.

Generated at Thu Feb 08 03:08:18 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.