Core/Database: Fixed WITH_COREDEBUG + WITH_DYNAMIC_LINKING incompatibility on windows

This commit is contained in:
Shauren
2024-07-05 13:28:09 +02:00
parent c8a55f4a18
commit f895d04b7d
2 changed files with 20 additions and 8 deletions

View File

@@ -51,6 +51,14 @@
#define MIN_MARIADB_CLIENT_VERSION 30003u
#define MIN_MARIADB_CLIENT_VERSION_STRING "3.0.3"
namespace
{
#ifdef TRINITY_DEBUG
template<typename Database>
thread_local bool WarnSyncQueries = false;
#endif
}
template<typename T>
struct DatabaseWorkerPool<T>::QueueSizeTracker
{
@@ -426,6 +434,14 @@ void DatabaseWorkerPool<T>::KeepAlive()
}
}
#ifdef TRINITY_DEBUG
template <class T>
void DatabaseWorkerPool<T>::WarnAboutSyncQueries([[maybe_unused]] bool warn)
{
WarnSyncQueries<T> = warn;
}
#endif
template <class T>
uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConnections)
{
@@ -485,7 +501,7 @@ template <class T>
T* DatabaseWorkerPool<T>::GetFreeConnection()
{
#ifdef TRINITY_DEBUG
if (_warnSyncQueries)
if (WarnSyncQueries<T>)
{
std::ostringstream ss;
ss << boost::stacktrace::stacktrace();

View File

@@ -204,12 +204,11 @@ class DatabaseWorkerPool
//! Keeps all our MySQL connections alive, prevent the server from disconnecting us.
void KeepAlive();
void WarnAboutSyncQueries([[maybe_unused]] bool warn)
{
#ifdef TRINITY_DEBUG
_warnSyncQueries = warn;
static void WarnAboutSyncQueries(bool warn);
#else
static void WarnAboutSyncQueries([[maybe_unused]] bool warn) { }
#endif
}
size_t QueueSize() const;
@@ -236,9 +235,6 @@ class DatabaseWorkerPool
std::unique_ptr<MySQLConnectionInfo> _connectionInfo;
std::vector<uint8> _preparedStatementSize;
uint8 _async_threads, _synch_threads;
#ifdef TRINITY_DEBUG
static inline thread_local bool _warnSyncQueries = false;
#endif
};
#endif