MXS-2456: Cap transaction replay attempts

In most cases it is reasonable to stop attempting transaction replays
after a certain number of failed attempts. This prevents transactions from
being repeatedly replayed on the same server over and over again if, for
example, it keeps crashing.
This commit is contained in:
Markus Mäkelä
2019-04-30 13:45:48 +03:00
parent bc654849e8
commit 26b2897280
4 changed files with 26 additions and 20 deletions

View File

@ -160,6 +160,7 @@ struct Config
, delayed_retry_timeout(params->get_duration<seconds>("delayed_retry_timeout").count())
, transaction_replay(params->get_bool("transaction_replay"))
, trx_max_size(params->get_size("transaction_replay_max_size"))
, trx_max_attempts(params->get_integer("transaction_replay_attempts"))
, optimistic_trx(params->get_bool("optimistic_trx"))
, lazy_connect(params->get_bool("lazy_connect"))
{
@ -223,6 +224,7 @@ struct Config
uint64_t delayed_retry_timeout; /**< How long to delay until an error is returned */
bool transaction_replay; /**< Replay failed transactions */
size_t trx_max_size; /**< Max transaction size for replaying */
int64_t trx_max_attempts; /**< Maximum number of transaction replay attempts */
bool optimistic_trx; /**< Enable optimistic transactions */
bool lazy_connect; /**< Create connections only when needed */
};