1
0
mirror of https://github.com/MariaDB/server.git synced 2026-01-06 05:22:24 +03:00

- 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
This commit is contained in:
Olivier Bertrand
2020-10-03 19:06:05 +02:00
parent 99ab562a92
commit c6eb127ca8
2 changed files with 26 additions and 17 deletions

View File

@@ -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;

View File

@@ -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