97{
99
100 if (!errorCode)
101 return true;
102
103 if (errorCode == ER_LOCK_DEADLOCK)
104 {
105 std::ostringstream threadIdStream;
106 threadIdStream << std::this_thread::get_id();
107 std::string threadId = threadIdStream.str();
108
109 {
110
112
114 {
116 return true;
117
118 LOG_WARN(
"sql.sql",
"Deadlocked SQL Transaction, retrying. Loop timer: {} ms, Thread Id: {}", loopDuration.count(), threadId);
119 }
120 }
121
122 LOG_ERROR(
"sql.sql",
"Fatal deadlocked SQL Transaction, it will not be retried anymore. Thread Id: {}", threadId);
123 }
124
125
127
128 return false;
129}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
#define LOG_WARN(filterType__,...)
Definition: Log.h:160
Milliseconds GetTimeMS()
Definition: Timer.h:84
uint32 GetMSTimeDiffToNow(uint32 oldMSTime)
Definition: Timer.h:131
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:27
constexpr Milliseconds DEADLOCK_MAX_RETRY_TIME_MS
Definition: Transaction.cpp:30
int TryExecute()
Definition: Transaction.cpp:131
static std::mutex _deadlockLock
Definition: Transaction.h:92
void CleanupOnFailure()
Definition: Transaction.cpp:136