diff options
author | Olivier Bertrand <bertrandop@gmail.com> | 2020-10-03 19:06:05 +0200 |
---|---|---|
committer | Olivier Bertrand <bertrandop@gmail.com> | 2020-10-03 19:06:05 +0200 |
commit | c6eb127ca88eb998fc3a7be122845d869a8d3ffc (patch) | |
tree | 8d7842cd7aa41d3f3483a9a719dc09ea4ce5067d | |
parent | 99ab562a92c05896ffb54216602507c56ea4e101 (diff) | |
download | mariadb-git-c6eb127ca88eb998fc3a7be122845d869a8d3ffc.tar.gz |
- Fix allocating work space larger than 4GB
The variable connect_work_size is now ulong or ulonglong for 64bit machines.
modified: storage/connect/ha_connect.cc
modified: storage/connect/user_connect.cc
-rw-r--r-- | storage/connect/ha_connect.cc | 31 | ||||
-rw-r--r-- | storage/connect/user_connect.cc | 12 |
2 files changed, 26 insertions, 17 deletions
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index e39b5cebaf4..cf2a86185ef 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,9 +170,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.07.0001 September 30, 2020"; + char version[]= "Version 1.07.0002 October 03, 2020"; #if defined(__WIN__) - char compver[]= "Version 1.07.0001 " __DATE__ " " __TIME__; + char compver[]= "Version 1.07.0002 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -254,8 +254,8 @@ TYPCONV GetTypeConv(void); char *GetJsonNull(void); uint GetJsonGrpSize(void); char *GetJavaWrapper(void); -ulong GetWorkSize(void); -void SetWorkSize(ulong); +size_t GetWorkSize(void); +void SetWorkSize(size_t); extern "C" const char *msglang(void); static char *strz(PGLOBAL g, LEX_STRING &ls); @@ -347,11 +347,19 @@ static MYSQL_THDVAR_ENUM( 1, // def (AUTO) &usetemp_typelib); // typelib +#ifdef _WIN64 +// Size used for g->Sarea_Size +static MYSQL_THDVAR_ULONGLONG(work_size, + PLUGIN_VAR_RQCMDARG, + "Size of the CONNECT work area.", + NULL, NULL, SZWORK, SZWMIN, ULONGLONG_MAX, 1); +#else // Size used for g->Sarea_Size static MYSQL_THDVAR_ULONG(work_size, - PLUGIN_VAR_RQCMDARG, - "Size of the CONNECT work area.", - NULL, NULL, SZWORK, SZWMIN, ULONG_MAX, 1); + PLUGIN_VAR_RQCMDARG, + "Size of the CONNECT work area.", + NULL, NULL, SZWORK, SZWMIN, ULONG_MAX, 1); +#endif // Size used when converting TEXT columns to VARCHAR static MYSQL_THDVAR_INT(conv_size, @@ -461,8 +469,8 @@ char *GetJsonNull(void) {return connect_hton ? THDVAR(current_thd, json_null) : NULL;} uint GetJsonGrpSize(void) {return connect_hton ? THDVAR(current_thd, json_grp_size) : 10;} -ulong GetWorkSize(void) {return THDVAR(current_thd, work_size);} -void SetWorkSize(ulong) +size_t GetWorkSize(void) {return (size_t)THDVAR(current_thd, work_size);} +void SetWorkSize(size_t) { // Changing the session variable value seems to be impossible here // and should be done in a check function @@ -472,7 +480,8 @@ void SetWorkSize(ulong) #if defined(JAVA_SUPPORT) char *GetJavaWrapper(void) -{return connect_hton ? THDVAR(current_thd, java_wrapper) : (char*)"wrappers/JdbcInterface";} +{return connect_hton ? THDVAR(current_thd, java_wrapper) + : (char*)"wrappers/JdbcInterface";} #endif // JAVA_SUPPORT #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) @@ -7376,7 +7385,7 @@ maria_declare_plugin(connect) 0x0107, /* version number (1.07) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.07.0001", /* string version */ + "1.07.0002", /* string version */ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index c061294c57e..5dbdb8f56f0 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -58,8 +58,8 @@ PCONNECT user_connect::to_users= NULL; /****************************************************************************/ /* Get the work_size SESSION variable value . */ /****************************************************************************/ -ulong GetWorkSize(void); -void SetWorkSize(ulong); +size_t GetWorkSize(void); +void SetWorkSize(size_t); /* -------------------------- class user_connect -------------------------- */ @@ -97,7 +97,7 @@ user_connect::~user_connect() bool user_connect::user_init() { // Initialize Plug-like environment - ulong worksize= GetWorkSize(); + size_t worksize= GetWorkSize(); PACTIVITY ap= NULL; PDBUSER dup= NULL; @@ -157,16 +157,16 @@ void user_connect::SetHandler(ha_connect *hc) bool user_connect::CheckCleanup(bool force) { if (thdp->query_id > last_query_id || force) { - ulong worksize = GetWorkSize(); + size_t worksize = GetWorkSize(); size_t size = g->Sarea_Size; PlugCleanup(g, true); - if (size != (size_t)worksize) { + if (size != worksize) { FreeSarea(g); // Check whether the work area could be allocated - if (AllocSarea(g, (size_t)worksize)) { + if (AllocSarea(g, worksize)) { AllocSarea(g, size); SetWorkSize(g->Sarea_Size); // Was too big } // endif sarea |