142{
144 if (!errorCode)
145 {
147 return true;
148 }
149
150 if (errorCode == ER_LOCK_DEADLOCK)
151 {
152 std::ostringstream threadIdStream;
153 threadIdStream << std::this_thread::get_id();
154 std::string threadId = threadIdStream.str();
155
156 {
157
159
161 {
163 {
165 return true;
166 }
167
168 LOG_WARN(
"sql.sql",
"Deadlocked SQL Transaction, retrying. Loop timer: {} ms, Thread Id: {}", loopDuration.count(), threadId);
169 }
170 }
171
172 LOG_ERROR(
"sql.sql",
"Fatal deadlocked SQL Transaction, it will not be retried anymore. Thread Id: {}", threadId);
173 }
174
175
178
179 return false;
180}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define LOG_WARN(filterType__,...)
Definition: Log.h:161
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
TransactionPromise m_result
Definition: Transaction.h:105