You've already forked mariadb-columnstore-engine
mirror of
https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
synced 2025-08-08 14:22:09 +03:00
MCOL-879 Fix QueryStats linking issues
With 1.1 we have removed libdrizzle and used MariaDB's client library instead for both CrossEngine and QueryStats. Unfortunately MariaDB 10.2 has two client libraries which have different structs with the same name. When QueryStats was running inside the ColumnStore plugin this symbol conflict was causing a crash. The server's built-in client API has several different and several missing functions so some additions to sm.cpp were made to fill the gaps. This patch does the following: * Make sure that libmariadb is only linked to executables, not the ColumnStore Plugin (to avoid symbol conflicts). Note that all executables that link to CrossEngine and/or QueryStats need to link to libmariadb to avoid missing symbol issues. * Use the server's built-in client API for QueryStats when run in the plugin * Replace missing server built-in client API calls in sm.cpp (this is for QueryStats and CrossEngine to keep the dynamic linker happy) * Fixes issue where using 'localhost' as the MariaDB Server hostname would fail in QueryStats.
This commit is contained in:
@@ -210,6 +210,9 @@ void QueryStats::insert()
|
||||
if (mysql.fCon == NULL)
|
||||
handleMySqlError("fatal error initializing querystats lib", -1);
|
||||
|
||||
unsigned int tcp_option = MYSQL_PROTOCOL_TCP;
|
||||
mysql_options(mysql.fCon, MYSQL_OPT_PROTOCOL, &tcp_option);
|
||||
|
||||
if (mysql_real_connect(mysql.fCon, host.c_str(), user.c_str(), pwd.c_str(),
|
||||
SCHEMA.c_str(), port, NULL, 0) == NULL)
|
||||
handleMySqlError("fatal error setting up parms in querystats lib", mysql_errno(mysql.fCon));
|
||||
@@ -241,7 +244,7 @@ void QueryStats::insert()
|
||||
insert << fNumFiles << ", ";
|
||||
insert << fFileBytes << ")"; // the last 2 fields are not populated yet
|
||||
|
||||
int ret = mysql_query(mysql.fCon, insert.str().c_str());
|
||||
int ret = mysql_real_query(mysql.fCon, insert.str().c_str(), insert.str().length());
|
||||
if (ret != 0)
|
||||
handleMySqlError("fatal error executing query in querystats lib", ret);
|
||||
}
|
||||
@@ -287,6 +290,9 @@ uint32_t QueryStats::userPriority(string _host, const string _user)
|
||||
if (mysql.fCon == NULL)
|
||||
handleMySqlError("fatal error initializing querystats lib", -1);
|
||||
|
||||
unsigned int tcp_option = MYSQL_PROTOCOL_TCP;
|
||||
mysql_options(mysql.fCon, MYSQL_OPT_PROTOCOL, &tcp_option);
|
||||
|
||||
if (mysql_real_connect(mysql.fCon, host.c_str(), user.c_str(), pwd.c_str(),
|
||||
SCHEMA.c_str(), port, NULL, 0) == NULL)
|
||||
handleMySqlError("fatal error connecting to InfiniDB in querystats lib", mysql_errno(mysql.fCon));
|
||||
@@ -307,7 +313,7 @@ uint32_t QueryStats::userPriority(string _host, const string _user)
|
||||
<< _user
|
||||
<< "') and upper(a.priority) = upper(b.priority)";
|
||||
|
||||
int ret =mysql_query(mysql.fCon, query.str().c_str());
|
||||
int ret =mysql_real_query(mysql.fCon, query.str().c_str(), query.str().length());
|
||||
if (ret != 0)
|
||||
handleMySqlError("fatal error executing query in querystats lib", ret);
|
||||
// Using mysql_store_result here as for mysql_use_result we would need to get every row
|
||||
|
Reference in New Issue
Block a user