From 7edd4294be4e59c19539167620ff140e3f5e7f58 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 28 Jan 2021 01:02:29 +0100 Subject: [PATCH 01/15] - Continue BSON development modified: storage/connect/bson.cpp modified: storage/connect/bson.h modified: storage/connect/bsonudf.cpp modified: storage/connect/bsonudf.h modified: storage/connect/ha_connect.cc modified: storage/connect/jsonudf.cpp modified: storage/connect/mysql-test/connect/r/bson.result modified: storage/connect/mysql-test/connect/r/bson_udf.result modified: storage/connect/mysql-test/connect/t/bson_udf.inc modified: storage/connect/mysql-test/connect/t/bson_udf.test modified: storage/connect/mysql-test/connect/t/bson_udf2.inc modified: storage/connect/tabbson.cpp modified: storage/connect/tabbson.h --- storage/connect/bson.cpp | 30 +-- storage/connect/bson.h | 2 +- storage/connect/bsonudf.cpp | 215 +++++++++++++++--- storage/connect/bsonudf.h | 12 +- storage/connect/ha_connect.cc | 16 +- storage/connect/jsonudf.cpp | 4 +- .../connect/mysql-test/connect/r/bson.result | 2 +- .../mysql-test/connect/r/bson_udf.result | 51 +++-- .../connect/mysql-test/connect/t/bson_udf.inc | 2 + .../mysql-test/connect/t/bson_udf.test | 1 + .../mysql-test/connect/t/bson_udf2.inc | 2 + storage/connect/tabbson.cpp | 128 ++++++----- storage/connect/tabbson.h | 7 +- 13 files changed, 341 insertions(+), 131 deletions(-) diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index fc58303a73f..5731ce9eac5 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -37,6 +37,8 @@ #undef SE_CATCH // Does not work for Linux #endif +int GetJsonDefPrec(void); + #if defined(SE_CATCH) /**************************************************************************/ /* This is the support of catching C interrupts to prevent crashes. */ @@ -1722,14 +1724,22 @@ void BJSON::SetBigint(PBVAL vlp, longlong ll) /***********************************************************************/ /* Set the Value's value as the given DOUBLE. */ /***********************************************************************/ -void BJSON::SetFloat(PBVAL vlp, double d, int nd) +void BJSON::SetFloat(PBVAL vlp, double d, int prec) { - double* dp = (double*)BsonSubAlloc(sizeof(double)); + int nd = MY_MIN((prec < 0) ? GetJsonDefPrec() : prec, 16); - *dp = d; - vlp->To_Val = MOF(dp); - vlp->Nd = MY_MIN(nd, 16); - vlp->Type = TYPE_DBL; + if (nd < 6 && d >= FLT_MIN && d <= FLT_MAX) { + vlp->F = (float)d; + vlp->Type = TYPE_FLOAT; + } else { + double* dp = (double*)BsonSubAlloc(sizeof(double)); + + *dp = d; + vlp->To_Val = MOF(dp); + vlp->Type = TYPE_DBL; + } // endif nd + + vlp->Nd = nd; } // end of SetFloat /***********************************************************************/ @@ -1746,13 +1756,7 @@ void BJSON::SetFloat(PBVAL vlp, PSZ s) for (--p; *p == '0'; nd--, p--); } // endif p - if (nd < 6 && d >= FLT_MIN && d <= FLT_MAX) { - vlp->F = (float)d; - vlp->Nd = nd; - vlp->Type = TYPE_FLOAT; - } else - SetFloat(vlp, d, nd); - + SetFloat(vlp, d, nd); } // end of SetFloat /***********************************************************************/ diff --git a/storage/connect/bson.h b/storage/connect/bson.h index 6eb6c019c1a..32a9c49b00a 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -149,7 +149,7 @@ public: void SetString(PBVAL vlp, PSZ s, int ci = 0); void SetInteger(PBVAL vlp, int n); void SetBigint(PBVAL vlp, longlong ll); - void SetFloat(PBVAL vlp, double f, int nd = 16); + void SetFloat(PBVAL vlp, double f, int nd = -1); void SetFloat(PBVAL vlp, PSZ s); void SetBool(PBVAL vlp, bool b); void Clear(PBVAL vlp) { vlp->N = 0; vlp->Nd = 0; vlp->Next = 0; } diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 719b7d7509a..dd9f95bc4ba 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -27,11 +27,20 @@ #endif #define M 6 +int JsonDefPrec = -1; +int GetDefaultPrec(void); int IsArgJson(UDF_ARGS* args, uint i); void SetChanged(PBSON bsp); /* --------------------------------- JSON UDF ---------------------------------- */ +/*********************************************************************************/ +/* Replaces GetJsonGrpSize not usable when CONNECT is not installed. */ +/*********************************************************************************/ +int GetJsonDefPrec(void) { + return (JsonDefPrec < 0) ? GetDefaultPrec() : JsonDefPrec; +} /* end of GetJsonDefPrec */ + /*********************************************************************************/ /* Program for saving the status of the memory pools. */ /*********************************************************************************/ @@ -262,6 +271,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) return true; } // endif's +#if 0 // For calculated arrays, a local Value must be used switch (jnp->Op) { case OP_NUM: @@ -293,6 +303,7 @@ my_bool BJNX::SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm) if (jnp->Valp) MulVal = AllocateValue(g, jnp->Valp); +#endif // 0 return false; } // end of SetArrayOptions @@ -376,7 +387,7 @@ my_bool BJNX::ParseJpath(PGLOBAL g) } // endfor i, p Nod = i; - MulVal = AllocateValue(g, Value); +//MulVal = AllocateValue(g, Value); if (trace(1)) for (i = 0; i < Nod; i++) @@ -433,20 +444,42 @@ PSZ BJNX::MakeKey(UDF_ARGS *args, int i) } // end of MakeKey /*********************************************************************************/ -/* MakeJson: Serialize the json item and set value to it. */ +/* MakeJson: Make the Json tree to serialize. */ /*********************************************************************************/ -PVAL BJNX::MakeJson(PGLOBAL g, PBVAL bvp) +PBVAL BJNX::MakeJson(PGLOBAL g, PBVAL bvp, int n) { - if (Value->IsTypeNum()) { - strcpy(g->Message, "Cannot make Json for a numeric value"); - Value->Reset(); - } else if (bvp->Type != TYPE_JAR && bvp->Type != TYPE_JOB) { - strcpy(g->Message, "Target is not an array or object"); - Value->Reset(); - } else - Value->SetValue_psz(Serialize(g, bvp, NULL, 0)); + PBVAL vlp, jvp = bvp; - return Value; + if (n < Nod -1) { + if (bvp->Type == TYPE_JAR) { + int ars = GetArraySize(bvp); + PJNODE jnp = &Nodes[n]; + + jvp = NewVal(TYPE_JAR); + jnp->Op = OP_EQ; + + for (int i = 0; i < ars; i++) { + jnp->Rank = i; + vlp = GetRowValue(g, bvp, n); + AddArrayValue(jvp, DupVal(vlp)); + } // endfor i + + jnp->Op = OP_XX; + jnp->Rank = 0; + } else if(bvp->Type == TYPE_JOB) { + jvp = NewVal(TYPE_JOB); + + for (PBPR prp = GetObject(bvp); prp; prp = GetNext(prp)) { + vlp = GetRowValue(g, GetVlp(prp), n + 1); + SetKeyValue(jvp, vlp, MZP(prp->Key)); + } // endfor prp + + } // endif Type + + } // endif n + + Jb = true; + return jvp; } // end of MakeJson /*********************************************************************************/ @@ -459,15 +492,18 @@ void BJNX::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL vlp) if (Jb) { vp->SetValue_psz(Serialize(g, vlp, NULL, 0)); + Jb = false; } else switch (vlp->Type) { case TYPE_DTM: case TYPE_STRG: vp->SetValue_psz(GetString(vlp)); break; case TYPE_INTG: - case TYPE_BINT: vp->SetValue(GetInteger(vlp)); break; + case TYPE_BINT: + vp->SetValue(GetBigint(vlp)); + break; case TYPE_DBL: case TYPE_FLOAT: if (vp->IsTypeNum()) @@ -532,7 +568,7 @@ PVAL BJNX::GetColumnValue(PGLOBAL g, PBVAL row, int i) /*********************************************************************************/ /* GetRowValue: */ /*********************************************************************************/ -PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i, my_bool b) +PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i) { my_bool expd = false; PBVAL bap; @@ -544,9 +580,7 @@ PBVAL BJNX::GetRowValue(PGLOBAL g, PBVAL row, int i, my_bool b) vlp = NewVal(Value); return vlp; } else if (Nodes[i].Op == OP_XX) { - Jb = b; - // return DupVal(g, row); - return row; // or last line ??? + return MakeJson(g, row, i); } else if (Nodes[i].Op == OP_EXP) { PUSH_WARNING("Expand not supported by this function"); return NULL; @@ -611,14 +645,95 @@ PVAL BJNX::ExpandArray(PGLOBAL g, PBVAL arp, int n) } // end of ExpandArray /*********************************************************************************/ -/* CalculateArray: NIY */ +/* Get the value used for calculating the array. */ +/*********************************************************************************/ +PVAL BJNX::GetCalcValue(PGLOBAL g, PBVAL bap, int n) +{ + // For calculated arrays, a local Value must be used + int lng = 0; + short type, prec = 0; + bool b = n < Nod - 1; + PVAL valp; + PBVAL vlp, vp; + OPVAL op = Nodes[n].Op; + + switch (op) { + case OP_NUM: + type = TYPE_INT; + break; + case OP_ADD: + case OP_MULT: + if (!IsTypeNum(Buf_Type)) { + type = TYPE_INT; + prec = 0; + + for (vlp = GetArray(bap); vlp; vlp = GetNext(vlp)) { + vp = (b && IsJson(vlp)) ? GetRowValue(g, vlp, n + 1) : vlp; + + switch (vp->Type) { + case TYPE_BINT: + if (type == TYPE_INT) + type = TYPE_BIGINT; + + break; + case TYPE_DBL: + case TYPE_FLOAT: + type = TYPE_DOUBLE; + prec = MY_MAX(prec, vp->Nd); + break; + default: + break; + } // endswitch Type + + } // endfor vlp + + } else { + type = Buf_Type; + prec = GetPrecision(); + } // endif Buf_Type + + break; + case OP_SEP: + if (IsTypeChar(Buf_Type)) { + type = TYPE_DOUBLE; + prec = 2; + } else + type = Buf_Type; + + break; + case OP_MIN: + case OP_MAX: + type = Buf_Type; + lng = Long; + prec = GetPrecision(); + break; + case OP_CNC: + type = TYPE_STRING; + + if (IsTypeChar(Buf_Type)) { + lng = Long; + prec = GetPrecision(); + } else + lng = 512; + + break; + default: + break; + } // endswitch Op + + return valp = AllocateValue(g, type, lng, prec); +} // end of GetCalcValue + +/*********************************************************************************/ +/* CalculateArray */ /*********************************************************************************/ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n) { int i, ars = GetArraySize(bap), nv = 0; bool err; OPVAL op = Nodes[n].Op; - PVAL val[2], vp = Nodes[n].Valp; + PVAL val[2], vp = GetCalcValue(g, bap, n); + PVAL mulval = AllocateValue(g, vp); PBVAL bvrp, bvp; BVAL bval; @@ -647,9 +762,9 @@ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n) SetJsonValue(g, vp, bvp); continue; } else - SetJsonValue(g, MulVal, bvp); + SetJsonValue(g, mulval, bvp); - if (!MulVal->IsNull()) { + if (!mulval->IsNull()) { switch (op) { case OP_CNC: if (Nodes[n].CncVal) { @@ -657,18 +772,18 @@ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n) err = vp->Compute(g, val, 1, op); } // endif CncVal - val[0] = MulVal; + val[0] = mulval; err = vp->Compute(g, val, 1, op); break; // case OP_NUM: case OP_SEP: - val[0] = Nodes[n].Valp; - val[1] = MulVal; + val[0] = vp; + val[1] = mulval; err = vp->Compute(g, val, 2, OP_ADD); break; default: - val[0] = Nodes[n].Valp; - val[1] = MulVal; + val[0] = vp; + val[1] = mulval; err = vp->Compute(g, val, 2, op); } // endswitch Op @@ -690,9 +805,9 @@ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n) if (op == OP_SEP) { // Calculate average - MulVal->SetValue(nv); + mulval->SetValue(nv); val[0] = vp; - val[1] = MulVal; + val[1] = mulval; if (vp->Compute(g, val, 2, OP_DIV)) vp->Reset(); @@ -2698,6 +2813,45 @@ void bson_object_values_deinit(UDF_INIT* initid) JsonFreeMem((PGLOBAL)initid->ptr); } // end of bson_object_values_deinit +/*********************************************************************************/ +/* Set the value of JsonGrpSize. */ +/*********************************************************************************/ +my_bool bsonset_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +{ + if (args->arg_count != 1 || args->arg_type[0] != INT_RESULT) { + strcpy(message, "This function must have 1 integer argument"); + return true; + } else + return false; + +} // end of bsonset_def_prec_init + +long long bsonset_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +{ + long long n = *(long long*)args->args[0]; + + JsonDefPrec = (int)n; + return (long long)GetJsonDefPrec(); +} // end of bsonset_def_prec + +/*********************************************************************************/ +/* Get the value of JsonGrpSize. */ +/*********************************************************************************/ +my_bool bsonget_def_prec_init(UDF_INIT *initid, UDF_ARGS *args, char *message) +{ + if (args->arg_count != 0) { + strcpy(message, "This function must have no arguments"); + return true; + } else + return false; + +} // end of bsonget_def_prec_init + +long long bsonget_def_prec(UDF_INIT *initid, UDF_ARGS *args, char *, char *) +{ + return (long long)GetJsonDefPrec(); +} // end of bsonget_def_prec + /*********************************************************************************/ /* Set the value of JsonGrpSize. */ /*********************************************************************************/ @@ -4714,7 +4868,8 @@ char *bson_serialize(UDF_INIT *initid, UDF_ARGS *args, char *result, BJNX bnx(bsp->G); PBVAL bvp = (args->arg_count == 1) ? (PBVAL)bsp->Jsp : (PBVAL)bsp->Top; - if (!(str = bnx.Serialize(g, bvp, bsp->Filename, bsp->Pretty))) +// if (!(str = bnx.Serialize(g, bvp, bsp->Filename, bsp->Pretty))) + if (!(str = bnx.Serialize(g, bvp, NULL, 0))) str = strcpy(result, g->Message); // Keep result of constant function @@ -5513,7 +5668,7 @@ void bbin_object_values_deinit(UDF_INIT* initid) my_bool bbin_get_item_init(UDF_INIT *initid, UDF_ARGS *args, char *message) { return bson_get_item_init(initid, args, message); -} // end of bbin_get_item_init +} // end of bbin_get_item_init char *bbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, unsigned long *res_length, char *is_null, char *error) diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index 01b9b9d55d5..bbfd1ceed80 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -81,6 +81,7 @@ typedef struct _jpn { extern uint JsonGrpSize; uint GetJsonGroupSize(void); + typedef class BJNX* PBJNX; /*********************************************************************************/ @@ -102,7 +103,7 @@ public: my_bool SetJpath(PGLOBAL g, char* path, my_bool jb = false); my_bool ParseJpath(PGLOBAL g); void ReadValue(PGLOBAL g); - PBVAL GetRowValue(PGLOBAL g, PBVAL row, int i, my_bool b = true); + PBVAL GetRowValue(PGLOBAL g, PBVAL row, int i); PBVAL GetJson(PGLOBAL g); my_bool CheckPath(PGLOBAL g); my_bool CheckPath(PGLOBAL g, UDF_ARGS* args, PBVAL jsp, PBVAL& jvp, int n); @@ -123,7 +124,8 @@ protected: PVAL GetColumnValue(PGLOBAL g, PBVAL row, int i); PVAL ExpandArray(PGLOBAL g, PBVAL arp, int n); PVAL CalculateArray(PGLOBAL g, PBVAL arp, int n); - PVAL MakeJson(PGLOBAL g, PBVAL bvp); + PVAL GetCalcValue(PGLOBAL g, PBVAL bap, int n); + PBVAL MakeJson(PGLOBAL g, PBVAL bvp, int n); void SetJsonValue(PGLOBAL g, PVAL vp, PBVAL vlp); PBVAL GetRow(PGLOBAL g); PBVAL MoveVal(PBVAL vlp); @@ -259,6 +261,12 @@ extern "C" { DllExport double bsonget_real(UDF_INIT*, UDF_ARGS*, char*, char*); DllExport void bsonget_real_deinit(UDF_INIT*); + DllExport my_bool bsonset_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); + DllExport long long bsonset_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + + DllExport my_bool bsonget_def_prec_init(UDF_INIT*, UDF_ARGS*, char*); + DllExport long long bsonget_def_prec(UDF_INIT*, UDF_ARGS*, char*, char*); + DllExport my_bool bsonset_grp_size_init(UDF_INIT*, UDF_ARGS*, char*); DllExport long long bsonset_grp_size(UDF_INIT*, UDF_ARGS*, char*, char*); diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 9b40b5c9a13..69646e22e30 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,7 +170,7 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.07.0002 December 25, 2020"; + char version[]= "Version 1.07.0002 January 27, 2021"; #if defined(__WIN__) char compver[]= "Version 1.07.0002 " __DATE__ " " __TIME__; char slash= '\\'; @@ -255,6 +255,7 @@ USETEMP UseTemp(void); int GetConvSize(void); TYPCONV GetTypeConv(void); int GetDefaultDepth(void); +int GetDefaultPrec(void); bool JsonAllPath(void); char *GetJsonNull(void); uint GetJsonGrpSize(void); @@ -420,9 +421,15 @@ static MYSQL_THDVAR_INT(default_depth, "Default depth used by Json, XML and Mongo discovery", NULL, NULL, 5, -1, 16, 1); // Defaults to 5 +// Default precision for doubles +static MYSQL_THDVAR_INT(default_prec, + PLUGIN_VAR_RQCMDARG, + "Default precision used for doubles", + NULL, NULL, 6, 0, 16, 1); // Defaults to 6 + // Estimate max number of rows for JSON aggregate functions static MYSQL_THDVAR_UINT(json_grp_size, - PLUGIN_VAR_RQCMDARG, // opt + PLUGIN_VAR_RQCMDARG, // opt "max number of rows for JSON aggregate functions.", NULL, NULL, JSONMAX, 1, INT_MAX, 1); @@ -495,6 +502,7 @@ TYPCONV GetTypeConv(void) {return (TYPCONV)THDVAR(current_thd, type_conv);} char *GetJsonNull(void) {return connect_hton ? THDVAR(current_thd, json_null) : NULL;} int GetDefaultDepth(void) {return THDVAR(current_thd, default_depth);} +int GetDefaultPrec(void) {return THDVAR(current_thd, default_prec);} uint GetJsonGrpSize(void) {return connect_hton ? THDVAR(current_thd, json_grp_size) : 10;} size_t GetWorkSize(void) {return (size_t)THDVAR(current_thd, work_size);} @@ -4834,6 +4842,7 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type) lock.cc by lock_external() and unlock_external() in lock.cc; the section "locking functions for mysql" in lock.cc; copy_data_between_tables() in sql_table.cc. + */ int ha_connect::external_lock(THD *thd, int lock_type) { @@ -7445,7 +7454,8 @@ static struct st_mysql_sys_var* connect_system_variables[]= { MYSQL_SYSVAR(json_null), MYSQL_SYSVAR(json_all_path), MYSQL_SYSVAR(default_depth), - MYSQL_SYSVAR(json_grp_size), + MYSQL_SYSVAR(default_prec), + MYSQL_SYSVAR(json_grp_size), #if defined(JAVA_SUPPORT) MYSQL_SYSVAR(jvm_path), MYSQL_SYSVAR(class_path), diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 53818cbe00b..49a36407cec 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -354,9 +354,11 @@ void JSNX::SetJsonValue(PGLOBAL g, PVAL vp, PJVAL val) vp->SetValue_psz(val->GetString(g)); break; case TYPE_INTG: - case TYPE_BINT: vp->SetValue(val->GetInteger()); break; + case TYPE_BINT: + vp->SetValue(val->GetBigint()); + break; case TYPE_DBL: if (vp->IsTypeNum()) vp->SetValue(val->GetFloat()); diff --git a/storage/connect/mysql-test/connect/r/bson.result b/storage/connect/mysql-test/connect/r/bson.result index fd15e020aac..98abdbb8744 100644 --- a/storage/connect/mysql-test/connect/r/bson.result +++ b/storage/connect/mysql-test/connect/r/bson.result @@ -279,7 +279,7 @@ SELECT * FROM t1; WHO WEEKS SUMS SUM AVGS SUMAVG AVGSUM AVGAVG AVERAGE Joe 3, 4, 5 69.00+83.00+26.00 178.00 17.25+16.60+13.00 46.85 59.33 15.62 16.18 Beth 3, 4, 5 16.00+32.00+32.00 80.00 16.00+16.00+16.00 48.00 26.67 16.00 16.00 -Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.12 +Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.13 DROP TABLE t1; # # Expand expense in 3 one week tables diff --git a/storage/connect/mysql-test/connect/r/bson_udf.result b/storage/connect/mysql-test/connect/r/bson_udf.result index a0b93f2e547..14b3629e4b1 100644 --- a/storage/connect/mysql-test/connect/r/bson_udf.result +++ b/storage/connect/mysql-test/connect/r/bson_udf.result @@ -176,6 +176,9 @@ Value List # # Test UDF's with column arguments # +SELECT Bsonset_Def_Prec(2); +Bsonset_Def_Prec(2) +2 CREATE TABLE t2 ( ISBN CHAR(15), @@ -213,7 +216,7 @@ SALARY DOUBLE(8,2) NOT NULL FLAG=52 ) ENGINE=CONNECT TABLE_TYPE=FIX BLOCK_SIZE=8 FILE_NAME='employee.dat' ENDING=1; SELECT Bson_Make_Object(SERIALNO, NAME, TITLE, SALARY) FROM t3 WHERE NAME = 'MERCHANT'; Bson_Make_Object(SERIALNO, NAME, TITLE, SALARY) -{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.0000000000000000} +{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.00} SELECT DEPARTMENT, Bson_Array_Grp(NAME) FROM t3 GROUP BY DEPARTMENT; DEPARTMENT Bson_Array_Grp(NAME) 0021 ["STRONG","SHORTSIGHT"] @@ -249,30 +252,30 @@ Bson_Make_Object(DEPARTMENT, Bson_Array_Grp(NAME) json_NAMES) {"DEPARTMENT":"2452","NAMES":["BIGHEAD","ORELLY","BIGHORN","SMITH","CHERRY"]} SELECT Bson_Make_Object(DEPARTMENT, Bson_Array_Grp(Bson_Make_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) FROM t3 GROUP BY DEPARTMENT; Bson_Make_Object(DEPARTMENT, Bson_Array_Grp(Bson_Make_Object(SERIALNO, NAME, TITLE, SALARY)) json_EMPLOYES) -{"DEPARTMENT":"0021","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","TITLE":"DIRECTOR","SALARY":23000.0000000000000000},{"SERIALNO":"22222","NAME":"SHORTSIGHT","TITLE":"SECRETARY","SALARY":5500.0000000000000000}]} -{"DEPARTMENT":"0318","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","TITLE":"SALESMAN","SALARY":9600.0000000000000000},{"SERIALNO":"24888","NAME":"PLUMHEAD","TITLE":"TYPIST","SALARY":2800.0000000000000000},{"SERIALNO":"27845","NAME":"HONEY","TITLE":"SECRETARY","SALARY":4900.0000000000000000},{"SERIALNO":"73452","NAME":"TONGHO","TITLE":"ENGINEER","SALARY":6800.0000000000000000},{"SERIALNO":"74234","NAME":"WALTER","TITLE":"ENGINEER","SALARY":7400.0000000000000000},{"SERIALNO":"77777","NAME":"SHRINKY","TITLE":"ADMINISTRATOR","SALARY":7500.0000000000000000},{"SERIALNO":"70012","NAME":"WERTHER","TITLE":"DIRECTOR","SALARY":14500.0000000000000000},{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.0000000000000000},{"SERIALNO":"73111","NAME":"WHEELFOR","TITLE":"SALESMAN","SALARY":10030.0000000000000000}]} -{"DEPARTMENT":"0319","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","TITLE":"SALESMAN","SALARY":14800.0000000000000000},{"SERIALNO":"40567","NAME":"QUINN","TITLE":"DIRECTOR","SALARY":14000.0000000000000000},{"SERIALNO":"00137","NAME":"BROWNY","TITLE":"ENGINEER","SALARY":10500.0000000000000000},{"SERIALNO":"12345","NAME":"KITTY","TITLE":"TYPIST","SALARY":3000.4499999999998181},{"SERIALNO":"33333","NAME":"MONAPENNY","TITLE":"SECRETARY","SALARY":3800.0000000000000000},{"SERIALNO":"00023","NAME":"MARTIN","TITLE":"ENGINEER","SALARY":10000.0000000000000000},{"SERIALNO":"07654","NAME":"FUNNIGUY","TITLE":"ADMINISTRATOR","SALARY":8500.0000000000000000},{"SERIALNO":"45678","NAME":"BUGHAPPY","TITLE":"PROGRAMMER","SALARY":8500.0000000000000000},{"SERIALNO":"56789","NAME":"FODDERMAN","TITLE":"SALESMAN","SALARY":7000.0000000000000000},{"SERIALNO":"55555","NAME":"MESSIFUL","TITLE":"SECRETARY","SALARY":5000.5000000000000000},{"SERIALNO":"98765","NAME":"GOOSEPEN","TITLE":"ADMINISTRATOR","SALARY":4700.0000000000000000}]} -{"DEPARTMENT":"2452","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","TITLE":"SCIENTIST","SALARY":8000.0000000000000000},{"SERIALNO":"31416","NAME":"ORELLY","TITLE":"ENGINEER","SALARY":13400.0000000000000000},{"SERIALNO":"36666","NAME":"BIGHORN","TITLE":"SCIENTIST","SALARY":11000.0000000000000000},{"SERIALNO":"02345","NAME":"SMITH","TITLE":"ENGINEER","SALARY":9000.0000000000000000},{"SERIALNO":"11111","NAME":"CHERRY","TITLE":"SECRETARY","SALARY":4500.0000000000000000}]} +{"DEPARTMENT":"0021","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","TITLE":"DIRECTOR","SALARY":23000.00},{"SERIALNO":"22222","NAME":"SHORTSIGHT","TITLE":"SECRETARY","SALARY":5500.00}]} +{"DEPARTMENT":"0318","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","TITLE":"SALESMAN","SALARY":9600.00},{"SERIALNO":"24888","NAME":"PLUMHEAD","TITLE":"TYPIST","SALARY":2800.00},{"SERIALNO":"27845","NAME":"HONEY","TITLE":"SECRETARY","SALARY":4900.00},{"SERIALNO":"73452","NAME":"TONGHO","TITLE":"ENGINEER","SALARY":6800.00},{"SERIALNO":"74234","NAME":"WALTER","TITLE":"ENGINEER","SALARY":7400.00},{"SERIALNO":"77777","NAME":"SHRINKY","TITLE":"ADMINISTRATOR","SALARY":7500.00},{"SERIALNO":"70012","NAME":"WERTHER","TITLE":"DIRECTOR","SALARY":14500.00},{"SERIALNO":"78943","NAME":"MERCHANT","TITLE":"SALESMAN","SALARY":8700.00},{"SERIALNO":"73111","NAME":"WHEELFOR","TITLE":"SALESMAN","SALARY":10030.00}]} +{"DEPARTMENT":"0319","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","TITLE":"SALESMAN","SALARY":14800.00},{"SERIALNO":"40567","NAME":"QUINN","TITLE":"DIRECTOR","SALARY":14000.00},{"SERIALNO":"00137","NAME":"BROWNY","TITLE":"ENGINEER","SALARY":10500.00},{"SERIALNO":"12345","NAME":"KITTY","TITLE":"TYPIST","SALARY":3000.45},{"SERIALNO":"33333","NAME":"MONAPENNY","TITLE":"SECRETARY","SALARY":3800.00},{"SERIALNO":"00023","NAME":"MARTIN","TITLE":"ENGINEER","SALARY":10000.00},{"SERIALNO":"07654","NAME":"FUNNIGUY","TITLE":"ADMINISTRATOR","SALARY":8500.00},{"SERIALNO":"45678","NAME":"BUGHAPPY","TITLE":"PROGRAMMER","SALARY":8500.00},{"SERIALNO":"56789","NAME":"FODDERMAN","TITLE":"SALESMAN","SALARY":7000.00},{"SERIALNO":"55555","NAME":"MESSIFUL","TITLE":"SECRETARY","SALARY":5000.50},{"SERIALNO":"98765","NAME":"GOOSEPEN","TITLE":"ADMINISTRATOR","SALARY":4700.00}]} +{"DEPARTMENT":"2452","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","TITLE":"SCIENTIST","SALARY":8000.00},{"SERIALNO":"31416","NAME":"ORELLY","TITLE":"ENGINEER","SALARY":13400.00},{"SERIALNO":"36666","NAME":"BIGHORN","TITLE":"SCIENTIST","SALARY":11000.00},{"SERIALNO":"02345","NAME":"SMITH","TITLE":"ENGINEER","SALARY":9000.00},{"SERIALNO":"11111","NAME":"CHERRY","TITLE":"SECRETARY","SALARY":4500.00}]} SELECT Bson_Make_Object(DEPARTMENT, TITLE, Bson_Array_Grp(Bson_Make_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) FROM t3 GROUP BY DEPARTMENT, TITLE; Bson_Make_Object(DEPARTMENT, TITLE, Bson_Array_Grp(Bson_Make_Object(SERIALNO, NAME, SALARY)) json_EMPLOYES) -{"DEPARTMENT":"0021","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","SALARY":23000.0000000000000000}]} -{"DEPARTMENT":"0021","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"22222","NAME":"SHORTSIGHT","SALARY":5500.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"77777","NAME":"SHRINKY","SALARY":7500.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"70012","NAME":"WERTHER","SALARY":14500.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"73452","NAME":"TONGHO","SALARY":6800.0000000000000000},{"SERIALNO":"74234","NAME":"WALTER","SALARY":7400.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","SALARY":9600.0000000000000000},{"SERIALNO":"78943","NAME":"MERCHANT","SALARY":8700.0000000000000000},{"SERIALNO":"73111","NAME":"WHEELFOR","SALARY":10030.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"27845","NAME":"HONEY","SALARY":4900.0000000000000000}]} -{"DEPARTMENT":"0318","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"24888","NAME":"PLUMHEAD","SALARY":2800.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"98765","NAME":"GOOSEPEN","SALARY":4700.0000000000000000},{"SERIALNO":"07654","NAME":"FUNNIGUY","SALARY":8500.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"40567","NAME":"QUINN","SALARY":14000.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"00023","NAME":"MARTIN","SALARY":10000.0000000000000000},{"SERIALNO":"00137","NAME":"BROWNY","SALARY":10500.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"PROGRAMMER","EMPLOYES":[{"SERIALNO":"45678","NAME":"BUGHAPPY","SALARY":8500.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","SALARY":14800.0000000000000000},{"SERIALNO":"56789","NAME":"FODDERMAN","SALARY":7000.0000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"33333","NAME":"MONAPENNY","SALARY":3800.0000000000000000},{"SERIALNO":"55555","NAME":"MESSIFUL","SALARY":5000.5000000000000000}]} -{"DEPARTMENT":"0319","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"12345","NAME":"KITTY","SALARY":3000.4499999999998181}]} -{"DEPARTMENT":"2452","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"31416","NAME":"ORELLY","SALARY":13400.0000000000000000},{"SERIALNO":"02345","NAME":"SMITH","SALARY":9000.0000000000000000}]} -{"DEPARTMENT":"2452","TITLE":"SCIENTIST","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","SALARY":8000.0000000000000000},{"SERIALNO":"36666","NAME":"BIGHORN","SALARY":11000.0000000000000000}]} -{"DEPARTMENT":"2452","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"11111","NAME":"CHERRY","SALARY":4500.0000000000000000}]} +{"DEPARTMENT":"0021","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"87777","NAME":"STRONG","SALARY":23000.00}]} +{"DEPARTMENT":"0021","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"22222","NAME":"SHORTSIGHT","SALARY":5500.00}]} +{"DEPARTMENT":"0318","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"77777","NAME":"SHRINKY","SALARY":7500.00}]} +{"DEPARTMENT":"0318","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"70012","NAME":"WERTHER","SALARY":14500.00}]} +{"DEPARTMENT":"0318","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"73452","NAME":"TONGHO","SALARY":6800.00},{"SERIALNO":"74234","NAME":"WALTER","SALARY":7400.00}]} +{"DEPARTMENT":"0318","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"74200","NAME":"BANCROFT","SALARY":9600.00},{"SERIALNO":"78943","NAME":"MERCHANT","SALARY":8700.00},{"SERIALNO":"73111","NAME":"WHEELFOR","SALARY":10030.00}]} +{"DEPARTMENT":"0318","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"27845","NAME":"HONEY","SALARY":4900.00}]} +{"DEPARTMENT":"0318","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"24888","NAME":"PLUMHEAD","SALARY":2800.00}]} +{"DEPARTMENT":"0319","TITLE":"ADMINISTRATOR","EMPLOYES":[{"SERIALNO":"98765","NAME":"GOOSEPEN","SALARY":4700.00},{"SERIALNO":"07654","NAME":"FUNNIGUY","SALARY":8500.00}]} +{"DEPARTMENT":"0319","TITLE":"DIRECTOR","EMPLOYES":[{"SERIALNO":"40567","NAME":"QUINN","SALARY":14000.00}]} +{"DEPARTMENT":"0319","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"00023","NAME":"MARTIN","SALARY":10000.00},{"SERIALNO":"00137","NAME":"BROWNY","SALARY":10500.00}]} +{"DEPARTMENT":"0319","TITLE":"PROGRAMMER","EMPLOYES":[{"SERIALNO":"45678","NAME":"BUGHAPPY","SALARY":8500.00}]} +{"DEPARTMENT":"0319","TITLE":"SALESMAN","EMPLOYES":[{"SERIALNO":"76543","NAME":"BULLOZER","SALARY":14800.00},{"SERIALNO":"56789","NAME":"FODDERMAN","SALARY":7000.00}]} +{"DEPARTMENT":"0319","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"33333","NAME":"MONAPENNY","SALARY":3800.00},{"SERIALNO":"55555","NAME":"MESSIFUL","SALARY":5000.50}]} +{"DEPARTMENT":"0319","TITLE":"TYPIST","EMPLOYES":[{"SERIALNO":"12345","NAME":"KITTY","SALARY":3000.45}]} +{"DEPARTMENT":"2452","TITLE":"ENGINEER","EMPLOYES":[{"SERIALNO":"31416","NAME":"ORELLY","SALARY":13400.00},{"SERIALNO":"02345","NAME":"SMITH","SALARY":9000.00}]} +{"DEPARTMENT":"2452","TITLE":"SCIENTIST","EMPLOYES":[{"SERIALNO":"34567","NAME":"BIGHEAD","SALARY":8000.00},{"SERIALNO":"36666","NAME":"BIGHORN","SALARY":11000.00}]} +{"DEPARTMENT":"2452","TITLE":"SECRETARY","EMPLOYES":[{"SERIALNO":"11111","NAME":"CHERRY","SALARY":4500.00}]} SELECT Bson_Object_Grp(SALARY) FROM t3; ERROR HY000: Can't initialize function 'bson_object_grp'; This function requires 2 arguments (key, value) SELECT Bson_Object_Grp(NAME, SALARY) FROM t3; @@ -325,7 +328,7 @@ BsonGet_String(Bson_Make_Array(45,28,36,45,89),'3') 45 SELECT BsonGet_String(Bson_Make_Array(45,28,36,45,89),'["+"]') "list",'=' as "egal",BsonGet_String(Bson_Make_Array(45,28,36,45,89),'[+]') "sum"; list egal sum -45+28+36+45+89 = 243.00 +45+28+36+45+89 = 243 SELECT BsonGet_String(Bson_Make_Array(Bson_Make_Array(45,28),Bson_Make_Array(36,45,89)),'1.0'); BsonGet_String(Bson_Make_Array(Bson_Make_Array(45,28),Bson_Make_Array(36,45,89)),'1.0') 36 diff --git a/storage/connect/mysql-test/connect/t/bson_udf.inc b/storage/connect/mysql-test/connect/t/bson_udf.inc index 366f48e5861..c4722722ef7 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf.inc +++ b/storage/connect/mysql-test/connect/t/bson_udf.inc @@ -22,6 +22,8 @@ if (!$HA_CONNECT_SO) { --eval CREATE FUNCTION bson_object_delete RETURNS STRING SONAME '$HA_CONNECT_SO'; --eval CREATE FUNCTION bson_object_list RETURNS STRING SONAME '$HA_CONNECT_SO'; --eval CREATE FUNCTION bson_object_values RETURNS STRING SONAME '$HA_CONNECT_SO'; +--eval CREATE FUNCTION bsonset_def_prec RETURNS INTEGER SONAME '$HA_CONNECT_SO'; +--eval CREATE FUNCTION bsonget_def_prec RETURNS INTEGER SONAME '$HA_CONNECT_SO'; --eval CREATE FUNCTION bsonset_grp_size RETURNS INTEGER SONAME '$HA_CONNECT_SO'; --eval CREATE FUNCTION bsonget_grp_size RETURNS INTEGER SONAME '$HA_CONNECT_SO'; --eval CREATE AGGREGATE FUNCTION bson_array_grp RETURNS STRING SONAME '$HA_CONNECT_SO'; diff --git a/storage/connect/mysql-test/connect/t/bson_udf.test b/storage/connect/mysql-test/connect/t/bson_udf.test index 84a3db6d061..0da2de38864 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf.test +++ b/storage/connect/mysql-test/connect/t/bson_udf.test @@ -77,6 +77,7 @@ SELECT Bson_Object_Values('{"One":1,"Two":2,"Three":3}') "Value List"; --echo # --echo # Test UDF's with column arguments --echo # +SELECT Bsonset_Def_Prec(2); CREATE TABLE t2 ( ISBN CHAR(15), diff --git a/storage/connect/mysql-test/connect/t/bson_udf2.inc b/storage/connect/mysql-test/connect/t/bson_udf2.inc index ceddf8b0632..d06d7fac435 100644 --- a/storage/connect/mysql-test/connect/t/bson_udf2.inc +++ b/storage/connect/mysql-test/connect/t/bson_udf2.inc @@ -13,6 +13,8 @@ DROP FUNCTION bson_object_add; DROP FUNCTION bson_object_delete; DROP FUNCTION bson_object_list; DROP FUNCTION bson_object_values; +DROP FUNCTION bsonset_def_prec; +DROP FUNCTION bsonget_def_prec; DROP FUNCTION bsonset_grp_size; DROP FUNCTION bsonget_grp_size; DROP FUNCTION bson_array_grp; diff --git a/storage/connect/tabbson.cpp b/storage/connect/tabbson.cpp index ba4380c5f89..db63b8e78db 100644 --- a/storage/connect/tabbson.cpp +++ b/storage/connect/tabbson.cpp @@ -719,7 +719,10 @@ void BCUTIL::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL jvp) if (jvp) { vp->SetNull(false); - switch (jvp->Type) { + if (Jb) { + vp->SetValue_psz(Serialize(g, jvp, NULL, 0)); + Jb = false; + } else switch (jvp->Type) { case TYPE_STRG: case TYPE_INTG: case TYPE_BINT: @@ -727,29 +730,29 @@ void BCUTIL::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL jvp) case TYPE_DTM: case TYPE_FLOAT: switch (vp->GetType()) { - case TYPE_STRING: - case TYPE_DATE: - case TYPE_DECIM: - vp->SetValue_psz(GetString(jvp)); - break; - case TYPE_INT: - case TYPE_SHORT: - case TYPE_TINY: - vp->SetValue(GetInteger(jvp)); - break; - case TYPE_BIGINT: - vp->SetValue(GetBigint(jvp)); - break; - case TYPE_DOUBLE: - vp->SetValue(GetDouble(jvp)); + case TYPE_STRING: + case TYPE_DATE: + case TYPE_DECIM: + vp->SetValue_psz(GetString(jvp)); + break; + case TYPE_INT: + case TYPE_SHORT: + case TYPE_TINY: + vp->SetValue(GetInteger(jvp)); + break; + case TYPE_BIGINT: + vp->SetValue(GetBigint(jvp)); + break; + case TYPE_DOUBLE: + vp->SetValue(GetDouble(jvp)); - if (jvp->Type == TYPE_DBL || jvp->Type == TYPE_FLOAT) - vp->SetPrec(jvp->Nd); + if (jvp->Type == TYPE_DBL || jvp->Type == TYPE_FLOAT) + vp->SetPrec(jvp->Nd); - break; - default: - sprintf(G->Message, "Unsupported column type %d", vp->GetType()); - throw 888; + break; + default: + sprintf(G->Message, "Unsupported column type %d", vp->GetType()); + throw 888; } // endswitch Type break; @@ -780,53 +783,59 @@ void BCUTIL::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL jvp) /***********************************************************************/ /* MakeJson: Serialize the json item and set value to it. */ /***********************************************************************/ -PVAL BCUTIL::MakeBson(PGLOBAL g, PBVAL jsp) +PBVAL BCUTIL::MakeBson(PGLOBAL g, PBVAL jsp, int n) { - if (Cp->Value->IsTypeNum()) { - strcpy(g->Message, "Cannot make Json for a numeric column"); + PBVAL vlp, jvp = jsp; - if (!Cp->Warned) { - PushWarning(g, Tp); - Cp->Warned = true; - } // endif Warned + if (n < Cp->Nod - 1) { + if (jsp->Type == TYPE_JAR) { + int ars = GetArraySize(jsp); + PJNODE jnp = &Cp->Nodes[n]; - Cp->Value->Reset(); -#if 0 - } else if (Value->GetType() == TYPE_BIN) { - if ((unsigned)Value->GetClen() >= sizeof(BSON)) { - ulong len = Tjp->Lrecl ? Tjp->Lrecl : 500; - PBSON bsp = JbinAlloc(g, NULL, len, jsp); + jvp = NewVal(TYPE_JAR); + jnp->Op = OP_EQ; - strcat(bsp->Msg, " column"); - ((BINVAL*)Value)->SetBinValue(bsp, sizeof(BSON)); - } else { - strcpy(g->Message, "Column size too small"); - Value->SetValue_char(NULL, 0); - } // endif Clen -#endif // 0 - } else - Cp->Value->SetValue_psz(Serialize(g, jsp, NULL, 0)); + for (int i = 0; i < ars; i++) { + jnp->Rank = i; + vlp = GetRowValue(g, jsp, n); + AddArrayValue(jvp,DupVal(vlp)); + } // endfor i - return Cp->Value; -} // end of MakeJson + jnp->Op = OP_XX; + jnp->Rank = 0; + } else if (jsp->Type == TYPE_JOB) { + jvp = NewVal(TYPE_JOB); + + for (PBPR prp = GetObject(jsp); prp; prp = GetNext(prp)) { + vlp = GetRowValue(g, GetVlp(prp), n + 1); + SetKeyValue(jvp, vlp, MZP(prp->Key)); + } // endfor prp + + } // endif Type + + } // endif's + + Jb = true; + return jvp; +} // end of MakeBson /***********************************************************************/ -/* GetColumnValue: */ +/* GetRowValue: */ /***********************************************************************/ -PVAL BCUTIL::GetColumnValue(PGLOBAL g, PBVAL row, int i) +PBVAL BCUTIL::GetRowValue(PGLOBAL g, PBVAL row, int i) { int nod = Cp->Nod, n = nod - 1; JNODE *nodes = Cp->Nodes; - PVAL value = Cp->Value; PBVAL arp; PBVAL bvp = NULL; for (; i < nod && row; i++) { if (nodes[i].Op == OP_NUM) { - value->SetValue(row->Type == TYPE_JAR ? GetSize(row) : 1); - return(value); + bvp = NewVal(TYPE_INT); + bvp->N = (row->Type == TYPE_JAR) ? GetSize(row) : 1; + return(bvp); } else if (nodes[i].Op == OP_XX) { - return MakeBson(g, row); + return MakeBson(g, row, i); } else switch (row->Type) { case TYPE_JOB: if (!nodes[i].Key) { @@ -847,9 +856,9 @@ PVAL BCUTIL::GetColumnValue(PGLOBAL g, PBVAL row, int i) if (nodes[i].Op == OP_EQ) bvp = GetArrayValue(arp, nodes[i].Rank); else if (nodes[i].Op == OP_EXP) - return ExpandArray(g, arp, i); + return NewVal(ExpandArray(g, arp, i)); else - return CalculateArray(g, arp, i); + return NewVal(CalculateArray(g, arp, i)); } else { // Unexpected array, unwrap it as [0] @@ -871,6 +880,17 @@ PVAL BCUTIL::GetColumnValue(PGLOBAL g, PBVAL row, int i) } // endfor i + return bvp; +} // end of GetColumnValue + +/***********************************************************************/ +/* GetColumnValue: */ +/***********************************************************************/ +PVAL BCUTIL::GetColumnValue(PGLOBAL g, PBVAL row, int i) +{ + PVAL value = Cp->Value; + PBVAL bvp = GetRowValue(g, row, i); + SetJsonValue(g, value, bvp); return value; } // end of GetColumnValue diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index bb3f32bd945..adb02dd28e4 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -127,11 +127,13 @@ protected: class BCUTIL : public BTUTIL { public: // Constructor - BCUTIL(PGLOBAL G, PBSCOL cp, TDBBSN* tp) : BTUTIL(G, tp) { Cp = cp; } + BCUTIL(PGLOBAL G, PBSCOL cp, TDBBSN* tp) : BTUTIL(G, tp) + { Cp = cp; Jb = false; } // Utility functions void SetJsonValue(PGLOBAL g, PVAL vp, PBVAL jvp); - PVAL MakeBson(PGLOBAL g, PBVAL jsp); + PBVAL MakeBson(PGLOBAL g, PBVAL jsp, int n); + PBVAL GetRowValue(PGLOBAL g, PBVAL row, int i); PVAL GetColumnValue(PGLOBAL g, PBVAL row, int i); PVAL ExpandArray(PGLOBAL g, PBVAL arp, int n); PVAL CalculateArray(PGLOBAL g, PBVAL arp, int n); @@ -140,6 +142,7 @@ public: protected: // Member PBSCOL Cp; + bool Jb; }; // end of class BCUTIL /* -------------------------- TDBBSN class --------------------------- */ From 848a1a613c103209e4f2fb5d02572237d46832a1 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 28 Jan 2021 19:54:24 +0100 Subject: [PATCH 02/15] Fix decimal problems in bson udf's --- storage/connect/bson.cpp | 46 +++--- storage/connect/bsonudf.cpp | 156 +++++++++--------- .../connect/mysql-test/connect/r/bson.result | 2 +- .../mysql-test/connect/r/bson_udf.result | 48 ++---- 4 files changed, 115 insertions(+), 137 deletions(-) diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 5731ce9eac5..6c979498286 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -1501,31 +1501,27 @@ double BJSON::GetDouble(PBVAL vp) PBVAL vlp = (vp->Type == TYPE_JVAL) ? MVP(vp->To_Val) : vp; switch (vlp->Type) { - case TYPE_DBL: - d = *(double*)MP(vlp->To_Val); - break; - case TYPE_BINT: - d = (double)*(longlong*)MP(vlp->To_Val); - break; - case TYPE_INTG: - d = (double)vlp->N; - break; - case TYPE_FLOAT: - { char buf[32]; - int n = (vlp->Nd) ? vlp->Nd : 5; - - sprintf(buf, "%.*f", n, vlp->F); - d = atof(buf); - } break; - case TYPE_DTM: - case TYPE_STRG: - d = atof(MZP(vlp->To_Val)); - break; - case TYPE_BOOL: - d = (vlp->B) ? 1.0 : 0.0; - break; - default: - d = 0.0; + case TYPE_DBL: + d = *(double*)MP(vlp->To_Val); + break; + case TYPE_BINT: + d = (double)*(longlong*)MP(vlp->To_Val); + break; + case TYPE_INTG: + d = (double)vlp->N; + break; + case TYPE_FLOAT: + d = (double)vlp->F; + break; + case TYPE_DTM: + case TYPE_STRG: + d = atof(MZP(vlp->To_Val)); + break; + case TYPE_BOOL: + d = (vlp->B) ? 1.0 : 0.0; + break; + default: + d = 0.0; } // endswitch Type return d; diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index dd9f95bc4ba..b8f4f9699d4 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -116,7 +116,7 @@ BJNX::BJNX(PGLOBAL g) : BDOC(g) Value = NULL; MulVal = NULL; Jpath = NULL; - Buf_Type = TYPE_NULL; + Buf_Type = TYPE_STRING; Long = len; Prec = 0; Nod = 0; @@ -171,10 +171,9 @@ BJNX::BJNX(PGLOBAL g, PBVAL row, int type, int len, int prec, my_bool wr) : BDOC my_bool BJNX::SetJpath(PGLOBAL g, char* path, my_bool jb) { // Check Value was allocated - if (!Value) - return true; + if (Value) + Value->SetNullable(true); - Value->SetNullable(true); Jpath = path; // Parse the json path @@ -697,8 +696,10 @@ PVAL BJNX::GetCalcValue(PGLOBAL g, PBVAL bap, int n) if (IsTypeChar(Buf_Type)) { type = TYPE_DOUBLE; prec = 2; - } else + } else { type = Buf_Type; + prec = GetPrecision(); + } // endif Buf_Type break; case OP_MIN: @@ -711,7 +712,7 @@ PVAL BJNX::GetCalcValue(PGLOBAL g, PBVAL bap, int n) type = TYPE_STRING; if (IsTypeChar(Buf_Type)) { - lng = Long; + lng = (Long) ? Long : 512; prec = GetPrecision(); } else lng = 512; @@ -740,79 +741,87 @@ PVAL BJNX::CalculateArray(PGLOBAL g, PBVAL bap, int n) vp->Reset(); xtrc(1, "CalculateArray size=%d op=%d\n", ars, op); - for (i = 0; i < ars; i++) { - bvrp = GetArrayValue(bap, i); - xtrc(1, "i=%d nv=%d\n", i, nv); + try { + for (i = 0; i < ars; i++) { + bvrp = GetArrayValue(bap, i); + xtrc(1, "i=%d nv=%d\n", i, nv); - if (!IsValueNull(bvrp) || (op == OP_CNC && GetJsonNull())) { - if (IsValueNull(bvrp)) { - SetString(bvrp, NewStr(GetJsonNull()), 0); - bvp = bvrp; - } else if (n < Nod - 1 && IsJson(bvrp)) { - SetValue(&bval, GetColumnValue(g, bvrp, n + 1)); - bvp = &bval; - } else - bvp = bvrp; + if (!IsValueNull(bvrp) || (op == OP_CNC && GetJsonNull())) { + if (IsValueNull(bvrp)) { + SetString(bvrp, NewStr(GetJsonNull()), 0); + bvp = bvrp; + } else if (n < Nod - 1 && IsJson(bvrp)) { + SetValue(&bval, GetColumnValue(g, bvrp, n + 1)); + bvp = &bval; + } else + bvp = bvrp; - if (trace(1)) - htrc("bvp=%s null=%d\n", - GetString(bvp), IsValueNull(bvp) ? 1 : 0); + if (trace(1)) + htrc("bvp=%s null=%d\n", + GetString(bvp), IsValueNull(bvp) ? 1 : 0); - if (!nv++) { - SetJsonValue(g, vp, bvp); - continue; - } else - SetJsonValue(g, mulval, bvp); + if (!nv++) { + SetJsonValue(g, vp, bvp); + continue; + } else + SetJsonValue(g, mulval, bvp); - if (!mulval->IsNull()) { - switch (op) { - case OP_CNC: - if (Nodes[n].CncVal) { - val[0] = Nodes[n].CncVal; + if (!mulval->IsNull()) { + switch (op) { + case OP_CNC: + if (Nodes[n].CncVal) { + val[0] = Nodes[n].CncVal; + err = vp->Compute(g, val, 1, op); + } // endif CncVal + + val[0] = mulval; err = vp->Compute(g, val, 1, op); - } // endif CncVal + break; + // case OP_NUM: + case OP_SEP: + val[0] = vp; + val[1] = mulval; + err = vp->Compute(g, val, 2, OP_ADD); + break; + default: + val[0] = vp; + val[1] = mulval; + err = vp->Compute(g, val, 2, op); + } // endswitch Op - val[0] = mulval; - err = vp->Compute(g, val, 1, op); - break; - // case OP_NUM: - case OP_SEP: - val[0] = vp; - val[1] = mulval; - err = vp->Compute(g, val, 2, OP_ADD); - break; - default: - val[0] = vp; - val[1] = mulval; - err = vp->Compute(g, val, 2, op); - } // endswitch Op + if (err) + vp->Reset(); - if (err) - vp->Reset(); + if (trace(1)) { + char buf(32); - if (trace(1)) { - char buf(32); + htrc("vp='%s' err=%d\n", + vp->GetCharString(&buf), err ? 1 : 0); + } // endif trace - htrc("vp='%s' err=%d\n", - vp->GetCharString(&buf), err ? 1 : 0); - } // endif trace + } // endif Zero - } // endif Zero + } // endif jvrp - } // endif jvrp + } // endfor i - } // endfor i + if (op == OP_SEP) { + // Calculate average + mulval->SetValue(nv); + val[0] = vp; + val[1] = mulval; - if (op == OP_SEP) { - // Calculate average - mulval->SetValue(nv); - val[0] = vp; - val[1] = mulval; + if (vp->Compute(g, val, 2, OP_DIV)) + vp->Reset(); - if (vp->Compute(g, val, 2, OP_DIV)) - vp->Reset(); + } // endif Op - } // endif Op + } catch (int n) { + xtrc(1, "Exception %d: %s\n", n, g->Message); + PUSH_WARNING(g->Message); + } catch (const char* msg) { + strcpy(g->Message, msg); + } // end catch return vp; } // end of CalculateArray @@ -4024,8 +4033,8 @@ double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, char *p, *path; double d; PBVAL jsp, jvp; - PBJNX bxp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; + BJNX bnx(g); if (g->N) { if (!g->Activityp) { @@ -4044,8 +4053,6 @@ double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, *is_null = 1; return 0.0; } else { - BJNX bnx(g); - jvp = bnx.MakeValue(args, 0); if ((p = bnx.GetString(jvp))) { @@ -4068,21 +4075,22 @@ double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, jsp = (PBVAL)g->Xchk; path = MakePSZ(g, args, 1); - bxp = new(g) BJNX(g, jsp, TYPE_DOUBLE); +//bxp = new(g) BJNX(g, jsp, TYPE_DOUBLE, 32, jsp->Nd); - if (bxp->SetJpath(g, path)) { + if (bnx.SetJpath(g, path)) { PUSH_WARNING(g->Message); *is_null = 1; return 0.0; } else - bxp->ReadValue(g); + jvp = bnx.GetRowValue(g, jsp, 0); - if (bxp->GetValue()->IsNull()) { + if (!jvp || bnx.IsValueNull(jvp)) { *is_null = 1; return 0.0; - } // endif IsNull - - d = bxp->GetValue()->GetFloatValue(); + } else if (args->arg_count == 2) { + d = atof(bnx.GetString(jvp)); + } else + d = bnx.GetDouble(jvp); if (initid->const_item) { // Keep result of constant function diff --git a/storage/connect/mysql-test/connect/r/bson.result b/storage/connect/mysql-test/connect/r/bson.result index 98abdbb8744..fd15e020aac 100644 --- a/storage/connect/mysql-test/connect/r/bson.result +++ b/storage/connect/mysql-test/connect/r/bson.result @@ -279,7 +279,7 @@ SELECT * FROM t1; WHO WEEKS SUMS SUM AVGS SUMAVG AVGSUM AVGAVG AVERAGE Joe 3, 4, 5 69.00+83.00+26.00 178.00 17.25+16.60+13.00 46.85 59.33 15.62 16.18 Beth 3, 4, 5 16.00+32.00+32.00 80.00 16.00+16.00+16.00 48.00 26.67 16.00 16.00 -Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.13 +Janet 3, 4, 5 55.00+17.00+57.00 129.00 18.33+17.00+14.25 49.58 43.00 16.53 16.12 DROP TABLE t1; # # Expand expense in 3 one week tables diff --git a/storage/connect/mysql-test/connect/r/bson_udf.result b/storage/connect/mysql-test/connect/r/bson_udf.result index 14b3629e4b1..4ec1f0c87fd 100644 --- a/storage/connect/mysql-test/connect/r/bson_udf.result +++ b/storage/connect/mysql-test/connect/r/bson_udf.result @@ -606,14 +606,12 @@ Bson_File('test/fx.json', 0) [{"_id":5,"type":"food","item":"beer","taste":"light","price":5.65,"ratings":[5,8,9]},{"_id":6,"type":"car","item":"roadster","mileage":56000,"ratings":[6,9]},{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2,4]},{"_id":8,"type":"furniture","item":"table","size":{"W":60,"L":80,"H":40},"ratings":[5,8,7]}] SELECT Bson_File('test/fx.json', '0'); Bson_File('test/fx.json', '0') -NULL -Warnings: -Warning 1105 +{"_id":5,"type":"food","item":"beer","taste":"light","price":5.65,"ratings":[5,8,9]} SELECT Bson_File('test/fx.json', '[?]'); Bson_File('test/fx.json', '[?]') NULL Warnings: -Warning 1105 +Warning 1105 Invalid function specification ? SELECT BsonGet_String(Bson_File('test/fx.json'), '1.*'); BsonGet_String(Bson_File('test/fx.json'), '1.*') {"_id":6,"type":"car","item":"roadster","mileage":56000,"ratings":[6,9]} @@ -628,57 +626,33 @@ Price 5.65 SELECT Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 'ratings'); Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 'ratings') -NULL -Warnings: -Warning 1105 -Warning 1105 No sub-item at 'ratings' +{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2,4,6]} SELECT Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 1, 'ratings'); Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 1, 'ratings') -NULL -Warnings: -Warning 1105 -Warning 1105 No sub-item at 'ratings' +{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2,6,4]} SELECT Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 'ratings', 1); Bson_Array_Add(Bson_File('test/fx.json', '2'), 6, 'ratings', 1) -NULL -Warnings: -Warning 1105 -Warning 1105 No sub-item at 'ratings' +{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2,6,4]} SELECT Bson_Array_Add(Bson_File('test/fx.json', '2.ratings'), 6, 0); Bson_Array_Add(Bson_File('test/fx.json', '2.ratings'), 6, 0) -[6,null] -Warnings: -Warning 1105 +[6,2,4] SELECT Bson_Array_Delete(Bson_File('test/fx.json', '2'), 'ratings', 1); Bson_Array_Delete(Bson_File('test/fx.json', '2'), 'ratings', 1) -NULL -Warnings: -Warning 1105 -Warning 1105 No sub-item at 'ratings' +{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2]} SELECT Bson_Object_Add(Bson_File('test/fx.json', '2'), 'france' origin); Bson_Object_Add(Bson_File('test/fx.json', '2'), 'france' origin) -NULL -Warnings: -Warning 1105 -Warning 1105 First argument target is not an object +{"_id":7,"type":"food","item":"meat","origin":"france","ratings":[2,4]} SELECT Bson_Object_Add(Bson_File('test/fx.json', '2'), 70 H, 'size'); Bson_Object_Add(Bson_File('test/fx.json', '2'), 70 H, 'size') -NULL +{"_id":7,"type":"food","item":"meat","origin":"argentina","ratings":[2,4]} Warnings: -Warning 1105 Warning 1105 No sub-item at 'size' SELECT Bson_Object_Add(Bson_File('test/fx.json', '3'), 70 H, 'size'); Bson_Object_Add(Bson_File('test/fx.json', '3'), 70 H, 'size') -NULL -Warnings: -Warning 1105 -Warning 1105 No sub-item at 'size' +{"_id":8,"type":"furniture","item":"table","size":{"W":60,"L":80,"H":70},"ratings":[5,8,7]} SELECT Bson_Object_List(Bson_File('test/fx.json', '3.size')); Bson_Object_List(Bson_File('test/fx.json', '3.size')) -NULL -Warnings: -Warning 1105 -Warning 1105 First argument is not an object +["W","L","H"] # # Testing new functions # From 7ab30f5d95e1214e52b631d01a21494c6eb33c2f Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 29 Jan 2021 15:45:08 +0100 Subject: [PATCH 03/15] Update bson_get_item modified: bsonudf.cpp --- storage/connect/bsonudf.cpp | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index b8f4f9699d4..0a9d3813aeb 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -3693,8 +3693,8 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, { char *path, *str = NULL; PBVAL jvp; - PBJNX bxp = NULL; PGLOBAL g = (PGLOBAL)initid->ptr; + BJNX bnx(g, NULL, TYPE_STRING, initid->max_length); if (g->N) { str = (char*)g->Activityp; @@ -3707,8 +3707,6 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, PUSH_WARNING("CheckMemory error"); goto fin; } else { - BJNX bnx(g); - jvp = bnx.MakeValue(args, 0, true); if (g->Mrr) { // First argument is a constant @@ -3722,16 +3720,16 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, jvp = (PBVAL)g->Xchk; path = MakePSZ(g, args, 1); - bxp = new(g) BJNX(g, jvp, TYPE_STRING, initid->max_length); - if (bxp->SetJpath(g, path, true)) { - PUSH_WARNING(g->Message); + if (bnx.SetJpath(g, path, true)) { goto fin; } else - bxp->ReadValue(g); + jvp = bnx.GetRowValue(g, jvp, 0); - if (!bxp->GetValue()->IsNull()) - str = bxp->GetValue()->GetCharValue(); + if (!bnx.IsJson(jvp)) { + strcpy(g->Message, "Not a Json item"); + } else + str = bnx.Serialize(g, jvp, NULL, 0); if (initid->const_item) // Keep result of constant function @@ -3739,6 +3737,7 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, fin: if (!str) { + PUSH_WARNING(g->Message); *is_null = 1; *res_length = 0; } else From 4a4171286654cfc43d958ef1a26ceb37333c5623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Thu, 28 Jan 2021 23:29:43 +0200 Subject: [PATCH 04/15] Skip TokuDB within autobake-deb.sh Skipping the package within debian/rules won't work because starting with Debian 10, the helper scripts read the control file before the recipe. --- debian/autobake-deb.sh | 6 ++++++ debian/rules | 5 ----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index ddef69bb350..5cf2398575a 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -91,6 +91,12 @@ then sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control fi +## Skip TokuDB if arch is not amd64 +if [[ ! $(dpkg-architecture -q DEB_BUILD_ARCH) =~ amd64 ]] +then + sed '/Package: mariadb-plugin-tokudb/,/^$/d' -i debian/control +fi + # Always remove aws plugin, see -DNOT_FOR_DISTRIBUTION in CMakeLists.txt sed '/Package: mariadb-plugin-aws-key-management-10.2/,/^$/d' -i debian/control diff --git a/debian/rules b/debian/rules index 809911d4179..35d5adf3f8a 100755 --- a/debian/rules +++ b/debian/rules @@ -112,11 +112,6 @@ override_dh_auto_install: dh_testdir dh_testroot -# Skip TokuDB if arch is not amd64 -ifneq ($(ARCH), amd64) - sed -i -e "/Package: mariadb-plugin-tokudb/,+16d" debian/control -endif - # Copy systemd files to a location available for dh_installinit cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.2.mariadb.service cp $(BUILDDIR)/support-files/mariadb@.service debian/mariadb-server-10.2.mariadb@.service From c2aecb05751ee7319722cbe4c65b974e1f10fbbb Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 30 Jan 2021 12:07:37 +0100 Subject: [PATCH 05/15] Fix failed test bson and xml --- storage/connect/bson.cpp | 1 - storage/connect/bson.h | 3 +-- storage/connect/mysql-test/connect/r/xml.result | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 6c979498286..a494cf3166b 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -886,7 +886,6 @@ PBPR BJSON::NewPair(OFFSET key, int type) PBPR bpp = (PBPR)BsonSubAlloc(sizeof(BPAIR)); bpp->Key = key; - bpp->Vlp.Ktp = TYPE_STRG; bpp->Vlp.Type = type; bpp->Vlp.To_Val = 0; bpp->Vlp.Nd = 0; diff --git a/storage/connect/bson.h b/storage/connect/bson.h index 32a9c49b00a..4da86aeac67 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -37,8 +37,7 @@ typedef struct _jvalue { bool B; // A boolean value True or false (0) }; short Nd; // Number of decimals - char Type; // The value type - char Ktp; // The key type + short Type; // The value type OFFSET Next; // Offset to the next value in array } BVAL, *PBVAL; // end of struct BVALUE diff --git a/storage/connect/mysql-test/connect/r/xml.result b/storage/connect/mysql-test/connect/r/xml.result index 599c35cb1ed..6a0c9db27b3 100644 --- a/storage/connect/mysql-test/connect/r/xml.result +++ b/storage/connect/mysql-test/connect/r/xml.result @@ -374,7 +374,7 @@ INSERT INTO t1 VALUES (_cp1251 0xC0C1C2C3); Warnings: Level Warning Code 1105 -Message Com error: Impossible d'enregistrer le caractère dans le codage iso-8859-1. +Message Com error: Unable to save character to 'iso-8859-1' encoding. INSERT INTO t1 VALUES ('&<>"\''); SELECT node, hex(node) FROM t1; From ff5186fd2b1ed06ed40fe3d817b41326e3f943d5 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 29 Jan 2021 19:31:07 +0200 Subject: [PATCH 06/15] List of unstable tests for 10.2.37 release Test code modifications and new failures from buildbot only registered for the main suite. The rest was updated partially, based on the status of existing JIRA items --- mysql-test/unstable-tests | 294 ++++++++++++++------------------------ 1 file changed, 111 insertions(+), 183 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 7eac636dc5d..286c99cba14 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,28 +23,31 @@ # ############################################################################## # -# Based on bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8 -# Fri Oct 30 12:58:16 2020 +0200 -# MDEV-23991 fixup: Initialize the memory +# Based on 10.2 9c84852809214e97cf91327a798204c1b745881e +# for main suite changes and failures, and +# bb-10.2-release 72eea39d4c4a8bcadccfdac457e61abc7b618ff8 +# for the rest -main.alter_table : Modified in 10.2.35 -main.alter_table_trans : MDEV-12084 - timeout +main.alter_table_trans : MDEV-12084 - Timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.aria_icp_debug : Added in 10.2.35 main.auth_named_pipe : MDEV-14724 - System error 2 -main.blackhole : Modified in 10.2.35 -main.bootstrap_innodb : Added in 10.2.35 main.connect : MDEV-17282 - Wrong result main.connect2 : MDEV-13885 - Server crash -main.count_distinct2 : MDEV-11768 - timeout +main.create : Modified in 10.2.37 main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result +main.cte_nonrecursive : Modified in 10.2.37 +main.cte_nonrecursive_not_embedded : Added in 10.2.37 +main.cte_recursive : Modified in 10.2.37 main.ctype_ucs : MDEV-17681 - Data too long for column main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade main.ctype_utf16 : MDEV-10675: timeout or extra warnings -main.ctype_utf8 : Modified in 10.2.35 +main.ctype_utf8mb4 : Modified in 10.2.37 +main.ctype_utf8mb4_heap : Include file modified in 10.2.37 +main.ctype_utf8mb4_innodb : Include file modified in 10.2.37 +main.ctype_utf8mb4_myisam : Include file modified in 10.2.37 main.debug_sync : MDEV-10607 - internal error -main.derived_opt : MDEV-11768 - timeout +main.derived_cond_pushdown : Modified in 10.2.37 main.dirty_close : MDEV-19368 - mysqltest failed but provided no output main.distinct : MDEV-14194 - Crash main.drop_bad_db_type : MDEV-15676 - Wrong result @@ -52,104 +55,92 @@ main.events_2 : MDEV-13277 - Crash main.events_bugs : MDEV-12892 - Crash main.events_restart : MDEV-12236 - Server shutdown problem main.events_slowlog : MDEV-12821 - Wrong result -main.fast_prefix_index_fetch_innodb : Modified in 10.2.35 main.flush : MDEV-19368 - mysqltest failed but provided no output -main.func_gconcat : MDEV-21379 - Valgrind warnings -main.func_json : Modified in 10.2.35 -main.func_test : Modified in 10.2.35 +main.func_gconcat : MDEV-21379 - Valgrind warnings; modified in 10.2.37 +main.func_like : Modified in 10.2.37 main.gis : MDEV-13411 - wrong result on P8 +main.gis-json : Modified in 10.2.37 main.gis_notembedded : MDEV-21264 - Wrong result with different default charset -main.grant : Modified in 10.2.35 -main.grant5 : Modified in 10.2.35 +main.group_by : Modified in 10.2.37 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Plan mismatch -main.information_schema : Modified in 10.2.35 -main.innodb_ext_key : Modified in 10.2.35 -main.innodb_icp_debug : Added in 10.2.35 +main.information_schema : Modified in 10.2.37 +main.innodb_mrr_cpk : MDEV-24737 - Server crash main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure (Fixed in 10.3+, MDEV-22947) +main.kill : Modified in 10.2.37 main.kill-2 : MDEV-13257 - Wrong result main.kill_processlist-6619 : MDEV-10793 - Wrong result -main.limit_rows_examined : Modified in 10.2.35 main.loaddata : MDEV-19368 - mysqltest failed but provided no output main.locale : MDEV-20521 - Missing warning -main.lock_view : Added in 10.2.35 +main.lock_tables_lost_commit : MDEV-24624 - Timeout +main.lock_view : Modified in 10.2.37 main.log_slow : MDEV-13263 - Wrong result -main.log_tables : Modified in 10.2.35 main.log_tables-big : MDEV-13408 - wrong result main.mdev-504 : MDEV-15171 - warning main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update_big : Modified in 10.2.35 -main.myisam_icp_debug : Added in 10.2.35 +main.myisam : Modified in 10.2.37 main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2 main.mysql_client_test_comp : MDEV-16641 - Error in exec main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed -main.mysql_upgrade : Modified in 10.2.35 +main.mysql_upgrade : Modified in 10.2.37 main.mysql_upgrade_noengine : MDEV-14355 - Wrong result -main.mysqlbinlog_row_minimal : Modified in 10.2.35 -main.mysqld--help : Modified in 10.2.35 main.mysqld_option_err : MDEV-21571 - Crash on bootstrap -main.mysqldump : MDEV-14800 - Stack smashing detected -main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug +main.mysqldump : Modified in 10.2.37 +main.mysqldump-system : Added in 10.2.37 main.mysqlslap : MDEV-11801 - timeout main.mysqltest : MDEV-9269 - fails on Alpha; MDEV-13887 - Wrong result main.old-mode : MDEV-19373 - Wrong result main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 -main.order_by : Modified in 10.2.35 +main.order_by : Modified in 10.2.37 main.order_by_optimizer_innodb : MDEV-10683 - Wrong result -main.parser : Modified in 10.2.35 -main.partition : Modified in 10.2.35 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1 -main.plugin_innodb : Modified in 10.2.35 -main.pool_of_threads : Modified in 10.2.35 -main.precedence : Added in 10.2.35 -main.precedence_bugs : Added in 10.2.35 -main.processlist_notembedded : Modified in 10.2.35 +main.precedence : Modified in 10.2.37 +main.processlist_notembedded : MDEV-23752 - Not explainable command main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count -main.query_cache : MDEV-16180 - Wrong result +main.ps_show_log : Added in 10.2.37 +main.query_cache : MDEV-16180 - Wrong result; modified in 10.2.37 main.query_cache_debug : MDEV-15281 - Query cache is disabled -main.range : Modified in 10.2.35 +main.range : Modified in 10.2.37 main.range_innodb : MDEV-23371 - Server crash main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away main.set_statement : MDEV-13183 - Wrong result main.set_statement_notembedded : MDEV-19414 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_explain : MDEV-10674 - Wrong result code +main.skip_grants : Modified in 10.2.37 +main.sp : Modified in 10.2.37 main.sp-security : MDEV-10607 - sporadic "can't connect" +main.sp-ucs2 : Modified in 10.2.37 main.sp_notembedded : MDEV-10607 - internal error main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_timeout : MDEV-11244 - Crash +main.stat_tables : Modified in 10.2.37 main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.status : MDEV-13255 - Wrong result -main.subselect4 : Modified in 10.2.35 -main.subselect_innodb : MDEV-10614 - Sporadic wrong results; modified in 10.2.35 -main.sum_distinct-big : Modified in 10.2.35 +main.subselect_innodb : MDEV-10614 - Sporadic wrong results main.tc_heuristic_recover : MDEV-14189 - Wrong result -main.temp_table_symlink : MDEV-24058 - Wrong error code; added in 10.2.35 +main.temp_table_symlink : MDEV-24058 - Wrong error code main.type_blob : MDEV-15195 - Wrong result -main.type_date : Modified in 10.2.35 -main.type_datetime : Modified in 10.2.35 main.type_datetime_hires : MDEV-10687 - Timeout -main.type_newdecimal : Modified in 10.2.35 main.type_temporal_innodb : MDEV-24025 - Wrong result -main.udf : Modified in 10.2.35 +main.type_year : Modified in 10.2.37 +main.user_limits : Modified in 10.2.37 main.userstat : MDEV-12904 - SSL errors -main.view : Modified in 10.2.35 +main.view : Modified in 10.2.37 main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query -main.win : Modified in 10.2.35 -main.xa : MDEV-11769 - lock wait timeout +main.xa : MDEV-11769 - lock wait timeout; modified in 10.2.37 #----------------------------------------------------------------------- -archive.archive_bitfield : MDEV-11771 - table is marked as crashed -archive.archive_symlink : MDEV-12170 - unexpected error on rmdir -archive.discover : MDEV-10510 - Table is marked as crashed -archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug +archive.archive_bitfield : MDEV-11771 - table is marked as crashed +archive.archive_symlink : MDEV-12170 - unexpected error on rmdir +archive.discover : MDEV-10510 - Table is marked as crashed #----------------------------------------------------------------------- @@ -157,18 +148,14 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed #----------------------------------------------------------------------- -binlog.binlog_commit_wait : MDEV-10150 - Mismatch -binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown -binlog.binlog_mysqlbinlog_row : Modified in 10.2.35 -binlog.binlog_mysqlbinlog_row_frag : Modified in 10.2.35 -binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown -binlog.binlog_recover_checksum_error : Added in 10.2.35 -binlog.binlog_show_binlog_event_random_pos : Modified in 10.2.35 -binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result -binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint -binlog.flashback-largebinlog : MDEV-19764 - Out of memory -binlog.load_data_stm_view : MDEV-16948 - Wrong result +binlog.binlog_commit_wait : MDEV-10150 - Mismatch +binlog.binlog_killed : MDEV-12925 - Wrong result +binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown +binlog.binlog_no_uniqfile_crash : MDEV-24078 - Server crash upon shutdown +binlog.binlog_stm_mix_innodb_myisam : MDEV-24057 - Wrong result +binlog.binlog_xa_recover : MDEV-12908 - Extra checkpoint +binlog.flashback-largebinlog : MDEV-19764 - Out of memory +binlog.load_data_stm_view : MDEV-16948 - Wrong result #----------------------------------------------------------------------- @@ -193,10 +180,9 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost con #----------------------------------------------------------------------- -connect.pivot : MDEV-14803 - Failed to discover table -connect.updelx : Modified in 10.2.35 -connect.vcol : MDEV-12374 - Fails on Windows -connect.zip : MDEV-13884 - Wrong result +connect.pivot : MDEV-14803 - Failed to discover table +connect.vcol : MDEV-12374 - Fails on Windows +connect.zip : MDEV-13884 - Wrong result #----------------------------------------------------------------------- @@ -204,40 +190,34 @@ disks.disks_notembedded : MDEV-21587 - Wrong result #----------------------------------------------------------------------- -encryption.create_or_replace : Modified in 10.2.35 -encryption.create_or_replace_big : Added in 10.2.35 -encryption.debug_key_management : MDEV-13841 - Timeout -encryption.encrypt_and_grep : MDEV-13765 - Wrong result -encryption.innochecksum : MDEV-13644 - Assertion failure -encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket -encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate -encryption.innodb-discard-import : MDEV-19113 - Timeout -encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout -encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error -encryption.innodb-missing-key : MDEV-17286 - SSL error -encryption.innodb-page_encryption : MDEV-10641 - mutex problem -encryption.innodb-page_encryption_compression : Modified in 10.2.35 -encryption.innodb-page_encryption_log_encryption : Modified in 10.2.35 -encryption.innodb-read-only : MDEV-16563 - Crash on startup -encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup -encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition -encryption.innodb-spatial-index : MDEV-13746 - Wrong result -encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout -encryption.innodb_encrypt_log : MDEV-13725 - Wrong result -encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash -encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result -encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout -encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure -encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result -encryption.innodb_encryption_is : MDEV-12898 - Server hang on startup -encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash -encryption.innodb_first_page : MDEV-10689 - Crash -encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart -encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) -encryption.tempfiles_encrypted : Added in 10.2.35 +encryption.create_or_replace : MDEV-24081 - Lock wait timeout exceeded +encryption.debug_key_management : MDEV-13841 - Timeout +encryption.encrypt_and_grep : MDEV-13765 - Wrong result +encryption.innochecksum : MDEV-13644 - Assertion failure +encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket +encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate +encryption.innodb-discard-import : MDEV-19113 - Timeout +encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout +encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition +encryption.innodb-force-corrupt : MDEV-17286 - SSL error +encryption.innodb-missing-key : MDEV-17286 - SSL error +encryption.innodb-page_encryption : MDEV-10641 - mutex problem +encryption.innodb-read-only : MDEV-16563 - Crash on startup +encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition +encryption.innodb-spatial-index : MDEV-13746 - Wrong result +encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout +encryption.innodb_encrypt_log : MDEV-13725 - Wrong result +encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash +encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result +encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout +encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure +encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result +encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash +encryption.innodb_first_page : MDEV-10689 - Crash +encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart +encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) +encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) +encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing (Fixed in 10.5+) #----------------------------------------------------------------------- @@ -285,33 +265,20 @@ galera_3nodes.* : Suite is not stable yet #----------------------------------------------------------------------- -gcol.gcol_keys_innodb : Include file modified in 10.2.35 -gcol.gcol_keys_myisam : Include file modified in 10.2.35 -gcol.gcol_partition_innodb : Include file modified in 10.2.35 -gcol.gcol_update : Include file modified in 10.2.35 -gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion -gcol.innodb_virtual_debug : MDEV-23111 - Server crash -gcol.innodb_virtual_debug_purge : Include file modified in 10.2.35 -gcol.innodb_virtual_fk : Modified in 10.2.35 -gcol.innodb_virtual_index : Modified in 10.2.35 -gcol.innodb_virtual_purge : Include file modified in 10.2.35 +gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion +gcol.innodb_virtual_debug : MDEV-23111 - Server crash #----------------------------------------------------------------------- innodb.101_compatibility : MDEV-13891 - Wrong result innodb.alter_copy : MDEV-16181 - Assertion failure innodb.alter_crash : MDEV-16944 - The process cannot access the file -innodb.alter_table : Modified in 10.2.35 innodb.binlog_consistent : MDEV-10618 - Server fails to start innodb.blob-crash : MDEV-20481 - Failures upon recovery innodb.doublewrite : MDEV-12905 - Server crash -innodb.foreign-keys : Modified in 10.2.35 -innodb.foreign_key : Modified in 10.2.35 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch innodb.ibuf_not_empty : MDEV-19021 - Wrong result -innodb.innodb : Modified in 10.2.35 -innodb.innodb-64k : Modified in 10.2.35 innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS innodb.innodb-alter-table : MDEV-10619 - Testcase timeout @@ -319,18 +286,15 @@ innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown innodb.innodb-get-fk : MDEV-13276 - Server crash -innodb.innodb-index : Include file modified in 10.2.35 -innodb.innodb-index-debug : Include file modified in 10.2.35 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb-table-online : MDEV-13894 - Wrong result +innodb.innodb-ucs2 : MDEV-24505 - Assertion failure innodb.innodb-wl5522-1 : MDEV-22945 - Server crash innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc -innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure -innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt innodb.innodb_bug30423 : MDEV-7311 - Wrong result innodb.innodb_bug47167 : MDEV-20524 - Table 'user' is marked as crashed and should be repaired innodb.innodb_bug48024 : MDEV-14352 - Assertion failure @@ -339,14 +303,11 @@ innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full innodb.innodb_information_schema : MDEV-8851 - Wrong result innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result -innodb.innodb_monitor : MDEV-10939 - Testcase timeout innodb.innodb_mysql : MDEV-19873 - Wrong result innodb.innodb_stats : MDEV-10682 - wrong result -innodb.innodb_stats_drop_locked : Modified in 10.2.35 innodb.innodb_stats_persistent : MDEV-21567 - Wrong result in execution plan innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait -innodb.innodb_trx_weight : Configuration deleted in 10.2.35 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start @@ -357,24 +318,19 @@ innodb.purge_secondary : MDEV-15681 - Wrong result innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile -innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace; modified in 10.2.35 -innodb.stats_persistent : Added in 10.2.35 +innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start innodb.temp_table_savepoint : MDEV-24077 - Assertion failure innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate : Modified in 10.2.35 innodb.undo_truncate : MDEV-17340 - Server hung innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away -innodb.update-cascade : Combinations added in 10.2.35 innodb.update_time : MDEV-14804 - Wrong result innodb.xa_recovery : MDEV-15279 - mysqld got exception #----------------------------------------------------------------------- -innodb_fts.basic : Modified in 10.2.35 innodb_fts.fulltext2 : MDEV-24074 - Server crash -innodb_fts.innodb_fts_misc_1 : Modified in 10.2.35 innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed @@ -383,13 +339,11 @@ innodb_fts.sync_ddl : MDEV-21568 - Errno: 2000 #----------------------------------------------------------------------- innodb_gis.gis_split_nan : MDEV-21678 - Cannot get geometry object -innodb_gis.rtree_add_index : Include file modified in 10.2.35 -innodb_gis.rtree_compress : Include file modified in 10.2.35 innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded -innodb_gis.rtree_purge : MDEV-15275 - Timeout; include file modified in 10.2.35 +innodb_gis.rtree_purge : MDEV-15275 - Timeout innodb_gis.rtree_recovery : MDEV-15274 - Error on check innodb_gis.rtree_split : MDEV-14208 - Too many arguments -innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file; include file modified in 10.2.35 +innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed #----------------------------------------------------------------------- @@ -412,24 +366,18 @@ maria.maria : MDEV-14430 - Extra warning #----------------------------------------------------------------------- -mariabackup.apply-log-only : MDEV-20135 - Timeout -mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown -mariabackup.data_directory : MDEV-15270 - Error on exec -mariabackup.ddl_incremental_encrypted : Added in 10.2.35 -mariabackup.full_backup : MDEV-16571 - Wrong result -mariabackup.huge_lsn : MDEV-17286 - SSL error -mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure -mariabackup.incremental_ddl_during_backup : Modified in 10.2.35 -mariabackup.incremental_encrypted : MDEV-15667 - Timeout -mariabackup.innodb_redo_overwrite : Added in 10.2.35 -mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.mlog_index_load : Modified in 10.2.35 -mariabackup.partial_exclude : MDEV-15270 - Error on exec -mariabackup.rpl_slave_info : Added in 10.2.35 -mariabackup.unencrypted_page_compressed : Include file modified in 10.2.35 -mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault -mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 -mariabackup.xb_partition : MDEV-17584 - Crash on shutdown +mariabackup.apply-log-only : MDEV-20135 - Timeout +mariabackup.backup_ssl : MDEV-24073 - Server crash upon shutdown +mariabackup.data_directory : MDEV-15270 - Error on exec +mariabackup.full_backup : MDEV-16571 - Wrong result +mariabackup.huge_lsn : MDEV-17286 - SSL error +mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure +mariabackup.incremental_encrypted : MDEV-15667 - Timeout +mariabackup.mdev-14447 : MDEV-15201 - Timeout +mariabackup.partial_exclude : MDEV-15270 - Error on exec +mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault +mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 +mariabackup.xb_partition : MDEV-17584 - Crash on shutdown #----------------------------------------------------------------------- @@ -453,8 +401,6 @@ multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - Wrong result, MDE multi_source.mdev-8874 : MDEV-19415 - AddressSanitizer: heap-use-after-free multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free multi_source.multisource : MDEV-10417 - Fails on Mips -multi_source.reset_slave : MDEV-10690 - Wrong result -multi_source.simple : MDEV-4633 - Wrong result multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats #----------------------------------------------------------------------- @@ -503,7 +449,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such plugins.processlist : MDEV-16574 - Wrong result -plugins.server_audit : MDEV-9562 - crashes on sol10-sparc; modified in 10.2.35 +plugins.server_audit : MDEV-9562 - crashes on sol10-sparc plugins.thread_pool_server_audit : MDEV-14295 - Wrong result #----------------------------------------------------------------------- @@ -553,7 +499,6 @@ rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log rpl.rpl_binlog_errors : MDEV-12742 - Crash -rpl.rpl_binlog_index : Modified in 10.2.35 rpl.rpl_checksum_cache : MDEV-22510 - Server crash rpl.rpl_colSize : MDEV-16112 - Server crash rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac @@ -563,13 +508,10 @@ rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning -rpl.rpl_filter_tables_dynamic : Modified in 10.2.35 -rpl.rpl_filter_wild_tables_dynamic : Modified in 10.2.35 rpl.rpl_flushlog_loop : MDEV-21570 - Server crash rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output rpl.rpl_gtid_basic : MDEV-10681 - server startup problem -rpl.rpl_gtid_crash : MDEV-13643 - Lost connection; modified in 10.2.35 -rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout; MDEV-23103 - Could not delete gtid domain; modified in 10.2.35 +rpl.rpl_gtid_crash : MDEV-13643 - Lost connection rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings rpl.rpl_gtid_reconnect : MDEV-14497 - Crash @@ -587,12 +529,9 @@ rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors rpl.rpl_mdev6020 : MDEV-23426 - Server crash, ASAN failures; MDEV-15272 - Server crash rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout -rpl.rpl_mysql_upgrade : Modified in 10.2.35 rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait rpl.rpl_parallel : MDEV-10653 - Timeouts -rpl.rpl_parallel2 : Modified in 10.2.35 rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash -rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master @@ -613,19 +552,15 @@ rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_index_choice : MDEV-15196 - Slave crash rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum -rpl.rpl_semi_sync : MDEV-11220 - Wrong result -rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result -rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings -rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures +rpl.rpl_semi_sync_uninstall_plugin : MDEV-24561 - Wrong usage of mutex; MDEV-7140 - Assorted failures rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_show_slave_hosts : MDEV-10681 - Crash rpl.rpl_skip_replication : MDEV-23372 - Extra warning -rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock; ; modified in 10.2.35 rpl.rpl_slave_load_tmpdir_not_exist : MDEV-23372 - Extra warning rpl.rpl_slow_query_log : MDEV-13250 - Test abort rpl.rpl_sp_effects : MDEV-13249 - Crash -rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout; modified in 10.2.35 +rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash rpl.rpl_sync : MDEV-10633 - Database page corruption @@ -635,7 +570,6 @@ rpl.rpl_trigger : MDEV-18055 - Wrong result rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error rpl.rpl_user_variables : MDEV-20522 - Wrong result rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result -rpl.show_status_stop_slave_race-7126 : Modified in 10.2.35 #----------------------------------------------------------------------- @@ -682,14 +616,9 @@ sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected err sys_vars.innodb_checksum_algorithm_basic : MDEV-21568 - Errno: 2000 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash -sys_vars.replicate_do_db_basic : Modified in 10.2.35 -sys_vars.rpl_init_slave_func : Modified in 10.2.35 -sys_vars.session_track_system_variables_basic : Modified in 10.2.35 sys_vars.slow_query_log_func : MDEV-14273 - Wrong result sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -sys_vars.wsrep_cluster_address_basic : Modified in 10.2.35 -sys_vars.wsrep_on_basic : Configuration deleted in 10.2.35 #----------------------------------------------------------------------- @@ -721,7 +650,7 @@ tokudb_alter_table.hcad_all_add2 : MDEV-15269 - Timeout #----------------------------------------------------------------------- -tokudb_backup.* : MDEV-11001 - Missing include file +tokudb_backup.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- @@ -738,11 +667,11 @@ tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection #----------------------------------------------------------------------- -tokudb_rpl.* : MDEV-11001 - Missing include file +tokudb_rpl.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- -tokudb_sys_vars.* : MDEV-11001 - Missing include file +tokudb_sys_vars.* : MDEV-11001 - Missing include file (Won't fix) #----------------------------------------------------------------------- @@ -760,14 +689,13 @@ unit.mf_iocache : MDEV-20952 - Buffer overflow vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout -vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.2.35 +vcol.vcol_misc : MDEV-16651 - Wrong error message #----------------------------------------------------------------------- wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use -wsrep.variables : Modified in 10.2.35 #----------------------------------------------------------------------- From 571294f954779c195763d996c3235ec979b4cdd9 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Tue, 2 Feb 2021 00:03:07 +0100 Subject: [PATCH 07/15] Fix failed test bson and xml --- storage/connect/tabjson.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 19f721f692b..fb5a64c7d55 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -1024,8 +1024,14 @@ bool TDBJSN::OpenDB(PGLOBAL g) /* Lrecl is Ok. */ /*********************************************************************/ size_t linelen = Lrecl; + MODE mode = Mode; - //To_Line = (char*)PlugSubAlloc(g, NULL, linelen); + // Buffer must be allocated in g->Sarea + Mode = MODE_ANY; + Txfp->AllocateBuffer(g); + Mode = mode; + + //To_Line = (char*)PlugSubAlloc(g, NULL, linelen); //memset(To_Line, 0, linelen); To_Line = Txfp->GetBuf(); xtrc(1, "OpenJSN: R%hd mode=%d To_Line=%p\n", Tdb_No, Mode, To_Line); From b3cecb7bfc88a72661e61b3c8ce3e6101ac4e9b5 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 2 Feb 2021 10:37:54 +0100 Subject: [PATCH 08/15] Revert "Fix of warnings on aarch64 like:" Fixed by the author in other way (char -> short) This reverts commit 496f7090a825ac7ee54a6b5f9700e5f261e4bce0. --- storage/connect/bson.cpp | 6 +++--- storage/connect/bsonudf.cpp | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index fa24300f91f..7665d8520ab 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -769,7 +769,7 @@ bool BDOC::SerializeValue(PBVAL jvp, bool b) case TYPE_DBL: sprintf(buf, "%.*lf", jvp->Nd, *(double*)MakePtr(Base, jvp->To_Val)); return jp->WriteStr(buf); - case (char)TYPE_NULL: + case TYPE_NULL: return jp->WriteStr("null"); case TYPE_JVAL: return SerializeValue(MVP(jvp->To_Val)); @@ -1554,7 +1554,7 @@ PSZ BJSON::GetString(PBVAL vp, char* buff) case TYPE_BOOL: p = (PSZ)((vlp->B) ? "true" : "false"); break; - case (char)TYPE_NULL: + case TYPE_NULL: p = (PSZ)"null"; break; default: @@ -1771,7 +1771,7 @@ bool BJSON::IsValueNull(PBVAL vlp) bool b; switch (vlp->Type) { - case (char)TYPE_NULL: + case TYPE_NULL: b = true; break; case TYPE_JOB: diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index a71cd2f0229..30cb69d1775 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -526,7 +526,7 @@ void BJNX::SetJsonValue(PGLOBAL g, PVAL vp, PBVAL vlp) case TYPE_JOB: vp->SetValue_psz(GetObjectText(g, vlp, NULL)); break; - case (char)TYPE_NULL: + case TYPE_NULL: vp->SetNull(true); default: vp->Reset(); @@ -1444,7 +1444,7 @@ my_bool BJNX::CompareValues(PGLOBAL g, PBVAL v1, PBVAL v2) b = (v1->B == v2->B); break; - case (char)TYPE_NULL: + case TYPE_NULL: b = (v2->Type == TYPE_NULL); break; default: From 716b0b44f8ec169de5b89e24c46434f64d58de90 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Tue, 2 Feb 2021 10:49:13 +0100 Subject: [PATCH 09/15] Fix compiler warnings of the new connect engine. --- storage/connect/bsonudf.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 30cb69d1775..18382c7a273 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -31,6 +31,7 @@ int JsonDefPrec = -1; int GetDefaultPrec(void); int IsArgJson(UDF_ARGS* args, uint i); void SetChanged(PBSON bsp); +int GetJsonDefPrec(void); static PBSON BbinAlloc(PGLOBAL g, ulong len, PBVAL jsp); From 87bf594bc505cef0cc5c3aa436bb134cc8810e86 Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 3 Feb 2021 10:44:44 +0100 Subject: [PATCH 10/15] Fix of random crashes of connect engine (probably depend on addresses used)- --- storage/connect/plugutil.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 389613351bb..9e1f006d605 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -628,7 +628,7 @@ size_t MakeOff(void* memp, void* ptr) DoThrow(999); } // endif ptr #endif // _DEBUG || DEVELOPMENT - return (size_t)((char*)ptr - (size_t)memp); + return (size_t)(((char*)ptr) - ((char*)memp)); } else return 0; From c04ae0d365f4e65bf6c0ccc01c25d597e269d47e Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Wed, 3 Feb 2021 15:35:32 +0100 Subject: [PATCH 11/15] Fix of crashes of connect engine. Use size_t everywhere and remove suspicious expression. --- storage/connect/bson.cpp | 32 ++++++++++++++++---------------- storage/connect/bson.h | 14 +++++++------- storage/connect/bsonudf.cpp | 2 +- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 7665d8520ab..3c33551cb68 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -82,7 +82,7 @@ BDOC::BDOC(PGLOBAL G) : BJSON(G, NULL) /***********************************************************************/ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) { - int i; + size_t i; bool b = false, ptyp = (bool *)pty; PBVAL bvp = NULL; @@ -185,7 +185,7 @@ PBVAL BDOC::ParseJson(PGLOBAL g, char* js, size_t lng) /***********************************************************************/ /* Parse several items as being in an array. */ /***********************************************************************/ -OFFSET BDOC::ParseAsArray(int& i) { +OFFSET BDOC::ParseAsArray(size_t& i) { if (pty[0] && (!pretty || pretty > 2)) { OFFSET jsp; @@ -202,7 +202,7 @@ OFFSET BDOC::ParseAsArray(int& i) { /***********************************************************************/ /* Parse a JSON Array. */ /***********************************************************************/ -OFFSET BDOC::ParseArray(int& i) +OFFSET BDOC::ParseArray(size_t& i) { int level = 0; bool b = (!i); @@ -214,7 +214,7 @@ OFFSET BDOC::ParseArray(int& i) switch (s[i]) { case ',': if (level < 2) { - sprintf(G->Message, "Unexpected ',' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS); throw 1; } else level = 1; @@ -222,7 +222,7 @@ OFFSET BDOC::ParseArray(int& i) break; case ']': if (level == 1) { - sprintf(G->Message, "Unexpected ',]' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',]' near %.*s", (int) ARGS); throw 1; } // endif level @@ -236,7 +236,7 @@ OFFSET BDOC::ParseArray(int& i) break; default: if (level == 2) { - sprintf(G->Message, "Unexpected value near %.*s", ARGS); + sprintf(G->Message, "Unexpected value near %.*s", (int) ARGS); throw 1; } else if (lastvlp) { vlp = ParseValue(i, NewVal()); @@ -260,7 +260,7 @@ OFFSET BDOC::ParseArray(int& i) /***********************************************************************/ /* Parse a JSON Object. */ /***********************************************************************/ -OFFSET BDOC::ParseObject(int& i) +OFFSET BDOC::ParseObject(size_t& i) { OFFSET key; int level = 0; @@ -283,7 +283,7 @@ OFFSET BDOC::ParseObject(int& i) level = 2; } else { - sprintf(G->Message, "misplaced string near %.*s", ARGS); + sprintf(G->Message, "misplaced string near %.*s", (int) ARGS); throw 2; } // endif level @@ -293,14 +293,14 @@ OFFSET BDOC::ParseObject(int& i) ParseValue(++i, GetVlp(lastbpp)); level = 3; } else { - sprintf(G->Message, "Unexpected ':' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ':' near %.*s", (int) ARGS); throw 2; } // endif level break; case ',': if (level < 3) { - sprintf(G->Message, "Unexpected ',' near %.*s", ARGS); + sprintf(G->Message, "Unexpected ',' near %.*s", (int) ARGS); throw 2; } else level = 1; @@ -308,7 +308,7 @@ OFFSET BDOC::ParseObject(int& i) break; case '}': if (!(level == 0 || level == 3)) { - sprintf(G->Message, "Unexpected '}' near %.*s", ARGS); + sprintf(G->Message, "Unexpected '}' near %.*s", (int) ARGS); throw 2; } // endif level @@ -321,7 +321,7 @@ OFFSET BDOC::ParseObject(int& i) break; default: sprintf(G->Message, "Unexpected character '%c' near %.*s", - s[i], ARGS); + s[i], (int) ARGS); throw 2; }; // endswitch s[i] @@ -332,7 +332,7 @@ OFFSET BDOC::ParseObject(int& i) /***********************************************************************/ /* Parse a JSON Value. */ /***********************************************************************/ -PBVAL BDOC::ParseValue(int& i, PBVAL bvp) +PBVAL BDOC::ParseValue(size_t& i, PBVAL bvp) { for (; i < len; i++) switch (s[i]) { @@ -398,14 +398,14 @@ suite: return bvp; err: - sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], ARGS); + sprintf(G->Message, "Unexpected character '%c' near %.*s", s[i], (int) ARGS); throw 3; } // end of ParseValue /***********************************************************************/ /* Unescape and parse a JSON string. */ /***********************************************************************/ -OFFSET BDOC::ParseString(int& i) +OFFSET BDOC::ParseString(size_t& i) { uchar* p; int n = 0; @@ -492,7 +492,7 @@ throw("Unexpected EOF in String"); /***********************************************************************/ /* Parse a JSON numeric value. */ /***********************************************************************/ -void BDOC::ParseNumeric(int& i, PBVAL vlp) +void BDOC::ParseNumeric(size_t& i, PBVAL vlp) { char buf[50]; int n = 0; diff --git a/storage/connect/bson.h b/storage/connect/bson.h index d13ded72eb1..acc36e8e0ed 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -184,12 +184,12 @@ public: PSZ Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty); protected: - OFFSET ParseArray(int& i); - OFFSET ParseObject(int& i); - PBVAL ParseValue(int& i, PBVAL bvp); - OFFSET ParseString(int& i); - void ParseNumeric(int& i, PBVAL bvp); - OFFSET ParseAsArray(int& i); + OFFSET ParseArray(size_t& i); + OFFSET ParseObject(size_t& i); + PBVAL ParseValue(size_t& i, PBVAL bvp); + OFFSET ParseString(size_t& i); + void ParseNumeric(size_t& i, PBVAL bvp); + OFFSET ParseAsArray(size_t& i); bool SerializeArray(OFFSET arp, bool b); bool SerializeObject(OFFSET obp); bool SerializeValue(PBVAL vp, bool b = false); @@ -197,7 +197,7 @@ protected: // Members used when parsing and serializing JOUT* jp; // Used with serialize char* s; // The Json string to parse - int len; // The Json string length + size_t len; // The Json string length int pretty; // The pretty style of the file to parse bool pty[3]; // Used to guess what pretty is bool comma; // True if Pretty = 1 diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 18382c7a273..f377e578399 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -1670,7 +1670,7 @@ PBVAL BJNX::ParseJsonFile(PGLOBAL g, char *fn, int& pty, size_t& len) len = (size_t)mm.lenL; if (mm.lenH) - len += ((size_t)mm.lenH * 0x000000001LL); + len += mm.lenH; memory = (char *)mm.memory; From dc31627c2d3100ecb45ef71d8040fedff202a2f7 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 5 Feb 2021 11:24:05 +0100 Subject: [PATCH 12/15] Fix of connect engine crashes --- storage/connect/bsonudf.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index f377e578399..0ef2f8ca9e6 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -3710,6 +3710,7 @@ char *bson_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, PUSH_WARNING("CheckMemory error"); goto fin; } else { + bnx.Reset(); jvp = bnx.MakeValue(args, 0, true); if (g->Mrr) { // First argument is a constant @@ -4055,6 +4056,7 @@ double bsonget_real(UDF_INIT *initid, UDF_ARGS *args, *is_null = 1; return 0.0; } else { + bnx.Reset(); jvp = bnx.MakeValue(args, 0); if ((p = bnx.GetString(jvp))) { From e7d9c1d498d0b86ef773f21a95f60af26b2dce75 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Fri, 5 Feb 2021 18:33:36 +0100 Subject: [PATCH 13/15] Fix connect engine ppc64 fail --- storage/connect/bsonudf.cpp | 2 +- storage/connect/mysql-test/connect/r/bson_udf.result | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index 0ef2f8ca9e6..29fe0a6bf22 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -3022,7 +3022,7 @@ void bson_object_grp_add(UDF_INIT *initid, UDF_ARGS *args, char*, char*) PBVAL bop = (PBVAL)g->Activityp; if (g->N-- > 0) - bxp->SetKeyValue(bop, bxp->MakeValue(args, 0), MakePSZ(g, args, 1)); + bxp->SetKeyValue(bop, bxp->MakeValue(args, 1), MakePSZ(g, args, 0)); } // end of bson_object_grp_add diff --git a/storage/connect/mysql-test/connect/r/bson_udf.result b/storage/connect/mysql-test/connect/r/bson_udf.result index 4ec1f0c87fd..fef55f7d3d9 100644 --- a/storage/connect/mysql-test/connect/r/bson_udf.result +++ b/storage/connect/mysql-test/connect/r/bson_udf.result @@ -280,13 +280,13 @@ SELECT Bson_Object_Grp(SALARY) FROM t3; ERROR HY000: Can't initialize function 'bson_object_grp'; This function requires 2 arguments (key, value) SELECT Bson_Object_Grp(NAME, SALARY) FROM t3; Bson_Object_Grp(NAME, SALARY) -{"":"MARTIN","ffffæp§@":"KITTY"} +{"BANCROFT":9600.00,"SMITH":9000.00,"MERCHANT":8700.00,"FUNNIGUY":8500.00,"BUGHAPPY":8500.00,"BIGHEAD":8000.00,"SHRINKY":7500.00,"WALTER":7400.00,"FODDERMAN":7000.00,"TONGHO":6800.00,"SHORTSIGHT":5500.00,"MESSIFUL":5000.50,"HONEY":4900.00,"GOOSEPEN":4700.00,"CHERRY":4500.00,"MONAPENNY":3800.00,"KITTY":3000.45,"PLUMHEAD":2800.00,"STRONG":23000.00,"BULLOZER":14800.00,"WERTHER":14500.00,"QUINN":14000.00,"ORELLY":13400.00,"BIGHORN":11000.00,"BROWNY":10500.00,"WHEELFOR":10030.00,"MARTIN":10000.00} SELECT Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES") FROM t3 GROUP BY DEPARTMENT; Bson_Make_Object(DEPARTMENT, Bson_Object_Grp(NAME, SALARY) "Json_SALARIES") -{"DEPARTMENT":"0021","SALARIES":{"":"SHORTSIGHT"}} -{"DEPARTMENT":"0318","SALARIES":{"":"WHEELFOR"}} -{"DEPARTMENT":"0319","SALARIES":{"":"GOOSEPEN","ffffæp§@":"KITTY"}} -{"DEPARTMENT":"2452","SALARIES":{"":"CHERRY"}} +{"DEPARTMENT":"0021","SALARIES":{"STRONG":23000.00,"SHORTSIGHT":5500.00}} +{"DEPARTMENT":"0318","SALARIES":{"BANCROFT":9600.00,"PLUMHEAD":2800.00,"HONEY":4900.00,"TONGHO":6800.00,"WALTER":7400.00,"SHRINKY":7500.00,"WERTHER":14500.00,"MERCHANT":8700.00,"WHEELFOR":10030.00}} +{"DEPARTMENT":"0319","SALARIES":{"BULLOZER":14800.00,"QUINN":14000.00,"BROWNY":10500.00,"KITTY":3000.45,"MONAPENNY":3800.00,"MARTIN":10000.00,"FUNNIGUY":8500.00,"BUGHAPPY":8500.00,"FODDERMAN":7000.00,"MESSIFUL":5000.50,"GOOSEPEN":4700.00}} +{"DEPARTMENT":"2452","SALARIES":{"BIGHEAD":8000.00,"ORELLY":13400.00,"BIGHORN":11000.00,"SMITH":9000.00,"CHERRY":4500.00}} SELECT Bson_Array_Grp(NAME) FROM t3; Bson_Array_Grp(NAME) ["BANCROFT","SMITH","MERCHANT","FUNNIGUY","BUGHAPPY","BIGHEAD","SHRINKY","WALTER","FODDERMAN","TONGHO","SHORTSIGHT","MESSIFUL","HONEY","GOOSEPEN","CHERRY","MONAPENNY","KITTY","PLUMHEAD","STRONG","BULLOZER","WERTHER","QUINN","ORELLY","BIGHORN","BROWNY","WHEELFOR","MARTIN"] @@ -303,7 +303,7 @@ Bson_Object_Key(name, title) {"WHEELFOR":"SALESMAN"} SELECT Bson_Object_Grp(name, title) FROM t3 WHERE DEPARTMENT = 318; Bson_Object_Grp(name, title) -{"SALESMAN":"WHEELFOR","ADMINISTRATOR":"SHRINKY","ENGINEER":"TONGHO","SECRETARY":"HONEY","TYPIST":"PLUMHEAD","DIRECTOR":"WERTHER"} +{"BANCROFT":"SALESMAN","MERCHANT":"SALESMAN","SHRINKY":"ADMINISTRATOR","WALTER":"ENGINEER","TONGHO":"ENGINEER","HONEY":"SECRETARY","PLUMHEAD":"TYPIST","WERTHER":"DIRECTOR","WHEELFOR":"SALESMAN"} # # Test value getting UDF's # From cbbbdb9c3bfbda7c2e7336cd68554f81714d3d97 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 18 Feb 2021 12:16:11 +0100 Subject: [PATCH 14/15] don't allocate 64K on the stack --- sql/wsrep_notify.cc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sql/wsrep_notify.cc b/sql/wsrep_notify.cc index fb04d7be7c1..3683d70a980 100644 --- a/sql/wsrep_notify.cc +++ b/sql/wsrep_notify.cc @@ -40,11 +40,13 @@ void wsrep_notify_status (wsrep_member_status_t status, return; } - char cmd_buf[1 << 16]; // this can be long - long cmd_len = sizeof(cmd_buf) - 1; - char* cmd_ptr = cmd_buf; + const long cmd_len = (1 << 16) - 1; + char* cmd_ptr = (char*) my_malloc(cmd_len + 1, MYF(MY_WME)); long cmd_off = 0; + if (!cmd_ptr) + return; // the warning is in the log + cmd_off += snprintf (cmd_ptr + cmd_off, cmd_len - cmd_off, "%s", wsrep_notify_cmd); @@ -93,6 +95,7 @@ void wsrep_notify_status (wsrep_member_status_t status, { WSREP_ERROR("Notification buffer too short (%ld). Aborting notification.", cmd_len); + my_free(cmd_ptr); return; } @@ -106,5 +109,6 @@ void wsrep_notify_status (wsrep_member_status_t status, WSREP_ERROR("Notification command failed: %d (%s): \"%s\"", err, strerror(err), cmd_ptr); } + my_free(cmd_ptr); } From ce3a2a688db556d8d077a409fd9bf5cc013d13dd Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 18 Feb 2021 14:20:48 +0100 Subject: [PATCH 15/15] make @@wsrep_provider and @@wsrep_notify_cmd read-only this should simplify run-time cluster management --- mysql-test/suite/galera/disabled.def | 2 + .../galera/include/galera_load_provider.inc | 1 - .../galera/include/galera_unload_provider.inc | 3 +- .../suite/galera/r/galera_ist_rsync.result | 2 +- .../galera/r/galera_sst_mysqldump.result | 2 +- .../suite/galera/r/mysql-wsrep#33.result | 2 +- .../suite/sys_vars/r/sysvars_wsrep.result | 4 +- .../sys_vars/r/wsrep_notify_cmd_basic.result | 47 ----------------- .../sys_vars/r/wsrep_provider_basic.result | 40 --------------- .../r/wsrep_provider_options_basic.result | 49 ------------------ .../sys_vars/t/wsrep_notify_cmd_basic.test | 43 ---------------- .../sys_vars/t/wsrep_provider_basic.test | 39 -------------- .../t/wsrep_provider_options_basic.test | 51 ------------------- mysql-test/suite/wsrep/disabled.def | 2 + mysql-test/suite/wsrep/r/variables.result | 12 ++--- mysql-test/suite/wsrep/t/variables.test | 34 +++---------- sql/sys_vars.cc | 4 +- 17 files changed, 24 insertions(+), 313 deletions(-) delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_basic.result delete mode 100644 mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_basic.test delete mode 100644 mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index 7fe03a94220..a063e17d465 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -30,3 +30,5 @@ partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin versioning_trx_id: MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch +galera_wsrep_provider_unset_set: wsrep_provider is read-only for security reasons +pxc-421: wsrep_provider is read-only for security reasons diff --git a/mysql-test/suite/galera/include/galera_load_provider.inc b/mysql-test/suite/galera/include/galera_load_provider.inc index aeab7e6ea19..e6ce6411193 100644 --- a/mysql-test/suite/galera/include/galera_load_provider.inc +++ b/mysql-test/suite/galera/include/galera_load_provider.inc @@ -1,7 +1,6 @@ --echo Loading wsrep provider ... --disable_query_log ---eval SET GLOBAL wsrep_provider = '$wsrep_provider_orig'; --eval SET GLOBAL wsrep_cluster_address = '$wsrep_cluster_address_orig'; --enable_query_log diff --git a/mysql-test/suite/galera/include/galera_unload_provider.inc b/mysql-test/suite/galera/include/galera_unload_provider.inc index edc7eb31e0e..83438a947f0 100644 --- a/mysql-test/suite/galera/include/galera_unload_provider.inc +++ b/mysql-test/suite/galera/include/galera_unload_provider.inc @@ -1,7 +1,6 @@ --echo Unloading wsrep provider ... --let $wsrep_cluster_address_orig = `SELECT @@wsrep_cluster_address` ---let $wsrep_provider_orig = `SELECT @@wsrep_provider` --let $wsrep_provider_options_orig = `SELECT @@wsrep_provider_options` -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; diff --git a/mysql-test/suite/galera/r/galera_ist_rsync.result b/mysql-test/suite/galera/r/galera_ist_rsync.result index 8a7c02ab1b6..80a28d349ba 100644 --- a/mysql-test/suite/galera/r/galera_ist_rsync.result +++ b/mysql-test/suite/galera/r/galera_ist_rsync.result @@ -21,7 +21,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/galera_sst_mysqldump.result b/mysql-test/suite/galera/r/galera_sst_mysqldump.result index 5c530c32ce6..6bdc933a9fc 100644 --- a/mysql-test/suite/galera/r/galera_sst_mysqldump.result +++ b/mysql-test/suite/galera/r/galera_sst_mysqldump.result @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/galera/r/mysql-wsrep#33.result b/mysql-test/suite/galera/r/mysql-wsrep#33.result index 6a5251204b9..4cc49c0cf07 100644 --- a/mysql-test/suite/galera/r/mysql-wsrep#33.result +++ b/mysql-test/suite/galera/r/mysql-wsrep#33.result @@ -30,7 +30,7 @@ INSERT INTO t1 VALUES ('node2_committed_before'); INSERT INTO t1 VALUES ('node2_committed_before'); COMMIT; Unloading wsrep provider ... -SET GLOBAL wsrep_provider = 'none'; +SET GLOBAL wsrep_cluster_address = ''; connection node_1; SET AUTOCOMMIT=OFF; START TRANSACTION; diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result index e54afd2d64a..67e15405313 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result +++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result @@ -349,7 +349,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_ON SESSION_VALUE OFF @@ -405,7 +405,7 @@ NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL ENUM_VALUE_LIST NULL -READ_ONLY NO +READ_ONLY YES COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME WSREP_PROVIDER_OPTIONS SESSION_VALUE NULL diff --git a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result b/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result deleted file mode 100644 index 056ff8c817b..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_notify_cmd_basic.result +++ /dev/null @@ -1,47 +0,0 @@ -# -# wsrep_notify_cmd -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -# save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; -# default -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - - -# scope -SELECT @@session.wsrep_notify_cmd; -ERROR HY000: Variable 'wsrep_notify_cmd' is a GLOBAL variable -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -notify_cmd - -# valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -command -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -hyphenated-command -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd - -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# invalid values -SET @@global.wsrep_notify_cmd=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_notify_cmd' -SELECT @@global.wsrep_notify_cmd; -@@global.wsrep_notify_cmd -NULL - -# restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result deleted file mode 100644 index 3e4ac8ca883..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_basic.result +++ /dev/null @@ -1,40 +0,0 @@ -# -# wsrep_provider -# -# save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; -# default -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# scope -SELECT @@session.wsrep_provider; -ERROR HY000: Variable 'wsrep_provider' is a GLOBAL variable -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# invalid values -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of '/invalid/libgalera_smm.so' -SET @@global.wsrep_provider=NULL; -ERROR 42000: Variable 'wsrep_provider' can't be set to the value of 'NULL' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none -SET @@global.wsrep_provider=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider' -SELECT @@global.wsrep_provider; -@@global.wsrep_provider -none - -# restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result b/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result deleted file mode 100644 index b2e07c55b38..00000000000 --- a/mysql-test/suite/sys_vars/r/wsrep_provider_options_basic.result +++ /dev/null @@ -1,49 +0,0 @@ -# -# wsrep_provider_options -# -call mtr.add_suppression("WSREP: Failed to get provider options"); -SET @@global.wsrep_provider = @@global.wsrep_provider; -# save the initial value -SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; -# default -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# scope -SELECT @@session.wsrep_provider_options; -ERROR HY000: Variable 'wsrep_provider_options' is a GLOBAL variable -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -option1 - -# valid values -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -name1=value1;name2=value2 -SET @@global.wsrep_provider_options='hyphenated-name:value'; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -hyphenated-name:value -SET @@global.wsrep_provider_options=default; -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - - -# invalid values -SET @@global.wsrep_provider_options=1; -ERROR 42000: Incorrect argument type to variable 'wsrep_provider_options' -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options - -SET @@global.wsrep_provider_options=NULL; -Got one of the listed errors -SELECT @@global.wsrep_provider_options; -@@global.wsrep_provider_options -NULL - -# restore the initial value -SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; -# End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test b/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test deleted file mode 100644 index 6d1535ba148..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_notify_cmd_basic.test +++ /dev/null @@ -1,43 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_notify_cmd ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - ---echo # save the initial value -SET @wsrep_notify_cmd_global_saved = @@global.wsrep_notify_cmd; - ---echo # default -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='notify_cmd'; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # valid values -SET @@global.wsrep_notify_cmd='command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd='hyphenated-command'; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=default; -SELECT @@global.wsrep_notify_cmd; -SET @@global.wsrep_notify_cmd=NULL; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_notify_cmd=1; -SELECT @@global.wsrep_notify_cmd; - ---echo ---echo # restore the initial value -SET @@global.wsrep_notify_cmd = @wsrep_notify_cmd_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test deleted file mode 100644 index 1190ab41bb0..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_basic.test +++ /dev/null @@ -1,39 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider ---echo # - ---echo # save the initial value -SET @wsrep_provider_global_saved = @@global.wsrep_provider; - ---echo # default -SELECT @@global.wsrep_provider; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider; -SELECT @@global.wsrep_provider; - ---echo ---echo # valid values -SET @@global.wsrep_provider=default; -SELECT @@global.wsrep_provider; - ---echo ---echo # invalid values ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider='/invalid/libgalera_smm.so'; ---error ER_WRONG_VALUE_FOR_VAR -SET @@global.wsrep_provider=NULL; -SELECT @@global.wsrep_provider; ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider=1; -SELECT @@global.wsrep_provider; - ---echo ---echo # restore the initial value -SET @@global.wsrep_provider = @wsrep_provider_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test b/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test deleted file mode 100644 index d2ea32a0637..00000000000 --- a/mysql-test/suite/sys_vars/t/wsrep_provider_options_basic.test +++ /dev/null @@ -1,51 +0,0 @@ ---source include/have_wsrep.inc - ---echo # ---echo # wsrep_provider_options ---echo # - -call mtr.add_suppression("WSREP: Failed to get provider options"); - -SET @@global.wsrep_provider = @@global.wsrep_provider; - ---echo # save the initial value -SET @wsrep_provider_options_global_saved = @@global.wsrep_provider_options; - ---echo # default -SELECT @@global.wsrep_provider_options; - ---echo ---echo # scope ---error ER_INCORRECT_GLOBAL_LOCAL_VAR -SELECT @@session.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='option1'; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # valid values ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='name1=value1;name2=value2'; -SELECT @@global.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options='hyphenated-name:value'; -SELECT @@global.wsrep_provider_options; ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=default; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # invalid values ---error ER_WRONG_TYPE_FOR_VAR -SET @@global.wsrep_provider_options=1; -SELECT @@global.wsrep_provider_options; ---error ER_WRONG_ARGUMENTS,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options=NULL; -SELECT @@global.wsrep_provider_options; - ---echo ---echo # restore the initial value ---error 0,ER_WRONG_ARGUMENTS -SET @@global.wsrep_provider_options = @wsrep_provider_options_global_saved; - ---echo # End of test diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index 11577bfe8b0..3d204db6945 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -10,3 +10,5 @@ # ############################################################################## + +mdev_6832: wsrep_provider is read-only for security reasons diff --git a/mysql-test/suite/wsrep/r/variables.result b/mysql-test/suite/wsrep/r/variables.result index 9ef1b3290af..8bb0b426380 100644 --- a/mysql-test/suite/wsrep/r/variables.result +++ b/mysql-test/suite/wsrep/r/variables.result @@ -14,7 +14,6 @@ SET SESSION wsrep_replicate_myisam= ON; ERROR HY000: Variable 'wsrep_replicate_myisam' is a GLOBAL variable and should be set with SET GLOBAL SET GLOBAL wsrep_replicate_myisam= ON; SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; # # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of # variables when using "_" @@ -26,7 +25,6 @@ wsrep_local_state_comment # # Should show nothing. SHOW STATUS LIKE 'x'; Variable_name Value -SET GLOBAL wsrep_provider=none; SHOW STATUS LIKE 'wsrep_local_state_uuid'; Variable_name Value @@ -35,7 +33,6 @@ wsrep_local_state_uuid # SHOW STATUS LIKE 'wsrep_last_committed'; Variable_name Value wsrep_last_committed # -SET GLOBAL wsrep_provider=none; # # MDEV#6206: wsrep_slave_threads subtracts from max_connections @@ -49,7 +46,7 @@ SELECT @@global.wsrep_slave_threads; 1 SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -58,14 +55,14 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 SELECT @@global.wsrep_provider; @@global.wsrep_provider libgalera_smm.so SELECT @@global.wsrep_cluster_address; @@global.wsrep_cluster_address - +gcomm:// SELECT @@global.wsrep_on; @@global.wsrep_on 1 @@ -74,11 +71,10 @@ Variable_name Value Threads_connected 1 SHOW STATUS LIKE 'wsrep_thread_count'; Variable_name Value -wsrep_thread_count 0 +wsrep_thread_count 2 # Setting wsrep_cluster_address triggers the creation of # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; # Wait for applier thread to get created 1. # Wait for applier thread to get created 2. SELECT VARIABLE_VALUE AS EXPECT_1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_applier_thread_count'; diff --git a/mysql-test/suite/wsrep/t/variables.test b/mysql-test/suite/wsrep/t/variables.test index 5ab0eb68505..1a3bd62b164 100644 --- a/mysql-test/suite/wsrep/t/variables.test +++ b/mysql-test/suite/wsrep/t/variables.test @@ -22,7 +22,7 @@ SET GLOBAL wsrep_replicate_myisam= ON; # Reset it back. SET GLOBAL wsrep_replicate_myisam= OFF; -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo # --echo # MDEV#5790: SHOW GLOBAL STATUS LIKE does not show the correct list of @@ -31,13 +31,9 @@ SET GLOBAL wsrep_provider=none; CALL mtr.add_suppression("WSREP: Could not open saved state file for reading.*"); ---disable_result_log ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --let $galera_version=25.3.24 source include/check_galera_version.inc; ---enable_result_log ---enable_query_log --replace_column 2 # SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; @@ -46,11 +42,9 @@ SHOW GLOBAL STATUS LIKE 'wsrep_local_state_comment'; SHOW STATUS LIKE 'x'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; # The following 2 variables are used by mariabackup # SST. @@ -62,7 +56,7 @@ SHOW STATUS LIKE 'wsrep_local_state_uuid'; SHOW STATUS LIKE 'wsrep_last_committed'; # Reset it back. -SET GLOBAL wsrep_provider=none; +#SET GLOBAL wsrep_provider=none; --echo --echo # @@ -70,9 +64,7 @@ SET GLOBAL wsrep_provider=none; --echo # call mtr.add_suppression("WSREP: Failed to get provider options"); ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -83,9 +75,7 @@ SHOW STATUS LIKE 'threads_connected'; SHOW STATUS LIKE 'wsrep_thread_count'; --echo ---disable_query_log -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; ---enable_query_log +#evalp SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; --replace_regex /.*libgalera_smm.*/libgalera_smm.so/ SELECT @@global.wsrep_provider; @@ -97,7 +87,7 @@ SHOW STATUS LIKE 'wsrep_thread_count'; --echo # Setting wsrep_cluster_address triggers the creation of --echo # applier/rollbacker threads. -SET GLOBAL wsrep_cluster_address= 'gcomm://'; +#SET GLOBAL wsrep_cluster_address= 'gcomm://'; --echo # Wait for applier thread to get created 1. --let $wait_timeout=600 @@ -159,14 +149,6 @@ SET @@global.wsrep_sst_auth= NULL; SELECT @@global.wsrep_sst_auth; SET @@global.wsrep_sst_auth= @wsrep_sst_auth_saved; -# Reset (for mtr internal checks) ---disable_query_log -SET GLOBAL wsrep_slave_threads= @wsrep_slave_threads_saved; -eval SET GLOBAL wsrep_provider= '$WSREP_PROVIDER'; -SET GLOBAL wsrep_cluster_address= @wsrep_cluster_address_saved; -SET GLOBAL wsrep_provider_options= @wsrep_provider_options_saved; ---enable_query_log - --source include/galera_wait_ready.inc --echo # End of test. diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc index baf27a7d0af..e4de3d8d0aa 100644 --- a/sql/sys_vars.cc +++ b/sql/sys_vars.cc @@ -4958,7 +4958,7 @@ static Sys_var_tz Sys_time_zone( static Sys_var_charptr Sys_wsrep_provider( "wsrep_provider", "Path to replication provider library", - PREALLOCATED GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG), + PREALLOCATED READ_ONLY GLOBAL_VAR(wsrep_provider), CMD_LINE(REQUIRED_ARG), IN_FS_CHARSET, DEFAULT(WSREP_NONE), NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(wsrep_provider_check), ON_UPDATE(wsrep_provider_update)); @@ -5171,7 +5171,7 @@ static Sys_var_ulong Sys_wsrep_max_ws_rows ( static Sys_var_charptr Sys_wsrep_notify_cmd( "wsrep_notify_cmd", "", - GLOBAL_VAR(wsrep_notify_cmd),CMD_LINE(REQUIRED_ARG), + READ_ONLY GLOBAL_VAR(wsrep_notify_cmd), CMD_LINE(REQUIRED_ARG), IN_SYSTEM_CHARSET, DEFAULT("")); static Sys_var_mybool Sys_wsrep_certify_nonPK(