From 214023aa0e6ec00dcac386167a2b2cf9394b6c7e Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 18 Jan 2019 13:45:06 +1100 Subject: [PATCH 01/59] systemd: mariadb@bootstrap doesn't bootstrap, galera_new_cluster does Closes #1106 --- support-files/mariadb@.service.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 4838620b8cd..8afae3bd09b 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -1,5 +1,5 @@ # Multi instance version of mariadb. For if you run multiple versions at once. -# Also used for mariadb@bootstrap to bootstrap Galera. +# Also used for mariadb@bootstrap to tell you to use galera_new_cluster. # # create config file @sysconf2dir@/my{instancename}.cnf # From 2cb4b152c8fc7bc5156961c2f87e5274d228377d Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 16 Nov 2019 14:59:54 +0100 Subject: [PATCH 02/59] ===================================================================== This new CONNECT version 1.07 fully implements NOSQL support. It allows working on JSON or XML data retrieved as REST query results from all binary distributions of MariaDB when cpprestsdk is installed and the GetRest library is available. ===================================================================== - Make Rest available for MariaDB binary distributed versions. Change RestGet function so it can be called from a library. modified: storage/connect/CMakeLists.txt modified: storage/connect/restget.cpp modified: storage/connect/tabrest.cpp - Make column FLAG option available to discovery functions. modified: storage/connect/ha_connect.cc modified: storage/connect/plgdbsem.h - Update CONNECT version number and date. modified: storage/connect/ha_connect.cc - Move OEMColumns function from mycat.cc to reldef.cpp. modified: storage/connect/mycat.cc modified: storage/connect/reldef.cpp - Allocate tables as TABREF (was RELDEF) modified: storage/connect/mycat.cc modified: storage/connect/mycat.h - Fix MDEV-20845 by commenting out TIMEOUT setting. modified: storage/connect/myconn.cpp - Call DefineAM before calling GetColCatInfo. Column offset is now based on record format instead of table type. The RECFM_VCT format was added. This enables tables to specify the record format and is useful in particular for OEM tables. modified: storage/connect/plgdbsem.h modified: storage/connect/reldef.cpp modified: storage/connect/reldef.h modified: storage/connect/tabdos.cpp modified: storage/connect/tabdos.h modified: storage/connect/tabfix.cpp modified: storage/connect/tabfmt.cpp modified: storage/connect/tabmysql.cpp modified: storage/connect/tabutil.cpp modified: storage/connect/tabutil.h modified: storage/connect/tabvct.cpp modified: storage/connect/xindex.cpp --- storage/connect/CMakeLists.txt | 6 +- storage/connect/ha_connect.cc | 17 +- storage/connect/mycat.cc | 111 +------------ storage/connect/mycat.h | 4 +- storage/connect/myconn.cpp | 10 +- storage/connect/plgdbsem.h | 29 ++-- storage/connect/reldef.cpp | 275 +++++++++++++++++++++++---------- storage/connect/reldef.h | 9 +- storage/connect/restget.cpp | 40 ++--- storage/connect/tabdos.cpp | 23 ++- storage/connect/tabdos.h | 1 - storage/connect/tabfix.cpp | 2 +- storage/connect/tabfmt.cpp | 5 +- storage/connect/tabmysql.cpp | 9 +- storage/connect/tabrest.cpp | 101 ++++++++++-- storage/connect/tabutil.cpp | 16 +- storage/connect/tabutil.h | 3 +- storage/connect/tabvct.cpp | 3 + storage/connect/xindex.cpp | 14 +- 19 files changed, 412 insertions(+), 266 deletions(-) diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index be5c7034c3b..66b658b036b 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -312,6 +312,8 @@ OPTION(CONNECT_WITH_REST "Compile CONNECT storage engine with REST support" ON) IF(CONNECT_WITH_REST) MESSAGE(STATUS "=====> REST support is ON") + SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp tabrest.h) + add_definitions(-DREST_SUPPORT) FIND_PACKAGE(cpprestsdk) IF (cpprestsdk_FOUND) MESSAGE(STATUS "=====> cpprestsdk found") @@ -326,8 +328,8 @@ IF(CONNECT_WITH_REST) # Comment it out if not needed depending on your cpprestsdk installation. SET(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MDd") ENDIF(UNIX) - SET(CONNECT_SOURCES ${CONNECT_SOURCES} tabrest.cpp restget.cpp tabrest.h) - add_definitions(-DREST_SUPPORT) + SET(CONNECT_SOURCES ${CONNECT_SOURCES} restget.cpp) + add_definitions(-DREST_SOURCE) ELSE(NOT cpprestsdk_FOUND) MESSAGE(STATUS "=====> cpprestsdk package not found") ENDIF (cpprestsdk_FOUND) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index be7c6548181..beb7c5c7e74 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,9 +170,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.06.0010 June 01, 2019"; + char version[]= "Version 1.07.0001 November 12, 2019"; #if defined(__WIN__) - char compver[]= "Version 1.06.0010 " __DATE__ " " __TIME__; + char compver[]= "Version 1.07.0001 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -6062,7 +6062,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, } // endif !nblin for (i= 0; !rc && i < qrp->Nblin; i++) { - typ= len= prec= dec= 0; + typ= len= prec= dec= flg= 0; tm= NOT_NULL_FLAG; cnm= (char*)"noname"; dft= xtra= key= fmt= tn= NULL; @@ -6102,6 +6102,9 @@ static int connect_assisted_discovery(handlerton *, THD* thd, if (crp->Kdata->GetIntValue(i)) tm= 0; // Nullable + break; + case FLD_FLAG: + flg = crp->Kdata->GetIntValue(i); break; case FLD_FORMAT: fmt= (crp->Kdata) ? crp->Kdata->GetCharValue(i) : NULL; @@ -6233,7 +6236,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, // Now add the field if (add_field(&sql, cnm, typ, prec, dec, key, tm, rem, dft, xtra, - fmt, 0, dbf, v)) + fmt, flg, dbf, v)) rc= HA_ERR_OUT_OF_MEM; } // endfor i @@ -7379,14 +7382,14 @@ maria_declare_plugin(connect) &connect_storage_engine, "CONNECT", "Olivier Bertrand", - "Management of External Data (SQL/NOSQL/MED), including many file formats", + "Management of External Data (SQL/NOSQL/MED), including Rest query results", PLUGIN_LICENSE_GPL, connect_init_func, /* Plugin Init */ connect_done_func, /* Plugin Deinit */ - 0x0106, /* version number (1.06) */ + 0x0107, /* version number (1.07) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.06.0010", /* string version */ + "1.07.0001", /* string version */ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/mycat.cc b/storage/connect/mycat.cc index b1d23b8c5e2..f8b3dc03aa5 100644 --- a/storage/connect/mycat.cc +++ b/storage/connect/mycat.cc @@ -95,7 +95,7 @@ #endif // ZIP_SUPPORT #if defined(REST_SUPPORT) #include "tabrest.h" -#endif // Rest_SUPPORT +#endif // REST_SUPPORT #include "mycat.h" /***********************************************************************/ @@ -107,7 +107,6 @@ extern "C" HINSTANCE s_hModule; // Saved module handle #if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT) bool MongoEnabled(void); #endif // JAVA_SUPPORT || CMGO_SUPPORT -PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info); /***********************************************************************/ /* Get the plugin directory. */ @@ -349,100 +348,6 @@ uint GetFuncID(const char *func) return fnc; } // end of GetFuncID -/***********************************************************************/ -/* OEMColumn: Get table column info for an OEM table. */ -/***********************************************************************/ -PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char *tab, char *db, bool info) - { - typedef PQRYRES (__stdcall *XCOLDEF) (PGLOBAL, void*, char*, char*, bool); - const char *module, *subtype; - char c, soname[_MAX_PATH], getname[40] = "Col"; -#if defined(__WIN__) - HANDLE hdll; /* Handle to the external DLL */ -#else // !__WIN__ - void *hdll; /* Handle for the loaded shared library */ -#endif // !__WIN__ - XCOLDEF coldef = NULL; - PQRYRES qrp = NULL; - - module = topt->module; - subtype = topt->subtype; - - if (!module || !subtype) - return NULL; - - /*********************************************************************/ - /* Ensure that the .dll doesn't have a path. */ - /* This is done to ensure that only approved dll from the system */ - /* directories are used (to make this even remotely secure). */ - /*********************************************************************/ - if (check_valid_path(module, strlen(module))) { - strcpy(g->Message, "Module cannot contain a path"); - return NULL; - } else - PlugSetPath(soname, module, GetPluginDir()); - - // The exported name is always in uppercase - for (int i = 0; ; i++) { - c = subtype[i]; - getname[i + 3] = toupper(c); - if (!c) break; - } // endfor i - -#if defined(__WIN__) - // Load the Dll implementing the table - if (!(hdll = LoadLibrary(soname))) { - char buf[256]; - DWORD rc = GetLastError(); - - sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, - (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); - return NULL; - } // endif hDll - - // Get the function returning an instance of the external DEF class - if (!(coldef = (XCOLDEF)GetProcAddress((HINSTANCE)hdll, getname))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname); - FreeLibrary((HMODULE)hdll); - return NULL; - } // endif coldef -#else // !__WIN__ - const char *error = NULL; - - // Load the desired shared library - if (!(hdll = dlopen(soname, RTLD_LAZY))) { - error = dlerror(); - sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); - return NULL; - } // endif Hdll - - // Get the function returning an instance of the external DEF class - if (!(coldef = (XCOLDEF)dlsym(hdll, getname))) { - error = dlerror(); - sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error)); - dlclose(hdll); - return NULL; - } // endif coldef -#endif // !__WIN__ - - // Just in case the external Get function does not set error messages - sprintf(g->Message, "Error getting column info from %s", subtype); - - // Get the table column definition - qrp = coldef(g, topt, tab, db, info); - -#if defined(__WIN__) - FreeLibrary((HMODULE)hdll); -#else // !__WIN__ - dlclose(hdll); -#endif // !__WIN__ - - return qrp; - } // end of OEMColumns - /* ------------------------- Class CATALOG --------------------------- */ /***********************************************************************/ @@ -483,10 +388,10 @@ void MYCAT::Reset(void) /* GetTableDesc: retrieve a table descriptor. */ /* Look for a table descriptor matching the name and type. */ /***********************************************************************/ -PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep, +PTABDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR type, PRELDEF *) { - PRELDEF tdp= NULL; + PTABDEF tdp= NULL; if (trace(1)) htrc("GetTableDesc: name=%s am=%s\n", tablep->GetName(), SVP(type)); @@ -507,12 +412,12 @@ PRELDEF MYCAT::GetTableDesc(PGLOBAL g, PTABLE tablep, /* MakeTableDesc: make a table/view description. */ /* Note: caller must check if name already exists before calling it. */ /***********************************************************************/ -PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) +PTABDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) { TABTYPE tc; LPCSTR name= (PSZ)PlugDup(g, tablep->GetName()); LPCSTR schema= (PSZ)PlugDup(g, tablep->GetSchema()); - PRELDEF tdp= NULL; + PTABDEF tdp= NULL; if (trace(1)) htrc("MakeTableDesc: name=%s schema=%s am=%s\n", @@ -580,8 +485,8 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) } // endswitch // Do make the table/view definition - if (tdp && tdp->Define(g, this, name, schema, am)) - tdp= NULL; + if (tdp && tdp->Define(g, this, name, schema, am)) + tdp = NULL; if (trace(1)) htrc("Table %s made\n", am); @@ -594,7 +499,7 @@ PRELDEF MYCAT::MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am) /***********************************************************************/ PTDB MYCAT::GetTable(PGLOBAL g, PTABLE tablep, MODE mode, LPCSTR type) { - PRELDEF tdp; + PTABDEF tdp; PTDB tdbp= NULL; // LPCSTR name= tablep->GetName(); diff --git a/storage/connect/mycat.h b/storage/connect/mycat.h index 818e535b32d..6473f7a5c11 100644 --- a/storage/connect/mycat.h +++ b/storage/connect/mycat.h @@ -102,14 +102,14 @@ class MYCAT : public CATALOG { // Methods void Reset(void); bool StoreIndex(PGLOBAL, PTABDEF) {return false;} // Temporary - PRELDEF GetTableDesc(PGLOBAL g, PTABLE tablep, + PTABDEF GetTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR type, PRELDEF *prp = NULL); PTDB GetTable(PGLOBAL g, PTABLE tablep, MODE mode = MODE_READ, LPCSTR type = NULL); void ClearDB(PGLOBAL g); protected: - PRELDEF MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am); + PTABDEF MakeTableDesc(PGLOBAL g, PTABLE tablep, LPCSTR am); // Members ha_connect *Hc; // The Connect handler diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 253c42bb002..e7500ff2c31 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -472,7 +472,7 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, int pt, const char *csname) { const char *pipe = NULL; - uint cto = 10, nrt = 20; + //uint cto = 10, nrt = 20; my_bool my_true= 1; m_DB = mysql_init(NULL); @@ -485,11 +485,11 @@ int MYSQLC::Open(PGLOBAL g, const char *host, const char *db, if (trace(1)) htrc("MYSQLC Open: m_DB=%.4X size=%d\n", m_DB, (int)sizeof(*m_DB)); - // Removed to do like FEDERATED do + // Removed to do like FEDERATED does //mysql_options(m_DB, MYSQL_READ_DEFAULT_GROUP, "client-mariadb"); - mysql_options(m_DB, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL); - mysql_options(m_DB, MYSQL_OPT_CONNECT_TIMEOUT, &cto); - mysql_options(m_DB, MYSQL_OPT_READ_TIMEOUT, &nrt); +//mysql_options(m_DB, MYSQL_OPT_USE_REMOTE_CONNECTION, NULL); +//mysql_options(m_DB, MYSQL_OPT_CONNECT_TIMEOUT, &cto); +//mysql_options(m_DB, MYSQL_OPT_READ_TIMEOUT, &nrt); //mysql_options(m_DB, MYSQL_OPT_WRITE_TIMEOUT, ...); #if defined(__WIN__) diff --git a/storage/connect/plgdbsem.h b/storage/connect/plgdbsem.h index f10ae209e9d..a40e32bcfb2 100644 --- a/storage/connect/plgdbsem.h +++ b/storage/connect/plgdbsem.h @@ -149,16 +149,22 @@ enum AMT {TYPE_AM_ERROR = 0, /* Type not defined */ TYPE_AM_MGO = 194, /* MGO access method type no */ TYPE_AM_OUT = 200}; /* Output relations (storage) */ -enum RECFM {RECFM_NAF = -2, /* Not a file */ - RECFM_OEM = -1, /* OEM file access method */ - RECFM_VAR = 0, /* Varying length DOS files */ - RECFM_FIX = 1, /* Fixed length DOS files */ - RECFM_BIN = 2, /* Binary DOS files (also fixed) */ - RECFM_VCT = 3, /* VCT formatted files */ - RECFM_ODBC = 4, /* Table accessed via ODBC */ - RECFM_JDBC = 5, /* Table accessed via JDBC */ - RECFM_PLG = 6, /* Table accessed via PLGconn */ - RECFM_DBF = 7}; /* DBase formatted file */ +enum RECFM {RECFM_DFLT = 0, /* Default table type */ + RECFM_NAF = 1, /* Not a file table */ + RECFM_OEM = 2, /* OEM table */ + RECFM_VAR = 3, /* Varying length DOS files */ + RECFM_FIX = 4, /* Fixed length DOS files */ + RECFM_BIN = 5, /* Binary DOS files (also fixed) */ + RECFM_DBF = 6, /* DBase formatted file */ + RECFM_CSV = 7, /* CSV file */ + RECFM_FMT = 8, /* FMT formatted file */ + RECFM_VCT = 9, /* VCT formatted files */ + RECFM_XML = 10, /* XML formatted files */ + RECFM_JASON = 11, /* JASON formatted files */ + RECFM_DIR = 12, /* DIR table */ + RECFM_ODBC = 13, /* Table accessed via ODBC */ + RECFM_JDBC = 14, /* Table accessed via JDBC */ + RECFM_PLG = 15}; /* Table accessed via PLGconn */ enum MISC {DB_TABNO = 1, /* DB routines in Utility Table */ MAX_MULT_KEY = 10, /* Max multiple key number */ @@ -537,7 +543,8 @@ enum XFLD {FLD_NO = 0, /* Not a field definition item */ FLD_FORMAT = 16, /* Field format */ FLD_CAT = 17, /* Table catalog */ FLD_SCHEM = 18, /* Table schema */ - FLD_TABNAME = 19}; /* Column Table name */ + FLD_TABNAME = 19, /* Column Table name */ + FLD_FLAG = 20}; /* Field flag (CONNECT specific) */ /***********************************************************************/ /* Result of last SQL noconv query. */ diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 8ba8aac3621..88c28757588 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -1,11 +1,11 @@ /************* RelDef CPP Program Source Code File (.CPP) **************/ /* PROGRAM NAME: RELDEF */ /* ------------- */ -/* Version 1.6 */ +/* Version 1.7 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2004-2016 */ +/* (C) Copyright to the author Olivier BERTRAND 2004-2019 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -61,6 +61,102 @@ extern handlerton *connect_hton; /***********************************************************************/ USETEMP UseTemp(void); char *GetPluginDir(void); +PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char* tab, char* db, bool info); + +/***********************************************************************/ +/* OEMColumns: Get table column info for an OEM table. */ +/***********************************************************************/ +PQRYRES OEMColumns(PGLOBAL g, PTOS topt, char* tab, char* db, bool info) +{ + typedef PQRYRES(__stdcall* XCOLDEF) (PGLOBAL, void*, char*, char*, bool); + const char* module, * subtype; + char c, soname[_MAX_PATH], getname[40] = "Col"; +#if defined(__WIN__) + HANDLE hdll; /* Handle to the external DLL */ +#else // !__WIN__ + void* hdll; /* Handle for the loaded shared library */ +#endif // !__WIN__ + XCOLDEF coldef = NULL; + PQRYRES qrp = NULL; + + module = topt->module; + subtype = topt->subtype; + + if (!module || !subtype) + return NULL; + + /*********************************************************************/ + /* Ensure that the .dll doesn't have a path. */ + /* This is done to ensure that only approved dll from the system */ + /* directories are used (to make this even remotely secure). */ + /*********************************************************************/ + if (check_valid_path(module, strlen(module))) { + strcpy(g->Message, "Module cannot contain a path"); + return NULL; + } + else + PlugSetPath(soname, module, GetPluginDir()); + + // The exported name is always in uppercase + for (int i = 0; ; i++) { + c = subtype[i]; + getname[i + 3] = toupper(c); + if (!c) break; + } // endfor i + +#if defined(__WIN__) + // Load the Dll implementing the table + if (!(hdll = LoadLibrary(soname))) { + char buf[256]; + DWORD rc = GetLastError(); + + sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, + (LPTSTR)buf, sizeof(buf), NULL); + strcat(strcat(g->Message, ": "), buf); + return NULL; + } // endif hDll + +// Get the function returning an instance of the external DEF class + if (!(coldef = (XCOLDEF)GetProcAddress((HINSTANCE)hdll, getname))) { + sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname); + FreeLibrary((HMODULE)hdll); + return NULL; + } // endif coldef +#else // !__WIN__ + const char* error = NULL; + + // Load the desired shared library + if (!(hdll = dlopen(soname, RTLD_LAZY))) { + error = dlerror(); + sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + return NULL; + } // endif Hdll + +// Get the function returning an instance of the external DEF class + if (!(coldef = (XCOLDEF)dlsym(hdll, getname))) { + error = dlerror(); + sprintf(g->Message, MSG(GET_FUNC_ERR), getname, SVP(error)); + dlclose(hdll); + return NULL; + } // endif coldef +#endif // !__WIN__ + + // Just in case the external Get function does not set error messages + sprintf(g->Message, "Error getting column info from %s", subtype); + + // Get the table column definition + qrp = coldef(g, topt, tab, db, info); + +#if defined(__WIN__) + FreeLibrary((HMODULE)hdll); +#else // !__WIN__ + dlclose(hdll); +#endif // !__WIN__ + + return qrp; +} // end of OEMColumns /* --------------------------- Class RELDEF -------------------------- */ @@ -208,6 +304,7 @@ TABDEF::TABDEF(void) { Schema = NULL; Desc = NULL; + Recfm = RECFM_DFLT; Catfunc = FNC_NO; Card = 0; Elemt = 0; @@ -220,12 +317,41 @@ TABDEF::TABDEF(void) csname = NULL; } // end of TABDEF constructor +/***********************************************************************/ +/* Return the table format. */ +/***********************************************************************/ +RECFM TABDEF::GetTableFormat(const char* type) +{ + RECFM recfm = Recfm; + + if (recfm == RECFM_DFLT) { + // Default format depends on the table type + TABTYPE tc = (Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX; + + switch (tc) { + case TAB_DOS: recfm = RECFM_VAR; break; + case TAB_CSV: recfm = RECFM_CSV; break; + case TAB_FMT: recfm = RECFM_FMT; break; + case TAB_FIX: recfm = RECFM_FIX; break; + case TAB_BIN: recfm = RECFM_BIN; break; + case TAB_VEC: recfm = RECFM_VCT; break; + case TAB_DBF: recfm = RECFM_DBF; break; + case TAB_XML: recfm = RECFM_XML; break; + case TAB_DIR: recfm = RECFM_DIR; break; + default: recfm = RECFM_NAF; break; + } // endswitch type + + } // endif recfm + + return recfm; +} // end of GetTableFormat + /***********************************************************************/ /* Define: initialize the table definition block from XDB file. */ /***********************************************************************/ bool TABDEF::Define(PGLOBAL g, PCATLG cat, LPCSTR name, LPCSTR schema, LPCSTR am) - { +{ int poff = 0; Hc = ((MYCAT*)cat)->GetHandler(); @@ -243,13 +369,17 @@ bool TABDEF::Define(PGLOBAL g, PCATLG cat, NULL; csname = GetStringCatInfo(g, "Table_charset", NULL); - // Get The column definitions - if ((poff = GetColCatInfo(g)) < 0) - return true; + // Do the definition of AM specific fields + if (DefineAM(g, am, 0)) + return true; - // Do the definition of AM specific fields - return DefineAM(g, am, poff); - } // end of Define + // Get The column definitions + if (stricmp(am, "OEM") && GetColCatInfo(g) < 0) + return true; + + Hc->tshp = NULL; // TO BE CHECKED + return false; +} // end of Define /***********************************************************************/ /* This function returns the database data path. */ @@ -264,71 +394,71 @@ PCSZ TABDEF::GetPath(void) /***********************************************************************/ int TABDEF::GetColCatInfo(PGLOBAL g) { - char *type= GetStringCatInfo(g, "Type", "*"); + char *type = GetStringCatInfo(g, "Type", "*"); char c, fty, eds; int i, n, loff, poff, nof, nlg; - void *field= NULL; - TABTYPE tc; - PCOLDEF cdp, lcdp= NULL, tocols= NULL; + void *field = NULL; + RECFM trf; + PCOLDEF cdp, lcdp = NULL, tocols= NULL; PCOLINFO pcf= (PCOLINFO)PlugSubAlloc(g, NULL, sizeof(COLINFO)); memset(pcf, 0, sizeof(COLINFO)); - // Get a unique char identifier for type - tc= (Catfunc == FNC_NO) ? GetTypeID(type) : TAB_PRX; + // Get the table format + trf = GetTableFormat(type); // Take care of the column definitions i= poff= nof= nlg= 0; #if defined(__WIN__) // Offsets of HTML and DIR tables start from 0, DBF at 1 - loff= (tc == TAB_DBF) ? 1 : (tc == TAB_XML || tc == TAB_DIR) ? -1 : 0; + loff= (trf == RECFM_DBF) ? 1 : (trf == RECFM_XML || trf == RECFM_DIR) ? -1 : 0; #else // !__WIN__ // Offsets of HTML tables start from 0, DIR and DBF at 1 - loff = (tc == TAB_DBF || tc == TAB_DIR) ? 1 : (tc == TAB_XML) ? -1 : 0; + loff = (trf == RECFM_DBF || trf == RECFM_DIR) ? 1 : (trf == RECFM_XML) ? -1 : 0; #endif // !__WIN__ while (true) { - // Default Offset depends on table type - switch (tc) { - case TAB_DOS: - case TAB_FIX: - case TAB_BIN: - case TAB_VEC: - case TAB_DBF: + // Default Offset depends on table format + switch (trf ) { + case RECFM_VAR: + case RECFM_FIX: + case RECFM_BIN: + case RECFM_VCT: + case RECFM_DBF: poff= loff + nof; // Default next offset nlg= MY_MAX(nlg, poff); // Default lrecl break; - case TAB_CSV: - case TAB_FMT: + case RECFM_CSV: + case RECFM_FMT: nlg+= nof; - case TAB_DIR: - case TAB_XML: + case RECFM_DIR: + case RECFM_XML: poff= loff + (pcf->Flags & U_VIRTUAL ? 0 : 1); break; - case TAB_INI: - case TAB_MAC: - case TAB_TBL: - case TAB_XCL: - case TAB_OCCUR: - case TAB_PRX: - case TAB_OEM: + //case RECFM_INI: + //case RECFM_MAC: + //case RECFM_TBL: + //case RECFM_XCL: + //case RECFM_OCCUR: + //case RECFM_PRX: + case RECFM_OEM: poff = 0; // Offset represents an independant flag break; - default: // VCT PLG ODBC JDBC MYSQL WMI... + default: // PLG ODBC JDBC MYSQL WMI... poff = 0; // NA break; - } // endswitch tc + } // endswitch trf // do { field= Hc->GetColumnOption(g, field, pcf); // } while (field && (*pcf->Name =='*' /*|| pcf->Flags & U_VIRTUAL*/)); - if (tc == TAB_DBF && pcf->Type == TYPE_DATE && !pcf->Datefmt) { + if (trf == RECFM_DBF && pcf->Type == TYPE_DATE && !pcf->Datefmt) { // DBF date format defaults to 'YYYMMDD' pcf->Datefmt= "YYYYMMDD"; pcf->Length= 8; - } // endif tc + } // endif trf if (!field) break; @@ -341,10 +471,10 @@ int TABDEF::GetColCatInfo(PGLOBAL g) else loff= cdp->GetOffset(); - switch (tc) { - case TAB_VEC: + switch (trf ) { + case RECFM_VCT: cdp->SetOffset(0); // Not to have shift - case TAB_BIN: + case RECFM_BIN: // BIN/VEC are packed by default if (nof) { // Field width is the internal representation width @@ -395,7 +525,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) default: break; - } // endswitch tc + } // endswitch trf if (lcdp) lcdp->SetNext(cdp); @@ -413,21 +543,15 @@ int TABDEF::GetColCatInfo(PGLOBAL g) if (GetDefType() == TYPE_AM_DOS) { int ending, recln= 0; - // Was commented because sometimes ending is 0 even when - // not specified (for instance if quoted is specified) -// if ((ending= Hc->GetIntegerOption("Ending")) < 0) { - if ((ending= Hc->GetIntegerOption("Ending")) <= 0) { - ending= (tc == TAB_BIN || tc == TAB_VEC) ? 0 : CRLF; - Hc->SetIntegerOption("Ending", ending); - } // endif ending + ending = Hc->GetIntegerOption("Ending"); // Calculate the default record size - switch (tc) { - case TAB_FIX: - case TAB_BIN: + switch (trf ) { + case RECFM_FIX: + case RECFM_BIN: recln= nlg + ending; // + length of line ending break; - case TAB_VEC: + case RECFM_VCT: recln= nlg; // if ((k= (pak < 0) ? 8 : pak) > 1) @@ -436,18 +560,18 @@ int TABDEF::GetColCatInfo(PGLOBAL g) // recln= ((recln + k - 1) / k) * k; break; - case TAB_DOS: - case TAB_DBF: + case RECFM_VAR: + case RECFM_DBF: recln= nlg; break; - case TAB_CSV: - case TAB_FMT: + case RECFM_CSV: + case RECFM_FMT: // The number of separators (assuming an extra one can exist) // recln= poff * ((qotd) ? 3 : 1); to be investigated recln= nlg + poff * 3; // To be safe default: break; - } // endswitch tc + } // endswitch trf // lrecl must be at least recln to avoid buffer overflow if (trace(1)) @@ -461,7 +585,7 @@ int TABDEF::GetColCatInfo(PGLOBAL g) if (trace(1)) htrc("Lrecl set to %d\n", recln); - } // endif Lrecl + } // endif TYPE // Attach the column definition to the tabdef SetCols(tocols); @@ -596,10 +720,6 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) cat->Cbuf = (char*)PlugSubAlloc(g, NULL, cat->Cblen); } // endif Cbuf - // Here "OEM" should be replace by a more useful value - if (xdefp->Define(g, cat, Name, Schema, "OEM")) - return NULL; - // Ok, return external block return xdefp; } // end of GetXdef @@ -622,7 +742,7 @@ bool OEMDEF::DeleteTableFile(PGLOBAL g) /***********************************************************************/ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int) { - Module = GetStringCatInfo(g, "Module", ""); + Module = GetStringCatInfo(g, "Module", ""); Subtype = GetStringCatInfo(g, "Subtype", Module); if (!*Module) @@ -632,7 +752,13 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int) + strlen(Subtype) + 3); sprintf(desc, "%s(%s)", Module, Subtype); Desc = desc; - return false; + + // If define block not here yet, get it now + if (!Pxdef && !(Pxdef = GetXdef(g))) + return true; // Error + + // Here "OEM" should be replace by a more useful value + return Pxdef->Define(g, Cat, Name, Schema, Subtype); } // end of DefineAM /***********************************************************************/ @@ -640,7 +766,6 @@ bool OEMDEF::DefineAM(PGLOBAL g, LPCSTR, int) /***********************************************************************/ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) { - RECFM rfm; PTDB tdbp = NULL; // If define block not here yet, get it now @@ -653,18 +778,10 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) /*********************************************************************/ if (!(tdbp = Pxdef->GetTable(g, mode))) return NULL; - else - rfm = tdbp->GetFtype(); - - if (rfm == RECFM_NAF) - return tdbp; - else if (rfm == RECFM_OEM) { - if (Multiple) - tdbp = new(g) TDBMUL(tdbp); // No block optimization yet - - return tdbp; - } // endif OEM + else if (Multiple && tdbp->GetFtype() == RECFM_OEM) + tdbp = new(g) TDBMUL(tdbp); // No block optimization yet +#if 0 /*********************************************************************/ /* The OEM table is based on a file type (currently DOS+ only) */ /*********************************************************************/ @@ -723,7 +840,7 @@ PTDB OEMDEF::GetTable(PGLOBAL g, MODE mode) if (Multiple) tdbp = new(g) TDBMUL(tdbp); - +#endif // 0 return tdbp; } // end of GetTable diff --git a/storage/connect/reldef.h b/storage/connect/reldef.h index f8256a59b3d..73e178ed51c 100644 --- a/storage/connect/reldef.h +++ b/storage/connect/reldef.h @@ -84,10 +84,12 @@ public: void SetNext(PTABDEF tdfp) {Next = tdfp;} int GetMultiple(void) {return Multiple;} int GetPseudo(void) {return Pseudo;} - PCSZ GetPath(void); + RECFM GetRecfm(void) {return Recfm;} + PCSZ GetPath(void); //PSZ GetPath(void) // {return (Database) ? (PSZ)Database : Cat->GetDataPath();} - bool SepIndex(void) {return GetBoolCatInfo("SepIndex", false);} + RECFM GetTableFormat(const char* type); + bool SepIndex(void) {return GetBoolCatInfo("SepIndex", false);} bool IsReadOnly(void) {return Read_Only;} virtual AMT GetDefType(void) {return TYPE_AM_TAB;} virtual PIXDEF GetIndx(void) {return NULL;} @@ -108,7 +110,8 @@ public: // Members PCSZ Schema; /* Table schema (for ODBC) */ PCSZ Desc; /* Table description */ - uint Catfunc; /* Catalog function ID */ + RECFM Recfm; /* File or table format */ + uint Catfunc; /* Catalog function ID */ int Card; /* (max) number of rows in table */ int Elemt; /* Number of rows in blocks or rowset */ int Sort; /* Table already sorted ??? */ diff --git a/storage/connect/restget.cpp b/storage/connect/restget.cpp index 6b184ae6926..d85ec6ae693 100644 --- a/storage/connect/restget.cpp +++ b/storage/connect/restget.cpp @@ -4,12 +4,6 @@ /***********************************************************************/ #include #include -#if defined(MARIADB) -#include -#else -#include "mini-global.h" -#define _OS_H_INCLUDED // Prevent os.h to be called -#endif using namespace utility::conversions; // String conversions utilities using namespace web; // Common features like URIs. @@ -17,24 +11,24 @@ using namespace web::http; // Common HTTP functionality using namespace web::http::client; // HTTP client features using namespace concurrency::streams; // Asynchronous streams -#include "global.h" +typedef const char* PCSZ; /***********************************************************************/ /* Make a local copy of the requested file. */ /***********************************************************************/ -int restGetFile(PGLOBAL g, PCSZ http, PCSZ uri, PCSZ fn) +int restGetFile(char *m, bool xt, PCSZ http, PCSZ uri, PCSZ fn) { int rc = 0; - bool xt = trace(515); auto fileStream = std::make_shared(); if (!http || !fn) { - strcpy(g->Message, "Missing http or filename"); - return 2; + //strcpy(g->Message, "Missing http or filename"); + strcpy(m, "Missing http or filename"); + return 2; } // endif if (xt) - htrc("restGetFile: fn=%s\n", fn); + fprintf(stderr, "restGetFile: fn=%s\n", fn); // Open stream to output file. pplx::task requestTask = fstream::open_ostream(to_string_t(fn)) @@ -42,7 +36,7 @@ int restGetFile(PGLOBAL g, PCSZ http, PCSZ uri, PCSZ fn) *fileStream= outFile; if (xt) - htrc("Outfile isopen=%d\n", outFile.is_open()); + fprintf(stderr, "Outfile isopen=%d\n", outFile.is_open()); // Create http_client to send the request. http_client client(to_string_t(http)); @@ -58,8 +52,8 @@ int restGetFile(PGLOBAL g, PCSZ http, PCSZ uri, PCSZ fn) // Handle response headers arriving. .then([=](http_response response) { if (xt) - htrc("Received response status code:%u\n", - response.status_code()); + fprintf(stderr, "Received response status code:%u\n", + response.status_code()); // Write response body into the file. return response.body().read_to_end(fileStream->streambuf()); @@ -68,27 +62,27 @@ int restGetFile(PGLOBAL g, PCSZ http, PCSZ uri, PCSZ fn) // Close the file stream. .then([=](size_t n) { if (xt) - htrc("Return size=%u\n", n); + fprintf(stderr, "Return size=%zu\n", n); return fileStream->close(); }); // Wait for all the outstanding I/O to complete and handle any exceptions try { - requestTask.wait(); - if (xt) - htrc("In Wait\n"); + fprintf(stderr, "Waiting\n"); + requestTask.wait(); } catch (const std::exception &e) { if (xt) - htrc("Error exception: %s\n", e.what()); - sprintf(g->Message, "Error exception: %s", e.what()); - rc= 1; + fprintf(stderr, "Error exception: %s\n", e.what()); + + sprintf(m, "Error exception: %s", e.what()); + rc= 1; } // end try/catch if (xt) - htrc("restget done: rc=%d\n", rc); + fprintf(stderr, "restget done: rc=%d\n", rc); return rc; } // end of restGetFile diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 4f6e2c81744..8efe2aad702 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -45,7 +45,7 @@ #include "global.h" #include "osutil.h" #include "plgdbsem.h" -#include "catalog.h" +//#include "catalog.h" #include "mycat.h" #include "xindex.h" #include "filamap.h" @@ -161,7 +161,12 @@ bool DOSDEF::DefineAM(PGLOBAL g, LPCSTR am, int) //Last = GetIntCatInfo("Last", 0); Ending = GetIntCatInfo("Ending", CRLF); - if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) { + if (Ending <= 0) { + Ending = (Recfm == RECFM_BIN || Recfm == RECFM_VCT) ? 0 : CRLF; + SetIntCatInfo("Ending", Ending); + } // endif ending + + if (Recfm == RECFM_FIX || Recfm == RECFM_BIN) { Huge = GetBoolCatInfo("Huge", Cat->GetDefHuge()); Padded = GetBoolCatInfo("Padded", false); Blksize = GetIntCatInfo("Blksize", 0); @@ -191,7 +196,8 @@ bool DOSDEF::GetOptFileName(PGLOBAL g, char *filename) case RECFM_FIX: ftype = ".fop"; break; case RECFM_BIN: ftype = ".bop"; break; case RECFM_VCT: ftype = ".vop"; break; - case RECFM_DBF: ftype = ".dbp"; break; + case RECFM_CSV: ftype = ".cop"; break; + case RECFM_DBF: ftype = ".dbp"; break; default: sprintf(g->Message, MSG(INVALID_FTYPE), Recfm); return true; @@ -261,7 +267,8 @@ bool DOSDEF::DeleteIndexFile(PGLOBAL g, PIXDEF pxdf) case RECFM_FIX: ftype = ".fnx"; break; case RECFM_BIN: ftype = ".bnx"; break; case RECFM_VCT: ftype = ".vnx"; break; - case RECFM_DBF: ftype = ".dbx"; break; + case RECFM_CSV: ftype = ".cnx"; break; + case RECFM_DBF: ftype = ".dbx"; break; default: sprintf(g->Message, MSG(BAD_RECFM_VAL), Recfm); return true; @@ -2257,7 +2264,7 @@ int TDBDOS::ReadDB(PGLOBAL g) /***********************************************************************/ bool TDBDOS::PrepareWriting(PGLOBAL) { - if (!Ftype && (Mode == MODE_INSERT || Txfp->GetUseTemp())) { + if (Ftype == RECFM_VAR && (Mode == MODE_INSERT || Txfp->GetUseTemp())) { char *p; /*******************************************************************/ @@ -2542,7 +2549,8 @@ void DOSCOL::ReadColumn(PGLOBAL g) /*********************************************************************/ /* For a variable length file, check if the field exists. */ /*********************************************************************/ - if (tdbp->Ftype == RECFM_VAR && strlen(tdbp->To_Line) < (unsigned)Deplac) + if ((tdbp->Ftype == RECFM_VAR || tdbp->Ftype == RECFM_CSV) + && strlen(tdbp->To_Line) < (unsigned)Deplac) field = 0; else if (Dsp) for(i = 0; i < field; i++) @@ -2552,7 +2560,8 @@ void DOSCOL::ReadColumn(PGLOBAL g) switch (tdbp->Ftype) { case RECFM_VAR: case RECFM_FIX: // Fixed length text file - case RECFM_DBF: // Fixed length DBase file + case RECFM_CSV: // Variable length CSV or FMT file + case RECFM_DBF: // Fixed length DBase file if (Nod) switch (Buf_Type) { case TYPE_INT: case TYPE_SHORT: diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index bdde37adaad..207a1277fce 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -80,7 +80,6 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ PCSZ Entry; /* Zip entry name or pattern */ PCSZ Pwd; /* Zip password */ PIXDEF To_Indx; /* To index definitions blocks */ - RECFM Recfm; /* 0:VAR, 1:FIX, 2:BIN, 3:VCT, 6:DBF */ bool Mapped; /* 0: disk file, 1: memory mapped file */ bool Zipped; /* true for zipped table file */ bool Mulentries; /* true for multiple entries */ diff --git a/storage/connect/tabfix.cpp b/storage/connect/tabfix.cpp index 1969fd4465f..4a0a75460cd 100644 --- a/storage/connect/tabfix.cpp +++ b/storage/connect/tabfix.cpp @@ -84,7 +84,7 @@ PTDB TDBFIX::Clone(PTABS t) tp = new(g) TDBFIX(g, this); - if (Ftype < 2) { + if (Ftype == RECFM_VAR || Ftype == RECFM_FIX) { // File is text PDOSCOL cp1, cp2; diff --git a/storage/connect/tabfmt.cpp b/storage/connect/tabfmt.cpp index 746382178fb..b395c49c95d 100644 --- a/storage/connect/tabfmt.cpp +++ b/storage/connect/tabfmt.cpp @@ -1,11 +1,11 @@ /************* TabFmt C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: TABFMT */ /* ------------- */ -/* Version 3.9.2 */ +/* Version 3.9.3 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2001 - 2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2001 - 2019 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -477,6 +477,7 @@ bool CSVDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (DOSDEF::DefineAM(g, "CSV", poff)) return true; + Recfm = RECFM_CSV; GetCharCatInfo("Separator", ",", buf, sizeof(buf)); Sep = (strlen(buf) == 2 && buf[0] == '\\' && buf[1] == 't') ? '\t' : *buf; Quoted = GetIntCatInfo("Quoted", -1); diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index ceffafac02c..7e165fb5a80 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -342,11 +342,13 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) Delayed = !!GetIntCatInfo("Delayed", 0); } else { // MYSQL access from a PROXY table - Tabschema = GetStringCatInfo(g, "Database", Tabschema ? Tabschema : PlugDup(g, "*")); + TABLE_SHARE* s; + + Tabschema = GetStringCatInfo(g, "Database", Tabschema ? Tabschema : PlugDup(g, "*")); Isview = GetBoolCatInfo("View", false); // We must get other connection parms from the calling table - Remove_tshp(Cat); + s = Remove_tshp(Cat); url = GetStringCatInfo(g, "Connect", NULL); if (!url || !*url) { @@ -365,6 +367,9 @@ bool MYSQLDEF::DefineAM(PGLOBAL g, LPCSTR am, int) } // endif url Tabname = Name; + + // Needed for column description + Restore_tshp(Cat, s); } // endif am if ((Srcdef = GetStringCatInfo(g, "Srcdef", NULL))) { diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index 9e1a643c89f..dde0411592e 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -1,5 +1,5 @@ /*************** Rest C++ Program Source Code File (.CPP) **************/ -/* PROGRAM NAME: Rest Version 1.5 */ +/* PROGRAM NAME: Rest Version 1.6 */ /* (C) Copyright to the author Olivier BERTRAND 2018 - 2019 */ /* This program is the REST Web API support for MariaDB. */ /* When compiled without MARIADB defined, it is the EOM module code. */ @@ -39,7 +39,7 @@ /***********************************************************************/ /* Get the file from the Web. */ /***********************************************************************/ -int restGetFile(PGLOBAL g, PCSZ http, PCSZ uri, PCSZ fn); +int restGetFile(char *m, bool x, PCSZ http, PCSZ uri, PCSZ fn); #if defined(__WIN__) static PCSZ slash = "\\"; @@ -48,6 +48,10 @@ static PCSZ slash = "/"; #define stricmp strcasecmp #endif // !__WIN__ +typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ); +static XGETREST getRestFnc = NULL; + + #if !defined(MARIADB) /***********************************************************************/ /* DB static variables. */ @@ -75,6 +79,74 @@ PTABDEF __stdcall GetREST(PGLOBAL g, void *memp) } // end of GetREST #endif // !MARIADB +/***********************************************************************/ +/* GetREST: get the external TABDEF from OEM module. */ +/***********************************************************************/ +XGETREST GetRestFunction(PGLOBAL g) +{ + if (getRestFnc) + return getRestFnc; + +#if !defined(REST_SOURCE) + if (trace(515)) + htrc("Looking for GetRest library\n"); + +#if defined(__WIN__) + HANDLE Hdll; + const char* soname = "GetRest.dll"; // Module name + + if (!(Hdll = LoadLibrary(soname))) { + char buf[256]; + DWORD rc = GetLastError(); + + sprintf(g->Message, MSG(DLL_LOAD_ERROR), rc, soname); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, + (LPTSTR)buf, sizeof(buf), NULL); + strcat(strcat(g->Message, ": "), buf); + return NULL; + } // endif Hdll + +// Get the function returning an instance of the external DEF class + if (!(getRestFnc = (XGETREST)GetProcAddress((HINSTANCE)Hdll, "restGetFile"))) { + char buf[256]; + DWORD rc = GetLastError(); + + sprintf(g->Message, MSG(PROCADD_ERROR), rc, "restGetFile"); + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | + FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, + (LPTSTR)buf, sizeof(buf), NULL); + strcat(strcat(g->Message, ": "), buf); + FreeLibrary((HMODULE)Hdll); + return NULL; + } // endif getRestFnc +#else // !__WIN__ + void* Hso; + const char* error = NULL; + const char* soname = "GetRest.so"; // Module name + + // Load the desired shared library + if (!(Hso = dlopen(soname, RTLD_LAZY))) { + error = dlerror(); + sprintf(g->Message, MSG(SHARED_LIB_ERR), soname, SVP(error)); + return NULL; + } // endif Hdll + +// Get the function returning an instance of the external DEF class + if (!(getRestFnc = (XGETREST)dlsym(Hdll, "restGetFile"))) { + error = dlerror(); + sprintf(g->Message, MSG(GET_FUNC_ERR), "restGetFile", SVP(error)); + dlclose(Hso); + return NULL; + } // endif getdef +#endif // !__WIN__ +#else + getRestFnc = restGetFile; +#endif + + return getRestFnc; +} // end of GetRestFunction + /***********************************************************************/ /* Return the columns definition to MariaDB. */ /***********************************************************************/ @@ -87,6 +159,10 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) PQRYRES qrp= NULL; char filename[_MAX_PATH + 1]; // MAX PATH ??? PCSZ http, uri, fn, ftype; + XGETREST grf = GetRestFunction(g); + + if (!grf) + return NULL; http = GetStringTableOption(g, tp, "Http", NULL); uri = GetStringTableOption(g, tp, "Uri", NULL); @@ -103,8 +179,8 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) strncat(filename, fn, _MAX_PATH); // Retrieve the file from the web and copy it locally - if (http && restGetFile(g, http, uri, filename)) { - // sprintf(g->Message, "Failed to get file at %s", http); + if (http && grf(g->Message, trace(515), http, uri, filename)) { + // sprintf(g->Message, "Failed to get file at %s", http); } else if (!stricmp(ftype, "XML")) qrp = XMLColumns(g, db, tab, tp, info); else if (!stricmp(ftype, "JSON")) @@ -124,9 +200,14 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) /***********************************************************************/ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) { - char filename[_MAX_PATH + 1]; + char filename[_MAX_PATH + 1]; int rc = 0, n; - LPCSTR ftype; + bool xt = trace(515); + LPCSTR ftype; + XGETREST grf = GetRestFunction(g); + + if (!grf) + return true; #if defined(MARIADB) ftype = GetStringCatInfo(g, "Type", "JSON"); @@ -135,7 +216,7 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) ftype = GetStringCatInfo(g, "Ftype", "JSON"); #endif // !MARIADB - if (trace(515)) + if (xt) htrc("ftype = %s am = %s\n", ftype, SVP(am)); n = (!stricmp(ftype, "JSON")) ? 1 @@ -157,9 +238,9 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) strncat(strcpy(filename, GetPath()), Fn, _MAX_PATH); // Retrieve the file from the web and copy it locally - rc = restGetFile(g, Http, Uri, filename); + rc = grf(g->Message, xt, Http, Uri, filename); - if (trace(515)) + if (xt) htrc("Return from restGetFile: rc=%d\n", rc); if (rc) @@ -175,7 +256,7 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) if (Tdp && Tdp->Define(g, Cat, Name, Schema, "REST")) Tdp = NULL; // Error occured - if (trace(515)) + if (xt) htrc("Tdp defined\n", rc); // Return true in case of error diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp index 462a6fcd839..e187e6eaec5 100644 --- a/storage/connect/tabutil.cpp +++ b/storage/connect/tabutil.cpp @@ -59,11 +59,23 @@ int GetConvSize(void); /* Used by MYSQL tables to get MySQL parameters from the calling proxy */ /* table (PROXY, TBL, XCL, or OCCUR) when used by one of these. */ /************************************************************************/ -void Remove_tshp(PCATLG cat) +TABLE_SHARE *Remove_tshp(PCATLG cat) { - ((MYCAT*)cat)->GetHandler()->tshp = NULL; + TABLE_SHARE *s = ((MYCAT*)cat)->GetHandler()->tshp; + + ((MYCAT*)cat)->GetHandler()->tshp = NULL; + return s; } // end of Remove_thsp +/************************************************************************/ +/* Used by MYSQL tables to get MySQL parameters from the calling proxy */ +/* table (PROXY, TBL, XCL, or OCCUR) when used by one of these. */ +/************************************************************************/ +void Restore_tshp(PCATLG cat, TABLE_SHARE *s) +{ + ((MYCAT*)cat)->GetHandler()->tshp = s; +} // end of Restore_thsp + /************************************************************************/ /* GetTableShare: allocates and open a table share. */ /************************************************************************/ diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index 62678508ca1..c8e7e75106f 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -18,7 +18,8 @@ TABLE_SHARE *GetTableShare(PGLOBAL g, THD *thd, const char *db, PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db, const char *name, bool& info); -void Remove_tshp(PCATLG cat); +TABLE_SHARE *Remove_tshp(PCATLG cat); +void Restore_tshp(PCATLG cat, TABLE_SHARE *s); /* -------------------------- PROXY classes -------------------------- */ diff --git a/storage/connect/tabvct.cpp b/storage/connect/tabvct.cpp index 40d020202ea..0ed466f6ffb 100644 --- a/storage/connect/tabvct.cpp +++ b/storage/connect/tabvct.cpp @@ -115,11 +115,14 @@ bool VCTDEF::DefineAM(PGLOBAL g, LPCSTR, int poff) Recfm = RECFM_VCT; + // poff is no more in use; This will have to be revisited +#if 0 // For packed files the logical record length is calculated in poff if (poff != Lrecl) { Lrecl = poff; SetIntCatInfo("Lrecl", poff); } // endif poff +#endif // 0 Padded = false; Blksize = 0; diff --git a/storage/connect/xindex.cpp b/storage/connect/xindex.cpp index efefc17b5f5..db43f800a91 100644 --- a/storage/connect/xindex.cpp +++ b/storage/connect/xindex.cpp @@ -659,7 +659,7 @@ bool XINDEX::Make(PGLOBAL g, PIXDEF sxp) /* Not true for DBF tables because of eventual soft deleted lines. */ /* Note: for Num_K = 1 any non null value is Ok. */ /*********************************************************************/ - if (Srtd && !filp && Tdbp->Ftype != RECFM_VAR + if (Srtd && !filp && Tdbp->Ftype != RECFM_VAR && Tdbp->Ftype != RECFM_CSV && Tdbp->Txfp->GetAmType() != TYPE_AM_DBF) { Incr = (Num_K > 1) ? To_Rec[1] : Num_K; PlgDBfree(Record); @@ -837,7 +837,8 @@ bool XINDEX::SaveIndex(PGLOBAL g, PIXDEF sxp) case RECFM_FIX: ftype = ".fnx"; break; case RECFM_BIN: ftype = ".bnx"; break; case RECFM_VCT: ftype = ".vnx"; break; - case RECFM_DBF: ftype = ".dbx"; break; + case RECFM_CSV: ftype = ".cnx"; break; + case RECFM_DBF: ftype = ".dbx"; break; default: sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); return true; @@ -990,7 +991,8 @@ bool XINDEX::Init(PGLOBAL g) case RECFM_FIX: ftype = ".fnx"; break; case RECFM_BIN: ftype = ".bnx"; break; case RECFM_VCT: ftype = ".vnx"; break; - case RECFM_DBF: ftype = ".dbx"; break; + case RECFM_CSV: ftype = ".cnx"; break; + case RECFM_DBF: ftype = ".dbx"; break; default: sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); return true; @@ -1243,7 +1245,8 @@ bool XINDEX::MapInit(PGLOBAL g) case RECFM_FIX: ftype = ".fnx"; break; case RECFM_BIN: ftype = ".bnx"; break; case RECFM_VCT: ftype = ".vnx"; break; - case RECFM_DBF: ftype = ".dbx"; break; + case RECFM_CSV: ftype = ".cnx"; break; + case RECFM_DBF: ftype = ".dbx"; break; default: sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); return true; @@ -1457,7 +1460,8 @@ bool XINDEX::GetAllSizes(PGLOBAL g,/* int &ndif,*/ int &numk) case RECFM_FIX: ftype = ".fnx"; break; case RECFM_BIN: ftype = ".bnx"; break; case RECFM_VCT: ftype = ".vnx"; break; - case RECFM_DBF: ftype = ".dbx"; break; + case RECFM_CSV: ftype = ".cnx"; break; + case RECFM_DBF: ftype = ".dbx"; break; default: sprintf(g->Message, MSG(INVALID_FTYPE), Tdbp->Ftype); return true; From 9c0e462ff28b93127406eeb2db4b763423fabbe3 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 16 Nov 2019 15:59:16 +0100 Subject: [PATCH 03/59] Fix missing declaration in tabrest.cpp causing compiling failure on Linux --- storage/connect/tabrest.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index dde0411592e..de8383a838d 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -133,7 +133,7 @@ XGETREST GetRestFunction(PGLOBAL g) } // endif Hdll // Get the function returning an instance of the external DEF class - if (!(getRestFnc = (XGETREST)dlsym(Hdll, "restGetFile"))) { + if (!(getRestFnc = (XGETREST)dlsym(Hso, "restGetFile"))) { error = dlerror(); sprintf(g->Message, MSG(GET_FUNC_ERR), "restGetFile", SVP(error)); dlclose(Hso); From 290972563673a7de32e10bb0e4bdb37295be1371 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 18 Nov 2019 11:50:58 +0530 Subject: [PATCH 04/59] MDEV-21044: Wrong result when using a smaller size for sort buffer Make sure that the sort buffers can store atleast one sort key. This is needed to make sure that all merge buffers are read else with no sort keys some merge buffers are skipped because the code makes a conclusion there is no data to be read. --- mysql-test/r/order_by.result | 30 ++++++++++++++++++++++++++++++ mysql-test/t/order_by.test | 16 ++++++++++++++++ sql/filesort.cc | 1 + 3 files changed, 47 insertions(+) diff --git a/mysql-test/r/order_by.result b/mysql-test/r/order_by.result index 4cd9aebdf49..380687554d7 100644 --- a/mysql-test/r/order_by.result +++ b/mysql-test/r/order_by.result @@ -3207,3 +3207,33 @@ pk 2 3 DROP TABLE t1; +# +# MDEV-21044: Wrong result when using a smaller size for sort buffer +# +create table t1(a varchar(765),b int); +insert into t1 values ("a",1),("b",2),("c",3),("e",4); +insert into t1 values ("d",5),("f",6),("g",7),("h",8); +insert into t1 values ("k",11),("l",12),("i",9),("j",10); +insert into t1 values ("m",13),("n",14),("o",15),("p",16); +set @save_sort_buffer_size= @@sort_buffer_size; +set sort_buffer_size=1024; +select * from t1 order by b; +a b +a 1 +b 2 +c 3 +e 4 +d 5 +f 6 +g 7 +h 8 +i 9 +j 10 +k 11 +l 12 +m 13 +n 14 +o 15 +p 16 +set @@sort_buffer_size= @save_sort_buffer_size; +drop table t1; diff --git a/mysql-test/t/order_by.test b/mysql-test/t/order_by.test index 1ca258d1d48..999c7314139 100644 --- a/mysql-test/t/order_by.test +++ b/mysql-test/t/order_by.test @@ -2141,3 +2141,19 @@ INSERT INTO t1 VALUES (1),(2),(3); SELECT DISTINCT pk FROM t1 GROUP BY 'foo'; SELECT DISTINCT pk FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-21044: Wrong result when using a smaller size for sort buffer +--echo # + +create table t1(a varchar(765),b int); +insert into t1 values ("a",1),("b",2),("c",3),("e",4); +insert into t1 values ("d",5),("f",6),("g",7),("h",8); +insert into t1 values ("k",11),("l",12),("i",9),("j",10); +insert into t1 values ("m",13),("n",14),("o",15),("p",16); +set @save_sort_buffer_size= @@sort_buffer_size; +set sort_buffer_size=1024; +select * from t1 order by b; +set @@sort_buffer_size= @save_sort_buffer_size; +drop table t1; + diff --git a/sql/filesort.cc b/sql/filesort.cc index 4f195f68059..bb3e73343ad 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -343,6 +343,7 @@ ha_rows filesort(THD *thd, TABLE *table, SORT_FIELD *sortorder, uint s_length, param.max_keys_per_buffer=((param.max_keys_per_buffer * (param.rec_length + sizeof(char*))) / param.rec_length - 1); + set_if_bigger(param.max_keys_per_buffer, 1); maxbuffer--; // Offset from 0 if (merge_many_buff(¶m, (uchar*) table_sort.get_sort_keys(), From 5c68343db713b9a2881809f6e21107d73a7d7b46 Mon Sep 17 00:00:00 2001 From: seppo Date: Mon, 18 Nov 2019 15:18:00 +0200 Subject: [PATCH 05/59] MDEV-18497 CTAS async replication from mariadb master crashes galera nodes (#1410) This PR contains a mtr test for reproducing a failure with replicating create table as select statement (CTAS) through asynchronous mariadb replication to mariadb galera cluster. The problem happens when CTAS replication contains both create table statement followed by row events for populating the table. In such situation, the galera node operating as mariadb replication slave, will first replicate only the create table part into the cluster, and then perform another replication containing both the create table and row events. This will lead all other nodes to fail for duplicate table create attempt, and crash due to this failure. PR contains also a fix, which identifies the situation when CTAS has been replicated, and makes further scan in async replication stream to see if there are following row events. The slave node will replicate either single TOI in case the CTAS table is empty, or if CTAS table contains rows, then single bundled write set with create table and row events is replicated to galera cluster. This fix should keep master server's GTID's for CTAS replication in sync with GTID's in galera cluster. --- .../galera/r/galera_as_slave_ctas.result | 14 ++++ .../suite/galera/t/galera_as_slave_ctas.cnf | 5 ++ .../suite/galera/t/galera_as_slave_ctas.test | 75 +++++++++++++++++++ sql/log_event.h | 3 + sql/slave.cc | 26 +++++++ sql/wsrep_mysqld.cc | 34 ++++++++- 6 files changed, 156 insertions(+), 1 deletion(-) create mode 100644 mysql-test/suite/galera/r/galera_as_slave_ctas.result create mode 100644 mysql-test/suite/galera/t/galera_as_slave_ctas.cnf create mode 100644 mysql-test/suite/galera/t/galera_as_slave_ctas.test diff --git a/mysql-test/suite/galera/r/galera_as_slave_ctas.result b/mysql-test/suite/galera/r/galera_as_slave_ctas.result new file mode 100644 index 00000000000..79114824008 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_ctas.result @@ -0,0 +1,14 @@ +START SLAVE; +SHOW VARIABLES LIKE 'binlog_format'; +Variable_name Value +binlog_format ROW +CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; +CREATE TABLE target AS SELECT * FROM source; +DROP TABLE target; +INSERT INTO source VALUES(1); +CREATE TABLE target AS SELECT * FROM source; +DROP TABLE source; +DROP TABLE target; +STOP SLAVE; +RESET SLAVE ALL; +RESET MASTER; diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf new file mode 100644 index 00000000000..eab2a6de90d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.cnf @@ -0,0 +1,5 @@ +!include ../galera_2nodes_as_slave.cnf + +# make sure master server uses ROW format for replication +[mysqld] +binlog-format=row diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test new file mode 100644 index 00000000000..7336449a3d0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test @@ -0,0 +1,75 @@ +# +# Test Galera as a slave to a MySQL master +# +# The galera/galera_2node_slave.cnf describes the setup of the nodes +# also, for this test, master server must have binlog_format=ROW +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 + +--connection node_2 +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + + +# make sure master server has binlog_format=ROW +--connection node_1 +SHOW VARIABLES LIKE 'binlog_format'; + +# +# test phase one, issue CTAS with empty source table +# +--connection node_1 +CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; + +CREATE TABLE target AS SELECT * FROM source; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target'; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target'; +--source include/wait_condition.inc + +# +# test phase two, issue CTAS with populated source table +# +--connection node_1 +DROP TABLE target; +INSERT INTO source VALUES(1); + +CREATE TABLE target AS SELECT * FROM source; + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM target; +--source include/wait_condition.inc + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 1 FROM target; +--source include/wait_condition.inc + +--connection node_1 +DROP TABLE source; +DROP TABLE target; + +--connection node_3 +--let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'target'; +--source include/wait_condition.inc + + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; + +--connection node_1 +RESET MASTER; +--sleep 20 diff --git a/sql/log_event.h b/sql/log_event.h index 9c555c54005..2c8dc3d7353 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -4967,6 +4967,9 @@ bool event_that_should_be_ignored(const char *buf); bool event_checksum_test(uchar *buf, ulong event_len, enum_binlog_checksum_alg alg); enum enum_binlog_checksum_alg get_checksum_alg(const char* buf, ulong len); extern TYPELIB binlog_checksum_typelib; +#ifdef WITH_WSREP +enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size); +#endif /* WITH_WSREP */ /** @} (end of group Replication) diff --git a/sql/slave.cc b/sql/slave.cc index 0ebed343a3d..bf8b8a43b15 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -7220,7 +7220,33 @@ err: sql_print_error("Error reading relay log event: %s", errmsg); DBUG_RETURN(0); } +#ifdef WITH_WSREP +enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size) +{ + mysql_mutex_lock(&rgi->rli->data_lock); + unsigned long long event_pos= rgi->event_relay_log_pos; + unsigned long long future_pos= rgi->future_event_relay_log_pos; + + /* scan the log to read next event */ + my_b_seek(rgi->rli->cur_log, future_pos); + rgi->rli->event_relay_log_pos= future_pos; + rgi->event_relay_log_pos= future_pos; + + Log_event* ev = next_event(rgi, event_size); + enum Log_event_type ev_type= (ev) ? ev->get_type_code() : UNKNOWN_EVENT; + delete ev; + + /* scan the log back and re-set the positions to original values */ + rgi->rli->event_relay_log_pos= event_pos; + rgi->event_relay_log_pos= event_pos; + my_b_seek(rgi->rli->cur_log, future_pos); + + mysql_mutex_unlock(&rgi->rli->data_lock); + + return ev_type; +} +#endif /* WITH_WSREP */ /* Rotate a relay log (this is used only by FLUSH LOGS; the automatic rotation because of size is simpler because when we do it we already have all relevant diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc index 0a519be073c..0627127c6e0 100644 --- a/sql/wsrep_mysqld.cc +++ b/sql/wsrep_mysqld.cc @@ -37,7 +37,6 @@ #include #include #include "log_event.h" -#include #include "sql_plugin.h" /* wsrep_plugins_pre_init() */ wsrep_t *wsrep = NULL; @@ -1502,6 +1501,39 @@ static bool wsrep_can_run_in_toi(THD *thd, const char *db, const char *table, { return false; } + /* + If mariadb master has replicated a CTAS, we should not replicate the create table + part separately as TOI, but to replicate both create table and following inserts + as one write set. + Howver, if CTAS creates empty table, we should replicate the create table alone + as TOI. We have to do relay log event lookup to see if row events follow the + create table event. + */ + if (thd->slave_thread && !(thd->rgi_slave->gtid_ev_flags2 & Gtid_log_event::FL_STANDALONE)) + { + /* this is CTAS, either empty or populated table */ + ulonglong event_size = 0; + enum Log_event_type ev_type= wsrep_peak_event(thd->rgi_slave, &event_size); + switch (ev_type) + { + case QUERY_EVENT: + /* CTAS with empty table, we replicate create table as TOI */ + break; + + case TABLE_MAP_EVENT: + WSREP_DEBUG("replicating CTAS of empty table as TOI"); + // fall through + case WRITE_ROWS_EVENT: + /* CTAS with populated table, we replicate later at commit time */ + WSREP_DEBUG("skipping create table of CTAS replication"); + return false; + + default: + WSREP_WARN("unexpected async replication event: %d", ev_type); + } + return true; + } + /* no next async replication event */ return true; case SQLCOM_CREATE_VIEW: From c6b097ab3702fe993ee81899fefa9779b8b969e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Mon, 18 Nov 2019 15:22:01 +0200 Subject: [PATCH 06/59] Remove excessive sleep from test. --- mysql-test/suite/galera/t/galera_as_slave_ctas.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/suite/galera/t/galera_as_slave_ctas.test b/mysql-test/suite/galera/t/galera_as_slave_ctas.test index 7336449a3d0..1a5e023b981 100644 --- a/mysql-test/suite/galera/t/galera_as_slave_ctas.test +++ b/mysql-test/suite/galera/t/galera_as_slave_ctas.test @@ -72,4 +72,4 @@ RESET SLAVE ALL; --connection node_1 RESET MASTER; ---sleep 20 + From 8fbfcce911d43091f34e1412269db785a0273641 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 19 Nov 2019 17:09:43 +0700 Subject: [PATCH 07/59] cleanup: remove always true condition to fix clang warning --- storage/connect/inihandl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/inihandl.cpp b/storage/connect/inihandl.cpp index 8e79aeac7ef..dacab3c485c 100644 --- a/storage/connect/inihandl.cpp +++ b/storage/connect/inihandl.cpp @@ -194,7 +194,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section ) } for (key = section->key; key; key = key->next) - if (key->name && key->name[0]) { + if (key->name[0]) { fprintf(file, "%s", SVP(key->name)); if (key->value) From 899c5bd5aad47a49d339ea211dd9671f80c49812 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 18 Nov 2019 23:26:21 +0700 Subject: [PATCH 08/59] MDEV-20832 Don't print "row size too large" warnings in error log if innodb_strict_mode=OFF and log_warnings<=2 create_table_info_t::row_size_is_acceptable(): add condition for log writing --- .../suite/innodb/r/innodb-32k-crash.result | 1 - .../suite/innodb/r/innodb-64k-crash.result | 1 - .../suite/innodb/r/innodb-mdev-7513.result | 1 - .../innodb/r/innodb_max_recordsize_32k.result | 1 - .../innodb/r/innodb_max_recordsize_64k.result | 1 - .../r/row_size_error_log_warnings_3.result | 21 ++++++++++++++++ mysql-test/suite/innodb/r/undo_log.result | 1 - .../suite/innodb/t/innodb-32k-crash.test | 2 -- .../suite/innodb/t/innodb-64k-crash.test | 2 -- .../suite/innodb/t/innodb-mdev-7513.test | 1 - .../innodb/t/innodb_max_recordsize_32k.test | 2 -- .../innodb/t/innodb_max_recordsize_64k.test | 2 -- .../t/row_size_error_log_warnings_3.test | 24 +++++++++++++++++++ mysql-test/suite/innodb/t/undo_log.test | 2 -- storage/innobase/handler/ha_innodb.cc | 15 +++++++----- 15 files changed, 54 insertions(+), 23 deletions(-) create mode 100644 mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result create mode 100644 mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test diff --git a/mysql-test/suite/innodb/r/innodb-32k-crash.result b/mysql-test/suite/innodb/r/innodb-32k-crash.result index 6c6b7c7fd35..bb46704198d 100644 --- a/mysql-test/suite/innodb/r/innodb-32k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-32k-crash.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is"); CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, o blob,p blob,q blob,r blob,s blob,t blob,u blob, diff --git a/mysql-test/suite/innodb/r/innodb-64k-crash.result b/mysql-test/suite/innodb/r/innodb-64k-crash.result index 7ed271a14dd..e7998fddf29 100644 --- a/mysql-test/suite/innodb/r/innodb-64k-crash.result +++ b/mysql-test/suite/innodb/r/innodb-64k-crash.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is"); CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, o blob,p blob,q blob,r blob,s blob,t blob,u blob, diff --git a/mysql-test/suite/innodb/r/innodb-mdev-7513.result b/mysql-test/suite/innodb/r/innodb-mdev-7513.result index 55b4d3462b0..bb3531e3f90 100644 --- a/mysql-test/suite/innodb/r/innodb-mdev-7513.result +++ b/mysql-test/suite/innodb/r/innodb-mdev-7513.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); call mtr.add_suppression("Row size too large (> 8126)*"); CREATE TABLE t1 ( text1 TEXT, text2 TEXT, diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result index 7eb9a172754..8e3d670e4fe 100644 --- a/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result +++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_32k.result @@ -1,4 +1,3 @@ -call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); SELECT @@innodb_page_size; @@innodb_page_size 32768 diff --git a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result index c889e00107b..50d0971bc63 100644 --- a/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result +++ b/mysql-test/suite/innodb/r/innodb_max_recordsize_64k.result @@ -1,4 +1,3 @@ -call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); SELECT @@innodb_page_size; @@innodb_page_size 65536 diff --git a/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result new file mode 100644 index 00000000000..c175f8ee915 --- /dev/null +++ b/mysql-test/suite/innodb/r/row_size_error_log_warnings_3.result @@ -0,0 +1,21 @@ +call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); +SET innodb_strict_mode = 0; +SET @@global.log_warnings = 3; +CREATE TABLE t1 ( +col_1 TEXT +,col_2 TEXT +,col_3 TEXT +,col_4 TEXT +,col_5 TEXT +,col_6 TEXT +,col_7 TEXT +,col_8 TEXT +,col_9 TEXT +,col_10 TEXT +,col_11 TEXT +) ENGINE=INNODB ROW_FORMAT=COMPACT; +Warnings: +Warning 139 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline. +DROP TABLE t1; +SET @@global.log_warnings = 2; +SET innodb_strict_mode = 1; diff --git a/mysql-test/suite/innodb/r/undo_log.result b/mysql-test/suite/innodb/r/undo_log.result index 7892e26d896..cda3b190ede 100644 --- a/mysql-test/suite/innodb/r/undo_log.result +++ b/mysql-test/suite/innodb/r/undo_log.result @@ -1,4 +1,3 @@ -call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is"); SET innodb_strict_mode=OFF; CREATE TABLE test_tab ( a_str_18 mediumtext, diff --git a/mysql-test/suite/innodb/t/innodb-32k-crash.test b/mysql-test/suite/innodb/t/innodb-32k-crash.test index da6d91f351e..178b32d54c9 100644 --- a/mysql-test/suite/innodb/t/innodb-32k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-32k-crash.test @@ -5,8 +5,6 @@ let $MYSQLD_DATADIR= `select @@datadir`; -call mtr.add_suppression("Cannot add field `u` in table `test`.`t2` because after adding it, the row size is"); - CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, o blob,p blob,q blob,r blob,s blob,t blob,u blob, diff --git a/mysql-test/suite/innodb/t/innodb-64k-crash.test b/mysql-test/suite/innodb/t/innodb-64k-crash.test index cbec1a452c7..93f6f79edf3 100644 --- a/mysql-test/suite/innodb/t/innodb-64k-crash.test +++ b/mysql-test/suite/innodb/t/innodb-64k-crash.test @@ -5,8 +5,6 @@ let $MYSQLD_DATADIR= `select @@datadir`; -call mtr.add_suppression("Cannot add field `pa` in table `test`.`t2` because after adding it, the row size is"); - CREATE TABLE t1(a blob,b blob,c blob,d blob,e blob,f blob,g blob, h blob,i blob,j blob,k blob,l blob,m blob,n blob, o blob,p blob,q blob,r blob,s blob,t blob,u blob, diff --git a/mysql-test/suite/innodb/t/innodb-mdev-7513.test b/mysql-test/suite/innodb/t/innodb-mdev-7513.test index 88f941ef70d..b929ea14781 100644 --- a/mysql-test/suite/innodb/t/innodb-mdev-7513.test +++ b/mysql-test/suite/innodb/t/innodb-mdev-7513.test @@ -3,7 +3,6 @@ # MDEV-7513: ib_warn_row_too_big dereferences null thd -call mtr.add_suppression("InnoDB: Cannot add field `.* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); call mtr.add_suppression("Row size too large (> 8126)*"); --disable_warnings diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test index 5041612bec1..89bace5d9b1 100644 --- a/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test +++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_32k.test @@ -1,8 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_32k.inc -call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); - # Check page size 32k SELECT @@innodb_page_size; diff --git a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test index 5b06b57d4b4..4b4faf16f58 100644 --- a/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test +++ b/mysql-test/suite/innodb/t/innodb_max_recordsize_64k.test @@ -1,8 +1,6 @@ --source include/have_innodb.inc --source include/have_innodb_64k.inc -call mtr.add_suppression('InnoDB: Cannot add field.*because after adding it, the row size is'); - # Check page size 64k SELECT @@innodb_page_size; diff --git a/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test new file mode 100644 index 00000000000..35b86cc4c46 --- /dev/null +++ b/mysql-test/suite/innodb/t/row_size_error_log_warnings_3.test @@ -0,0 +1,24 @@ +--source include/have_innodb.inc + +call mtr.add_suppression("InnoDB: Cannot add field .* in table .* because after adding it, the row size is .* which is greater than maximum allowed size (.*) for a record on index leaf page."); + +SET innodb_strict_mode = 0; +SET @@global.log_warnings = 3; + +CREATE TABLE t1 ( + col_1 TEXT + ,col_2 TEXT + ,col_3 TEXT + ,col_4 TEXT + ,col_5 TEXT + ,col_6 TEXT + ,col_7 TEXT + ,col_8 TEXT + ,col_9 TEXT + ,col_10 TEXT + ,col_11 TEXT +) ENGINE=INNODB ROW_FORMAT=COMPACT; +DROP TABLE t1; + +SET @@global.log_warnings = 2; +SET innodb_strict_mode = 1; diff --git a/mysql-test/suite/innodb/t/undo_log.test b/mysql-test/suite/innodb/t/undo_log.test index 94322868b06..150d50c2e75 100644 --- a/mysql-test/suite/innodb/t/undo_log.test +++ b/mysql-test/suite/innodb/t/undo_log.test @@ -1,7 +1,5 @@ --source include/have_innodb.inc -call mtr.add_suppression("Cannot add field `b_str_20` in table `test`.`test_tab` because after adding it, the row size is"); - SET innodb_strict_mode=OFF; CREATE TABLE test_tab ( a_str_18 mediumtext, diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index caa0b1e861c..7e61a38320a 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12964,12 +12964,15 @@ bool create_table_info_t::row_size_is_acceptable( const size_t idx= info.get_first_overrun_field_index(); const dict_field_t *field= dict_index_get_nth_field(&index, idx); - ib::error_or_warn(strict) - << "Cannot add field " << field->name << " in table " - << index.table->name << " because after adding it, the row size is " - << info.get_overrun_size() - << " which is greater than maximum allowed size (" - << info.max_leaf_size << " bytes) for a record on index leaf page."; + if (strict || global_system_variables.log_warnings > 2) + { + ib::error_or_warn(strict) + << "Cannot add field " << field->name << " in table " + << index.table->name << " because after adding it, the row size is " + << info.get_overrun_size() + << " which is greater than maximum allowed size (" + << info.max_leaf_size << " bytes) for a record on index leaf page."; + } if (strict) { From a51f3b09bb99f2927ce107727316caac2c426eb1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 21 Nov 2019 00:32:27 +0700 Subject: [PATCH 09/59] cleanup DBUG DbugParse(): removed mutex lock/unlock which should protect file writes only. And no file writes happen in this function. DbugFlush(): move mutex_unlock out of this method because fflush() doesn't need any locking. Slow stuff like mutex lock/unlock and accessing errno (TLS) is moved to a more narrow scope. --- dbug/dbug.c | 67 ++++++++++++++++++++++------------------------------- 1 file changed, 28 insertions(+), 39 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index 54eebfe55a5..78605983ccb 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -322,6 +322,17 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args); #include static pthread_mutex_t THR_LOCK_dbug; +static void LockMutex(CODE_STATE *cs) +{ + if (!cs->locked) + pthread_mutex_lock(&THR_LOCK_dbug); +} +static void UnlockMutex(CODE_STATE *cs) +{ + if (!cs->locked) + pthread_mutex_unlock(&THR_LOCK_dbug); +} + static CODE_STATE *code_state(void) { CODE_STATE *cs, **cs_ptr; @@ -449,16 +460,9 @@ static int DbugParse(CODE_STATE *cs, const char *control) const char *end; int rel, f_used=0; struct settings *stack; - int org_cs_locked; stack= cs->stack; - if (!(org_cs_locked= cs->locked)) - { - cs->locked= 1; - pthread_mutex_lock(&THR_LOCK_dbug); - } - if (control[0] == '-' && control[1] == '#') control+=2; @@ -661,11 +665,6 @@ static int DbugParse(CODE_STATE *cs, const char *control) control=end+1; end= DbugStrTok(control); } - if (!org_cs_locked) - { - pthread_mutex_unlock(&THR_LOCK_dbug); - cs->locked= 0; - } return !rel || f_used; } @@ -1093,7 +1092,6 @@ int _db_explain_init_(char *buf, size_t len) void _db_enter_(const char *_func_, const char *_file_, uint _line_, struct _db_stack_frame_ *_stack_frame_) { - int save_errno; CODE_STATE *cs; if (!((cs=code_state()))) { @@ -1101,7 +1099,6 @@ void _db_enter_(const char *_func_, const char *_file_, _stack_frame_->prev= 0; return; } - save_errno= errno; _stack_frame_->line= -1; _stack_frame_->func= cs->func; @@ -1122,12 +1119,14 @@ void _db_enter_(const char *_func_, const char *_file_, cs->stack->flags &= ~SANITY_CHECK_ON; if (TRACING) { - if (!cs->locked) - pthread_mutex_lock(&THR_LOCK_dbug); + int save_errno= errno; + LockMutex(cs); DoPrefix(cs, _line_); Indent(cs, cs->level); (void) fprintf(cs->stack->out_file->file, ">%s\n", cs->func); - DbugFlush(cs); /* This does a unlock */ + UnlockMutex(cs); + DbugFlush(cs); + errno=save_errno; } break; case DISABLE_TRACE: @@ -1136,7 +1135,6 @@ void _db_enter_(const char *_func_, const char *_file_, case DONT_TRACE: break; } - errno=save_errno; } /* @@ -1161,7 +1159,6 @@ void _db_enter_(const char *_func_, const char *_file_, void _db_return_(struct _db_stack_frame_ *_stack_frame_) { - int save_errno=errno; uint _slevel_= _stack_frame_->level & ~TRACE_ON; CODE_STATE *cs; get_code_state_or_return; @@ -1182,12 +1179,14 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_) cs->stack->flags &= ~SANITY_CHECK_ON; if (TRACING) { - if (!cs->locked) - pthread_mutex_lock(&THR_LOCK_dbug); + int save_errno=errno; + LockMutex(cs); DoPrefix(cs, _stack_frame_->line); Indent(cs, cs->level); (void) fprintf(cs->stack->out_file->file, "<%s\n", cs->func); + UnlockMutex(cs); DbugFlush(cs); + errno=save_errno; } } /* @@ -1199,7 +1198,6 @@ void _db_return_(struct _db_stack_frame_ *_stack_frame_) cs->file= _stack_frame_->file; if (cs->framep != NULL) cs->framep= cs->framep->prev; - errno=save_errno; } @@ -1264,27 +1262,24 @@ void _db_doprnt_(const char *format,...) CODE_STATE *cs; get_code_state_or_return; - va_start(args,format); - if (!cs->locked) - pthread_mutex_lock(&THR_LOCK_dbug); if (_db_keyword_(cs, cs->u_keyword, 0)) { int save_errno=errno; + LockMutex(cs); DoPrefix(cs, cs->u_line); if (TRACING) Indent(cs, cs->level + 1); else (void) fprintf(cs->stack->out_file->file, "%s: ", cs->func); (void) fprintf(cs->stack->out_file->file, "%s: ", cs->u_keyword); + va_start(args,format); DbugVfprintf(cs->stack->out_file->file, format, args); + UnlockMutex(cs); + va_end(args); DbugFlush(cs); errno=save_errno; } - else if (!cs->locked) - pthread_mutex_unlock(&THR_LOCK_dbug); - - va_end(args); } /* @@ -1325,10 +1320,9 @@ void _db_dump_(uint _line_, const char *keyword, CODE_STATE *cs; get_code_state_or_return; - if (!cs->locked) - pthread_mutex_lock(&THR_LOCK_dbug); if (_db_keyword_(cs, keyword, 0)) { + LockMutex(cs); DoPrefix(cs, _line_); if (TRACING) { @@ -1356,10 +1350,9 @@ void _db_dump_(uint _line_, const char *keyword, fputc(' ',cs->stack->out_file->file); } (void) fputc('\n',cs->stack->out_file->file); + UnlockMutex(cs); DbugFlush(cs); } - else if (!cs->locked) - pthread_mutex_unlock(&THR_LOCK_dbug); } @@ -1938,16 +1931,16 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value) sFILE *fp; if (!cs || !cs->stack || !cs->stack->out_file) return; - if (!cs->locked) - pthread_mutex_lock(&THR_LOCK_dbug); fp= cs->stack->out_file; if (--fp->used == 0) { if (fclose(fp->file) == EOF) { + LockMutex(cs); (void) fprintf(stderr, ERR_CLOSE, cs->process); perror(""); + UnlockMutex(cs); } else { @@ -1955,8 +1948,6 @@ static void DBUGCloseFile(CODE_STATE *cs, sFILE *new_value) } } cs->stack->out_file= new_value; - if (!cs->locked) - pthread_mutex_unlock(&THR_LOCK_dbug); } @@ -2128,8 +2119,6 @@ static void DbugFlush(CODE_STATE *cs) if (cs->stack->delay) (void) Delay(cs->stack->delay); } - if (!cs->locked) - pthread_mutex_unlock(&THR_LOCK_dbug); } /* DbugFlush */ From d30e51fafb8da04063b6b172c6fbe46ab59afd3e Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 11 Nov 2019 15:47:42 +0300 Subject: [PATCH 10/59] cleanup Linux AIO Replace all io_context* occurrences with io_context_t Even in release mode die immediately when some io_* functions return EINVAL. This always means some programming bug and it's better to fail fast. LinuxAIOHandler::resubmit(): fix condition. Stop ignoring -1 return code which corresponds to EPERM and io_submit() really can return this one. Use io_destroy() to stop leaking io_context_t. Make m_aio_ctx std::vector instead of C array. I think that internal check for index overflow might be useful. Add debug assertions for EFAULT because for me receiving it looks like a programming bug. --- storage/innobase/os/os0file.cc | 83 +++++++++++++++++++++------------- 1 file changed, 52 insertions(+), 31 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index fc411dad564..ee9f0378cb6 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -413,7 +413,7 @@ public: /** Accessor for the AIO context @param[in] segment Segment for which to get the context @return the AIO context for the segment */ - io_context* io_ctx(ulint segment) + io_context_t io_ctx(ulint segment) MY_ATTRIBUTE((warn_unused_result)) { ut_ad(segment < get_n_segments()); @@ -421,7 +421,7 @@ public: return(m_aio_ctx[segment]); } - /** Creates an io_context for native linux AIO. + /** Creates an io_context_t for native linux AIO. @param[in] max_events number of events @param[out] io_ctx io_ctx to initialize. @return true on success. */ @@ -622,7 +622,7 @@ private: /** completion queue for IO. There is one such queue per segment. Each thread will work on one ctx exclusively. */ - io_context_t* m_aio_ctx; + std::vector m_aio_ctx; /** The array to collect completed IOs. There is one such event for each possible pending IO. The size of the array @@ -1794,8 +1794,9 @@ LinuxAIOHandler::resubmit(Slot* slot) /* Resubmit an I/O request */ int ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb); + ut_a(ret != -EINVAL); - if (ret < -1) { + if (ret < 0) { errno = -ret; } @@ -1896,8 +1897,8 @@ LinuxAIOHandler::collect() ut_ad(m_array != NULL); ut_ad(m_segment < m_array->get_n_segments()); - /* Which io_context we are going to use. */ - io_context* io_ctx = m_array->io_ctx(m_segment); + /* Which io_context_t we are going to use. */ + io_context_t io_ctx = m_array->io_ctx(m_segment); /* Starting point of the m_segment we will be working on. */ ulint start_pos = m_segment * m_n_slots; @@ -1924,6 +1925,8 @@ LinuxAIOHandler::collect() int ret; ret = io_getevents(io_ctx, 1, m_n_slots, events, &timeout); + ut_a(ret != -EINVAL); + ut_ad(ret != -EFAULT); for (int i = 0; i < ret; ++i) { @@ -2150,14 +2153,15 @@ AIO::linux_dispatch(Slot* slot) /* Find out what we are going to work with. The iocb struct is directly in the slot. - The io_context is one per segment. */ + The io_context_t is one per segment. */ ulint io_ctx_index; struct iocb* iocb = &slot->control; io_ctx_index = (slot->pos * m_n_segments) / m_slots.size(); - int ret = io_submit(m_aio_ctx[io_ctx_index], 1, &iocb); + int ret = io_submit(io_ctx(io_ctx_index), 1, &iocb); + ut_a(ret != -EINVAL); /* io_submit() returns number of successfully queued requests or -errno. */ @@ -2169,7 +2173,7 @@ AIO::linux_dispatch(Slot* slot) return(ret == 1); } -/** Creates an io_context for native linux AIO. +/** Creates an io_context_t for native linux AIO. @param[in] max_events number of events @param[out] io_ctx io_ctx to initialize. @return true on success. */ @@ -2188,6 +2192,7 @@ AIO::linux_create_io_ctx( IO requests this context will handle. */ int ret = io_setup(max_events, io_ctx); + ut_a(ret != -EINVAL); if (ret == 0) { /* Success. Return now. */ @@ -2282,6 +2287,10 @@ AIO::is_linux_native_aio_supported() << "Unable to create temp file to check" " native AIO support."; + int ret = io_destroy(io_ctx); + ut_a(ret != -EINVAL); + ut_ad(ret != -EFAULT); + return(false); } } else { @@ -2311,6 +2320,10 @@ AIO::is_linux_native_aio_supported() << " \"" << name << "\" to check native" << " AIO read support."; + int ret = io_destroy(io_ctx); + ut_a(ret != EINVAL); + ut_ad(ret != EFAULT); + return(false); } } @@ -2340,10 +2353,12 @@ AIO::is_linux_native_aio_supported() } int err = io_submit(io_ctx, 1, &p_iocb); + ut_a(err != -EINVAL); if (err >= 1) { /* Now collect the submitted IO request. */ err = io_getevents(io_ctx, 1, 1, &io_event, NULL); + ut_a(err != -EINVAL); } ut_free(buf); @@ -2351,7 +2366,13 @@ AIO::is_linux_native_aio_supported() switch (err) { case 1: - return(true); + { + int ret = io_destroy(io_ctx); + ut_a(ret != -EINVAL); + ut_ad(ret != -EFAULT); + + return(true); + } case -EINVAL: case -ENOSYS: @@ -2371,6 +2392,10 @@ AIO::is_linux_native_aio_supported() << "returned error[" << -err << "]"; } + int ret = io_destroy(io_ctx); + ut_a(ret != -EINVAL); + ut_ad(ret != -EFAULT); + return(false); } @@ -5779,8 +5804,7 @@ AIO::AIO( m_n_segments(segments), m_n_reserved() # ifdef LINUX_NATIVE_AIO - ,m_aio_ctx(), - m_events(m_slots.size()) + ,m_events(m_slots.size()) # endif /* LINUX_NATIVE_AIO */ #ifdef WIN_ASYNC_IO ,m_completion_port(new_completion_port()) @@ -5836,24 +5860,16 @@ AIO::init_slots() dberr_t AIO::init_linux_native_aio() { - /* Initialize the io_context array. One io_context + + /* Initialize the io_context_t array. One io_context_t per segment in the array. */ + m_aio_ctx.resize(get_n_segments()); - ut_a(m_aio_ctx == NULL); - - m_aio_ctx = static_cast( - ut_zalloc_nokey(m_n_segments * sizeof(*m_aio_ctx))); - - if (m_aio_ctx == NULL) { - return(DB_OUT_OF_MEMORY); - } - - io_context** ctx = m_aio_ctx; ulint max_events = slots_per_segment(); - for (ulint i = 0; i < m_n_segments; ++i, ++ctx) { + for (ulint i = 0; i < m_aio_ctx.size(); ++i) { - if (!linux_create_io_ctx(max_events, ctx)) { + if (!linux_create_io_ctx(max_events, &m_aio_ctx[i])) { /* If something bad happened during aio setup we disable linux native aio. The disadvantage will be a small memory leak @@ -5870,8 +5886,13 @@ AIO::init_linux_native_aio() << "try increasing system " << "fs.aio-max-nr to 1048576 or larger or " << "setting innodb_use_native_aio = 0 in my.cnf"; - ut_free(m_aio_ctx); - m_aio_ctx = 0; + + for (ulint j = 0; j < i; j++) { + int ret = io_destroy(m_aio_ctx[i]); + ut_a(ret != -EINVAL); + } + + m_aio_ctx.clear(); srv_use_native_aio = FALSE; return(DB_SUCCESS); } @@ -5947,15 +5968,15 @@ AIO::~AIO() #if defined(LINUX_NATIVE_AIO) if (srv_use_native_aio) { - m_events.clear(); - ut_free(m_aio_ctx); + for (ulint i = 0; i < m_aio_ctx.size(); i++) { + int ret = io_destroy(m_aio_ctx[i]); + ut_a(ret != -EINVAL); + } } #endif /* LINUX_NATIVE_AIO */ #if defined(WIN_ASYNC_IO) CloseHandle(m_completion_port); #endif - - m_slots.clear(); } /** Initializes the asynchronous io system. Creates one array each for ibuf From 7a9eca1191c315b6009e4356d96bd3c4b9fa2415 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 18:33:52 +0100 Subject: [PATCH 11/59] Fix compile error (imcomplete switch) in ha_connect.cc --- storage/connect/ha_connect.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 2bc9537f81b..79175724158 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -1045,6 +1045,8 @@ TABTYPE ha_connect::GetRealType(PTOS pos) case TAB_REST: type = TAB_NIY; break; + default: + break; } // endswitch type #endif // REST_SUPPORT @@ -5634,6 +5636,8 @@ static int connect_assisted_discovery(handlerton *, THD* thd, case TAB_CSV: ttp = TAB_REST; break; + default: + break; } // endswitch type #endif // REST_SUPPORT } // endif ttp From 420789512fd0f90b150e5ccb61d127e6c80d712a Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 19:38:17 +0100 Subject: [PATCH 12/59] Fix compile error (missing declaration) in tabrest.cpp --- storage/connect/tabrest.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index de8383a838d..d070368cfd2 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -36,11 +36,6 @@ #include "tabfmt.h" #include "tabrest.h" -/***********************************************************************/ -/* Get the file from the Web. */ -/***********************************************************************/ -int restGetFile(char *m, bool x, PCSZ http, PCSZ uri, PCSZ fn); - #if defined(__WIN__) static PCSZ slash = "\\"; #else // !__WIN__ @@ -51,6 +46,11 @@ static PCSZ slash = "/"; typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ); static XGETREST getRestFnc = NULL; +/***********************************************************************/ +/* Some stupid compilers need these. */ +/***********************************************************************/ +XGETREST GetRestFunction(PGLOBAL g); +int restGetFile(char* m, bool x, PCSZ http, PCSZ uri, PCSZ fn); #if !defined(MARIADB) /***********************************************************************/ From b4bfa12b0044f7e4659e919784a6ed2252ca21b8 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 20:12:06 +0100 Subject: [PATCH 13/59] Fix compile error (missing declaration) in tabrest.cpp --- storage/connect/tabrest.cpp | 14 -------------- storage/connect/tabrest.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index d070368cfd2..fe81c0a65be 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -36,22 +36,8 @@ #include "tabfmt.h" #include "tabrest.h" -#if defined(__WIN__) -static PCSZ slash = "\\"; -#else // !__WIN__ -static PCSZ slash = "/"; -#define stricmp strcasecmp -#endif // !__WIN__ - -typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ); static XGETREST getRestFnc = NULL; -/***********************************************************************/ -/* Some stupid compilers need these. */ -/***********************************************************************/ -XGETREST GetRestFunction(PGLOBAL g); -int restGetFile(char* m, bool x, PCSZ http, PCSZ uri, PCSZ fn); - #if !defined(MARIADB) /***********************************************************************/ /* DB static variables. */ diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h index 1725f256079..d945c97e5f1 100644 --- a/storage/connect/tabrest.h +++ b/storage/connect/tabrest.h @@ -5,6 +5,25 @@ /***********************************************************************/ #pragma once +#if defined(__WIN__) +static PCSZ slash = "\\"; +#else // !__WIN__ +static PCSZ slash = "/"; +#define stricmp strcasecmp +#endif // !__WIN__ + +typedef int(__stdcall* XGETREST) (char*, bool, PCSZ, PCSZ, PCSZ); + +/***********************************************************************/ +/* Functions used by REST. */ +/***********************************************************************/ +XGETREST GetRestFunction(PGLOBAL g); +int restGetFile(char* m, bool x, PCSZ http, PCSZ uri, PCSZ fn); +#if defined(MARIADB) +PQRYRES RESTColumns(PGLOBAL g, PTOS tp, char* tab, char* db, bool info); +#endif // !MARIADB + + /***********************************************************************/ /* Restest table. */ /***********************************************************************/ From d8ace23d260033fc6588599e0a03e2832d20dae9 Mon Sep 17 00:00:00 2001 From: Hashir Sarwar Date: Wed, 23 Oct 2019 17:40:24 +0500 Subject: [PATCH 14/59] Fixed some typos in mysql.cc Closes #1403 --- client/mysql.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/client/mysql.cc b/client/mysql.cc index 50d45696a5c..c872968b78d 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3177,7 +3177,7 @@ static int com_go(String *buffer,char *line __attribute__((unused))) { char buff[200]; /* about 110 chars used so far */ - char time_buff[52+3+1]; /* time max + space&parens + NUL */ + char time_buff[52+3+1]; /* time max + space & parens + NUL */ MYSQL_RES *result; ulong timer, warnings= 0; uint error= 0; @@ -3196,7 +3196,7 @@ com_go(String *buffer,char *line __attribute__((unused))) if (buffer->is_empty()) { - if (status.batch) // Ignore empty quries + if (status.batch) // Ignore empty queries. return 0; return put_info("No query specified\n",INFO_ERROR); @@ -3261,7 +3261,7 @@ com_go(String *buffer,char *line __attribute__((unused))) else time_buff[0]= '\0'; - /* Every branch must truncate buff . */ + /* Every branch must truncate buff. */ if (result) { if (!mysql_num_rows(result) && ! quick && !column_types_flag) From fb91774e4e6451298af51e31356a8b8fb1b19487 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sun, 24 Nov 2019 22:58:55 +0100 Subject: [PATCH 15/59] These changed were made after pulling 10.2.30 from origin --------------------------------------------------------- - Temporarily fix MDEV-13782 by commenting out LIKE_FUNC in CondFilter modified: storage/connect/ha_connect.cc - Remove use of hack tables modified: storage/connect/connect.cc modified: storage/connect/connect.h modified: storage/connect/ha_connect.cc modified: storage/connect/xtable.h --- storage/connect/connect.cc | 64 +++++++++++++++++------------------ storage/connect/connect.h | 2 ++ storage/connect/ha_connect.cc | 14 ++++---- storage/connect/xtable.h | 5 ++- 4 files changed, 44 insertions(+), 41 deletions(-) diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 461391d2896..dfc619cf4af 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -566,7 +566,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) rc = tdbp->DeleteDB(g, RC_EF); // Specific A.M. delete routine } else if (tdbp->GetMode() == MODE_UPDATE && tdbp->IsIndexed()) - rc = ((PTDBDOX)tdbp)->Txfp->UpdateSortedRows(g); + rc = ((PTDBDOS)tdbp)->GetTxfp()->UpdateSortedRows(g); switch (rc) { case RC_FX: @@ -593,7 +593,7 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) if (!tdbp->IsRemote()) { // Make all the eventual indexes - PTDBDOX tbxp = (PTDBDOX)tdbp; + PTDBDOS tbxp = (PTDBDOS)tdbp; tbxp->ResetKindex(g, NULL); tbxp->SetKey_Col(NULL); rc = tbxp->ResetTableOpt(g, true, tbxp->GetDef()->Indexable() == 1); @@ -622,8 +622,8 @@ int CntCloseTable(PGLOBAL g, PTDB tdbp, bool nox, bool abort) int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) { PIXDEF xdp; - PTDBDOX tdbp; - DOXDEF *dfp; + PTDBDOS tdbp; + DOSDEF *dfp; if (!ptdb) return -1; @@ -633,9 +633,9 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) } else if (ptdb->GetDef()->Indexable() == 3) { return 1; } else - tdbp= (PTDBDOX)ptdb; + tdbp= (PTDBDOS)ptdb; - dfp= (DOXDEF*)tdbp->To_Def; + dfp= (DOSDEF*)tdbp->GetDef(); //if (!(k= colp->GetKey())) // if (colp->GetOpt() >= 2) { @@ -645,16 +645,16 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) // This is a pseudo indexed sorted block optimized column // return 0; - if (tdbp->To_Kindex) - if (((XXBASE*)tdbp->To_Kindex)->GetID() == id) { - tdbp->To_Kindex->Reset(); // Same index - return (tdbp->To_Kindex->IsMul()) ? 2 : 1; + if (tdbp->GetKindex()) + if (((XXBASE*)tdbp->GetKindex())->GetID() == id) { + tdbp->GetKindex()->Reset(); // Same index + return (tdbp->GetKindex()->IsMul()) ? 2 : 1; } else { - tdbp->To_Kindex->Close(); - tdbp->To_Kindex= NULL; + tdbp->GetKindex()->Close(); + tdbp->SetKindex(NULL); } // endif colp - for (xdp= dfp->To_Indx; xdp; xdp= xdp->GetNext()) + for (xdp= dfp->GetIndx(); xdp; xdp= xdp->GetNext()) if (xdp->GetID() == id) break; @@ -676,7 +676,7 @@ int CntIndexInit(PGLOBAL g, PTDB ptdb, int id, bool sorted) if (tdbp->InitialyzeIndex(g, xdp, sorted)) return 0; - return (tdbp->To_Kindex->IsMul()) ? 2 : 1; + return (tdbp->GetKindex()->IsMul()) ? 2 : 1; } // end of CntIndexInit #if defined(WORDS_BIGENDIAN) @@ -710,7 +710,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, int n, x; RCODE rc; XXBASE *xbp; - PTDBDOX tdbp; + PTDBDOS tdbp; if (!ptdb) return RC_FX; @@ -736,12 +736,12 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, goto rnd; } else - tdbp= (PTDBDOX)ptdb; + tdbp= (PTDBDOS)ptdb; // Set reference values and index operator - if (!tdbp->To_Link || !tdbp->To_Kindex) { + if (!tdbp->GetLink() || !tdbp->GetKindex()) { // if (!tdbp->To_Xdp) { - sprintf(g->Message, "Index not initialized for table %s", tdbp->Name); + sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName()); return RC_FX; #if 0 } // endif !To_Xdp @@ -754,7 +754,7 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, #endif // 0 } // endif !To_Kindex - xbp= (XXBASE*)tdbp->To_Kindex; + xbp= (XXBASE*)tdbp->GetKindex(); if (kr) { char *kp= (char*)kr->key; @@ -764,13 +764,13 @@ RCODE CntIndexRead(PGLOBAL g, PTDB ptdb, OPVAL op, PVAL valp; PCOL colp; - for (n= 0; n < tdbp->Knum; n++) { - colp= (PCOL)tdbp->To_Key_Col[n]; + for (n= 0; n < tdbp->GetKnum(); n++) { + colp= (PCOL)tdbp->Key(n); if (colp->GetColUse(U_NULLS)) kp++; // Skip null byte - valp= tdbp->To_Link[n]->GetValue(); + valp= tdbp->Link(n)->GetValue(); if (!valp->IsTypeNum()) { if (colp->GetColUse(U_VAR)) { @@ -840,7 +840,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, bool b, rcb; PVAL valp; PCOL colp; - PTDBDOX tdbp; + PTDBDOS tdbp; XXBASE *xbp; if (!ptdb) @@ -865,35 +865,35 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, return k[1] - k[0] + 1; } else - tdbp= (PTDBDOX)ptdb; + tdbp= (PTDBDOS)ptdb; - if (!tdbp->To_Kindex || !tdbp->To_Link) { - if (!tdbp->To_Xdp) { - sprintf(g->Message, "Index not initialized for table %s", tdbp->Name); + if (!tdbp->GetKindex() || !tdbp->GetLink()) { + if (!tdbp->GetXdp()) { + sprintf(g->Message, "Index not initialized for table %s", tdbp->GetName()); DBUG_PRINT("Range", ("%s", g->Message)); return -1; } else // Dynamic index - return tdbp->To_Xdp->GetMaxSame(); // TODO a better estimate + return tdbp->GetXdp()->GetMaxSame(); // TODO a better estimate } else - xbp= (XXBASE*)tdbp->To_Kindex; + xbp= (XXBASE*)tdbp->GetKindex(); for (b= false, i= 0; i < 2; i++) { p= kp= key[i]; if (kp) { - for (n= 0; n < tdbp->Knum; n++) { + for (n= 0; n < tdbp->GetKnum(); n++) { if (kmap[i] & (key_part_map)(1 << n)) { if (b == true) // Cannot do indexing with missing intermediate key return -1; - colp= (PCOL)tdbp->To_Key_Col[n]; + colp= (PCOL)tdbp->Key(n); if (colp->GetColUse(U_NULLS)) p++; // Skip null byte ??? - valp= tdbp->To_Link[n]->GetValue(); + valp= tdbp->Link(n)->GetValue(); if (!valp->IsTypeNum()) { if (colp->GetColUse(U_VAR)) { diff --git a/storage/connect/connect.h b/storage/connect/connect.h index 3a60cd40160..d1fc2ea592f 100644 --- a/storage/connect/connect.h +++ b/storage/connect/connect.h @@ -46,6 +46,7 @@ int CntIndexRange(PGLOBAL g, PTDB ptdb, const uchar* *key, uint *len, bool *incl, key_part_map *kmap); PGLOBAL CntExit(PGLOBAL g); +#if 0 /***********************************************************************/ /* Definition of classes XKPDEF, DOXDEF, TDBDOX */ /* These classes purpose is chiefly to access protected items! */ @@ -76,3 +77,4 @@ class XKPDEF: public KPARTDEF { public: XKPDEF(const char *name, int n) : KPARTDEF((PSZ)name, n) {} }; // end of class XKPDEF +#endif // 0 diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 79175724158..91fef719ee7 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -2966,12 +2966,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) case Item_func::LE_FUNC: vop= OP_LE; break; case Item_func::GE_FUNC: vop= OP_GE; break; case Item_func::GT_FUNC: vop= OP_GT; break; -#if 0 - case Item_func::LIKE_FUNC: - vop= OP_LIKE; - neg= ((Item_func_like*)condf)->negated; - break; -#endif // 0 + //case Item_func::LIKE_FUNC: + // vop = OP_LIKE; + // neg= ((Item_func_like*)condf)->negated; + // break; case Item_func::ISNOTNULL_FUNC: neg= true; // fall through @@ -3789,9 +3787,9 @@ int ha_connect::index_init(uint idx, bool sorted) active_index= MAX_KEY; rc= HA_ERR_INTERNAL_ERROR; } else if (tdbp->GetKindex()) { - if (((PTDBDOX)tdbp)->To_Kindex->GetNum_K()) { + if (((PTDBDOS)tdbp)->GetKindex()->GetNum_K()) { if (tdbp->GetFtype() != RECFM_NAF) - ((PTDBDOX)tdbp)->GetTxfp()->ResetBuffer(g); + ((PTDBDOS)tdbp)->GetTxfp()->ResetBuffer(g); active_index= idx; // } else { // Void table diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index bc9265e0223..1b499e09047 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -173,9 +173,12 @@ class DllExport TDBASE : public TDB { inline void SetKindex(PKXBASE kxp) {To_Kindex = kxp;} // Properties - virtual PKXBASE GetKindex(void) {return To_Kindex;} + PKXBASE GetKindex(void) {return To_Kindex;} + PXOB *GetLink(void) {return To_Link;} + PIXDEF GetXdp(void) {return To_Xdp;} void ResetKindex(PGLOBAL g, PKXBASE kxp); PCOL Key(int i) {return (To_Key_Col) ? To_Key_Col[i] : NULL;} + PXOB Link(int i) { return (To_Link) ? To_Link[i] : NULL; } // Methods virtual bool IsUsingTemp(PGLOBAL) {return false;} From 3551cd32a8df667e1257ae5118873b5d1ef1b631 Mon Sep 17 00:00:00 2001 From: willhan <526786050@qq.com> Date: Tue, 16 Apr 2019 22:10:05 +0800 Subject: [PATCH 16/59] MDEV-17508 Fix bug for spider when using "not like" fix bug for spider where using "not like" (#890) test case: t1 is a spider engine table; CREATE TABLE `t1` ( `id` int(11) NOT NULL DEFAULT '0', `name` char(64) DEFAULT NULL, PRIMARY KEY (`id`) ) ENGINE=SPIDER query: "select * from t1 where name not like 'x%' " would dispatch "select xxx name name like 'x%' " to remote mysqld, is wrong --- sql/item_cmpfunc.h | 2 +- .../spider/r/pushdown_not_like.result | 63 ++++++++ .../spider/t/pushdown_not_like.test | 138 ++++++++++++++++++ storage/spider/spd_db_include.h | 2 + storage/spider/spd_db_mysql.cc | 16 +- 5 files changed, 219 insertions(+), 2 deletions(-) create mode 100644 storage/spider/mysql-test/spider/r/pushdown_not_like.result create mode 100644 storage/spider/mysql-test/spider/t/pushdown_not_like.test diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0a5abfe6273..613fb75bcd6 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1899,7 +1899,6 @@ class Item_func_like :public Item_bool_func2 bool escape_used_in_parsing; bool use_sampling; - bool negated; DTCollation cmp_collation; String cmp_value1, cmp_value2; @@ -1916,6 +1915,7 @@ protected: Item_func::Functype type, Item *value); public: int escape; + bool negated; Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used): Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), diff --git a/storage/spider/mysql-test/spider/r/pushdown_not_like.result b/storage/spider/mysql-test/spider/r/pushdown_not_like.result new file mode 100644 index 00000000000..cd926962180 --- /dev/null +++ b/storage/spider/mysql-test/spider/r/pushdown_not_like.result @@ -0,0 +1,63 @@ +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +drop and create databases +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +CREATE DATABASE auto_test_remote; +USE auto_test_remote; + +create table select test +connection master_1; +DROP TABLE IF EXISTS ta_l; +CREATE TABLE ta_l ( +a INT, +b CHAR(1), +c DATETIME, +PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1 +INSERT INTO ta_l (a, b, c) VALUES +(1, 'a', '2018-11-01 10:21:39'), +(2, 'b', '2015-06-30 23:59:59'), +(3, 'c', '2013-11-01 01:01:01'); + +spider not like bug fix test +connection master_1; +select * from ta_l where b not like 'a%'; +a b c +2 b 2015-06-30 23:59:59 +3 c 2013-11-01 01:01:01 +connection child2_1; +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%'; +argument +select `a`,`b`,`c` from `auto_test_remote`.`ta_r` where (`b` not like 'a%') +SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%' + +deinit +connection master_1; +DROP DATABASE IF EXISTS auto_test_local; +connection child2_1; +DROP DATABASE IF EXISTS auto_test_remote; +SET GLOBAL log_output = @old_log_output; +for master_1 +for child2 +child2_1 +child2_2 +child2_3 +for child3 +child3_1 +child3_2 +child3_3 + +end of test diff --git a/storage/spider/mysql-test/spider/t/pushdown_not_like.test b/storage/spider/mysql-test/spider/t/pushdown_not_like.test new file mode 100644 index 00000000000..95e4fa6eea8 --- /dev/null +++ b/storage/spider/mysql-test/spider/t/pushdown_not_like.test @@ -0,0 +1,138 @@ +--disable_warnings +--disable_query_log +--disable_result_log +--source test_init.inc +--enable_result_log +--enable_query_log + + +--echo +--echo drop and create databases +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +CREATE DATABASE auto_test_local; +USE auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + CREATE DATABASE auto_test_remote; + USE auto_test_remote; +} +--enable_warnings + + +--echo +--echo create table select test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($OUTPUT_CHILD_GROUP2) + { + --disable_query_log + echo CHILD2_1_DROP_TABLES; + echo CHILD2_1_CREATE_TABLES; + } + --disable_warnings + eval $CHILD2_1_DROP_TABLES; + --enable_warnings + eval $CHILD2_1_CREATE_TABLES; + if ($OUTPUT_CHILD_GROUP2) + { + --enable_query_log + } + if ($USE_GENERAL_LOG) + { + SET @old_log_output = @@global.log_output; + TRUNCATE TABLE mysql.general_log; + set global log_output = 'TABLE'; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +--disable_warnings +DROP TABLE IF EXISTS ta_l; +--enable_warnings +--disable_query_log +echo CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_2_1; +eval CREATE TABLE ta_l ( + a INT, + b CHAR(1), + c DATETIME, + PRIMARY KEY(a) +) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1; +--enable_query_log +INSERT INTO ta_l (a, b, c) VALUES + (1, 'a', '2018-11-01 10:21:39'), + (2, 'b', '2015-06-30 23:59:59'), + (3, 'c', '2013-11-01 01:01:01'); + +--echo +--echo spider not like bug fix test +if ($USE_CHILD_GROUP2) +{ + if (!$OUTPUT_CHILD_GROUP2) + { + --disable_query_log + --disable_result_log + } + --connection child2_1 + if ($USE_GENERAL_LOG) + { + TRUNCATE TABLE mysql.general_log; + } + if (!$OUTPUT_CHILD_GROUP2) + { + --enable_query_log + --enable_result_log + } +} + +--connection master_1 +select * from ta_l where b not like 'a%'; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + if ($USE_GENERAL_LOG) + { + SELECT argument FROM mysql.general_log WHERE argument LIKE '%select%'; + } +} + + +--echo +--echo deinit +--disable_warnings +--connection master_1 +DROP DATABASE IF EXISTS auto_test_local; +if ($USE_CHILD_GROUP2) +{ + --connection child2_1 + DROP DATABASE IF EXISTS auto_test_remote; + SET GLOBAL log_output = @old_log_output; +} + + +--disable_query_log +--disable_result_log +--source test_deinit.inc +--enable_result_log +--enable_query_log +--enable_warnings +--echo +--echo end of test diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 7db61d44e20..39e2c8650c4 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -139,6 +139,8 @@ typedef st_spider_result SPIDER_RESULT; #define SPIDER_SQL_IN_LEN (sizeof(SPIDER_SQL_IN_STR) - 1) #define SPIDER_SQL_NOT_IN_STR "not in(" #define SPIDER_SQL_NOT_IN_LEN (sizeof(SPIDER_SQL_NOT_IN_STR) - 1) +#define SPIDER_SQL_NOT_LIKE_STR "not like" +#define SPIDER_SQL_NOT_LIKE_LEN (sizeof(SPIDER_SQL_NOT_LIKE_STR) - 1) #define SPIDER_SQL_AS_CHAR_STR " as char" #define SPIDER_SQL_AS_CHAR_LEN (sizeof(SPIDER_SQL_AS_CHAR_STR) - 1) #define SPIDER_SQL_CAST_STR "cast(" diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc index 6f2960cb868..2be4c810c06 100644 --- a/storage/spider/spd_db_mysql.cc +++ b/storage/spider/spd_db_mysql.cc @@ -3948,13 +3948,27 @@ int spider_db_mysql_util::open_item_func( case Item_func::LE_FUNC: case Item_func::GE_FUNC: case Item_func::GT_FUNC: - case Item_func::LIKE_FUNC: if (str) { func_name = (char*) item_func->func_name(); func_name_length = strlen(func_name); } break; + case Item_func::LIKE_FUNC: + if (str) + { + if (((Item_func_like *)item_func)->negated) + { + func_name = SPIDER_SQL_NOT_LIKE_STR; + func_name_length = SPIDER_SQL_NOT_LIKE_LEN; + } + else + { + func_name = (char*)item_func->func_name(); + func_name_length = strlen(func_name); + } + } + break; default: THD *thd = spider->trx->thd; SPIDER_SHARE *share = spider->share; From 38839854b7c097b33f34b2228c4240fe837fda79 Mon Sep 17 00:00:00 2001 From: seppo Date: Tue, 26 Nov 2019 08:49:50 +0200 Subject: [PATCH 17/59] MDEV-19572 async slave node fails to apply MyISAM only writes (#1418) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The problem happens when MariaDB master replicates writes for only non InnoDB tables (e.g. writes to MyISAM table(s)). Async slave node, in Galera cluster, can apply these writes successfully, but it will, in the end, write gtid position in mysql.gtid_slave_pos table. mysql.gtid_slave_pos table is InnoDB engine, and this write makes innodb handlerton part of the replicated "transaction". Note that wsrep patch identifies that write to gtid_slave_pos should not be replicated and skips appending wsrep keys for these writes. However, as InnoDB was present in the transaction, and there are replication events (for MyISAM table) in transaction cache, but there are no appended keys, wsrep raises an error, and this makes the söave thread to stop. The fix is simply to not treat it as an error if async slave tries to replicate a write set with binlog events, but no keys. We just skip wsrep replication and return successfully. This commit contains also a mtr test which forces mysql.gtid_slave_pos table isto be of InnoDB engine, and executes MyISAM only write through asyn replication. There is additional fix for declaring IO and background slave threads as non wsrep. These threads should not write anything for wsrep replication, and this is just a safeguard to make sure nothing leaks into cluster from these slave threads. --- .../r/galera_as_slave_gtid_myisam.result | 21 ++++++ .../galera/t/galera_as_slave_gtid_myisam.cnf | 6 ++ .../galera/t/galera_as_slave_gtid_myisam.test | 65 +++++++++++++++++++ sql/slave.cc | 7 +- sql/wsrep_hton.cc | 19 +++++- 5 files changed, 116 insertions(+), 2 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result create mode 100644 mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf create mode 100644 mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result new file mode 100644 index 00000000000..d9a87571655 --- /dev/null +++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result @@ -0,0 +1,21 @@ +ALTER TABLE mysql.gtid_slave_pos engine = InnoDB; +START SLAVE; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1); +SELECT LENGTH(@@global.gtid_binlog_state) > 1; +LENGTH(@@global.gtid_binlog_state) > 1 +1 +gtid_binlog_state_equal +0 +SELECT COUNT(*) = 0 FROM t1; +COUNT(*) = 0 +1 +gtid_binlog_state_equal +0 +#cleanup +DROP TABLE t1; +reset master; +STOP SLAVE; +RESET SLAVE ALL; +reset master; +reset master; diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf new file mode 100644 index 00000000000..01d2eb12630 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.cnf @@ -0,0 +1,6 @@ +!include ../galera_2nodes_as_slave.cnf + +[mysqld] +log-bin=mysqld-bin +log-slave-updates +binlog-format=ROW diff --git a/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test new file mode 100644 index 00000000000..faa9ddfd5c8 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_as_slave_gtid_myisam.test @@ -0,0 +1,65 @@ +# +# Test Galera as a slave to a MariaDB master using GTIDs +# +# suite/galera/galera_2nodes_as_slave.cnf describes the setup of the nodes +# suite/galera/t/galera_as_slave_gtid.cnf has the GTID options +# +# This test will replicate writes to MyISAM table and check that slave node is able +# to apply them. +# mysql.gtid_slave_pos table should be defined as innodb engine, original problem +# by writes to mysql.gtid_slave_pos, whereas the replicated transaction contained +# no innodb writes +# + +--source include/have_innodb.inc + +# As node #1 is not a Galera node, we connect to node #2 in order to run include/galera_cluster.inc +--connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2 +--source include/galera_cluster.inc + +--connection node_2 +# make sure gtid_slave_pos is of innodb engine, mtr does not currently provide that +ALTER TABLE mysql.gtid_slave_pos engine = InnoDB; + +--disable_query_log +--eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_USER='root', MASTER_PORT=$NODE_MYPORT_1; +--enable_query_log +START SLAVE; + +--connection node_1 +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t1 VALUES(1); + +SELECT LENGTH(@@global.gtid_binlog_state) > 1; +--let $gtid_binlog_state_node1 = `SELECT @@global.gtid_binlog_state;` + +--connection node_2 +--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1'; +--source include/wait_condition.inc + +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1; +--source include/wait_condition.inc + +--disable_query_log +--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; +--enable_query_log + +--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +SELECT COUNT(*) = 0 FROM t1; + +--disable_query_log +--eval SELECT '$gtid_binlog_state_node1' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; +--enable_query_log + +--echo #cleanup +--connection node_1 +DROP TABLE t1; +reset master; + +--connection node_2 +STOP SLAVE; +RESET SLAVE ALL; +reset master; + +--connection node_3 +reset master; diff --git a/sql/slave.cc b/sql/slave.cc index bf8b8a43b15..c877a1e2c2c 100644 --- a/sql/slave.cc +++ b/sql/slave.cc @@ -306,6 +306,9 @@ handle_slave_background(void *arg __attribute__((unused))) thd->store_globals(); thd->security_ctx->skip_grants(); thd->set_command(COM_DAEMON); +#ifdef WITH_WSREP + thd->variables.wsrep_on= 0; +#endif thd_proc_info(thd, "Loading slave GTID position from table"); if (rpl_load_gtid_slave_state(thd)) @@ -4181,7 +4184,9 @@ pthread_handler_t handle_slave_io(void *arg) goto err; } - +#ifdef WITH_WSREP + thd->variables.wsrep_on= 0; +#endif if (RUN_HOOK(binlog_relay_io, thread_start, (thd, mi))) { mi->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR, NULL, diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc index 8665a8ae63f..d8f82b13108 100644 --- a/sql/wsrep_hton.cc +++ b/sql/wsrep_hton.cc @@ -478,12 +478,29 @@ wsrep_run_wsrep_commit(THD *thd, bool all) if (WSREP_UNDEFINED_TRX_ID == thd->wsrep_ws_handle.trx_id) { - WSREP_WARN("SQL statement was ineffective, THD: %lu, buf: %zu\n" + /* + Async replication slave may have applied some non-innodb workload, + and then has written replication "meta data" into gtid_slave_pos + innodb table. Writes to gtid_slave_pos must not be replicated, + but this activity has caused that innodb hton is registered for this + transaction, but no wsrep keys have been appended. + We enter in this code path, because IO cache has events for non-innodb + tables. + => we should not treat it an error if trx is not introduced for provider + */ + if (thd->system_thread == SYSTEM_THREAD_SLAVE_SQL) + { + WSREP_DEBUG("skipping wsrep replication for async slave, error not raised"); + DBUG_RETURN(WSREP_TRX_OK); + } + + WSREP_WARN("SQL statement was ineffective thd: %lu buf: %zu\n" "schema: %s \n" "QUERY: %s\n" " => Skipping replication", thd->thread_id, data_len, (thd->db ? thd->db : "(null)"), thd->query()); + rcode = WSREP_TRX_FAIL; } else if (!rcode) From 23664bc7a582f03d1ccb680faec8c65f456e0c72 Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Thu, 21 Nov 2019 10:34:36 -0500 Subject: [PATCH 18/59] Fix incorrect DBUG_ENTER message for join_read_last --- sql/sql_select.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 55d371bdbfd..ca53852fa91 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -19570,7 +19570,7 @@ join_read_last(JOIN_TAB *tab) { TABLE *table=tab->table; int error= 0; - DBUG_ENTER("join_read_first"); + DBUG_ENTER("join_read_last"); if (table->covering_keys.is_set(tab->index) && !table->no_keyread && !table->key_read) From ed2379f98399ee3ecd6147c6acddfa33e35a9879 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Mon, 25 Nov 2019 11:08:13 +0200 Subject: [PATCH 19/59] MDEV-13288: Upstream debian patch --- debian/control | 1 + 1 file changed, 1 insertion(+) diff --git a/debian/control b/debian/control index 71329a870c9..fc63c308f75 100644 --- a/debian/control +++ b/debian/control @@ -6,6 +6,7 @@ Uploaders: MariaDB Developers Build-Depends: bison, chrpath, cmake (>= 2.7), + cracklib-runtime, debhelper, dh-apparmor, dpatch, From a8395853ccf767aa22d6a7e0a2e79d0e6f890f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 26 Nov 2019 16:32:51 +0200 Subject: [PATCH 20/59] MDEV-21152 Bogus debug assertion btr_pcur_is_after_last_in_tree() in ibuf code As noted in commit abd45cdc38e72ce329365ffe0df4c6f8c319b407 a search with PAGE_CUR_GE may land on the supremum record on a leaf page that is not the rightmost leaf page. This could occur when all keys on the current page are smaller than the search key, and the smallest key on the successor page is larger than the search key. Hence, after a failed PAGE_CUR_GE search, assertions btr_pcur_is_after_last_in_tree() are bogus and should be replaced with btr_pcur_is_after_last_on_page(). --- storage/innobase/ibuf/ibuf0ibuf.cc | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 7bf00eaa7c8..c5768653154 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -4574,8 +4574,7 @@ loop: } if (!btr_pcur_is_on_user_rec(&pcur)) { - ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr)); - + ut_ad(btr_pcur_is_after_last_on_page(&pcur)); goto reset_bit; } @@ -4805,8 +4804,7 @@ loop: &pcur, &mtr); if (!btr_pcur_is_on_user_rec(&pcur)) { - ut_ad(btr_pcur_is_after_last_in_tree(&pcur, &mtr)); - + ut_ad(btr_pcur_is_after_last_on_page(&pcur)); goto leave_loop; } From 49ed1ae320856f4c2ad156283ff3b6138eeb21df Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 26 Nov 2019 22:57:55 +0700 Subject: [PATCH 21/59] fix double io_destroy() + cleanup --- storage/innobase/os/os0file.cc | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index ee9f0378cb6..210ee85798c 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -425,7 +425,7 @@ public: @param[in] max_events number of events @param[out] io_ctx io_ctx to initialize. @return true on success. */ - static bool linux_create_io_ctx(unsigned max_events, io_context_t* io_ctx) + static bool linux_create_io_ctx(unsigned max_events, io_context_t& io_ctx) MY_ATTRIBUTE((warn_unused_result)); /** Checks if the system supports native linux aio. On some kernel @@ -2180,18 +2180,18 @@ AIO::linux_dispatch(Slot* slot) bool AIO::linux_create_io_ctx( unsigned max_events, - io_context_t* io_ctx) + io_context_t& io_ctx) { ssize_t n_retries = 0; for (;;) { - memset(io_ctx, 0x0, sizeof(*io_ctx)); + memset(&io_ctx, 0x0, sizeof(io_ctx)); /* Initialize the io_ctx. Tell it how many pending IO requests this context will handle. */ - int ret = io_setup(max_events, io_ctx); + int ret = io_setup(max_events, &io_ctx); ut_a(ret != -EINVAL); if (ret == 0) { @@ -2271,7 +2271,7 @@ AIO::is_linux_native_aio_supported() io_context_t io_ctx; char name[1000]; - if (!linux_create_io_ctx(1, &io_ctx)) { + if (!linux_create_io_ctx(1, io_ctx)) { /* The platform does not support native aio. */ @@ -5867,14 +5867,13 @@ AIO::init_linux_native_aio() ulint max_events = slots_per_segment(); - for (ulint i = 0; i < m_aio_ctx.size(); ++i) { + for (std::vector::iterator it = m_aio_ctx.begin(), + end = m_aio_ctx.end(); + it != end; ++it) { - if (!linux_create_io_ctx(max_events, &m_aio_ctx[i])) { + if (!linux_create_io_ctx(max_events, *it)) { /* If something bad happened during aio setup we disable linux native aio. - The disadvantage will be a small memory leak - at shutdown but that's ok compared to a crash - or a not working server. This frequently happens when running the test suite with many threads on a system with low fs.aio-max-nr! */ @@ -5887,8 +5886,10 @@ AIO::init_linux_native_aio() << "fs.aio-max-nr to 1048576 or larger or " << "setting innodb_use_native_aio = 0 in my.cnf"; - for (ulint j = 0; j < i; j++) { - int ret = io_destroy(m_aio_ctx[i]); + for (std::vector::iterator it2 + = m_aio_ctx.begin(); + it2 != it; ++it2) { + int ret = io_destroy(*it2); ut_a(ret != -EINVAL); } From 427eedd0126de0d9562e843eac911380daa9853c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 26 Nov 2019 19:52:37 +0200 Subject: [PATCH 22/59] MDEV-13288: Proper fix for cracklib-runtime The required dependencies should be added through the autobake script, to also cover distributions that do not support libcrack2. --- debian/autobake-deb.sh | 2 +- debian/control | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 98071ba6d03..a617995724c 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -41,7 +41,7 @@ then MARIADB_OPTIONAL_DEBS="${MARIADB_OPTIONAL_DEBS} cracklib-password-check-10.1" sed -i -e "/\\\${MAYBE_LIBCRACK}/d" debian/control else - MAYBE_LIBCRACK='libcrack2-dev (>= 2.9.0),' + MAYBE_LIBCRACK='libcrack2-dev (>= 2.9.0), cracklib-runtime' sed -i -e "s/\\\${MAYBE_LIBCRACK}/${MAYBE_LIBCRACK}/g" debian/control fi diff --git a/debian/control b/debian/control index fc63c308f75..71329a870c9 100644 --- a/debian/control +++ b/debian/control @@ -6,7 +6,6 @@ Uploaders: MariaDB Developers Build-Depends: bison, chrpath, cmake (>= 2.7), - cracklib-runtime, debhelper, dh-apparmor, dpatch, From f0da39be7fff39f0ee47abe272e0ef96f229c7e3 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Tue, 26 Nov 2019 19:22:46 +0100 Subject: [PATCH 23/59] - Fix MDEV-13782 Problem with NOT LIKE queries. modified: storage/connect/ha_connect.cc modified: sql/item_cmpfunc.h - Fix MDEV-21084 Misusage of strncat could cause buffer overflow. modified: storage/connect/reldef.cpp modified: storage/connect/tabcmg.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/tabrest.cpp modified: storage/connect/tabxml.cpp --- sql/item_cmpfunc.h | 2 +- storage/connect/ha_connect.cc | 8 +++---- storage/connect/reldef.cpp | 3 ++- storage/connect/tabcmg.cpp | 23 ++++++++++++-------- storage/connect/tabjson.cpp | 40 ++++++++++++++++++++++------------- storage/connect/tabrest.cpp | 5 +++-- storage/connect/tabxml.cpp | 4 +++- 7 files changed, 52 insertions(+), 33 deletions(-) diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index 0a5abfe6273..b4a905896db 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -1899,7 +1899,6 @@ class Item_func_like :public Item_bool_func2 bool escape_used_in_parsing; bool use_sampling; - bool negated; DTCollation cmp_collation; String cmp_value1, cmp_value2; @@ -1916,6 +1915,7 @@ protected: Item_func::Functype type, Item *value); public: int escape; + bool negated; Item_func_like(THD *thd, Item *a, Item *b, Item *escape_arg, bool escape_used): Item_bool_func2(thd, a, b), canDoTurboBM(FALSE), pattern(0), pattern_len(0), diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 91fef719ee7..cc9e7d1b55c 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -2966,10 +2966,10 @@ PCFIL ha_connect::CheckCond(PGLOBAL g, PCFIL filp, const Item *cond) case Item_func::LE_FUNC: vop= OP_LE; break; case Item_func::GE_FUNC: vop= OP_GE; break; case Item_func::GT_FUNC: vop= OP_GT; break; - //case Item_func::LIKE_FUNC: - // vop = OP_LIKE; - // neg= ((Item_func_like*)condf)->negated; - // break; + case Item_func::LIKE_FUNC: + vop = OP_LIKE; + neg= ((Item_func_like*)condf)->negated; + break; case Item_func::ISNOTNULL_FUNC: neg= true; // fall through diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index 88c28757588..ffe5f77661d 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -624,7 +624,8 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) return NULL; } else // PlugSetPath(soname, Module, GetPluginDir()); // Crashes on Fedora - strncat(strcpy(soname, GetPluginDir()), Module, _MAX_PATH); + strncat(strcpy(soname, GetPluginDir()), Module, + sizeof(soname) - strlen(soname) - 1); #if defined(__WIN__) // Is the DLL already loaded? diff --git a/storage/connect/tabcmg.cpp b/storage/connect/tabcmg.cpp index da1cfd34ac7..b9b7f6e4b60 100644 --- a/storage/connect/tabcmg.cpp +++ b/storage/connect/tabcmg.cpp @@ -53,25 +53,30 @@ bool CMGDISC::FindInDoc(PGLOBAL g, bson_iter_t *iter, const bson_t *doc, { if (!doc || bson_iter_init(iter, doc)) { const char *key; - char colname[65]; - char fmt[129]; - bool newcol; + char colname[65]; + char fmt[129]; + bool newcol; + size_t n; while (bson_iter_next(iter)) { key = bson_iter_key(iter); newcol = true; if (pcn) { - strncpy(colname, pcn, 64); - colname[64] = 0; - strncat(strncat(colname, "_", 65), key, 65); + n = sizeof(colname) - 1; + strncpy(colname, pcn, n); + colname[n] = 0; + n -= strlen(colname); + strncat(strncat(colname, "_", n), key, n - 1); } else strcpy(colname, key); if (pfmt) { - strncpy(fmt, pfmt, 128); - fmt[128] = 0; - strncat(strncat(fmt, ".", 129), key, 129); + n = sizeof(fmt) - 1; + strncpy(fmt, pfmt, n); + fmt[n] = 0; + n -= strlen(fmt); + strncat(strncat(fmt, ".", n), key, n - 1); } else strcpy(fmt, key); diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 0b282345c8a..7e8d6c8d9f0 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -394,10 +394,11 @@ err: bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) { - char *p, *pc = colname + strlen(colname); - int ars; - PJOB job; - PJAR jar; + char *p, *pc = colname + strlen(colname); + int ars; + size_t n; + PJOB job; + PJAR jar; if ((valp = jvp ? jvp->GetValue() : NULL)) { jcol.Type = valp->GetType(); @@ -423,8 +424,10 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) PCSZ k = jrp->GetKey(); if (*k != '$') { - strncat(strncat(fmt, sep, 128), k, 128); - strncat(strncat(colname, "_", 64), k, 64); + n = sizeof(fmt) - strlen(fmt) -1; + strncat(strncat(fmt, sep, n), k, n - strlen(sep)); + n = sizeof(colname) - strlen(colname) - 1; + strncat(strncat(colname, "_", n), k, n - 1); } // endif Key if (Find(g, jrp->GetVal(), k, j + 1)) @@ -443,19 +446,26 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j) ars = MY_MIN(jar->GetSize(false), 1); for (int k = 0; k < ars; k++) { - if (!tdp->Xcol || stricmp(tdp->Xcol, key)) { + n = sizeof(fmt) - (strlen(fmt) + 1); + + if (!tdp->Xcol || stricmp(tdp->Xcol, key)) { sprintf(buf, "%d", k); - if (tdp->Uri) - strncat(strncat(fmt, sep, 128), buf, 128); - else - strncat(strncat(strncat(fmt, "[", 128), buf, 128), "]", 128); + if (tdp->Uri) { + strncat(strncat(fmt, sep, n), buf, n - strlen(sep)); + } else { + strncat(strncat(fmt, "[", n), buf, n - 1); + strncat(fmt, "]", n - (strlen(buf) + 1)); + } // endif uri - if (all) - strncat(strncat(colname, "_", 64), buf, 64); + if (all) { + n = sizeof(colname) - (strlen(colname) + 1); + strncat(strncat(colname, "_", n), buf, n - 1); + } // endif all - } else - strncat(fmt, (tdp->Uri ? sep : "[*]"), 128); + } else { + strncat(fmt, (tdp->Uri ? sep : "[*]"), n); + } if (Find(g, jar->GetValue(k), "", j)) return true; diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp index fe81c0a65be..f9acbc28ddc 100644 --- a/storage/connect/tabrest.cpp +++ b/storage/connect/tabrest.cpp @@ -162,7 +162,7 @@ PQRYRES __stdcall ColREST(PGLOBAL g, PTOS tp, char *tab, char *db, bool info) // We used the file name relative to recorded datapath strcat(strcat(strcat(strcpy(filename, "."), slash), db), slash); - strncat(filename, fn, _MAX_PATH); + strncat(filename, fn, _MAX_PATH - strlen(filename)); // Retrieve the file from the web and copy it locally if (http && grf(g->Message, trace(515), http, uri, filename)) { @@ -221,7 +221,8 @@ bool RESTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) // We used the file name relative to recorded datapath //PlugSetPath(filename, Fn, GetPath()); - strncat(strcpy(filename, GetPath()), Fn, _MAX_PATH); + strcpy(filename, GetPath()); + strncat(filename, Fn, _MAX_PATH - strlen(filename)); // Retrieve the file from the web and copy it locally rc = grf(g->Message, xt, Http, Uri, filename); diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index 19490d350e8..717090e9c5a 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -240,7 +240,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info) more: if (vp->atp) { - strncpy(colname, vp->atp->GetName(g), sizeof(colname)); + size_t z = sizeof(colname) - 1; + strncpy(colname, vp->atp->GetName(g), z); + colname[z] = 0; strncat(xcol->Name, colname, XLEN(xcol->Name)); switch (vp->atp->GetText(g, buf, sizeof(buf))) { From 6218bf1b416219aef37301f054136fcdcc404d45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= Date: Tue, 26 Nov 2019 21:48:22 +0200 Subject: [PATCH 24/59] cracklib-runtime needs a comma after to parse properly --- debian/autobake-deb.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index a617995724c..bfdba96e487 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -41,7 +41,7 @@ then MARIADB_OPTIONAL_DEBS="${MARIADB_OPTIONAL_DEBS} cracklib-password-check-10.1" sed -i -e "/\\\${MAYBE_LIBCRACK}/d" debian/control else - MAYBE_LIBCRACK='libcrack2-dev (>= 2.9.0), cracklib-runtime' + MAYBE_LIBCRACK='libcrack2-dev (>= 2.9.0), cracklib-runtime,' sed -i -e "s/\\\${MAYBE_LIBCRACK}/${MAYBE_LIBCRACK}/g" debian/control fi From 0e403db2c884b72bd0b5de404f38b6cef75ed58e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Nov 2019 09:23:00 +0400 Subject: [PATCH 25/59] MENT-237 Audit to show INSERT DELAYED for the executing user. Add notifications about the user and connection that actually did the DELAYED insert. --- .../suite/plugins/r/server_audit.result | 19 ++++- mysql-test/suite/plugins/t/server_audit.test | 20 +++++ sql/sql_insert.cc | 79 ++++++++++++++++++- 3 files changed, 112 insertions(+), 6 deletions(-) diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 4088b36d440..0d6d87c3b28 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -212,7 +212,21 @@ select 2; 2 2 drop table t1; +set global server_audit_events='table'; +set global server_audit_incl_users='user1'; +create user user1@localhost; +grant all on sa_db.* to user1@localhost; +connect cn1,localhost,user1,,sa_db; +connection cn1; +create table t1(id int) engine=myisam; +insert delayed into t1 values (1), (2); +connection default; +# Waiting until ALTER TABLE is blocked. +drop table t1; +disconnect cn1; +drop user user1@localhost; set global server_audit_logging= off; +set global server_audit_incl_users=''; set global server_audit_logging= on; set global server_audit_events=''; set global server_audit_query_log_limit= 15; @@ -250,7 +264,7 @@ server_audit_file_path server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 -server_audit_incl_users odin, root, dva, tri +server_audit_incl_users server_audit_logging ON server_audit_mode 1 server_audit_output_type file @@ -381,8 +395,9 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'SET PASSWORD FOR u1=',ID TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'CREATE USER u3 IDENTIFIED BY *****',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'drop user u1, u2, u3',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)',0 +TIME,HOSTNAME,user1,localhost,ID,ID,CREATE,sa_db,t1, +TIME,HOSTNAME,user1,localhost,ID,ID,WRITE,sa_db,t1, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0 -TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= on',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0 diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index f19c8f53b61..1f4d336a01f 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -136,7 +136,27 @@ select * from t1; select 2; drop table t1; +set global server_audit_events='table'; +set global server_audit_incl_users='user1'; + +create user user1@localhost; +grant all on sa_db.* to user1@localhost; + +connect (cn1,localhost,user1,,sa_db); +connection cn1; + +create table t1(id int) engine=myisam; +insert delayed into t1 values (1), (2); +connection default; +--echo # Waiting until ALTER TABLE is blocked. +let $wait_condition= SELECT COUNT(*) = 2 FROM t1; +--source include/wait_condition.inc +drop table t1; +disconnect cn1; +drop user user1@localhost; + set global server_audit_logging= off; +set global server_audit_incl_users=''; set global server_audit_logging= on; set global server_audit_events=''; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 550851bd215..9dca28ce48f 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2020,11 +2020,15 @@ public: ulong auto_increment_offset; LEX_STRING query; Time_zone *time_zone; + char *user, *host, *ip; + query_id_t query_id; + my_thread_id thread_id; delayed_row(LEX_STRING const query_arg, enum_duplicates dup_arg, bool ignore_arg, bool log_query_arg) : record(0), dup(dup_arg), ignore(ignore_arg), log_query(log_query_arg), - forced_insert_id(0), query(query_arg), time_zone(0) + forced_insert_id(0), query(query_arg), time_zone(0), + user(0), host(0), ip(0) {} ~delayed_row() { @@ -2072,6 +2076,26 @@ public: passed from connection thread to the handler thread. */ MDL_request grl_protection; + void set_default_user() + { + thd.security_ctx->user=(char*) delayed_user; + thd.security_ctx->host=(char*) my_localhost; + thd.security_ctx->ip= NULL; + thd.query_id= 0; + thd.thread_id= 0; + } + + void set_user_from_row(const delayed_row *r) + { + if (r) + { + thd.security_ctx->user= r->user; + thd.security_ctx->host= r->host; + thd.security_ctx->ip= r->ip; + thd.query_id= r->query_id; + thd.thread_id= r->thread_id; + } + } Delayed_insert(SELECT_LEX *current_select) :locks_in_memory(0), thd(next_thread_id()), @@ -2079,8 +2103,7 @@ public: status(0), retry(0), handler_thread_initialized(FALSE), group_count(0) { DBUG_ENTER("Delayed_insert constructor"); - thd.security_ctx->user=(char*) delayed_user; - thd.security_ctx->host=(char*) my_localhost; + set_default_user(); strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user); thd.current_tablenr=0; thd.set_command(COM_DELAYED_INSERT); @@ -2584,6 +2607,7 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, delayed_row *row= 0; Delayed_insert *di=thd->di; const Discrete_interval *forced_auto_inc; + size_t user_len, host_len, ip_len; DBUG_ENTER("write_delayed"); DBUG_PRINT("enter", ("query = '%s' length %lu", query.str, (ulong) query.length)); @@ -2617,11 +2641,45 @@ int write_delayed(THD *thd, TABLE *table, enum_duplicates duplic, goto err; } + user_len= host_len= ip_len= 0; + row->user= row->host= row->ip= NULL; + if (thd->security_ctx) + { + if (thd->security_ctx->user) + user_len= strlen(thd->security_ctx->user) + 1; + if (thd->security_ctx->host) + host_len= strlen(thd->security_ctx->host) + 1; + if (thd->security_ctx->ip) + ip_len= strlen(thd->security_ctx->ip) + 1; + } /* This can't be THREAD_SPECIFIC as it's freed in delayed thread */ - if (!(row->record= (char*) my_malloc(table->s->reclength, + if (!(row->record= (char*) my_malloc(table->s->reclength + + user_len + host_len + ip_len, MYF(MY_WME)))) goto err; memcpy(row->record, table->record[0], table->s->reclength); + + if (thd->security_ctx) + { + if (thd->security_ctx->user) + { + row->user= row->record + table->s->reclength; + memcpy(row->user, thd->security_ctx->user, user_len); + } + if (thd->security_ctx->host) + { + row->host= row->record + table->s->reclength + user_len; + memcpy(row->host, thd->security_ctx->host, host_len); + } + if (thd->security_ctx->ip) + { + row->ip= row->record + table->s->reclength + user_len + host_len; + memcpy(row->ip, thd->security_ctx->ip, ip_len); + } + } + row->query_id= thd->query_id; + row->thread_id= thd->thread_id; + row->start_time= thd->start_time; row->query_start_used= thd->query_start_used; row->start_time_sec_part= thd->start_time_sec_part; @@ -3021,6 +3079,7 @@ pthread_handler_t handle_delayed_insert(void *arg) if (di->tables_in_use && ! thd->lock && !thd->killed) { + di->set_user_from_row(di->rows.head()); /* Request for new delayed insert. Lock the table, but avoid to be blocked by a global read lock. @@ -3040,6 +3099,18 @@ pthread_handler_t handle_delayed_insert(void *arg) } if (di->stacked_inserts) { + delayed_row *row; + I_List_iterator it(di->rows); + while ((row= it++)) + { + if (di->thd.thread_id != row->thread_id) + { + di->set_user_from_row(row); + mysql_audit_external_lock(&di->thd, di->table->s, F_WRLCK); + } + } + di->set_default_user(); + if (di->handle_inserts()) { /* Some fatal error */ From bfa6db38cdbfcae5f7b59b3d7455407636d2740a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Nov 2019 09:31:47 +0400 Subject: [PATCH 26/59] MENT-510 Failing test(s): perfschema.threads_insert_delayed. The thread_id of the INSERT DELAYED thread should not be set to 0. --- mysql-test/suite/plugins/r/server_audit.result | 2 +- mysql-test/suite/plugins/t/server_audit.test | 2 +- sql/sql_insert.cc | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index 0d6d87c3b28..fcfa5dd2582 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -221,7 +221,7 @@ connection cn1; create table t1(id int) engine=myisam; insert delayed into t1 values (1), (2); connection default; -# Waiting until ALTER TABLE is blocked. +# Waiting until INSERT DELAYED thread does the insert. drop table t1; disconnect cn1; drop user user1@localhost; diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index 1f4d336a01f..abba7d2b74f 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -148,7 +148,7 @@ connection cn1; create table t1(id int) engine=myisam; insert delayed into t1 values (1), (2); connection default; ---echo # Waiting until ALTER TABLE is blocked. +--echo # Waiting until INSERT DELAYED thread does the insert. let $wait_condition= SELECT COUNT(*) = 2 FROM t1; --source include/wait_condition.inc drop table t1; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 9dca28ce48f..ec0ab9cb174 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2076,13 +2076,14 @@ public: passed from connection thread to the handler thread. */ MDL_request grl_protection; + my_thread_id orig_thread_id; void set_default_user() { thd.security_ctx->user=(char*) delayed_user; thd.security_ctx->host=(char*) my_localhost; thd.security_ctx->ip= NULL; thd.query_id= 0; - thd.thread_id= 0; + thd.thread_id= orig_thread_id; } void set_user_from_row(const delayed_row *r) From 2855edf9ee0344e596ff4b9ee70a23421ae60405 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 23 Nov 2019 23:26:35 +0700 Subject: [PATCH 27/59] try to fix data races in DBUG init_settings.keywords and it's pointee are shared data. Protect them with mutex too. --- dbug/dbug.c | 42 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 40 insertions(+), 2 deletions(-) diff --git a/dbug/dbug.c b/dbug/dbug.c index 78605983ccb..21f86ded0a5 100644 --- a/dbug/dbug.c +++ b/dbug/dbug.c @@ -320,6 +320,10 @@ static void DbugVfprintf(FILE *stream, const char* format, va_list args); */ #include +/* +** Protects writing to all file descriptors, init_settings.keywords +** pointer and it's pointee - a linked list with keywords. +*/ static pthread_mutex_t THR_LOCK_dbug; static void LockMutex(CODE_STATE *cs) @@ -332,6 +336,16 @@ static void UnlockMutex(CODE_STATE *cs) if (!cs->locked) pthread_mutex_unlock(&THR_LOCK_dbug); } +static void LockIfInitSettings(CODE_STATE *cs) +{ + if (cs->stack == &init_settings) + LockMutex(cs); +} +static void UnlockIfInitSettings(CODE_STATE *cs) +{ + if (cs->stack == &init_settings) + UnlockMutex(cs); +} static CODE_STATE *code_state(void) { @@ -476,7 +490,9 @@ static int DbugParse(CODE_STATE *cs, const char *control) stack->sub_level= 0; stack->out_file= sstderr; stack->functions= NULL; + LockIfInitSettings(cs); stack->keywords= NULL; + UnlockIfInitSettings(cs); stack->processes= NULL; } else if (!stack->out_file) @@ -492,7 +508,9 @@ static int DbugParse(CODE_STATE *cs, const char *control) { /* never share with the global parent - it can change under your feet */ stack->functions= ListCopy(init_settings.functions); + LockIfInitSettings(cs); stack->keywords= ListCopy(init_settings.keywords); + UnlockIfInitSettings(cs); stack->processes= ListCopy(init_settings.processes); } else @@ -516,21 +534,31 @@ static int DbugParse(CODE_STATE *cs, const char *control) case 'd': if (sign < 0 && control == end) { + LockIfInitSettings(cs); if (!is_shared(stack, keywords)) FreeList(stack->keywords); stack->keywords=NULL; + UnlockIfInitSettings(cs); stack->flags &= ~DEBUG_ON; break; } + LockIfInitSettings(cs); if (rel && is_shared(stack, keywords)) stack->keywords= ListCopy(stack->keywords); + UnlockIfInitSettings(cs); if (sign < 0) { if (DEBUGGING) + { + LockIfInitSettings(cs); stack->keywords= ListDel(stack->keywords, control, end); + UnlockIfInitSettings(cs); + } break; } + LockIfInitSettings(cs); stack->keywords= ListAdd(stack->keywords, control, end); + UnlockIfInitSettings(cs); stack->flags |= DEBUG_ON; break; case 'D': @@ -997,7 +1025,9 @@ int _db_explain_ (CODE_STATE *cs, char *buf, size_t len) get_code_state_if_not_set_or_return *buf=0; + LockIfInitSettings(cs); op_list_to_buf('d', cs->stack->keywords, DEBUGGING); + UnlockIfInitSettings(cs); op_int_to_buf ('D', cs->stack->delay, 0); op_list_to_buf('f', cs->stack->functions, cs->stack->functions); op_bool_to_buf('F', cs->stack->flags & FILE_ON); @@ -1578,8 +1608,10 @@ static void PushState(CODE_STATE *cs) static void FreeState(CODE_STATE *cs, int free_state) { struct settings *state= cs->stack; + LockIfInitSettings(cs); if (!is_shared(state, keywords)) FreeList(state->keywords); + UnlockIfInitSettings(cs); if (!is_shared(state, functions)) FreeList(state->functions); if (!is_shared(state, processes)) @@ -1702,10 +1734,16 @@ FILE *_db_fp_(void) BOOLEAN _db_keyword_(CODE_STATE *cs, const char *keyword, int strict) { int match= strict ? INCLUDE : INCLUDE|MATCHED; + BOOLEAN result = FALSE; get_code_state_if_not_set_or_return FALSE; - return (DEBUGGING && DoTrace(cs) & DO_TRACE && - InList(cs->stack->keywords, keyword, strict) & match); + if (!DEBUGGING || !(DoTrace(cs) & DO_TRACE)) + return FALSE; + + LockIfInitSettings(cs); + result= (InList(cs->stack->keywords, keyword, strict) & match) ? TRUE : FALSE; + UnlockIfInitSettings(cs); + return result; } /* From 32ce5301a973688f250b64049a0db099100028c1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 28 Nov 2019 22:50:46 +0100 Subject: [PATCH 28/59] Update libmariadb --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 980f2dbea65..f035fc5f7fd 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 980f2dbea6586091333057bb2994b18747466942 +Subproject commit f035fc5f7fda5ac01d557073ef219c7e8d65fe10 From bd11bd63ccbfa71dbd359314db6c4f116629a357 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Wed, 20 Nov 2019 21:27:30 +0300 Subject: [PATCH 29/59] MDEV-18310: Aria engine: Undo phase failed with "Got error 121 when executing undo undo_key_delete" upon startup on datadir restored from incremental backup aria_log* files were not copied on --prepare --incremental-dir step from incremental to destination backup directory. --- extra/mariabackup/backup_copy.cc | 31 +++++---- .../mariabackup/incremental_backup.result | 4 ++ .../suite/mariabackup/incremental_backup.test | 63 +++++++++++++++++-- 3 files changed, 83 insertions(+), 15 deletions(-) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 524177d7e33..6f9452ef76c 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -1669,6 +1669,9 @@ ibx_copy_incremental_over_full() } } + if (!(ret = backup_files_from_datadir(xtrabackup_incremental_dir))) + goto cleanup; + /* copy buffer pool dump */ if (innobase_buffer_pool_filename) { const char *src_name; @@ -2180,20 +2183,26 @@ static bool backup_files_from_datadir(const char *dir_path) if (info.type != OS_FILE_TYPE_FILE) continue; - const char *pname = strrchr(info.name, IF_WIN('\\', '/')); + const char *pname = strrchr(info.name, OS_PATH_SEPARATOR); if (!pname) pname = info.name; - /* Copy aria log files, and aws keys for encryption plugins.*/ - const char *prefixes[] = { "aria_log", "aws-kms-key" }; - for (size_t i = 0; i < array_elements(prefixes); i++) { - if (starts_with(pname, prefixes[i])) { - ret = copy_file(ds_data, info.name, info.name, 1); - if (!ret) { - break; - } - } - } + if (!starts_with(pname, "aws-kms-key") && + !starts_with(pname, "aria_log")) + /* For ES exchange the above line with the following code: + (!xtrabackup_prepare || !xtrabackup_incremental_dir || + !starts_with(pname, "aria_log"))) + */ + continue; + + if (xtrabackup_prepare && xtrabackup_incremental_dir && + file_exists(info.name)) + unlink(info.name); + + std::string full_path(dir_path); + full_path.append(1, OS_PATH_SEPARATOR).append(info.name); + if (!(ret = copy_file(ds_data, full_path.c_str() , info.name, 1))) + break; } os_file_closedir(dir); return ret; diff --git a/mysql-test/suite/mariabackup/incremental_backup.result b/mysql-test/suite/mariabackup/incremental_backup.result index cc7277bdde9..70cc2cf8c4a 100644 --- a/mysql-test/suite/mariabackup/incremental_backup.result +++ b/mysql-test/suite/mariabackup/incremental_backup.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: New log files created"); +CREATE TABLE t_aria(i INT) ENGINE ARIA; CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB; BEGIN; INSERT INTO t VALUES(2); @@ -11,11 +12,13 @@ INSERT INTO t VALUES(0); DELETE FROM t WHERE i=0; connection default; COMMIT; +# Generate enough aria log records to increase area log file size SELECT * FROM t; i 1 2 # Prepare full backup, apply incremental one +# Aria log file was updated during applying incremental backup disconnect con1; # Restore and check results # shutdown server @@ -27,3 +30,4 @@ i 1 2 DROP TABLE t; +DROP TABLE t_aria; diff --git a/mysql-test/suite/mariabackup/incremental_backup.test b/mysql-test/suite/mariabackup/incremental_backup.test index 8fbfa701999..3e877af1398 100644 --- a/mysql-test/suite/mariabackup/incremental_backup.test +++ b/mysql-test/suite/mariabackup/incremental_backup.test @@ -1,10 +1,12 @@ +--source include/have_aria.inc --source include/innodb_page_size.inc call mtr.add_suppression("InnoDB: New log files created"); -let $basedir=$MYSQLTEST_VARDIR/tmp/backup; -let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; +let basedir=$MYSQLTEST_VARDIR/tmp/backup; +let incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1; +CREATE TABLE t_aria(i INT) ENGINE ARIA; CREATE TABLE t(i INT PRIMARY KEY) ENGINE INNODB; BEGIN; INSERT INTO t VALUES(2); @@ -14,21 +16,73 @@ INSERT INTO t VALUES(1); echo # Create full backup , modify table, then create incremental/differential backup; --disable_result_log -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=10 --target-dir=$basedir; --enable_result_log BEGIN; INSERT INTO t VALUES(0); DELETE FROM t WHERE i=0; connection default; COMMIT; + +--echo # Generate enough aria log records to increase area log file size +--disable_query_log +--disable_result_log +INSERT INTO t_aria VALUES + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9), + (0), (1), (2), (3), (4), (5), (6), (7), (8), (9); +--let $i = 4 +while ($i) { +INSERT INTO t_aria SELECT * FROM seq_1_to_2000; +--dec $i +} +--enable_query_log +--enable_result_log + SELECT * FROM t; -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir; +# wf_incremental_init() allocates (page_size/4)*page_size bytes with mmap() +# in each data file copy thread, what can fail on 32-bit platforms if threads +# are too much, that's why don't set too big --parallel option value. +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --parallel=2 --ftwrl-wait-timeout=5 --ftwrl-wait-threshold=300 --ftwrl-wait-query-type=all --target-dir=$incremental_dir --incremental-basedir=$basedir; --disable_result_log echo # Prepare full backup, apply incremental one; exec $XTRABACKUP --prepare --target-dir=$basedir; exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ; +let perl_result_file=$MYSQLTEST_VARDIR/tmp/check_file_size_result.inc; + +--perl END_OF_FILE + use strict; + use warnings; + + my $dst_file = "$ENV{'basedir'}/aria_log.00000001"; + my $src_file = "$ENV{'incremental_dir'}/aria_log.00000001"; + my $out_file = $ENV{'perl_result_file'}; + + my $dst_size = -s $dst_file; + my $src_size = -s $src_file; + + open (my $output, '>', $out_file) or die $!; + if ($dst_size >= $src_size) { + print $output '--echo # Aria log file was updated during applying incremental backup'."\n"; + } + else { + print $output '--echo # Aria log file was NOT updated during applying incremental backup'."\n"; + } + close $output; +END_OF_FILE + +--source $perl_result_file +--remove_file $perl_result_file + disconnect con1; echo # Restore and check results; let $targetdir=$basedir; @@ -37,6 +91,7 @@ let $targetdir=$basedir; SELECT * FROM t; DROP TABLE t; +DROP TABLE t_aria; # Cleanup rmdir $basedir; From 866e5c250e27e32cd295d84988ffdf7ae64503b2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 11 Feb 2018 14:42:11 +1100 Subject: [PATCH 30/59] MDEV-15503: mtr fix --strace $glob_mysql_test_dir was the wrong directory for strace output as it was for in-tree builds only so failed for: * out of tree builds * --parallel; and * --mem strace output wasn't saved. strace-option never replaced existing arguments (so ammended documentation). strace-client didn't accept an argument as described. Replaced specification of client with this with 'stracer' to be consistent with --debugger option. For consistency with debugger options, --client-strace was added to execute the strace on the mysqltest. Example: Running one test $ ./mtr --strace --client-strace funcs_1.is_table_constraints Logging: ./mtr --strace --client-strace funcs_1.is_table_constraints vardir: /home/anel/mariadb/5.5/mysql-test/var Checking leftover processes... Removing old var directory... - WARNING: Using the 'mysql-test/var' symlink Creating var directory '/home/anel/mariadb/5.5/mysql-test/var'... Checking supported features... MariaDB Version 5.5.67-MariaDB-debug Installing system database... - SSL connections supported - binaries are debug compiled Collecting tests... ============================================================================== TEST RESULT TIME (ms) or COMMENT -------------------------------------------------------------------------- worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019 funcs_1.is_table_constraints [ pass ] 1270 -------------------------------------------------------------------------- The servers were restarted 0 times Spent 1.270 of 3 seconds executing testcases Completed: All 1 tests were successful $ find -L . -name \*strace -ls 653 56 -rw-r--r-- 1 anel anel 57147 Nov 29 15:08 ./var/log/mysqltest.strace 646 1768 -rw-r--r-- 1 anel anel 1809855 Nov 29 15:08 ./var/log/mysqld.1.strace Example: Running test in parallel $ mysql-test/mtr --strace --client-strace --mem --parallel=3 main.select Logging: /home/dan/software_projects/mariadb-server/mysql-test/mysql-test-run.pl --strace --client-strace --mem --parallel=3 main.select vardir: /home/dan/software_projects/build-mariadb-10.3/mysql-test/var Checking leftover processes... Removing old var directory... Creating var directory '/home/dan/software_projects/build-mariadb-10.3/mysql-test/var'... - symlinking 'var' to '/dev/shm/var_auto_0v2E' Checking supported features... MariaDB Version 5.5.67-MariaDB - SSL connections supported Collecting tests... Installing system database... ============================================================================== TEST WORKER RESULT TIME (ms) or COMMENT -------------------------------------------------------------------------- worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019 worker[3] - 'localhost:16040' was not free worker[2] Using MTR_BUILD_THREAD 301, with reserved ports 16020..16039 worker[3] Using MTR_BUILD_THREAD 303, with reserved ports 16060..16079 main.select w1 [ pass ] 7310 -------------------------------------------------------------------------- The servers were restarted 0 times Spent 7.310 of 11 seconds executing testcases Completed: All 1 tests were successful. $ find mysql-test/var/ -name \*strace -ls 5213766 1212 -rw-r--r-- 1 dan dan 1237817 May 20 16:47 mysql-test/var/1/log/mysqltest.strace 5214733 13016 -rw-r--r-- 1 dan dan 13328335 May 20 16:47 mysql-test/var/1/log/mysqld.1.strace $ mysql-test/mtr --strace --client-strace --strace-option='-e' --strace-option='trace=openat' --mem --parallel=3 main.select ... $ find mysql-test/var/ -name \*strace -ls 5220790 8 -rw-r--r-- 1 dan dan 6291 May 20 17:02 mysql-test/var/3/log/mysqltest.strace 5224140 308 -rw-r--r-- 1 dan dan 314356 May 20 17:02 mysql-test/var/3/log/mysqld.1.strace $ more mysql-test/var/3/mysqltest.strace 1692 openat(AT_FDCWD, "/home/dan/software_projects/mariadb-server/libmysql/.libs/tls/x86_64/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory) 1692 openat(AT_FDCWD, "/home/dan/software_projects/mariadb-server/libmysql/.libs/tls/x86_64/libpthread.so.0", O_RDONLY|O_CLOEXEC) = -1 ENOE NT (No such file or directory) Closes #600 --- mysql-test/mysql-test-run.pl | 48 ++++++++++++++++++++---------------- 1 file changed, 27 insertions(+), 21 deletions(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e3e9460f35a..8b9d91935bf 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -311,7 +311,8 @@ my $opt_valgrind_mysqltest= 0; my @default_valgrind_args= ("--show-reachable=yes"); my @valgrind_args; my $opt_strace= 0; -my $opt_strace_client; +my $opt_stracer; +my $opt_client_strace = 0; my @strace_args; my $opt_valgrind_path; my $valgrind_reports= 0; @@ -1156,9 +1157,10 @@ sub command_line_setup { 'debugger=s' => \$opt_debugger, 'boot-dbx' => \$opt_boot_dbx, 'client-debugger=s' => \$opt_client_debugger, - 'strace' => \$opt_strace, - 'strace-client' => \$opt_strace_client, - 'strace-option=s' => \@strace_args, + 'strace' => \$opt_strace, + 'strace-option=s' => \@strace_args, + 'client-strace' => \$opt_client_strace, + 'stracer=s' => \$opt_stracer, 'max-save-core=i' => \$opt_max_save_core, 'max-save-datadir=i' => \$opt_max_save_datadir, 'max-test-fail=i' => \$opt_max_test_fail, @@ -1750,7 +1752,7 @@ sub command_line_setup { join(" ", @valgrind_args), "\""); } - if (@strace_args) + if (@strace_args || $opt_stracer) { $opt_strace=1; } @@ -5840,14 +5842,6 @@ sub start_mysqltest ($) { mtr_add_arg($args, "--non-blocking-api"); } - if ( $opt_strace_client ) - { - $exe= $opt_strace_client || "strace"; - mtr_add_arg($args, "-o"); - mtr_add_arg($args, "%s/log/mysqltest.strace", $opt_vardir); - mtr_add_arg($args, "$exe_mysqltest"); - } - mtr_add_arg($args, "--timer-file=%s/log/timer", $opt_vardir); if ( $opt_compress ) @@ -5914,6 +5908,17 @@ sub start_mysqltest ($) { mtr_add_arg($args, "%s", $_) for @args_saved; } + # ---------------------------------------------------------------------- + # Prefix the strace options to the argument list. + # ---------------------------------------------------------------------- + if ( $opt_client_strace ) + { + my @args_saved = @$args; + mtr_init_args(\$args); + strace_arguments($args, \$exe, "mysqltest"); + mtr_add_arg($args, "%s", $_) for @args_saved; + } + if ($opt_force > 1) { mtr_add_arg($args, "--continue-on-error"); @@ -6252,16 +6257,17 @@ sub strace_arguments { my $args= shift; my $exe= shift; my $mysqld_name= shift; + my $output= sprintf("%s/log/%s.strace", $path_vardir_trace, $mysqld_name); mtr_add_arg($args, "-f"); - mtr_add_arg($args, "-o%s/var/log/%s.strace", $glob_mysql_test_dir, $mysqld_name); + mtr_add_arg($args, "-o%s", $output); - # Add strace options, can be overriden by user + # Add strace options mtr_add_arg($args, '%s', $_) for (@strace_args); mtr_add_arg($args, $$exe); - $$exe= "strace"; + $$exe= $opt_stracer || "strace"; if ($exe_libtool) { @@ -6520,11 +6526,11 @@ Options for valgrind Options for strace strace Run the "mysqld" executables using strace. Default - options are -f -o var/log/'mysqld-name'.strace - strace-option=ARGS Option to give strace, replaces default option(s), - strace-client=[path] Create strace output for mysqltest client, optionally - specifying name and path to the trace program to use. - Example: $0 --strace-client=ktrace + options are -f -o 'vardir'/log/'mysqld-name'.strace. + client-strace Trace the "mysqltest". + strace-option=ARGS Option to give strace, appends to existing options. + stracer= Specify name and path to the trace program to use. + Example: $0 --strace-client=ktrace. Misc options user=USER User for connecting to mysqld(default: $opt_user) From 3cb60ec2c305f0b0ab9c3680eb787f8dcd78e57b Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Fri, 29 Nov 2019 15:50:40 +0100 Subject: [PATCH 31/59] Update `stracer` description in `mtr`. `strace-client` is not used --- mysql-test/mysql-test-run.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index 8b9d91935bf..6d32e97d6b4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -6530,7 +6530,7 @@ Options for strace client-strace Trace the "mysqltest". strace-option=ARGS Option to give strace, appends to existing options. stracer= Specify name and path to the trace program to use. - Example: $0 --strace-client=ktrace. + Default is "strace". Example: $0 --stracer=ktrace. Misc options user=USER User for connecting to mysqld(default: $opt_user) From 3fb0fe400c3f6eb8f4d9f34e81db5516f4ecf3dc Mon Sep 17 00:00:00 2001 From: HF Date: Fri, 29 Nov 2019 21:25:52 +0000 Subject: [PATCH 32/59] MENT-510 Failing test(s): perfschema.threads_insert_delayed. orig_test_id should be set properly. Also fixed sporadic test failure. --- mysql-test/suite/plugins/r/server_audit.result | 15 +++++++++++---- mysql-test/suite/plugins/t/server_audit.test | 6 +++--- sql/sql_insert.cc | 1 + 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/mysql-test/suite/plugins/r/server_audit.result b/mysql-test/suite/plugins/r/server_audit.result index fcfa5dd2582..7da9c840202 100644 --- a/mysql-test/suite/plugins/r/server_audit.result +++ b/mysql-test/suite/plugins/r/server_audit.result @@ -223,11 +223,11 @@ insert delayed into t1 values (1), (2); connection default; # Waiting until INSERT DELAYED thread does the insert. drop table t1; +set global server_audit_logging= off; +set global server_audit_incl_users='root'; +set global server_audit_logging= on; disconnect cn1; drop user user1@localhost; -set global server_audit_logging= off; -set global server_audit_incl_users=''; -set global server_audit_logging= on; set global server_audit_events=''; set global server_audit_query_log_limit= 15; select (1), (2), (3), (4); @@ -264,7 +264,7 @@ server_audit_file_path server_audit_file_rotate_now OFF server_audit_file_rotate_size 1000000 server_audit_file_rotations 9 -server_audit_incl_users +server_audit_incl_users root server_audit_logging ON server_audit_mode 1 server_audit_output_type file @@ -398,6 +398,13 @@ TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'insert into t1 values (1), (2)', TIME,HOSTNAME,user1,localhost,ID,ID,CREATE,sa_db,t1, TIME,HOSTNAME,user1,localhost,ID,ID,WRITE,sa_db,t1, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_logging= off',0 +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,user, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,db, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,tables_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,columns_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,procs_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,proxies_priv, +TIME,HOSTNAME,root,localhost,ID,ID,WRITE,mysql,roles_mapping, TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global server_audit_events=\'\'',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'set global serv',0 TIME,HOSTNAME,root,localhost,ID,ID,QUERY,sa_db,'select (1), (2)',0 diff --git a/mysql-test/suite/plugins/t/server_audit.test b/mysql-test/suite/plugins/t/server_audit.test index abba7d2b74f..67b855871a3 100644 --- a/mysql-test/suite/plugins/t/server_audit.test +++ b/mysql-test/suite/plugins/t/server_audit.test @@ -152,12 +152,12 @@ connection default; let $wait_condition= SELECT COUNT(*) = 2 FROM t1; --source include/wait_condition.inc drop table t1; -disconnect cn1; -drop user user1@localhost; set global server_audit_logging= off; -set global server_audit_incl_users=''; +set global server_audit_incl_users='root'; set global server_audit_logging= on; +disconnect cn1; +drop user user1@localhost; set global server_audit_events=''; diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index ec0ab9cb174..a312a8652c4 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -2104,6 +2104,7 @@ public: status(0), retry(0), handler_thread_initialized(FALSE), group_count(0) { DBUG_ENTER("Delayed_insert constructor"); + orig_thread_id= thd.thread_id; set_default_user(); strmake_buf(thd.security_ctx->priv_user, thd.security_ctx->user); thd.current_tablenr=0; From 6fe2aae3ce8139864dfe45f2f9834f82ef54ff1e Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 30 Nov 2019 12:14:00 +0700 Subject: [PATCH 33/59] InnoDB: log unsuccessful calls to pthread_attr_init() and pthread_create() before crash --- storage/innobase/os/os0thread.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index 792d9cc4e10..ed3f1a13f42 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -143,7 +143,13 @@ os_thread_create_func( pthread_attr_t attr; #ifndef UNIV_HPUX10 - pthread_attr_init(&attr); + ret = pthread_attr_init(&attr); + if (UNIV_UNLIKELY(ret)) { + fprintf(stderr, + "InnoDB: Error: pthread_attr_init() returned %d\n", + ret); + exit(1); + } #endif #ifdef UNIV_AIX @@ -171,7 +177,11 @@ os_thread_create_func( #else ret = pthread_create(&pthread, &attr, func, arg); #endif - ut_a(ret == 0); + if (UNIV_UNLIKELY(ret)) { + fprintf(stderr, + "InnoDB: Error: pthread_create() returned %d\n", ret); + exit(1); + } #ifndef UNIV_HPUX10 pthread_attr_destroy(&attr); From 33cf4da1838f3f13d8e973e7f46cc486f1183338 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 30 Nov 2019 18:19:20 +0700 Subject: [PATCH 34/59] cleanup: replace exit(1) with abort() --- storage/innobase/os/os0thread.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/storage/innobase/os/os0thread.cc b/storage/innobase/os/os0thread.cc index ed3f1a13f42..1182166f522 100644 --- a/storage/innobase/os/os0thread.cc +++ b/storage/innobase/os/os0thread.cc @@ -148,7 +148,7 @@ os_thread_create_func( fprintf(stderr, "InnoDB: Error: pthread_attr_init() returned %d\n", ret); - exit(1); + abort(); } #endif @@ -165,7 +165,7 @@ os_thread_create_func( fprintf(stderr, "InnoDB: Error: pthread_attr_setstacksize" " returned %d\n", ret); - exit(1); + abort(); } #endif os_mutex_enter(os_sync_mutex); @@ -180,7 +180,7 @@ os_thread_create_func( if (UNIV_UNLIKELY(ret)) { fprintf(stderr, "InnoDB: Error: pthread_create() returned %d\n", ret); - exit(1); + abort(); } #ifndef UNIV_HPUX10 From c6ed37b88a36bdadb5dbd47dc5ce84bbe847faba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= Date: Sat, 30 Nov 2019 09:48:15 +0200 Subject: [PATCH 35/59] MDEV-21182: Galera test failure on MW-284 galera_2nodes.cnf did not contain wsrep_on=1 on correct places. Fixed restart options to use correct configuration. --- mysql-test/mysql-test-run.pl | 148 +++++++++++++++++- mysql-test/suite/galera/disabled.def | 2 + mysql-test/suite/galera/galera_2nodes.cnf | 11 +- mysql-test/suite/galera/r/MW-284.result | 11 +- mysql-test/suite/galera/r/MW-328C.result | 23 --- mysql-test/suite/galera/r/MW-44.result | 13 -- .../r/galera_forced_binlog_format.result | 6 +- mysql-test/suite/galera/r/galera_gtid.result | 10 +- .../suite/galera/r/galera_log_bin.result | 2 - .../galera/r/galera_var_dirty_reads.result | 7 +- .../galera/r/galera_var_notify_cmd.result | 2 +- .../galera/r/galera_var_reject_queries.result | 5 +- .../galera/r/galera_wsrep_new_cluster.result | 2 +- mysql-test/suite/galera/t/MW-284.test | 16 +- mysql-test/suite/galera/t/MW-313-master.opt | 1 - mysql-test/suite/galera/t/MW-313.cnf | 12 ++ mysql-test/suite/galera/t/MW-328C.test | 36 ----- mysql-test/suite/galera/t/MW-329-master.opt | 1 - mysql-test/suite/galera/t/MW-329.cnf | 9 ++ mysql-test/suite/galera/t/MW-44-master.opt | 1 - mysql-test/suite/galera/t/MW-44.test | 32 ++-- .../suite/galera/t/MW-86-wait1-master.opt | 1 - .../suite/galera/t/MW-86-wait8-master.opt | 1 - mysql-test/suite/galera/t/MW-86-wait8.cnf | 10 ++ .../galera/t/enforce_storage_engine2.cnf | 13 ++ .../galera/t/enforce_storage_engine2.opt | 2 - ...alera_applier_ftwrl_table_alter-master.opt | 1 - .../t/galera_applier_ftwrl_table_alter.cnf | 14 ++ .../t/galera_bf_background_statistics.cnf | 9 ++ .../t/galera_bf_background_statistics.opt | 1 - .../t/galera_binlog_checksum-master.opt | 1 - .../suite/galera/t/galera_binlog_checksum.cnf | 13 ++ ...alera_binlog_event_max_size_max-master.opt | 1 - .../t/galera_binlog_event_max_size_max.cnf | 9 ++ ...alera_binlog_event_max_size_min-master.opt | 1 - .../t/galera_binlog_event_max_size_min.cnf | 9 ++ .../suite/galera/t/galera_flush-master.opt | 1 - mysql-test/suite/galera/t/galera_flush.cnf | 10 ++ .../suite/galera/t/galera_flush_local.cnf | 12 ++ .../suite/galera/t/galera_flush_local.opt | 3 - .../galera/t/galera_forced_binlog_format.test | 6 + .../suite/galera/t/galera_gtid-master.opt | 1 - mysql-test/suite/galera/t/galera_gtid.cnf | 10 ++ mysql-test/suite/galera/t/galera_gtid.test | 8 +- .../suite/galera/t/galera_log_bin-master.opt | 1 - mysql-test/suite/galera/t/galera_log_bin.cnf | 10 ++ mysql-test/suite/galera/t/galera_log_bin.test | 5 +- .../suite/galera/t/galera_mdev_13787.cnf | 9 ++ .../suite/galera/t/galera_mdev_13787.opt | 1 - .../galera/t/galera_query_cache-master.opt | 1 - .../suite/galera/t/galera_query_cache.cnf | 10 ++ .../t/galera_query_cache_sync_wait-master.opt | 1 - .../galera/t/galera_query_cache_sync_wait.cnf | 10 ++ .../galera/t/galera_sbr_binlog-master.opt | 1 - .../suite/galera/t/galera_sbr_binlog.cnf | 7 + .../galera_sst_mariabackup_table_options.cnf | 2 + .../galera_sst_mariabackup_table_options.opt | 2 - .../suite/galera/t/galera_udf-master.opt | 2 - mysql-test/suite/galera/t/galera_udf.cnf | 15 ++ .../galera/t/galera_v1_row_events-master.opt | 1 - .../suite/galera/t/galera_v1_row_events.cnf | 13 ++ .../t/galera_var_auto_inc_control_on.cnf | 13 ++ .../t/galera_var_auto_inc_control_on.opt | 1 - .../galera/t/galera_var_dirty_reads.test | 9 +- .../galera/t/galera_var_notify_cmd-master.opt | 1 - .../suite/galera/t/galera_var_notify_cmd.cnf | 13 ++ .../galera/t/galera_var_reject_queries.test | 6 +- .../suite/galera/t/galera_var_sst_auth.cnf | 12 ++ .../suite/galera/t/galera_var_sst_auth.opt | 1 - .../t/galera_wsrep_log_conficts-master.opt | 1 - .../galera/t/galera_wsrep_log_conficts.cnf | 12 ++ .../t/galera_wsrep_new_cluster-master.opt | 1 - .../galera/t/galera_wsrep_new_cluster.cnf | 10 ++ .../suite/galera/t/mysql-wsrep#201-master.opt | 1 - mysql-test/suite/galera/t/mysql-wsrep#201.cnf | 9 ++ mysql-test/suite/galera/t/query_cache.cnf | 9 ++ mysql-test/suite/galera/t/query_cache.opt | 1 - mysql-test/suite/wsrep/disabled.def | 3 + mysql-test/suite/wsrep/t/pool_of_threads.opt | 2 +- 79 files changed, 505 insertions(+), 178 deletions(-) delete mode 100644 mysql-test/suite/galera/r/MW-328C.result delete mode 100644 mysql-test/suite/galera/t/MW-313-master.opt create mode 100644 mysql-test/suite/galera/t/MW-313.cnf delete mode 100644 mysql-test/suite/galera/t/MW-328C.test delete mode 100644 mysql-test/suite/galera/t/MW-329-master.opt create mode 100644 mysql-test/suite/galera/t/MW-329.cnf delete mode 100644 mysql-test/suite/galera/t/MW-86-wait1-master.opt delete mode 100644 mysql-test/suite/galera/t/MW-86-wait8-master.opt create mode 100644 mysql-test/suite/galera/t/MW-86-wait8.cnf create mode 100644 mysql-test/suite/galera/t/enforce_storage_engine2.cnf delete mode 100644 mysql-test/suite/galera/t/enforce_storage_engine2.opt delete mode 100644 mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt create mode 100644 mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf create mode 100644 mysql-test/suite/galera/t/galera_bf_background_statistics.cnf delete mode 100644 mysql-test/suite/galera/t/galera_bf_background_statistics.opt delete mode 100644 mysql-test/suite/galera/t/galera_binlog_checksum-master.opt create mode 100644 mysql-test/suite/galera/t/galera_binlog_checksum.cnf delete mode 100644 mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt create mode 100644 mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf delete mode 100644 mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt create mode 100644 mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf delete mode 100644 mysql-test/suite/galera/t/galera_flush-master.opt create mode 100644 mysql-test/suite/galera/t/galera_flush.cnf create mode 100644 mysql-test/suite/galera/t/galera_flush_local.cnf delete mode 100644 mysql-test/suite/galera/t/galera_flush_local.opt delete mode 100644 mysql-test/suite/galera/t/galera_gtid-master.opt create mode 100644 mysql-test/suite/galera/t/galera_gtid.cnf delete mode 100644 mysql-test/suite/galera/t/galera_log_bin-master.opt create mode 100644 mysql-test/suite/galera/t/galera_log_bin.cnf create mode 100644 mysql-test/suite/galera/t/galera_mdev_13787.cnf delete mode 100644 mysql-test/suite/galera/t/galera_mdev_13787.opt delete mode 100644 mysql-test/suite/galera/t/galera_query_cache-master.opt create mode 100644 mysql-test/suite/galera/t/galera_query_cache.cnf delete mode 100644 mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt create mode 100644 mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf delete mode 100644 mysql-test/suite/galera/t/galera_sbr_binlog-master.opt create mode 100644 mysql-test/suite/galera/t/galera_sbr_binlog.cnf delete mode 100644 mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt delete mode 100644 mysql-test/suite/galera/t/galera_udf-master.opt create mode 100644 mysql-test/suite/galera/t/galera_udf.cnf delete mode 100644 mysql-test/suite/galera/t/galera_v1_row_events-master.opt create mode 100644 mysql-test/suite/galera/t/galera_v1_row_events.cnf create mode 100644 mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf delete mode 100644 mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt delete mode 100644 mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt create mode 100644 mysql-test/suite/galera/t/galera_var_notify_cmd.cnf create mode 100644 mysql-test/suite/galera/t/galera_var_sst_auth.cnf delete mode 100644 mysql-test/suite/galera/t/galera_var_sst_auth.opt delete mode 100644 mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt create mode 100644 mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf delete mode 100644 mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt create mode 100644 mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf delete mode 100644 mysql-test/suite/galera/t/mysql-wsrep#201-master.opt create mode 100644 mysql-test/suite/galera/t/mysql-wsrep#201.cnf create mode 100644 mysql-test/suite/galera/t/query_cache.cnf delete mode 100644 mysql-test/suite/galera/t/query_cache.opt diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index e1561d6794a..f3135e07eb4 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -3055,15 +3055,43 @@ sub mysql_server_start($) { # Save this test case information, so next can examine it $mysqld->{'started_tinfo'}= $tinfo; } + + # If wsrep is on, we need to wait until the first + # server starts and bootstraps the cluster before + # starting other servers. The bootsrap server in the + # configuration should always be the first which has + # wsrep_on=ON + if (wsrep_on($mysqld) && wsrep_is_bootstrap_server($mysqld)) + { + mtr_verbose("Waiting for wsrep bootstrap server to start"); + if ($mysqld->{WAIT}->($mysqld)) + { + return 1; + } + } } sub mysql_server_wait { - my ($mysqld) = @_; + my ($mysqld, $tinfo) = @_; - return not sleep_until_file_created($mysqld->value('pid-file'), + if (!sleep_until_file_created($mysqld->value('pid-file'), $opt_start_timeout, $mysqld->{'proc'}, - $warn_seconds); + $warn_seconds)) + { + $tinfo->{comment}= "Failed to start ".$mysqld->name() . "\n"; + return 1; + } + + if (wsrep_on($mysqld)) + { + mtr_verbose("Waiting for wsrep server " . $mysqld->name() . " to be ready"); + if (!wait_wsrep_ready($tinfo, $mysqld)) + { + return 1; + } + } + return 0; } sub create_config_file_for_extern { @@ -5577,6 +5605,118 @@ sub stop_servers($$) { } } +# +# run_query_output +# +# Run a query against a server using mysql client. The output of +# the query will be written into outfile. +# +sub run_query_output { + my ($mysqld, $query, $outfile)= @_; + my $args; + + mtr_init_args(\$args); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--execute=%s", $query); + + my $res= My::SafeProcess->run + ( + name => "run_query_output -> ".$mysqld->name(), + path => $exe_mysql, + args => \$args, + output => $outfile, + error => $outfile + ); + + return $res +} + + +# +# wsrep_wait_ready +# +# Wait until the server has been joined to the cluster and is +# ready for operation. +# +# RETURN +# 1 Server is ready +# 0 Server didn't transition to ready state within start timeout +# +sub wait_wsrep_ready($$) { + my ($tinfo, $mysqld)= @_; + + my $sleeptime= 100; # Milliseconds + my $loops= ($opt_start_timeout * 1000) / $sleeptime; + + my $name= $mysqld->name(); + my $outfile= "$opt_vardir/tmp/$name.wsrep_ready"; + my $query= "SET SESSION wsrep_sync_wait = 0; + SELECT VARIABLE_NAME, VARIABLE_VALUE + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME = 'wsrep_ready'"; + + for (my $loop= 1; $loop <= $loops; $loop++) + { + # Careful... if MTR runs with option 'verbose' then the + # file contains also SafeProcess verbose output + if (run_query_output($mysqld, $query, $outfile) == 0 && + mtr_grab_file($outfile) =~ /WSREP_READY\s+ON/) + { + unlink($outfile); + return 1; + } + mtr_milli_sleep($sleeptime); + } + + $tinfo->{logfile}= "WSREP did not transition to state READY"; + return 0; +} + +# +# wsrep_is_bootstrap_server +# +# Check if the server is the first one to be started in the +# cluster. +# +# RETURN +# 1 The server is a bootstrap server +# 0 The server is not a bootstrap server +# +sub wsrep_is_bootstrap_server($) { + my $mysqld= shift; + + my $cluster_address= $mysqld->if_exist('wsrep-cluster-address') || + $mysqld->if_exist('wsrep_cluster_address'); + if (defined $cluster_address) + { + return $cluster_address eq "gcomm://" || $cluster_address eq "'gcomm://'"; + } + return 0; +} + +# +# wsrep_on +# +# Check if wsrep has been enabled for a server. +# +# RETURN +# 1 Wsrep has been enabled +# 0 Wsrep is not enabled +# +sub wsrep_on($) { + my $mysqld= shift; + #check if wsrep_on= is set in configuration + if ($mysqld->if_exist('wsrep-on')) { + my $on= "".$mysqld->value('wsrep-on'); + if ($on eq "1" || $on eq "ON") { + return 1; + } + } + return 0; +} + # # start_servers @@ -5596,7 +5736,7 @@ sub start_servers($) { for (all_servers()) { next unless $_->{WAIT} and started($_); - if ($_->{WAIT}->($_)) { + if ($_->{WAIT}->($_, $tinfo)) { $tinfo->{comment}= "Failed to start ".$_->name() . "\n"; return 1; } diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index f6853e35ca3..ebe8d2ac2d3 100644 --- a/mysql-test/suite/galera/disabled.def +++ b/mysql-test/suite/galera/disabled.def @@ -10,6 +10,7 @@ # ############################################################################## +MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill MW-329 : MDEV-19962 Galera test failure on MW-329 MW-388: MDEV-19803 Long semaphore wait error on galera.MW-388 galera_account_management : MariaDB 10.0 does not support ALTER USER @@ -17,6 +18,7 @@ galera_as_master_gtid : Requires MySQL GTID galera_as_master_gtid_change_master : Requires MySQL GTID galera_as_slave_preordered : wsrep-preordered feature not merged to MariaDB galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event() +galera_autoinc_sst_mariabackup : Known issue, may require porting MDEV-17458 from later versions galera_binlog_rows_query_log_events: MariaDB does not support binlog_rows_query_log_events galera_binlog_stmt_autoinc: MDEV-19959 Galera test failure on galera_binlog_stmt_autoinc galera_flush : MariaDB does not have global.thread_statistics diff --git a/mysql-test/suite/galera/galera_2nodes.cnf b/mysql-test/suite/galera/galera_2nodes.cnf index b24f3603894..67e9893179f 100644 --- a/mysql-test/suite/galera/galera_2nodes.cnf +++ b/mysql-test/suite/galera/galera_2nodes.cnf @@ -2,7 +2,7 @@ !include include/default_mysqld.cnf [mysqld] -wsrep-on=1 +loose-innodb binlog-format=row innodb-autoinc-lock-mode=2 default-storage-engine=innodb @@ -12,18 +12,26 @@ wsrep_node_address=127.0.0.1 wsrep-sync-wait=15 [mysqld.1] +loose-innodb #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port +wsrep-on=1 wsrep-cluster-address=gcomm:// wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.1.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S;gcache.size=10M' wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port' +# enforce read-committed characteristics across the cluster +wsrep_causal_reads=ON +wsrep_sync_wait = 15 + [mysqld.2] +loose-innodb #galera_port=@OPT.port #ist_port=@OPT.port #sst_port=@OPT.port +wsrep-on=1 wsrep_cluster_address='gcomm://127.0.0.1:@mysqld.1.#galera_port' wsrep_provider_options='repl.causal_read_timeout=PT90S;base_port=@mysqld.2.#galera_port;evs.suspect_timeout=PT10S;evs.inactive_timeout=PT30S;evs.install_timeout=PT15S' @@ -36,7 +44,6 @@ wsrep_sst_receive_address=127.0.0.2:@mysqld.2.#sst_port wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port' - [ENV] NODE_MYPORT_1= @mysqld.1.port NODE_MYSOCK_1= @mysqld.1.socket diff --git a/mysql-test/suite/galera/r/MW-284.result b/mysql-test/suite/galera/r/MW-284.result index 0f6c0be25fe..6f7bdf3917a 100644 --- a/mysql-test/suite/galera/r/MW-284.result +++ b/mysql-test/suite/galera/r/MW-284.result @@ -1,4 +1,6 @@ connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3; +call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*"); +call mtr.add_suppression("WSREP has not yet prepared node for application use"); connection node_1; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET GLOBAL wsrep_provider_options='gmcast.isolate=1'; @@ -6,6 +8,9 @@ SET SESSION wsrep_on = OFF; SET SESSION wsrep_on = ON; SET global wsrep_sync_wait=0; connection node_3; +SELECT @@wsrep_on; +@@wsrep_on +0 START SLAVE; include/wait_for_slave_param.inc [Slave_IO_Running] connection node_1; @@ -22,9 +27,3 @@ connection node_3; STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); -CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); -connection node_1; -RESET MASTER; -CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); -connection node_2; -CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); diff --git a/mysql-test/suite/galera/r/MW-328C.result b/mysql-test/suite/galera/r/MW-328C.result deleted file mode 100644 index f8d747c5df1..00000000000 --- a/mysql-test/suite/galera/r/MW-328C.result +++ /dev/null @@ -1,23 +0,0 @@ -CREATE TABLE t1 (f1 INTEGER AUTO_INCREMENT PRIMARY KEY, f2 CHAR(20) DEFAULT 'abc') ENGINE=InnoDB; -INSERT INTO t1 (f1) VALUES (1); -CREATE TABLE t2 (f1 CHAR(20)) ENGINE=InnoDB; -CREATE PROCEDURE proc_update () -BEGIN -DECLARE CONTINUE HANDLER FOR SQLEXCEPTION BEGIN END; -SET SESSION wsrep_sync_wait = 0; -WHILE 1 DO -UPDATE t1 SET f2 = LEFT(MD5(RAND()), 4); -END WHILE; -END| -connect node_1X, 127.0.0.1, root, , test, $NODE_MYPORT_1; -connection node_1X; -CALL proc_update();; -connection node_2; -SET SESSION wsrep_retry_autocommit = 10000; -connection node_1; -connection node_1X; -Got one of the listed errors -connection node_1; -DROP PROCEDURE proc_update; -DROP TABLE t1, t2; -CALL mtr.add_suppression("conflict state ABORTED after post commit"); diff --git a/mysql-test/suite/galera/r/MW-44.result b/mysql-test/suite/galera/r/MW-44.result index 83668339310..7335acc445a 100644 --- a/mysql-test/suite/galera/r/MW-44.result +++ b/mysql-test/suite/galera/r/MW-44.result @@ -1,24 +1,11 @@ connection node_1; TRUNCATE TABLE mysql.general_log; connection node_2; -TRUNCATE TABLE mysql.general_log; connection node_1; -SELECT Argument FROM mysql.general_log; -Argument -SET GLOBAL general_log='ON'; SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_osu_method=RSU; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET SESSION wsrep_osu_method=TOI; -SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; -argument -CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB -ALTER TABLE t1 ADD COLUMN f2 INTEGER connection node_2; -SELECT Argument FROM mysql.general_log; -Argument DROP TABLE t1; -SET GLOBAL general_log='OFF'; -connection node_1; -SET GLOBAL general_log='OFF'; diff --git a/mysql-test/suite/galera/r/galera_forced_binlog_format.result b/mysql-test/suite/galera/r/galera_forced_binlog_format.result index b94e6530886..2a31893ca1d 100644 --- a/mysql-test/suite/galera/r/galera_forced_binlog_format.result +++ b/mysql-test/suite/galera/r/galera_forced_binlog_format.result @@ -1,13 +1,11 @@ connection node_1; +SET SESSION wsrep_on=OFF; RESET MASTER; +SET SESSION wsrep_on=ON; SET SESSION binlog_format = 'STATEMENT'; -Warnings: -Warning 1105 MariaDB Galera and flashback do not support binlog format: STATEMENT CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); SET SESSION binlog_format = 'MIXED'; -Warnings: -Warning 1105 MariaDB Galera and flashback do not support binlog format: MIXED INSERT INTO t1 VALUES (2); SHOW BINLOG EVENTS IN 'mysqld-bin.000001' FROM 256; Log_name Pos Event_type Server_id End_log_pos Info diff --git a/mysql-test/suite/galera/r/galera_gtid.result b/mysql-test/suite/galera/r/galera_gtid.result index acc5eae9876..0346abc5a6c 100644 --- a/mysql-test/suite/galera/r/galera_gtid.result +++ b/mysql-test/suite/galera/r/galera_gtid.result @@ -1,14 +1,12 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); INSERT INTO t1 VALUES (1); connection node_2; -SELECT COUNT(*) = 1 FROM t1; -COUNT(*) = 1 -1 UPDATE t1 SET f1 = 2; connection node_1; -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; -COUNT(*) = 1 -1 +SET SESSION wsrep_sync_wait = 15; +SELECT * from t1; +f1 +2 gtid_binlog_state_equal 1 DROP TABLE t1; diff --git a/mysql-test/suite/galera/r/galera_log_bin.result b/mysql-test/suite/galera/r/galera_log_bin.result index 2fb59fc200f..eb009a620e0 100644 --- a/mysql-test/suite/galera/r/galera_log_bin.result +++ b/mysql-test/suite/galera/r/galera_log_bin.result @@ -71,5 +71,3 @@ DROP TABLE t2; #cleanup connection node_1; RESET MASTER; -connection node_2; -reset master; diff --git a/mysql-test/suite/galera/r/galera_var_dirty_reads.result b/mysql-test/suite/galera/r/galera_var_dirty_reads.result index 020efb7b8f1..50938d61a4b 100644 --- a/mysql-test/suite/galera/r/galera_var_dirty_reads.result +++ b/mysql-test/suite/galera/r/galera_var_dirty_reads.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("WSREP has not yet prepared node for application use"); connection node_1; connection node_2; connection node_2; @@ -16,9 +17,9 @@ SHOW STATUS LIKE 'wsrep_cluster_status'; Variable_name Value wsrep_cluster_status non-Primary SELECT * FROM t1; -ERROR 08S01: WSREP has not yet prepared node for application use +Got one of the listed errors SELECT 1 FROM t1; -ERROR 08S01: WSREP has not yet prepared node for application use +Got one of the listed errors SET @@session.wsrep_dirty_reads=ON; SELECT * FROM t1; i @@ -31,7 +32,7 @@ i variable_name variable_value 1 WSREP_DIRTY_READS ON SET @@session.wsrep_dirty_reads=OFF; SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; -ERROR 08S01: WSREP has not yet prepared node for application use +Got one of the listed errors SELECT 1; 1 1 diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result index 3f0dd57aa3b..b02124cda70 100644 --- a/mysql-test/suite/galera/r/galera_var_notify_cmd.result +++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result @@ -7,4 +7,4 @@ MAX(size) = 2 1 SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status; COUNT(DISTINCT idx) = 2 -1 +0 diff --git a/mysql-test/suite/galera/r/galera_var_reject_queries.result b/mysql-test/suite/galera/r/galera_var_reject_queries.result index caf98566595..22e2e6d764a 100644 --- a/mysql-test/suite/galera/r/galera_var_reject_queries.result +++ b/mysql-test/suite/galera/r/galera_var_reject_queries.result @@ -1,3 +1,4 @@ +call mtr.add_suppression("WSREP has not yet prepared node for application use"); CREATE TABLE t1 (f1 INTEGER); connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; connection node_1; @@ -5,14 +6,14 @@ SET SESSION wsrep_reject_queries = ALL; ERROR HY000: Variable 'wsrep_reject_queries' is a GLOBAL variable and should be set with SET GLOBAL SET GLOBAL wsrep_reject_queries = ALL; SELECT * FROM t1; -ERROR 08S01: WSREP has not yet prepared node for application use +Got one of the listed errors SET GLOBAL wsrep_reject_queries = ALL_KILL; connection node_1a; SELECT * FROM t1; Got one of the listed errors connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1; SELECT * FROM t1; -ERROR 08S01: WSREP has not yet prepared node for application use +Got one of the listed errors connection node_2; SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'; VARIABLE_VALUE = 2 diff --git a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result index ca388496794..24484fb66d2 100644 --- a/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result +++ b/mysql-test/suite/galera/r/galera_wsrep_new_cluster.result @@ -25,7 +25,7 @@ VARIABLE_VALUE = 'ON' 1 SELECT VARIABLE_VALUE = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_local_index'; VARIABLE_VALUE = 0 -1 +0 SELECT VARIABLE_VALUE = 'ON' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready'; VARIABLE_VALUE = 'ON' 1 diff --git a/mysql-test/suite/galera/t/MW-284.test b/mysql-test/suite/galera/t/MW-284.test index 5e17baa1bdb..568826db5b0 100644 --- a/mysql-test/suite/galera/t/MW-284.test +++ b/mysql-test/suite/galera/t/MW-284.test @@ -2,10 +2,13 @@ # MW-284 Slave I/O retry on ER_COM_UNKNOWN_ERROR # +--source include/have_log_bin.inc --source include/galera_cluster.inc ---source include/have_innodb.inc --connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3 +call mtr.add_suppression("\\[ERROR\\] Error reading packet from server: WSREP has not yet prepared node for application use .*"); +call mtr.add_suppression("WSREP has not yet prepared node for application use"); + --disable_query_log --eval CHANGE MASTER TO MASTER_HOST='127.0.0.1', MASTER_PORT=$NODE_MYPORT_1, MASTER_USER='root', MASTER_CONNECT_RETRY=1; --enable_query_log @@ -18,11 +21,14 @@ SET SESSION wsrep_on = OFF; --let $wait_condition = SELECT VARIABLE_VALUE = 'non-Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status' --source include/wait_condition.inc SET SESSION wsrep_on = ON; + #wsrep_sync_wait is set to zero because when slave tries to connect it it ask for queries like SELECT UNIX_TIMESTAMP() on node 1 which will fail, causing #a warning in slave error log. SET global wsrep_sync_wait=0; --connection node_3 +SELECT @@wsrep_on; +--sleep 1 START SLAVE; --let $slave_param= Slave_IO_Running --let $slave_param_value= Connecting @@ -50,8 +56,8 @@ INSERT INTO t1 VALUES (1); --connection node_1 DROP TABLE t1; - --eval SET global wsrep_sync_wait=$wsrep_sync_wait_state + --connection node_3 --let $wait_condition = SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 't1' --source include/wait_condition.inc @@ -60,11 +66,5 @@ STOP SLAVE; RESET SLAVE ALL; CALL mtr.add_suppression('failed registering on master'); -CALL mtr.add_suppression('You need to use --log-bin to make --binlog-format work'); ---connection node_1 -RESET MASTER; -CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); ---connection node_2 -CALL mtr.add_suppression('WSREP: Last Applied Action message in non-primary configuration from member'); \ No newline at end of file diff --git a/mysql-test/suite/galera/t/MW-313-master.opt b/mysql-test/suite/galera/t/MW-313-master.opt deleted file mode 100644 index 8a755e98b00..00000000000 --- a/mysql-test/suite/galera/t/MW-313-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin --log-slave-updates diff --git a/mysql-test/suite/galera/t/MW-313.cnf b/mysql-test/suite/galera/t/MW-313.cnf new file mode 100644 index 00000000000..184900c58fd --- /dev/null +++ b/mysql-test/suite/galera/t/MW-313.cnf @@ -0,0 +1,12 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + + + diff --git a/mysql-test/suite/galera/t/MW-328C.test b/mysql-test/suite/galera/t/MW-328C.test deleted file mode 100644 index 1594547d0de..00000000000 --- a/mysql-test/suite/galera/t/MW-328C.test +++ /dev/null @@ -1,36 +0,0 @@ -# -# MW-328 Fix unnecessary/silent BF aborts -# - -# -# Make sure that a high value of wsrep_retry_autocommit -# masks all deadlock errors -# - ---source include/galera_cluster.inc ---source include/big_test.inc ---source suite/galera/t/MW-328-header.inc - ---connection node_2 ---let $count = 100 - -SET SESSION wsrep_retry_autocommit = 10000; - ---disable_query_log - -while ($count) -{ - --error 0 - INSERT IGNORE INTO t2 SELECT f2 FROM t1; - - --disable_result_log - --error 0 - SELECT 1 FROM DUAL; - --enable_result_log - - --dec $count -} - ---enable_query_log - ---source suite/galera/t/MW-328-footer.inc diff --git a/mysql-test/suite/galera/t/MW-329-master.opt b/mysql-test/suite/galera/t/MW-329-master.opt deleted file mode 100644 index 6565a6af3c4..00000000000 --- a/mysql-test/suite/galera/t/MW-329-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-retry-autocommit=0 diff --git a/mysql-test/suite/galera/t/MW-329.cnf b/mysql-test/suite/galera/t/MW-329.cnf new file mode 100644 index 00000000000..10870a81547 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-329.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-retry-autocommit=0 + +[mysqld.2] + + + diff --git a/mysql-test/suite/galera/t/MW-44-master.opt b/mysql-test/suite/galera/t/MW-44-master.opt index 9b086195e8a..a15aa0a99d9 100644 --- a/mysql-test/suite/galera/t/MW-44-master.opt +++ b/mysql-test/suite/galera/t/MW-44-master.opt @@ -1,2 +1 @@ --log-output=TABLE ---general-log=OFF diff --git a/mysql-test/suite/galera/t/MW-44.test b/mysql-test/suite/galera/t/MW-44.test index 8730631edc6..a2acfc57f6c 100644 --- a/mysql-test/suite/galera/t/MW-44.test +++ b/mysql-test/suite/galera/t/MW-44.test @@ -3,40 +3,30 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --connection node_1 TRUNCATE TABLE mysql.general_log; ---sleep 1 --connection node_2 ---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log; ---source include/wait_condition.inc -TRUNCATE TABLE mysql.general_log; +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument NOT LIKE '%mysql.general_log%' +--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log +--source include/wait_condition_with_debug.inc ---sleep 1 --connection node_1 ---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log; ---source include/wait_condition.inc -SELECT Argument FROM mysql.general_log; - -SET GLOBAL general_log='ON'; SET SESSION wsrep_osu_method=TOI; CREATE TABLE t1 (f1 INTEGER) ENGINE=InnoDB; SET SESSION wsrep_osu_method=RSU; ALTER TABLE t1 ADD COLUMN f2 INTEGER; SET SESSION wsrep_osu_method=TOI; ---let $wait_condition = SELECT COUNT(argument) = 2 FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; ---source include/wait_condition.inc - -SELECT argument FROM mysql.general_log WHERE argument LIKE 'CREATE%' OR argument LIKE 'ALTER%'; +--let $wait_condition = SELECT COUNT(*) = 2 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%" +--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log +--source include/wait_condition_with_debug.inc --connection node_2 -SELECT Argument FROM mysql.general_log; + +--let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.general_log WHERE argument LIKE "CREATE%" OR argument LIKE "ALTER%" +--let $wait_condition_on_error_output = SELECT * FROM mysql.general_log +--source include/wait_condition_with_debug.inc + DROP TABLE t1; -SET GLOBAL general_log='OFF'; - ---connection node_1 -SET GLOBAL general_log='OFF'; - diff --git a/mysql-test/suite/galera/t/MW-86-wait1-master.opt b/mysql-test/suite/galera/t/MW-86-wait1-master.opt deleted file mode 100644 index 8a755e98b00..00000000000 --- a/mysql-test/suite/galera/t/MW-86-wait1-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin --log-slave-updates diff --git a/mysql-test/suite/galera/t/MW-86-wait8-master.opt b/mysql-test/suite/galera/t/MW-86-wait8-master.opt deleted file mode 100644 index 8a755e98b00..00000000000 --- a/mysql-test/suite/galera/t/MW-86-wait8-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin --log-slave-updates diff --git a/mysql-test/suite/galera/t/MW-86-wait8.cnf b/mysql-test/suite/galera/t/MW-86-wait8.cnf new file mode 100644 index 00000000000..8f6a760def0 --- /dev/null +++ b/mysql-test/suite/galera/t/MW-86-wait8.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.cnf b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf new file mode 100644 index 00000000000..b14fce85b36 --- /dev/null +++ b/mysql-test/suite/galera/t/enforce_storage_engine2.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +enforce_storage_engine=innodb +sql_mode='' + +[mysqld.2] +enforce_storage_engine=innodb +sql_mode='' + + + + diff --git a/mysql-test/suite/galera/t/enforce_storage_engine2.opt b/mysql-test/suite/galera/t/enforce_storage_engine2.opt deleted file mode 100644 index 03f7dc5e527..00000000000 --- a/mysql-test/suite/galera/t/enforce_storage_engine2.opt +++ /dev/null @@ -1,2 +0,0 @@ ---enforce_storage_engine=innodb --sql_mode='' - diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt deleted file mode 100644 index d8ecaacaa4c..00000000000 --- a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter-master.opt +++ /dev/null @@ -1 +0,0 @@ ---lock_wait_timeout=5 --innodb_lock_wait_timeout=5 --wait_timeout=5 diff --git a/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf new file mode 100644 index 00000000000..4d93a1b2509 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_applier_ftwrl_table_alter.cnf @@ -0,0 +1,14 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +lock_wait_timeout=5 +innodb_lock_wait_timeout=5 +wait_timeout=5 + +[mysqld.2] +lock_wait_timeout=5 +innodb_lock_wait_timeout=5 +wait_timeout=5 + + + diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf new file mode 100644 index 00000000000..4101b4073ec --- /dev/null +++ b/mysql-test/suite/galera/t/galera_bf_background_statistics.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +innodb_stats_persistent=ON + +[mysqld.2] +innodb_stats_persistent=ON + + diff --git a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt b/mysql-test/suite/galera/t/galera_bf_background_statistics.opt deleted file mode 100644 index f9b1414a974..00000000000 --- a/mysql-test/suite/galera/t/galera_bf_background_statistics.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb_stats_persistent=ON diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt b/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt deleted file mode 100644 index c8e53f07fc2..00000000000 --- a/mysql-test/suite/galera/t/galera_binlog_checksum-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog-checksum=CRC32 --master-verify-checksum=1 --slave-sql-verify-checksum=1 diff --git a/mysql-test/suite/galera/t/galera_binlog_checksum.cnf b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf new file mode 100644 index 00000000000..bd61ee67406 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_binlog_checksum.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +binlog-checksum=CRC32 +master-verify-checksum=1 +slave-sql-verify-checksum=1 + +[mysqld.2] +binlog-checksum=CRC32 +master-verify-checksum=1 +slave-sql-verify-checksum=1 + + diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt deleted file mode 100644 index a36d21315a6..00000000000 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog-row-event-max-size=4294967295 diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf new file mode 100644 index 00000000000..7d87a0d0078 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_max.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +binlog-row-event-max-size=4294967295 + +[mysqld.2] + + + diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt deleted file mode 100644 index 22174756652..00000000000 --- a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min-master.opt +++ /dev/null @@ -1 +0,0 @@ ---binlog-row-event-max-size=256 diff --git a/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf new file mode 100644 index 00000000000..798435d8e54 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_binlog_event_max_size_min.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +binlog-row-event-max-size=256 + +[mysqld.2] + + + diff --git a/mysql-test/suite/galera/t/galera_flush-master.opt b/mysql-test/suite/galera/t/galera_flush-master.opt deleted file mode 100644 index 5a1fb6748d9..00000000000 --- a/mysql-test/suite/galera/t/galera_flush-master.opt +++ /dev/null @@ -1 +0,0 @@ ---query_cache_type=1 --query_cache_size=1000000 diff --git a/mysql-test/suite/galera/t/galera_flush.cnf b/mysql-test/suite/galera/t/galera_flush.cnf new file mode 100644 index 00000000000..e2d869ab364 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_flush.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 +query_cache_size=1000000 + +[mysqld.2] +query_cache_type=1 +query_cache_size=1000000 + diff --git a/mysql-test/suite/galera/t/galera_flush_local.cnf b/mysql-test/suite/galera/t/galera_flush_local.cnf new file mode 100644 index 00000000000..c92cb58f484 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_flush_local.cnf @@ -0,0 +1,12 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 +query_cache_size=1000000 +wsrep_replicate_myisam=ON + +[mysqld.2] +query_cache_type=1 +query_cache_size=1000000 +wsrep_replicate_myisam=ON + diff --git a/mysql-test/suite/galera/t/galera_flush_local.opt b/mysql-test/suite/galera/t/galera_flush_local.opt deleted file mode 100644 index a084db15c5d..00000000000 --- a/mysql-test/suite/galera/t/galera_flush_local.opt +++ /dev/null @@ -1,3 +0,0 @@ ---query_cache_type=1 ---query_cache_size=1000000 ---wsrep_replicate_myisam=ON diff --git a/mysql-test/suite/galera/t/galera_forced_binlog_format.test b/mysql-test/suite/galera/t/galera_forced_binlog_format.test index 364f41529a4..5da70abd255 100644 --- a/mysql-test/suite/galera/t/galera_forced_binlog_format.test +++ b/mysql-test/suite/galera/t/galera_forced_binlog_format.test @@ -7,14 +7,20 @@ --source include/galera_cluster.inc --connection node_1 +SET SESSION wsrep_on=OFF; RESET MASTER; +SET SESSION wsrep_on=ON; +--disable_warnings SET SESSION binlog_format = 'STATEMENT'; +--enable_warnings CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB; INSERT INTO t1 VALUES (1); +--disable_warnings SET SESSION binlog_format = 'MIXED'; +--enable_warnings INSERT INTO t1 VALUES (2); diff --git a/mysql-test/suite/galera/t/galera_gtid-master.opt b/mysql-test/suite/galera/t/galera_gtid-master.opt deleted file mode 100644 index 8a755e98b00..00000000000 --- a/mysql-test/suite/galera/t/galera_gtid-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin --log-slave-updates diff --git a/mysql-test/suite/galera/t/galera_gtid.cnf b/mysql-test/suite/galera/t/galera_gtid.cnf new file mode 100644 index 00000000000..8f6a760def0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_gtid.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + diff --git a/mysql-test/suite/galera/t/galera_gtid.test b/mysql-test/suite/galera/t/galera_gtid.test index e8369be62e6..560a320255f 100644 --- a/mysql-test/suite/galera/t/galera_gtid.test +++ b/mysql-test/suite/galera/t/galera_gtid.test @@ -11,14 +11,18 @@ CREATE TABLE t1 (f1 INT PRIMARY KEY); INSERT INTO t1 VALUES (1); --connection node_2 -SELECT COUNT(*) = 1 FROM t1; +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 +--source include/wait_condition.inc UPDATE t1 SET f1 = 2; --let $gtid_binlog_state_node2 = `SELECT @@global.gtid_binlog_state;` --connection node_1 -SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2; +SET SESSION wsrep_sync_wait = 15; +--let $wait_condition = SELECT COUNT(*) = 1 FROM t1 WHERE f1 = 2 +--source include/wait_condition.inc +SELECT * from t1; --disable_query_log --eval SELECT '$gtid_binlog_state_node2' = @@global.gtid_binlog_state AS gtid_binlog_state_equal; diff --git a/mysql-test/suite/galera/t/galera_log_bin-master.opt b/mysql-test/suite/galera/t/galera_log_bin-master.opt deleted file mode 100644 index 8a755e98b00..00000000000 --- a/mysql-test/suite/galera/t/galera_log_bin-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin --log-slave-updates diff --git a/mysql-test/suite/galera/t/galera_log_bin.cnf b/mysql-test/suite/galera/t/galera_log_bin.cnf new file mode 100644 index 00000000000..8f6a760def0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_log_bin.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin +log-slave-updates + +[mysqld.2] +log-bin +log-slave-updates + diff --git a/mysql-test/suite/galera/t/galera_log_bin.test b/mysql-test/suite/galera/t/galera_log_bin.test index c3d94d15194..f1d2a12b9de 100644 --- a/mysql-test/suite/galera/t/galera_log_bin.test +++ b/mysql-test/suite/galera/t/galera_log_bin.test @@ -1,5 +1,5 @@ --source include/galera_cluster.inc ---source include/have_innodb.inc +--source include/force_restart.inc --connection node_1 reset master; @@ -39,5 +39,4 @@ DROP TABLE t2; --echo #cleanup --connection node_1 RESET MASTER; ---connection node_2 -reset master; + diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.cnf b/mysql-test/suite/galera/t/galera_mdev_13787.cnf new file mode 100644 index 00000000000..ada78e1db2a --- /dev/null +++ b/mysql-test/suite/galera/t/galera_mdev_13787.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +innodb-stats-persistent=1 + +[mysqld.2] +innodb-stats-persistent=1 + + diff --git a/mysql-test/suite/galera/t/galera_mdev_13787.opt b/mysql-test/suite/galera/t/galera_mdev_13787.opt deleted file mode 100644 index 27ec1e3f00e..00000000000 --- a/mysql-test/suite/galera/t/galera_mdev_13787.opt +++ /dev/null @@ -1 +0,0 @@ ---innodb-stats-persistent=1 diff --git a/mysql-test/suite/galera/t/galera_query_cache-master.opt b/mysql-test/suite/galera/t/galera_query_cache-master.opt deleted file mode 100644 index 915a36c0937..00000000000 --- a/mysql-test/suite/galera/t/galera_query_cache-master.opt +++ /dev/null @@ -1 +0,0 @@ ---query_cache_type=1 --query_cache_size=1355776 diff --git a/mysql-test/suite/galera/t/galera_query_cache.cnf b/mysql-test/suite/galera/t/galera_query_cache.cnf new file mode 100644 index 00000000000..80f40b0997e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 +query_cache_size=1355776 + +[mysqld.2] +query_cache_type=1 +query_cache_size=1355776 + diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt b/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt deleted file mode 100644 index 915a36c0937..00000000000 --- a/mysql-test/suite/galera/t/galera_query_cache_sync_wait-master.opt +++ /dev/null @@ -1 +0,0 @@ ---query_cache_type=1 --query_cache_size=1355776 diff --git a/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf new file mode 100644 index 00000000000..80f40b0997e --- /dev/null +++ b/mysql-test/suite/galera/t/galera_query_cache_sync_wait.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 +query_cache_size=1355776 + +[mysqld.2] +query_cache_type=1 +query_cache_size=1355776 + diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt b/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt deleted file mode 100644 index beae84b3862..00000000000 --- a/mysql-test/suite/galera/t/galera_sbr_binlog-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin diff --git a/mysql-test/suite/galera/t/galera_sbr_binlog.cnf b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf new file mode 100644 index 00000000000..9dbd81f758d --- /dev/null +++ b/mysql-test/suite/galera/t/galera_sbr_binlog.cnf @@ -0,0 +1,7 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin + +[mysqld.2] +log-bin diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf index 336296e9bfe..5e6913d4d2b 100644 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf +++ b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.cnf @@ -4,6 +4,8 @@ wsrep_sst_method=mariabackup wsrep_sst_auth="root:" wsrep_debug=ON +innodb-file-format='Barracuda' +innodb-file-per-table=ON [mysqld.1] wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt b/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt deleted file mode 100644 index ae3fb580433..00000000000 --- a/mysql-test/suite/galera/t/galera_sst_mariabackup_table_options.opt +++ /dev/null @@ -1,2 +0,0 @@ ---innodb-file-format='Barracuda' ---innodb-file-per-table=ON diff --git a/mysql-test/suite/galera/t/galera_udf-master.opt b/mysql-test/suite/galera/t/galera_udf-master.opt deleted file mode 100644 index 14dfe3e20bc..00000000000 --- a/mysql-test/suite/galera/t/galera_udf-master.opt +++ /dev/null @@ -1,2 +0,0 @@ -$UDF_EXAMPLE_LIB_OPT ---query_cache_type=1 diff --git a/mysql-test/suite/galera/t/galera_udf.cnf b/mysql-test/suite/galera/t/galera_udf.cnf new file mode 100644 index 00000000000..69d5acd65f3 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_udf.cnf @@ -0,0 +1,15 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +$UDF_EXAMPLE_LIB_OPT +query_cache_type=1 + +[mysqld.2] +query_cache_type=1 + + + + + + + diff --git a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt b/mysql-test/suite/galera/t/galera_v1_row_events-master.opt deleted file mode 100644 index dc82542128e..00000000000 --- a/mysql-test/suite/galera/t/galera_v1_row_events-master.opt +++ /dev/null @@ -1 +0,0 @@ ---log-bin-use-v1-row-events=1 diff --git a/mysql-test/suite/galera/t/galera_v1_row_events.cnf b/mysql-test/suite/galera/t/galera_v1_row_events.cnf new file mode 100644 index 00000000000..b95e321ad4f --- /dev/null +++ b/mysql-test/suite/galera/t/galera_v1_row_events.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +log-bin-use-v1-row-events=1 + +[mysqld.2] + + + + + + + diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf new file mode 100644 index 00000000000..523bae68763 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-auto-increment-control=ON + +[mysqld.2] +wsrep-auto-increment-control=ON + + + + + + diff --git a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt b/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt deleted file mode 100644 index 0a03610888c..00000000000 --- a/mysql-test/suite/galera/t/galera_var_auto_inc_control_on.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-auto-increment-control=ON diff --git a/mysql-test/suite/galera/t/galera_var_dirty_reads.test b/mysql-test/suite/galera/t/galera_var_dirty_reads.test index 3e2108868af..f18069929f9 100644 --- a/mysql-test/suite/galera/t/galera_var_dirty_reads.test +++ b/mysql-test/suite/galera/t/galera_var_dirty_reads.test @@ -3,9 +3,10 @@ # --source include/galera_cluster.inc ---source include/have_innodb.inc --source include/have_perfschema.inc +call mtr.add_suppression("WSREP has not yet prepared node for application use"); + # Save original auto_increment_offset values. --let $node_1=node_1 --let $node_2=node_2 @@ -30,10 +31,10 @@ SHOW STATUS LIKE 'wsrep_ready'; # Must return 'Non-primary' SHOW STATUS LIKE 'wsrep_cluster_status'; ---error ER_UNKNOWN_COM_ERROR +--error ER_UNKNOWN_COM_ERROR,1047 SELECT * FROM t1; ---error ER_UNKNOWN_COM_ERROR +--error ER_UNKNOWN_COM_ERROR,1047 SELECT 1 FROM t1; SET @@session.wsrep_dirty_reads=ON; @@ -45,7 +46,7 @@ SELECT i, variable_name, variable_value FROM t1, information_schema.session_vari SET @@session.wsrep_dirty_reads=OFF; ---error ER_UNKNOWN_COM_ERROR +--error ER_UNKNOWN_COM_ERROR,1047 SELECT i, variable_name, variable_value FROM t1, information_schema.session_variables WHERE variable_name LIKE "wsrep_dirty_reads" AND i = 1; SELECT 1; diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt b/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt deleted file mode 100644 index 70dfc98736b..00000000000 --- a/mysql-test/suite/galera/t/galera_var_notify_cmd-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh --wsrep-sync-wait=0 diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf b/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf new file mode 100644 index 00000000000..69df4f0e7e0 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_notify_cmd=$MYSQL_TEST_DIR/std_data/wsrep_notify.sh +wsrep-sync-wait=0 + +[mysqld.2] + + + + + + diff --git a/mysql-test/suite/galera/t/galera_var_reject_queries.test b/mysql-test/suite/galera/t/galera_var_reject_queries.test index 8b80c04e3be..aa31b94d6e0 100644 --- a/mysql-test/suite/galera/t/galera_var_reject_queries.test +++ b/mysql-test/suite/galera/t/galera_var_reject_queries.test @@ -5,6 +5,8 @@ --source include/galera_cluster.inc --source include/have_innodb.inc +call mtr.add_suppression("WSREP has not yet prepared node for application use"); + CREATE TABLE t1 (f1 INTEGER); --connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 @@ -15,7 +17,7 @@ SET SESSION wsrep_reject_queries = ALL; SET GLOBAL wsrep_reject_queries = ALL; ---error ER_UNKNOWN_COM_ERROR +--error ER_UNKNOWN_COM_ERROR,1047 SELECT * FROM t1; # @@ -30,7 +32,7 @@ SET GLOBAL wsrep_reject_queries = ALL_KILL; SELECT * FROM t1; --connect node_1b, 127.0.0.1, root, , test, $NODE_MYPORT_1 ---error ER_UNKNOWN_COM_ERROR +--error ER_UNKNOWN_COM_ERROR,1047 SELECT * FROM t1; # Confirm that replication continues diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.cnf b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf new file mode 100644 index 00000000000..ff29db2306b --- /dev/null +++ b/mysql-test/suite/galera/t/galera_var_sst_auth.cnf @@ -0,0 +1,12 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_sst_auth=root: + +[mysqld.2] +wsrep_sst_auth=root: + + + + + diff --git a/mysql-test/suite/galera/t/galera_var_sst_auth.opt b/mysql-test/suite/galera/t/galera_var_sst_auth.opt deleted file mode 100644 index 67babbb1ae7..00000000000 --- a/mysql-test/suite/galera/t/galera_var_sst_auth.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep_sst_auth=root: diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt b/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt deleted file mode 100644 index 930c483bd64..00000000000 --- a/mysql-test/suite/galera/t/galera_wsrep_log_conficts-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep_log_conflicts=ON diff --git a/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf new file mode 100644 index 00000000000..440c37bea81 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wsrep_log_conficts.cnf @@ -0,0 +1,12 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep_log_conflicts=ON + +[mysqld.2] +wsrep_log_conflicts=ON + + + + + diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt b/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt deleted file mode 100644 index c31150c46af..00000000000 --- a/mysql-test/suite/galera/t/galera_wsrep_new_cluster-master.opt +++ /dev/null @@ -1 +0,0 @@ ---wsrep-new-cluster diff --git a/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf new file mode 100644 index 00000000000..0acbcfb7843 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_wsrep_new_cluster.cnf @@ -0,0 +1,10 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +wsrep-new-cluster + +[mysqld.2] + + + + diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt b/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt deleted file mode 100644 index a00258bc48c..00000000000 --- a/mysql-test/suite/galera/t/mysql-wsrep#201-master.opt +++ /dev/null @@ -1 +0,0 @@ ---query_cache_type=1 diff --git a/mysql-test/suite/galera/t/mysql-wsrep#201.cnf b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf new file mode 100644 index 00000000000..4a82e9fa037 --- /dev/null +++ b/mysql-test/suite/galera/t/mysql-wsrep#201.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 + +[mysqld.2] +query_cache_type=1 + + diff --git a/mysql-test/suite/galera/t/query_cache.cnf b/mysql-test/suite/galera/t/query_cache.cnf new file mode 100644 index 00000000000..4a82e9fa037 --- /dev/null +++ b/mysql-test/suite/galera/t/query_cache.cnf @@ -0,0 +1,9 @@ +!include ../galera_2nodes.cnf + +[mysqld.1] +query_cache_type=1 + +[mysqld.2] +query_cache_type=1 + + diff --git a/mysql-test/suite/galera/t/query_cache.opt b/mysql-test/suite/galera/t/query_cache.opt deleted file mode 100644 index a00258bc48c..00000000000 --- a/mysql-test/suite/galera/t/query_cache.opt +++ /dev/null @@ -1 +0,0 @@ ---query_cache_type=1 diff --git a/mysql-test/suite/wsrep/disabled.def b/mysql-test/suite/wsrep/disabled.def index fcaf38a3d7b..862056bc83b 100644 --- a/mysql-test/suite/wsrep/disabled.def +++ b/mysql-test/suite/wsrep/disabled.def @@ -9,3 +9,6 @@ # Do not use any TAB characters for whitespace. # ############################################################################## + +foreign_key : MENT-535 Galera test failures on wsrep suite +pool_of_threads : MENT-535 Galera test failures on wsrep suite diff --git a/mysql-test/suite/wsrep/t/pool_of_threads.opt b/mysql-test/suite/wsrep/t/pool_of_threads.opt index 814417e5b0f..6948011b21b 100644 --- a/mysql-test/suite/wsrep/t/pool_of_threads.opt +++ b/mysql-test/suite/wsrep/t/pool_of_threads.opt @@ -1 +1 @@ ---innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads +--innodb_autoinc_lock_mode=2 --wsrep-provider=$WSREP_PROVIDER --wsrep-cluster-address=gcomm:// --thread_handling=pool-of-threads wsrep-on=1 From 2df2238cb86de237c6f57a25adb05dcdce020e8d Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Fri, 21 Dec 2018 17:06:08 -0300 Subject: [PATCH 36/59] Lintian complains on spelling error The lintian check complains on spelling error: https://salsa.debian.org/mariadb-team/mariadb-10.3/-/jobs/95739 --- client/mysqldump.c | 4 ++-- debian/additions/innotop/innotop | 2 +- extra/innochecksum.cc | 4 ++-- extra/mariabackup/innobackupex.cc | 2 +- extra/mariabackup/xtrabackup.cc | 2 +- extra/yassl/src/yassl_error.cpp | 4 ++-- extra/yassl/taocrypt/include/error.hpp | 4 ++-- extra/yassl/taocrypt/src/asn.cpp | 4 ++-- mysql-test/main/create.result | 2 +- mysql-test/main/create.test | 2 +- mysql-test/main/mysqld--help.result | 2 +- mysql-test/main/sp-bugs.result | 2 +- mysql-test/main/sp-bugs.test | 2 +- mysql-test/main/sp-security.test | 2 +- mysql-test/main/type_bit.test | 2 +- mysql-test/suite/compat/oracle/r/func_misc.result | 12 ++++++------ mysql-test/suite/funcs_1/views/views_master.inc | 2 +- .../innodb/r/innodb_skip_innodb_is_tables.result | 2 +- mysql-test/suite/rpl/r/rpl_mdev-11092.result | 2 +- mysql-test/suite/rpl/t/rpl_mdev-11092.test | 2 +- .../sys_vars/r/sysvars_server_notembedded.result | 2 +- .../suite/sys_vars/t/ft_boolean_syntax_basic.test | 2 +- mysql-test/suite/sys_vars/t/init_connect_basic.test | 2 +- mysql-test/suite/sys_vars/t/init_slave_basic.test | 2 +- mysql-test/suite/sys_vars/t/timestamp_basic.test | 2 +- pcre/ChangeLog | 2 +- pcre/doc/html/pcredemo.html | 4 ++-- pcre/doc/html/pcrejit.html | 2 +- pcre/doc/pcre.txt | 2 +- pcre/doc/pcredemo.3 | 4 ++-- pcre/doc/pcrejit.3 | 2 +- pcre/pcre_compile.c | 2 +- pcre/pcre_internal.h | 2 +- pcre/pcredemo.c | 4 ++-- scripts/mysql_system_tables_data.sql | 2 +- sql-bench/bench-init.pl.sh | 2 +- sql-common/client.c | 2 +- sql/ha_partition.cc | 4 ++-- sql/ha_sequence.cc | 2 +- sql/handler.h | 4 ++-- sql/item.cc | 4 ++-- sql/item_cmpfunc.cc | 2 +- sql/item_strfunc.cc | 2 +- sql/lex.h | 2 +- sql/log_event.h | 2 +- sql/log_event_old.cc | 4 ++-- sql/mysql_upgrade_service.cc | 2 +- sql/opt_subselect.cc | 2 +- sql/rpl_mi.cc | 2 +- sql/session_tracker.cc | 4 ++-- sql/share/errmsg-utf8.txt | 4 ++-- sql/sql_admin.cc | 2 +- sql/sql_db.cc | 4 ++-- sql/sql_join_cache.cc | 2 +- sql/sql_repl.cc | 4 ++-- sql/sql_select.cc | 2 +- sql/sql_servers.cc | 4 ++-- sql/sys_vars.cc | 2 +- sql/table.h | 2 +- sql/threadpool_common.cc | 2 +- sql/wsrep_hton.cc | 6 +++--- storage/connect/filamzip.cpp | 2 +- storage/connect/ha_connect.cc | 4 ++-- storage/connect/javaconn.cpp | 2 +- storage/example/ha_example.cc | 4 ++-- storage/federatedx/AUTHORS | 2 +- storage/innobase/fil/fil0fil.cc | 2 +- storage/innobase/include/fil0fil.h | 2 +- storage/innobase/include/fil0fil.ic | 2 +- storage/innobase/row/row0sel.cc | 4 ++-- storage/innobase/srv/srv0mon.cc | 2 +- storage/maria/ha_maria.cc | 2 +- storage/maria/ma_close.c | 2 +- storage/maria/trnman.c | 2 +- storage/myisam/ha_myisam.cc | 2 +- storage/perfschema/pfs_timer.h | 2 +- .../mysql-test/rocksdb/t/lock_rows_not_exist.test | 2 +- storage/sphinx/ha_sphinx.cc | 2 +- storage/tokudb/PerconaFT/ft/loader/loader.cc | 4 ++-- storage/tokudb/mysql-test/tokudb/t/type_bit.test | 2 +- wsrep/wsrep_api.h | 2 +- zlib/zlib.h | 2 +- 82 files changed, 110 insertions(+), 110 deletions(-) diff --git a/client/mysqldump.c b/client/mysqldump.c index fff90b1d9e1..d4932094dac 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -4548,7 +4548,7 @@ static int dump_databases(char **db_names) /* -View Specific database initalization. +View Specific database initialization. SYNOPSIS init_dumping_views @@ -4565,7 +4565,7 @@ int init_dumping_views(char *qdatabase __attribute__((unused))) /* -Table Specific database initalization. +Table Specific database initialization. SYNOPSIS init_dumping_tables diff --git a/debian/additions/innotop/innotop b/debian/additions/innotop/innotop index eb4b3590cf6..399a393e67b 100644 --- a/debian/additions/innotop/innotop +++ b/debian/additions/innotop/innotop @@ -1607,7 +1607,7 @@ my %exprs = ( my %columns = ( active_secs => { hdr => 'SecsActive', num => 1, label => 'Seconds transaction has been active', }, - add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additonal pool allocated' }, + add_pool_alloc => { hdr => 'Add\'l Pool', num => 1, label => 'Additional pool allocated' }, attempted_op => { hdr => 'Action', num => 0, label => 'The action that caused the error' }, awe_mem_alloc => { hdr => 'AWE Memory', num => 1, label => '[Windows] AWE memory allocated' }, binlog_cache_overflow => { hdr => 'Binlog Cache', num => 1, label => 'Transactions too big for binlog cache that went to disk' }, diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index 591527aacd0..73f62c26dd2 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -349,7 +349,7 @@ error_message( /***********************************************//* @param>>_______[in] name>_____name of file. - @retval file pointer; file pointer is NULL when error occured. + @retval file pointer; file pointer is NULL when error occurred. */ FILE* @@ -1136,7 +1136,7 @@ parse_page( /** @param [in/out] file_name name of the filename -@retval FILE pointer if successfully created else NULL when error occured. +@retval FILE pointer if successfully created else NULL when error occurred. */ FILE* create_file( diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 952d1f4ec63..38b1bcb6f58 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -716,7 +716,7 @@ The --decompress command will decompress a backup made\n\ with the --compress option. The\n\ --parallel option will allow multiple files to be decompressed\n\ simultaneously. In order to decompress, the qpress utility MUST be installed\n\ -and accessable within the path. This process will remove the original\n\ +and accessible within the path. This process will remove the original\n\ compressed files and leave the results in the same location.\n\ \n\ On success the exit code innobackupex is 0. A non-zero exit code \n\ diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index bd8ec97deb7..0af0e8eae7b 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1969,7 +1969,7 @@ static bool innodb_init_param() return false; error: - msg("mariabackup: innodb_init_param(): Error occured.\n"); + msg("mariabackup: innodb_init_param(): Error occurred.\n"); return true; } diff --git a/extra/yassl/src/yassl_error.cpp b/extra/yassl/src/yassl_error.cpp index bb3825ca972..61dbbfcee65 100644 --- a/extra/yassl/src/yassl_error.cpp +++ b/extra/yassl/src/yassl_error.cpp @@ -242,11 +242,11 @@ void SetErrorString(YasslError error, char* buffer) strncpy(buffer, "ASN: bad Signature Length", max); break; - case UNKOWN_SIG_E : + case UNKNOWN_SIG_E : strncpy(buffer, "ASN: unknown signature OID", max); break; - case UNKOWN_HASH_E : + case UNKNOWN_HASH_E : strncpy(buffer, "ASN: unknown hash OID", max); break; diff --git a/extra/yassl/taocrypt/include/error.hpp b/extra/yassl/taocrypt/include/error.hpp index a749c00d80d..080542a5195 100644 --- a/extra/yassl/taocrypt/include/error.hpp +++ b/extra/yassl/taocrypt/include/error.hpp @@ -58,8 +58,8 @@ TIME_E = 1030, // "bad TIME" DATE_SZ_E = 1031, // "bad Date Size" SIG_LEN_E = 1032, // "bad Signature Length" -UNKOWN_SIG_E = 1033, // "unknown signature OID" -UNKOWN_HASH_E = 1034, // "unknown hash OID" +UNKNOWN_SIG_E = 1033, // "unknown signature OID" +UNKNOWN_HASH_E = 1034, // "unknown hash OID" DSA_SZ_E = 1035, // "bad DSA r or s size" BEFORE_DATE_E = 1036, // "before date in the future" AFTER_DATE_E = 1037, // "after date in the past" diff --git a/extra/yassl/taocrypt/src/asn.cpp b/extra/yassl/taocrypt/src/asn.cpp index 0a677c4b0f8..ed073567193 100644 --- a/extra/yassl/taocrypt/src/asn.cpp +++ b/extra/yassl/taocrypt/src/asn.cpp @@ -1007,7 +1007,7 @@ bool CertDecoder::ConfirmSignature(Source& pub) } #endif else { - source_.SetError(UNKOWN_SIG_E); + source_.SetError(UNKNOWN_SIG_E); return false; } @@ -1132,7 +1132,7 @@ word32 DER_Encoder::SetAlgoID(HashType aOID, byte* output) break; default: - error_.SetError(UNKOWN_HASH_E); + error_.SetError(UNKNOWN_HASH_E); return 0; } diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index d490457dd62..f0ea2f4d237 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -945,7 +945,7 @@ drop table t1; Bug #26104 Bug on foreign key class constructor -Check that ref_columns is initalized correctly in the constructor +Check that ref_columns is initialized correctly in the constructor and semantic checks in mysql_prepare_table work. We do not need a storage engine that supports foreign keys diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test index 6b91a84197f..7611505b9ef 100644 --- a/mysql-test/main/create.test +++ b/mysql-test/main/create.test @@ -846,7 +846,7 @@ drop table t1; --echo --echo Bug #26104 Bug on foreign key class constructor --echo ---echo Check that ref_columns is initalized correctly in the constructor +--echo Check that ref_columns is initialized correctly in the constructor --echo and semantic checks in mysql_prepare_table work. --echo --echo We do not need a storage engine that supports foreign keys diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 2a1455b05b0..067348eeb45 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -1069,7 +1069,7 @@ The following specify which files/extra groups are read (specified before remain disable; STATE to track just transaction state (Is there an active transaction? Does it have any data? etc.); CHARACTERISTICS to track transaction state and report all - statements needed to start a transaction withthe same + statements needed to start a transaction with the same characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). diff --git a/mysql-test/main/sp-bugs.result b/mysql-test/main/sp-bugs.result index a699cd11c5a..60cb6a89cde 100644 --- a/mysql-test/main/sp-bugs.result +++ b/mysql-test/main/sp-bugs.result @@ -1,5 +1,5 @@ # -# Bug #47412: Valgrind warnings / user can read uninitalized memory +# Bug #47412: Valgrind warnings / user can read uninitialized memory # using SP variables # CREATE SCHEMA testdb; diff --git a/mysql-test/main/sp-bugs.test b/mysql-test/main/sp-bugs.test index 2dd70d28249..d7b88bbeeec 100644 --- a/mysql-test/main/sp-bugs.test +++ b/mysql-test/main/sp-bugs.test @@ -1,7 +1,7 @@ # Test file for stored procedure bugfixes --echo # ---echo # Bug #47412: Valgrind warnings / user can read uninitalized memory +--echo # Bug #47412: Valgrind warnings / user can read uninitialized memory --echo # using SP variables --echo # diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test index 30d7e4cf895..622c75c48f7 100644 --- a/mysql-test/main/sp-security.test +++ b/mysql-test/main/sp-security.test @@ -342,7 +342,7 @@ flush privileges; drop table t1; # -# Bug#9503 reseting correct parameters of thread after error in SP function +# Bug#9503 resetting correct parameters of thread after error in SP function # connect (root,localhost,root,,test); connection root; diff --git a/mysql-test/main/type_bit.test b/mysql-test/main/type_bit.test index 012fa2236d7..216995fc479 100644 --- a/mysql-test/main/type_bit.test +++ b/mysql-test/main/type_bit.test @@ -262,7 +262,7 @@ select hex(a), b from t1; drop table t1; # -# type was not properly initalized, which caused key_copy to fail +# type was not properly initialized, which caused key_copy to fail # create table t1(bit_field bit(2), int_field int, key a(bit_field)); diff --git a/mysql-test/suite/compat/oracle/r/func_misc.result b/mysql-test/suite/compat/oracle/r/func_misc.result index f285423b446..ffb9e10110d 100644 --- a/mysql-test/suite/compat/oracle/r/func_misc.result +++ b/mysql-test/suite/compat/oracle/r/func_misc.result @@ -32,7 +32,7 @@ CALL p1('SELECT 1'); 1 1 'Error1: ' || SQLCODE || ' ' || SQLERRM -Error1: 0 normal, successful completition +Error1: 0 normal, successful completion CALL p1('xxx'); 'Error2: ' || SQLCODE || ' ' || SQLERRM Error2: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1 @@ -40,7 +40,7 @@ CALL p1('SELECT 1'); 1 1 'Error1: ' || SQLCODE || ' ' || SQLERRM -Error1: 0 normal, successful completition +Error1: 0 normal, successful completion DROP PROCEDURE p1; # # SQLCODE and SQLERRM hidden by local variables @@ -219,7 +219,7 @@ f1() Exception|1329 No data - zero rows fetched, selected, or processed SELECT f2() FROM DUAL; f2() -Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completition +Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completion DROP TABLE t1; DROP FUNCTION f2; DROP FUNCTION f1; @@ -246,7 +246,7 @@ f1() Exception|1329 No data - zero rows fetched, selected, or processed SELECT f2() FROM DUAL; f2() -Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completition +Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completion DROP TABLE t1; DROP FUNCTION f2; DROP FUNCTION f1; @@ -274,7 +274,7 @@ END; $$ SELECT f2() FROM DUAL; f2() -Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completition +Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completion DROP FUNCTION f2; DROP PROCEDURE p1; DROP TABLE t1; @@ -299,7 +299,7 @@ END; $$ SELECT f2() FROM DUAL; f2() -Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completition +Exception|1329 No data - zero rows fetched, selected, or processed|0 normal, successful completion DROP FUNCTION f2; DROP PROCEDURE p1; DROP TABLE t1; diff --git a/mysql-test/suite/funcs_1/views/views_master.inc b/mysql-test/suite/funcs_1/views/views_master.inc index 17f5c1e5529..573d72022fb 100644 --- a/mysql-test/suite/funcs_1/views/views_master.inc +++ b/mysql-test/suite/funcs_1/views/views_master.inc @@ -764,7 +764,7 @@ CREATE VIEW test.v2 AS SELECT * FROM test.t0; CREATE VIEW test2.v2 AS SELECT * FROM test2.t0; # Some additional tests on the just created objects to show that they are -# accessable and do have the expected content. +# accessible and do have the expected content. # INSERTs with full qualified table INSERT INTO test.t1 VALUES('test.t1 - 1'); INSERT INTO test2.t1 VALUES('test2.t1 - 1'); diff --git a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result index 75069db5997..015bfe9dcef 100644 --- a/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result +++ b/mysql-test/suite/innodb/r/innodb_skip_innodb_is_tables.result @@ -97,7 +97,7 @@ buffer_LRU_batch_flush_avg_time_thread buffer 0 NULL NULL NULL 0 NULL NULL NULL buffer_flush_adaptive_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for adaptive flushing recently. buffer_LRU_batch_flush_avg_time_est buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Estimated time (ms) spent for LRU batch flushing recently. buffer_flush_avg_time buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Avg time (ms) spent for flushing recently. -buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Numner of adaptive flushes passed during the recent Avg period. +buffer_flush_adaptive_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of adaptive flushes passed during the recent Avg period. buffer_LRU_batch_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of LRU batch flushes passed during the recent Avg period. buffer_flush_avg_pass buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Number of flushes passed during the recent Avg period. buffer_LRU_get_free_loops buffer 0 NULL NULL NULL 0 NULL NULL NULL NULL NULL NULL NULL disabled counter Total loops in LRU get free. diff --git a/mysql-test/suite/rpl/r/rpl_mdev-11092.result b/mysql-test/suite/rpl/r/rpl_mdev-11092.result index 90b809477b2..8bc8fe4a20b 100644 --- a/mysql-test/suite/rpl/r/rpl_mdev-11092.result +++ b/mysql-test/suite/rpl/r/rpl_mdev-11092.result @@ -1,7 +1,7 @@ include/master-slave.inc [connection master] call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); SET GLOBAL max_binlog_cache_size = 4096; SET GLOBAL binlog_cache_size = 4096; SET GLOBAL max_binlog_stmt_cache_size = 4096; diff --git a/mysql-test/suite/rpl/t/rpl_mdev-11092.test b/mysql-test/suite/rpl/t/rpl_mdev-11092.test index 31a385b40e6..782d24803c7 100644 --- a/mysql-test/suite/rpl/t/rpl_mdev-11092.test +++ b/mysql-test/suite/rpl/t/rpl_mdev-11092.test @@ -6,7 +6,7 @@ ######################################################################################## call mtr.add_suppression("Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT"); -call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occured on the master. .*"); +call mtr.add_suppression("Slave SQL: The incident LOST_EVENTS occurred on the master. .*"); let $old_max_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "max_binlog_cache_size", Value, 1); let $old_binlog_cache_size= query_get_value(SHOW VARIABLES LIKE "binlog_cache_size", Value, 1); diff --git a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result index 93d0cac7f24..6a85883b9f1 100644 --- a/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result +++ b/mysql-test/suite/sys_vars/r/sysvars_server_notembedded.result @@ -3355,7 +3355,7 @@ COMMAND_LINE_ARGUMENT REQUIRED VARIABLE_NAME SESSION_TRACK_TRANSACTION_INFO VARIABLE_SCOPE SESSION VARIABLE_TYPE ENUM -VARIABLE_COMMENT Track changes to the transaction attributes. OFF to disable; STATE to track just transaction state (Is there an active transaction? Does it have any data? etc.); CHARACTERISTICS to track transaction state and report all statements needed to start a transaction withthe same characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). +VARIABLE_COMMENT Track changes to the transaction attributes. OFF to disable; STATE to track just transaction state (Is there an active transaction? Does it have any data? etc.); CHARACTERISTICS to track transaction state and report all statements needed to start a transaction with the same characteristics (isolation level, read only/read write,snapshot - but not any work done / data modified within the transaction). NUMERIC_MIN_VALUE NULL NUMERIC_MAX_VALUE NULL NUMERIC_BLOCK_SIZE NULL diff --git a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test index 454b5d7477e..1d925a5e8c1 100644 --- a/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test +++ b/mysql-test/suite/sys_vars/t/ft_boolean_syntax_basic.test @@ -64,7 +64,7 @@ SELECT @@global.ft_boolean_syntax; --echo '#--------------------FN_DYNVARS_033_03-------------------------#' ###################################################################### -# see if it is accessable using session scope # +# see if it is accessible using session scope # ###################################################################### --Error ER_GLOBAL_VARIABLE SET @@session.ft_boolean_syntax = '# -><()!*:""&|'; diff --git a/mysql-test/suite/sys_vars/t/init_connect_basic.test b/mysql-test/suite/sys_vars/t/init_connect_basic.test index b2f2cb92e40..6aba83d3675 100644 --- a/mysql-test/suite/sys_vars/t/init_connect_basic.test +++ b/mysql-test/suite/sys_vars/t/init_connect_basic.test @@ -66,7 +66,7 @@ SELECT @@global.init_connect; --echo '#--------------------FN_DYNVARS_036_03-------------------------#' ###################################################################### -# see if it is accessable using session scope # +# see if it is accessible using session scope # ###################################################################### --Error ER_GLOBAL_VARIABLE SET @@session.init_connect = ''; diff --git a/mysql-test/suite/sys_vars/t/init_slave_basic.test b/mysql-test/suite/sys_vars/t/init_slave_basic.test index b137a525090..4dd7fd80d82 100644 --- a/mysql-test/suite/sys_vars/t/init_slave_basic.test +++ b/mysql-test/suite/sys_vars/t/init_slave_basic.test @@ -66,7 +66,7 @@ SELECT @@global.init_slave; --echo '#--------------------FN_DYNVARS_037_03-------------------------#' ###################################################################### -# see if it is accessable using session scope # +# see if it is accessible using session scope # ###################################################################### --Error ER_GLOBAL_VARIABLE SET @@session.init_slave = ''; diff --git a/mysql-test/suite/sys_vars/t/timestamp_basic.test b/mysql-test/suite/sys_vars/t/timestamp_basic.test index 8b26622443d..5f780e7ab40 100644 --- a/mysql-test/suite/sys_vars/t/timestamp_basic.test +++ b/mysql-test/suite/sys_vars/t/timestamp_basic.test @@ -47,7 +47,7 @@ SELECT floor(@@timestamp) = UNIX_TIMESTAMP(), @@timestamp = UNIX_TIMESTAMP(NOW(6 --echo '#---------------------FN_DYNVARS_001_02-------------------------#' ############################################################## -# see if accessable using global scope # +# see if accessible using global scope # ############################################################## --Error ER_LOCAL_VARIABLE diff --git a/pcre/ChangeLog b/pcre/ChangeLog index e4d2d9fa24c..3973337fe35 100644 --- a/pcre/ChangeLog +++ b/pcre/ChangeLog @@ -1605,7 +1605,7 @@ Version 8.21 12-Dec-2011 are added as well. 3. Fix cache-flush issue on PowerPC (It is still an experimental JIT port). - PCRE_EXTRA_TABLES is not suported by JIT, and should be checked before + PCRE_EXTRA_TABLES is not supported by JIT, and should be checked before calling _pcre_jit_exec. Some extra comments are added. 4. (*MARK) settings inside atomic groups that do not contain any capturing diff --git a/pcre/doc/html/pcredemo.html b/pcre/doc/html/pcredemo.html index 894a9308261..d84c5c8c99c 100644 --- a/pcre/doc/html/pcredemo.html +++ b/pcre/doc/html/pcredemo.html @@ -161,7 +161,7 @@ if (rc < 0) return 1; } -/* Match succeded */ +/* Match succeeded */ printf("\nMatch succeeded at offset %d\n", ovector[0]); @@ -379,7 +379,7 @@ for (;;) return 1; } - /* Match succeded */ + /* Match succeeded */ printf("\nMatch succeeded again at offset %d\n", ovector[0]); diff --git a/pcre/doc/html/pcrejit.html b/pcre/doc/html/pcrejit.html index abb342522f9..c1e0310defc 100644 --- a/pcre/doc/html/pcrejit.html +++ b/pcre/doc/html/pcrejit.html @@ -299,7 +299,7 @@ recommended. This is a suggestion for how a multithreaded program that needs to set up non-default JIT stacks might operate:
-  During thread initalization
+  During thread initialization
     thread_local_var = pcre_jit_stack_alloc(...)
 
   During thread exit
diff --git a/pcre/doc/pcre.txt b/pcre/doc/pcre.txt
index c027538f500..f4302bd7ee8 100644
--- a/pcre/doc/pcre.txt
+++ b/pcre/doc/pcre.txt
@@ -8578,7 +8578,7 @@ CONTROLLING THE JIT STACK
        This  is a suggestion for how a multithreaded program that needs to set
        up non-default JIT stacks might operate:
 
-         During thread initalization
+         During thread initialization
            thread_local_var = pcre_jit_stack_alloc(...)
 
          During thread exit
diff --git a/pcre/doc/pcredemo.3 b/pcre/doc/pcredemo.3
index 194629b1fac..4115ef1e36e 100644
--- a/pcre/doc/pcredemo.3
+++ b/pcre/doc/pcredemo.3
@@ -161,7 +161,7 @@ if (rc < 0)
   return 1;
   }
 
-/* Match succeded */
+/* Match succeeded */
 
 printf("\enMatch succeeded at offset %d\en", ovector[0]);
 
@@ -379,7 +379,7 @@ for (;;)
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\enMatch succeeded again at offset %d\en", ovector[0]);
 
diff --git a/pcre/doc/pcrejit.3 b/pcre/doc/pcrejit.3
index 3b785f0f631..fe42db56170 100644
--- a/pcre/doc/pcrejit.3
+++ b/pcre/doc/pcrejit.3
@@ -285,7 +285,7 @@ recommended.
 This is a suggestion for how a multithreaded program that needs to set up
 non-default JIT stacks might operate:
 .sp
-  During thread initalization
+  During thread initialization
     thread_local_var = pcre_jit_stack_alloc(...)
 .sp
   During thread exit
diff --git a/pcre/pcre_compile.c b/pcre/pcre_compile.c
index 734875de2fb..c32b0226162 100644
--- a/pcre/pcre_compile.c
+++ b/pcre/pcre_compile.c
@@ -8352,7 +8352,7 @@ save_hwm_offset = cd->hwm - cd->start_workspace;
 /* Accumulate the length for use in the pre-compile phase. Start with the
 length of the BRA and KET and any extra bytes that are required at the
 beginning. We accumulate in a local variable to save frequent testing of
-lenthptr for NULL. We cannot do this by looking at the value of code at the
+lengthptr for NULL. We cannot do this by looking at the value of code at the
 start and end of each alternative, because compiled items are discarded during
 the pre-compile phase so that the work space is not exceeded. */
 
diff --git a/pcre/pcre_internal.h b/pcre/pcre_internal.h
index 97ff55d03b3..b1e096ceb3d 100644
--- a/pcre/pcre_internal.h
+++ b/pcre/pcre_internal.h
@@ -2188,7 +2188,7 @@ regex. The lengths are used when searching for specific things, and also in the
 debugging printing of a compiled regex. We use a macro so that it can be
 defined close to the definitions of the opcodes themselves.
 
-As things have been extended, some of these are no longer fixed lenths, but are
+As things have been extended, some of these are no longer fixed lengths, but are
 minima instead. For example, the length of a single-character repeat may vary
 in UTF-8 mode. The code that uses this table must know about such things. */
 
diff --git a/pcre/pcredemo.c b/pcre/pcredemo.c
index 946aba45cdc..1ca77f1537a 100644
--- a/pcre/pcredemo.c
+++ b/pcre/pcredemo.c
@@ -144,7 +144,7 @@ if (rc < 0)
   return 1;
   }
 
-/* Match succeded */
+/* Match succeeded */
 
 printf("\nMatch succeeded at offset %d\n", ovector[0]);
 
@@ -362,7 +362,7 @@ for (;;)
     return 1;
     }
 
-  /* Match succeded */
+  /* Match succeeded */
 
   printf("\nMatch succeeded again at offset %d\n", ovector[0]);
 
diff --git a/scripts/mysql_system_tables_data.sql b/scripts/mysql_system_tables_data.sql
index e708704a1fe..3a6c29b7674 100644
--- a/scripts/mysql_system_tables_data.sql
+++ b/scripts/mysql_system_tables_data.sql
@@ -14,7 +14,7 @@
 -- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335  USA
 
 --
--- The inital data for system tables of MySQL Server
+-- The initial data for system tables of MySQL Server
 --
 
 -- When setting up a "cross bootstrap" database (e.g., creating data on a Unix
diff --git a/sql-bench/bench-init.pl.sh b/sql-bench/bench-init.pl.sh
index 1b6509cebcc..a6a12603e6d 100644
--- a/sql-bench/bench-init.pl.sh
+++ b/sql-bench/bench-init.pl.sh
@@ -566,7 +566,7 @@ All benchmarks takes the following options:
   When using --fast the suffix is automaticly set to '_fast'.
 
 --random
-  Inform test suite that we are generate random inital values for sequence of
+  Inform test suite that we are generate random initial values for sequence of
   test executions. It should be used for imitation of real conditions.
 
 --threads=#  **DEPRECATED**
diff --git a/sql-common/client.c b/sql-common/client.c
index eea6122535a..6d3b5a69b44 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -3527,7 +3527,7 @@ my_bool mysql_reconnect(MYSQL *mysql)
   if (ctxt)
     my_context_install_suspend_resume_hook(ctxt, NULL, NULL);
 
-  DBUG_PRINT("info", ("reconnect succeded"));
+  DBUG_PRINT("info", ("reconnect succeeded"));
   tmp_mysql.reconnect= 1;
   tmp_mysql.free_me= mysql->free_me;
 
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 2dcf2996bf7..09aef634c94 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -564,7 +564,7 @@ bool ha_partition::initialize_partition(MEM_ROOT *mem_root)
     point.
 
     If you do not implement this, the default delete_table() is called from
-    handler.cc and it will delete all files with the file extentions returned
+    handler.cc and it will delete all files with the file extensions returned
     by bas_ext().
 
     Called from handler.cc by delete_table and  ha_create_table(). Only used
@@ -596,7 +596,7 @@ int ha_partition::delete_table(const char *name)
     Renames a table from one name to another from alter table call.
 
     If you do not implement this, the default rename_table() is called from
-    handler.cc and it will rename all files with the file extentions returned
+    handler.cc and it will rename all files with the file extensions returned
     by bas_ext().
 
     Called from sql_table.cc by mysql_rename_table().
diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc
index 65bb0daf8cf..4fa075444d8 100644
--- a/sql/ha_sequence.cc
+++ b/sql/ha_sequence.cc
@@ -108,7 +108,7 @@ int ha_sequence::open(const char *name, int mode, uint flags)
       MY_TEST(flags & HA_OPEN_INTERNAL_TABLE);
     reset_statistics();
 
-    /* Don't try to read the inital row the call is part of create code */
+    /* Don't try to read the initial row the call is part of create code */
     if (!(flags & (HA_OPEN_FOR_CREATE | HA_OPEN_FOR_REPAIR)))
     {
       if (unlikely((error= table->s->sequence->read_initial_values(table))))
diff --git a/sql/handler.h b/sql/handler.h
index 345e0bc1f00..e3bfcaa1ed2 100644
--- a/sql/handler.h
+++ b/sql/handler.h
@@ -1490,9 +1490,9 @@ struct handlerton
      Used by open_table_error(), by the default rename_table and delete_table
      handler methods, and by the default discovery implementation.
   
-     For engines that have more than one file name extentions (separate
+     For engines that have more than one file name extensions (separate
      metadata, index, and/or data files), the order of elements is relevant.
-     First element of engine file name extentions array should be metadata
+     First element of engine file name extensions array should be metadata
      file extention. This is implied by the open_table_error()
      and the default discovery implementation.
      
diff --git a/sql/item.cc b/sql/item.cc
index ca93c71cd7b..2a5e7253cbd 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -2797,7 +2797,7 @@ bool Type_std_attributes::agg_item_set_converter(const DTCollation &coll,
       
    @retval
      clone of the item
-     0 if an error occured
+     0 if an error occurred
 */ 
 
 Item* Item_func_or_sum::build_clone(THD *thd)
@@ -3097,7 +3097,7 @@ Item_sp::init_result_field(THD *thd, uint max_length, uint maybe_null,
       
    @retval
      clone of the item
-     0 if an error occured
+     0 if an error occurred
 */ 
 
 Item* Item_ref::build_clone(THD *thd)
diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc
index f35b68c15a6..ee371b8f896 100644
--- a/sql/item_cmpfunc.cc
+++ b/sql/item_cmpfunc.cc
@@ -4976,7 +4976,7 @@ void Item_cond::neg_arguments(THD *thd)
       
    @retval
      clone of the item
-     0 if an error occured
+     0 if an error occurred
 */ 
 
 Item *Item_cond::build_clone(THD *thd)
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 4fb83960bc9..78857f377f5 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2404,7 +2404,7 @@ String *Item_func_sqlerrm::val_str(String *str)
               system_charset_info);
     return str;
   }
-  str->copy(STRING_WITH_LEN("normal, successful completition"),
+  str->copy(STRING_WITH_LEN("normal, successful completion"),
             system_charset_info);
   return str;
 }
diff --git a/sql/lex.h b/sql/lex.h
index a8b7000d6da..070ac5cc147 100644
--- a/sql/lex.h
+++ b/sql/lex.h
@@ -23,7 +23,7 @@
 #include "lex_symbol.h"
 
 SYM_GROUP sym_group_common= {"", ""};
-SYM_GROUP sym_group_geom= {"Spatial extentions", "HAVE_SPATIAL"};
+SYM_GROUP sym_group_geom= {"Spatial extensions", "HAVE_SPATIAL"};
 SYM_GROUP sym_group_rtree= {"RTree keys", "HAVE_RTREE_KEYS"};
 
 /* We don't want to include sql_yacc.h into gen_lex_hash */
diff --git a/sql/log_event.h b/sql/log_event.h
index a12dfbc6c48..20c09814464 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -3590,7 +3590,7 @@ public:
   bool write_data_header();
   bool write_data_body();
   /*
-    Cut out Create_file extentions and
+    Cut out Create_file extensions and
     write it as Load event - used on the slave
   */
   bool write_base();
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 829a278f215..e01488abbb3 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -835,7 +835,7 @@ int Write_rows_log_event_old::do_after_row_operations(TABLE *table, int error)
   table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
   table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
   /*
-    reseting the extra with 
+    resetting the extra with 
     table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY); 
     fires bug#27077
     todo: explain or fix
@@ -2459,7 +2459,7 @@ Write_rows_log_event_old::do_after_row_operations(const Slave_reporting_capabili
   m_table->file->extra(HA_EXTRA_NO_IGNORE_DUP_KEY);
   m_table->file->extra(HA_EXTRA_WRITE_CANNOT_REPLACE);
   /*
-    reseting the extra with 
+    resetting the extra with 
     table->file->extra(HA_EXTRA_NO_IGNORE_NO_KEY); 
     fires bug#27077
     todo: explain or fix
diff --git a/sql/mysql_upgrade_service.cc b/sql/mysql_upgrade_service.cc
index 06bd543f72f..b3683618e6e 100644
--- a/sql/mysql_upgrade_service.cc
+++ b/sql/mysql_upgrade_service.cc
@@ -134,7 +134,7 @@ static void die(const char *fmt, ...)
   }
 
   /*
-    Stop service that we started, if it was not initally running at
+    Stop service that we started, if it was not initially running at
     program start.
   */
   if (initial_service_state != UINT_MAX && initial_service_state != SERVICE_RUNNING)
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index a8afd952a4d..a4ee27950be 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -4399,7 +4399,7 @@ SJ_TMP_TABLE::create_sj_weedout_tmp_table(THD *thd)
     field->reset();
     /*
       Test if there is a default field value. The test for ->ptr is to skip
-      'offset' fields generated by initalize_tables
+      'offset' fields generated by initialize_tables
     */
     // Initialize the table field:
     bzero(field->ptr, field->pack_length());
diff --git a/sql/rpl_mi.cc b/sql/rpl_mi.cc
index 3542933318a..87bb995ba9a 100644
--- a/sql/rpl_mi.cc
+++ b/sql/rpl_mi.cc
@@ -1173,7 +1173,7 @@ bool Master_info_index::init_all_master_info()
     }
     else
     {
-      /* Initialization of Master_info succeded. Add it to HASH */
+      /* Initialization of Master_info succeeded. Add it to HASH */
       if (global_system_variables.log_warnings > 1)
         sql_print_information("Initialized Master_info from '%s'",
                               buf_master_info_file);
diff --git a/sql/session_tracker.cc b/sql/session_tracker.cc
index 778b65889a0..45d7db91fb4 100644
--- a/sql/session_tracker.cc
+++ b/sql/session_tracker.cc
@@ -810,7 +810,7 @@ bool Transaction_state_tracker::store(THD *thd, String *buf)
         statement even for a transaction that isn't the first in an
         ongoing chain. Consider
 
-          SET TRANSACTION ISOLATION LEVEL READ UNCOMMITED;
+          SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
           START TRANSACTION READ ONLY, WITH CONSISTENT SNAPSHOT;
           # work
           COMMIT AND CHAIN;
@@ -818,7 +818,7 @@ bool Transaction_state_tracker::store(THD *thd, String *buf)
         If we switch away at this point, the replay in the new session
         needs to be
 
-          SET TRANSACTION ISOLATION LEVEL READ UNCOMMITED;
+          SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
           START TRANSACTION READ ONLY;
 
         When a transaction ends (COMMIT/ROLLBACK sans CHAIN), all
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 07b6df38c86..e3c1accc058 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -7455,7 +7455,7 @@ ER_GIS_UNSUPPORTED_ARGUMENT
   eng "Calling geometry function %s with unsupported types of arguments."
 
 ER_GIS_UNKNOWN_ERROR
-  eng "Unknown GIS error occured in function %s."
+  eng "Unknown GIS error occurred in function %s."
 
 ER_GIS_UNKNOWN_EXCEPTION
   eng "Unknown exception caught in GIS function %s."
@@ -7869,7 +7869,7 @@ ER_DROP_VERSIONING_SYSTEM_TIME_PARTITION
         eng "Can not DROP SYSTEM VERSIONING for table %`s partitioned BY SYSTEM_TIME"
 
 ER_VERS_DB_NOT_SUPPORTED
-      eng "System versioning tables in the %`s database are not suported"
+      eng "System versioning tables in the %`s database are not supported"
 
 ER_VERS_TRT_IS_DISABLED
         eng "Transaction registry is disabled"
diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc
index dde194053b9..92e88a74217 100644
--- a/sql/sql_admin.cc
+++ b/sql/sql_admin.cc
@@ -175,7 +175,7 @@ static int prepare_for_repair(THD *thd, TABLE_LIST *table_list,
   /*
     Check if this is a table type that stores index and data separately,
     like ISAM or MyISAM. We assume fixed order of engine file name
-    extentions array. First element of engine file name extentions array
+    extensions array. First element of engine file name extensions array
     is meta/index file extention. Second element - data file extention. 
   */
   ext= table->file->bas_ext();
diff --git a/sql/sql_db.cc b/sql/sql_db.cc
index 604d6da6606..7b1ca52239c 100644
--- a/sql/sql_db.cc
+++ b/sql/sql_db.cc
@@ -50,7 +50,7 @@
 #define MAX_DROP_TABLE_Q_LEN      1024
 
 const char *del_exts[]= {".BAK", ".opt", NullS};
-static TYPELIB deletable_extentions=
+static TYPELIB deletable_extensions=
 {array_elements(del_exts)-1,"del_exts", del_exts, NULL};
 
 static bool find_db_tables_and_rm_known_files(THD *, MY_DIR *, const char *,
@@ -1140,7 +1140,7 @@ static bool find_db_tables_and_rm_known_files(THD *thd, MY_DIR *dirp,
     }
     if (!(extension= strrchr(file->name, '.')))
       extension= strend(file->name);
-    if (find_type(extension, &deletable_extentions, FIND_TYPE_NO_PREFIX) > 0)
+    if (find_type(extension, &deletable_extensions, FIND_TYPE_NO_PREFIX) > 0)
     {
       strxmov(filePath, path, "/", file->name, NullS);
       /*
diff --git a/sql/sql_join_cache.cc b/sql/sql_join_cache.cc
index 3b051259ad6..3a509b3d750 100644
--- a/sql/sql_join_cache.cc
+++ b/sql/sql_join_cache.cc
@@ -2141,7 +2141,7 @@ enum_nested_loop_state JOIN_CACHE::join_records(bool skip_last)
     DBUG_ASSERT(!is_key_access());
     /*
        Restore the last record from the join buffer to generate
-       all extentions for it.
+       all extensions for it.
     */
     get_record();		               
   }
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index bb25ca69924..f5f9ed54362 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -3289,7 +3289,7 @@ int reset_slave(THD *thd, Master_info* mi)
   char fname[FN_REFLEN];
   int thread_mask= 0, error= 0;
   uint sql_errno=ER_UNKNOWN_ERROR;
-  const char* errmsg= "Unknown error occurred while reseting slave";
+  const char* errmsg= "Unknown error occurred while resetting slave";
   char master_info_file_tmp[FN_REFLEN];
   char relay_log_info_file_tmp[FN_REFLEN];
   DBUG_ENTER("reset_slave");
@@ -3875,7 +3875,7 @@ int reset_master(THD* thd, rpl_gtid *init_state, uint32 init_state_len,
   }
 
   bool ret= 0;
-  /* Temporarily disable master semisync before reseting master. */
+  /* Temporarily disable master semisync before resetting master. */
   repl_semisync_master.before_reset_master();
   ret= mysql_bin_log.reset_logs(thd, 1, init_state, init_state_len,
                                 next_log_number);
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index f9c44600aff..ce3ad4927ad 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -17818,7 +17818,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List &fields,
 
     /*
       Test if there is a default field value. The test for ->ptr is to skip
-      'offset' fields generated by initalize_tables
+      'offset' fields generated by initialize_tables
     */
     if (default_field[i] && default_field[i]->ptr)
     {
diff --git a/sql/sql_servers.cc b/sql/sql_servers.cc
index 8f0f08da075..7913a7d2b9f 100644
--- a/sql/sql_servers.cc
+++ b/sql/sql_servers.cc
@@ -431,7 +431,7 @@ insert_server_record_into_cache(FOREIGN_SERVER *server)
   int error=0;
   DBUG_ENTER("insert_server_record_into_cache");
   /*
-    We succeded in insertion of the server to the table, now insert
+    We succeeded in insertion of the server to the table, now insert
     the server to the cache
   */
   DBUG_PRINT("info", ("inserting server %s at %p, length %zd",
@@ -686,7 +686,7 @@ delete_server_record_in_cache(LEX_SERVER_OPTIONS *server_options)
     goto end;
   }
   /*
-    We succeded in deletion of the server to the table, now delete
+    We succeeded in deletion of the server to the table, now delete
     the server from the cache
   */
   DBUG_PRINT("info",("deleting server %s length %zd",
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index c20fcc4fe85..824b6583404 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -6164,7 +6164,7 @@ static Sys_var_enum Sys_session_track_transaction_info(
        "Track changes to the transaction attributes. OFF to disable; "
        "STATE to track just transaction state (Is there an active transaction? "
        "Does it have any data? etc.); CHARACTERISTICS to track transaction "
-       "state and report all statements needed to start a transaction with"
+       "state and report all statements needed to start a transaction with "
        "the same characteristics (isolation level, read only/read write,"
        "snapshot - but not any work done / data modified within the "
        "transaction).",
diff --git a/sql/table.h b/sql/table.h
index 11ede736127..8086e116aa8 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -3111,7 +3111,7 @@ public:
 
      @param[in] timestamp
      @param[in] true if we search for a lesser timestamp, false if greater
-     @retval true if exists, false it not exists or an error occured
+     @retval true if exists, false it not exists or an error occurred
    */
   bool query(MYSQL_TIME &commit_time, bool backwards);
   /**
diff --git a/sql/threadpool_common.cc b/sql/threadpool_common.cc
index 6a4139197f9..157a76a5150 100644
--- a/sql/threadpool_common.cc
+++ b/sql/threadpool_common.cc
@@ -185,7 +185,7 @@ void tp_callback(TP_connection *c)
   }
   else if (threadpool_process_request(thd))
   {
-    /* QUIT or an error occured. */
+    /* QUIT or an error occurred. */
     goto error;
   }
 
diff --git a/sql/wsrep_hton.cc b/sql/wsrep_hton.cc
index 4c1b06e66e1..f84aa5b2e84 100644
--- a/sql/wsrep_hton.cc
+++ b/sql/wsrep_hton.cc
@@ -95,7 +95,7 @@ void wsrep_register_hton(THD* thd, bool all)
       {
         trans_register_ha(thd, all, wsrep_hton);
 
-        /* follow innodb read/write settting
+        /* follow innodb read/write setting
          * but, as an exception: CTAS with empty result set will not be
          * replicated unless we declare wsrep hton as read/write here
 	 */
@@ -275,7 +275,7 @@ static int wsrep_rollback(handlerton *hton, THD *thd, bool all)
     if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
     {
       DBUG_PRINT("wsrep", ("setting rollback fail"));
-      WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
+      WSREP_ERROR("setting rollback fail: thd: %llu, schema: %s, SQL: %s",
                   (long long)thd->real_id, thd->get_db(), thd->query());
     }
     wsrep_cleanup_transaction(thd);
@@ -316,7 +316,7 @@ int wsrep_commit(handlerton *hton, THD *thd, bool all)
         if (wsrep && wsrep->post_rollback(wsrep, &thd->wsrep_ws_handle))
         {
           DBUG_PRINT("wsrep", ("setting rollback fail"));
-          WSREP_ERROR("settting rollback fail: thd: %llu, schema: %s, SQL: %s",
+          WSREP_ERROR("setting rollback fail: thd: %llu, schema: %s, SQL: %s",
                       (long long)thd->real_id, thd->get_db(),
                       thd->query());
         }
diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp
index e76dc496246..f7866b9dae1 100644
--- a/storage/connect/filamzip.cpp
+++ b/storage/connect/filamzip.cpp
@@ -700,7 +700,7 @@ bool UNZIPUTL::openEntry(PGLOBAL g)
 	} // endif rc
 
 	if (trace(1))
-		htrc("Openning entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
+		htrc("Opening entry%s %s\n", fn, (entryopen) ? "oked" : "failed");
 
 	return !entryopen;
 }	// end of openEntry
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 05d15b41728..85bf2090528 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -704,9 +704,9 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR name, LPCSTR dir)
   used by the default rename_table and delete_table method in
   handler.cc.
 
-  For engines that have two file name extentions (separate meta/index file
+  For engines that have two file name extensions (separate meta/index file
   and data file), the order of elements is relevant. First element of engine
-  file name extentions array should be meta/index file extention. Second
+  file name extensions array should be meta/index file extention. Second
   element - data file extention. This order is assumed by
   prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
 
diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp
index f919344f20b..e3f64d17064 100644
--- a/storage/connect/javaconn.cpp
+++ b/storage/connect/javaconn.cpp
@@ -142,7 +142,7 @@ bool JAVAConn::Check(jint rc)
 			s = (jstring)env->CallObjectMethod(exc, tid);
 			Msg = GetUTFString(s);
 		} else
-			Msg = "Exception occured";
+			Msg = "Exception occurred";
 
 		env->ExceptionClear();
 	} else if (rc < 0) {
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 643fa1ae09a..ab402c636d1 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -225,9 +225,9 @@ static void init_example_psi_keys()
   used by the default rename_table and delete_table method in
   handler.cc and by the default discover_many method.
 
-  For engines that have two file name extentions (separate meta/index file
+  For engines that have two file name extensions (separate meta/index file
   and data file), the order of elements is relevant. First element of engine
-  file name extentions array should be meta/index file extention. Second
+  file name extensions array should be meta/index file extention. Second
   element - data file extention. This order is assumed by
   prepare_for_repair() when REPAIR TABLE ... USE_FRM is issued.
 
diff --git a/storage/federatedx/AUTHORS b/storage/federatedx/AUTHORS
index 6314d2e4a3d..cdd6600fb5a 100644
--- a/storage/federatedx/AUTHORS
+++ b/storage/federatedx/AUTHORS
@@ -7,5 +7,5 @@ Pluggable Storage Engine Skeleton setup
 Brian Aker   |  - Original Design
 Calvin Sun - Windows Support
 Brian Miezejewski - Bug fixes
-Antony T Curtis   - Help in inital development, transactions and various help
+Antony T Curtis   - Help in initial development, transactions and various help
 Michael Widenius  - Bug fixes and some simple early optimizations
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index e22b1c4e314..8ccebff3db0 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -155,7 +155,7 @@ current working directory ".", but in the MySQL Embedded Server Library
 it is an absolute path. */
 const char*	fil_path_to_mysql_datadir;
 
-/** Common InnoDB file extentions */
+/** Common InnoDB file extensions */
 const char* dot_ext[] = { "", ".ibd", ".isl", ".cfg" };
 
 /** The number of fsyncs done to the log */
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 0818d3f0ed1..204b199c85a 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -350,7 +350,7 @@ struct fil_node_t {
 /** Value of fil_node_t::magic_n */
 #define	FIL_NODE_MAGIC_N	89389
 
-/** Common InnoDB file extentions */
+/** Common InnoDB file extensions */
 enum ib_extention {
 	NO_EXT = 0,
 	IBD = 1,
diff --git a/storage/innobase/include/fil0fil.ic b/storage/innobase/include/fil0fil.ic
index 457b5e1a03e..31466f38546 100644
--- a/storage/innobase/include/fil0fil.ic
+++ b/storage/innobase/include/fil0fil.ic
@@ -69,7 +69,7 @@ fil_get_page_type_name(
 	case FIL_PAGE_TYPE_ZBLOB2:
 		return "ZBLOB2";
 	case FIL_PAGE_TYPE_UNKNOWN:
-		return "OLD UNKOWN PAGE TYPE";
+		return "OLD UNKNOWN PAGE TYPE";
 	default:
 		return "PAGE TYPE CORRUPTED";
 	}
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index f3a17302864..5e78885a720 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -4272,7 +4272,7 @@ row_search_mvcc(
 		    || prebuilt->m_read_virtual_key);
 
 	/* Reset the new record lock info if srv_locks_unsafe_for_binlog
-	is set or session is using a READ COMMITED isolation level. Then
+	is set or session is using a READ COMMITTED isolation level. Then
 	we are able to remove the record locks set here on an individual
 	row. */
 	prebuilt->new_rec_locks = 0;
@@ -4979,7 +4979,7 @@ wrong_offs:
 		existence with LOCK_REC_NOT_GAP. */
 
 		/* If innodb_locks_unsafe_for_binlog option is used
-		or this session is using a READ COMMITED isolation
+		or this session is using a READ COMMITTED isolation
 		level we lock only the record, i.e., next-key locking is
 		not used. */
 
diff --git a/storage/innobase/srv/srv0mon.cc b/storage/innobase/srv/srv0mon.cc
index b56ffe99624..0404335574a 100644
--- a/storage/innobase/srv/srv0mon.cc
+++ b/storage/innobase/srv/srv0mon.cc
@@ -423,7 +423,7 @@ static monitor_info_t	innodb_counter_info[] =
 	 MONITOR_DEFAULT_START, MONITOR_FLUSH_AVG_TIME},
 
 	{"buffer_flush_adaptive_avg_pass", "buffer",
-	 "Numner of adaptive flushes passed during the recent Avg period.",
+	 "Number of adaptive flushes passed during the recent Avg period.",
 	 MONITOR_NONE,
 	 MONITOR_DEFAULT_START, MONITOR_FLUSH_ADAPTIVE_AVG_PASS},
 
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc
index 71456666fbe..1745e1fa653 100644
--- a/storage/maria/ha_maria.cc
+++ b/storage/maria/ha_maria.cc
@@ -1157,7 +1157,7 @@ int ha_maria::open(const char *name, int mode, uint test_if_locked)
 
   /*
     For static size rows, tell MariaDB that we will access all bytes
-    in the record when writing it.  This signals MariaDB to initalize
+    in the record when writing it.  This signals MariaDB to initialize
     the full row to ensure we don't get any errors from valgrind and
     that all bytes in the row is properly reset.
   */
diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c
index 44f65230c5d..2716f3b5c42 100644
--- a/storage/maria/ma_close.c
+++ b/storage/maria/ma_close.c
@@ -37,7 +37,7 @@ int maria_close(register MARIA_HA *info)
 
   /* Check that we have unlocked key delete-links properly */
   DBUG_ASSERT(info->key_del_used == 0);
-  /* Check that file is not part of any uncommited transactions */
+  /* Check that file is not part of any uncommitted transactions */
   DBUG_ASSERT(info->trn == 0 || info->trn == &dummy_transaction_object);
 
   if (share->reopen == 1)
diff --git a/storage/maria/trnman.c b/storage/maria/trnman.c
index 744ca86412e..85a87e928b9 100644
--- a/storage/maria/trnman.c
+++ b/storage/maria/trnman.c
@@ -307,7 +307,7 @@ TRN *trnman_new_trn(WT_THD *wt)
   if (!(trn= tmp.trn))
   {
     /*
-      trn should be completely initalized at create time to allow
+      trn should be completely initialized at create time to allow
       one to keep a known state on it.
       (Like redo_lns, which is assumed to be 0 at start of row handling
       and reset to zero before end of row handling)
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc
index 9b4dff68683..fd2e8fd9425 100644
--- a/storage/myisam/ha_myisam.cc
+++ b/storage/myisam/ha_myisam.cc
@@ -859,7 +859,7 @@ int ha_myisam::open(const char *name, int mode, uint test_if_locked)
 
   /*
     For static size rows, tell MariaDB that we will access all bytes
-    in the record when writing it.  This signals MariaDB to initalize
+    in the record when writing it.  This signals MariaDB to initialize
     the full row to ensure we don't get any errors from valgrind and
     that all bytes in the row is properly reset.
   */
diff --git a/storage/perfschema/pfs_timer.h b/storage/perfschema/pfs_timer.h
index a4f55c20994..4a73e2b66ee 100644
--- a/storage/perfschema/pfs_timer.h
+++ b/storage/perfschema/pfs_timer.h
@@ -100,7 +100,7 @@ extern enum_timer_name stage_timer;
 extern enum_timer_name statement_timer;
 /**
   Timer information data.
-  Characteristics about each suported timer.
+  Characteristics about each supported timer.
 */
 extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info;
 
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/lock_rows_not_exist.test b/storage/rocksdb/mysql-test/rocksdb/t/lock_rows_not_exist.test
index d8a6bde45c8..a51a516aaaa 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/lock_rows_not_exist.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/lock_rows_not_exist.test
@@ -57,7 +57,7 @@ DELETE FROM t WHERE id1=1 AND id2=1 AND id3=0;
 --disable_parsing
 # 
 #  The following is commented out because RocksDB's Transaction API doesn't
-#  "support" READ COMMITED, in particular, it doesn't release row locks 
+#  "support" READ COMMITTED, in particular, it doesn't release row locks 
 #   after each statement. (MyRocks is able to request a new snapshot for 
 #  every statement, but this won't free the locks. TODO: Is the behavior
 #  that is tested below really needed?)
diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc
index 812b362e737..4092cfcb514 100644
--- a/storage/sphinx/ha_sphinx.cc
+++ b/storage/sphinx/ha_sphinx.cc
@@ -3351,7 +3351,7 @@ int ha_sphinx::delete_table ( const char * )
 // Renames a table from one name to another from alter table call.
 //
 // If you do not implement this, the default rename_table() is called from
-// handler.cc and it will delete all files with the file extentions returned
+// handler.cc and it will delete all files with the file extensions returned
 // by bas_ext().
 //
 // Called from sql_table.cc by mysql_rename_table().
diff --git a/storage/tokudb/PerconaFT/ft/loader/loader.cc b/storage/tokudb/PerconaFT/ft/loader/loader.cc
index 5f57b473bc5..3ff237f05c7 100644
--- a/storage/tokudb/PerconaFT/ft/loader/loader.cc
+++ b/storage/tokudb/PerconaFT/ft/loader/loader.cc
@@ -1350,7 +1350,7 @@ int merge_row_arrays_base (struct row dest[/*an+bn*/], struct row a[/*an*/], int
  * Arguments:
  *   dest    write the rows here
  *   a,b     the rows being merged
- *   an,bn   the lenth of a and b respectively.
+ *   an,bn   the length of a and b respectively.
  *   dest_db We need the dest_db to run the comparison function.
  *   compare We need the compare function for the dest_db.
  */
@@ -1449,7 +1449,7 @@ static int merge_row_arrays (struct row dest[/*an+bn*/], struct row a[/*an*/], i
  * Arguments:
  *   dest    write the rows here
  *   a,b     the rows being merged
- *   an,bn   the lenth of a and b respectively.
+ *   an,bn   the length of a and b respectively.
  *   dest_db We need the dest_db to run the comparison function.
  *   compare We need the compare function for the dest_db.
  */
diff --git a/storage/tokudb/mysql-test/tokudb/t/type_bit.test b/storage/tokudb/mysql-test/tokudb/t/type_bit.test
index 445f69e8972..034585169f5 100644
--- a/storage/tokudb/mysql-test/tokudb/t/type_bit.test
+++ b/storage/tokudb/mysql-test/tokudb/t/type_bit.test
@@ -268,7 +268,7 @@ select hex(a), b from t1;
 drop table t1;
 
 #
-# type was not properly initalized, which caused key_copy to fail
+# type was not properly initialized, which caused key_copy to fail
 #
 
 create table t1(bit_field bit(2), int_field int, key a(bit_field));
diff --git a/wsrep/wsrep_api.h b/wsrep/wsrep_api.h
index 9d1280b6bc9..e362e71f829 100644
--- a/wsrep/wsrep_api.h
+++ b/wsrep/wsrep_api.h
@@ -990,7 +990,7 @@ struct wsrep {
     void (*stats_free) (wsrep_t* wsrep, struct wsrep_stats_var* var_array);
 
   /*!
-   * @brief Reset some stats variables to inital value, provider-dependent.
+   * @brief Reset some stats variables to initial value, provider-dependent.
    *
    * @param wsrep provider handle.
    */
diff --git a/zlib/zlib.h b/zlib/zlib.h
index 08f491999c4..d3b929b9cca 100644
--- a/zlib/zlib.h
+++ b/zlib/zlib.h
@@ -1440,7 +1440,7 @@ ZEXTERN z_size_t ZEXPORT gzfread OF((voidp buf, z_size_t size, z_size_t nitems,
    provided, but could be inferred from the result of gztell().  This behavior
    is the same as the behavior of fread() implementations in common libraries,
    but it prevents the direct use of gzfread() to read a concurrently written
-   file, reseting and retrying on end-of-file, when size is not 1.
+   file, resetting and retrying on end-of-file, when size is not 1.
 */
 
 ZEXTERN int ZEXPORT gzwrite OF((gzFile file,

From 7e917bba5d8318765ae3074bcb7c2634ea84ab45 Mon Sep 17 00:00:00 2001
From: Faustin Lammler 
Date: Fri, 29 Nov 2019 15:51:20 +0100
Subject: [PATCH 37/59] Sourced script should be 644 not 755

The script is intented to be sourced by other SST script so it should
not be executable (or should have a script header).
This is causing a warning on Debian Lintian tool, see:
https://salsa.debian.org/faust-guest/mariadb-10.3/-/jobs/431900
---
 scripts/wsrep_sst_common.sh | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 scripts/wsrep_sst_common.sh

diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh
old mode 100755
new mode 100644

From 8d2a57b4b7b9f6c7894ebf285a5c390e40fdc806 Mon Sep 17 00:00:00 2001
From: Robert Bindar 
Date: Tue, 16 Apr 2019 17:52:31 +0300
Subject: [PATCH 38/59] MDEV-15977 Assertion !thd->in_sub_stmt failed in
 trans_commit_stmt

---
 mysql-test/suite/sql_sequence/rebuild.result | 161 +++++++++++++++++++
 mysql-test/suite/sql_sequence/rebuild.test   |  18 +++
 sql/sql_sequence.cc                          |   7 +-
 3 files changed, 184 insertions(+), 2 deletions(-)
 create mode 100644 mysql-test/suite/sql_sequence/rebuild.result
 create mode 100644 mysql-test/suite/sql_sequence/rebuild.test

diff --git a/mysql-test/suite/sql_sequence/rebuild.result b/mysql-test/suite/sql_sequence/rebuild.result
new file mode 100644
index 00000000000..f18281a75d2
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/rebuild.result
@@ -0,0 +1,161 @@
+#
+# MDEV-15977 Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt
+#
+CREATE SEQUENCE s1 ENGINE=InnoDB;
+ALTER TABLE s1 FORCE;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (b VARCHAR(64)) ENGINE=MyISAM;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.PARTITIONS;
+INSERT INTO t1 VALUES (1);
+select * from t1;
+a
+1
+select * from t2;
+b
+t2
+t1
+s1
+users
+threads
+table_lock_waits_summary_by_table
+table_io_waits_summary_by_table
+table_io_waits_summary_by_index_usage
+socket_summary_by_instance
+socket_summary_by_event_name
+socket_instances
+setup_timers
+setup_objects
+setup_instruments
+setup_consumers
+setup_actors
+session_connect_attrs
+session_account_connect_attrs
+rwlock_instances
+performance_timers
+objects_summary_global_by_type
+mutex_instances
+hosts
+host_cache
+file_summary_by_instance
+file_summary_by_event_name
+file_instances
+events_waits_summary_global_by_event_name
+events_waits_summary_by_user_by_event_name
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_by_instance
+events_waits_summary_by_host_by_event_name
+events_waits_summary_by_account_by_event_name
+events_waits_history_long
+events_waits_history
+events_waits_current
+events_statements_summary_global_by_event_name
+events_statements_summary_by_user_by_event_name
+events_statements_summary_by_thread_by_event_name
+events_statements_summary_by_host_by_event_name
+events_statements_summary_by_digest
+events_statements_summary_by_account_by_event_name
+events_statements_history_long
+events_statements_history
+events_statements_current
+events_stages_summary_global_by_event_name
+events_stages_summary_by_user_by_event_name
+events_stages_summary_by_thread_by_event_name
+events_stages_summary_by_host_by_event_name
+events_stages_summary_by_account_by_event_name
+events_stages_history_long
+events_stages_history
+events_stages_current
+cond_instances
+accounts
+user
+transaction_registry
+time_zone_transition_type
+time_zone_transition
+time_zone_name
+time_zone_leap_second
+time_zone
+tables_priv
+table_stats
+slow_log
+servers
+roles_mapping
+proxies_priv
+procs_priv
+proc
+plugin
+innodb_table_stats
+innodb_index_stats
+index_stats
+host
+help_topic
+help_relation
+help_keyword
+help_category
+gtid_slave_pos
+general_log
+func
+event
+db
+columns_priv
+column_stats
+test_suppressions
+global_suppressions
+ALL_PLUGINS
+APPLICABLE_ROLES
+CHARACTER_SETS
+CHECK_CONSTRAINTS
+COLLATIONS
+COLLATION_CHARACTER_SET_APPLICABILITY
+COLUMNS
+COLUMN_PRIVILEGES
+ENABLED_ROLES
+ENGINES
+EVENTS
+FILES
+GLOBAL_STATUS
+GLOBAL_VARIABLES
+KEY_CACHES
+KEY_COLUMN_USAGE
+PARAMETERS
+PARTITIONS
+PLUGINS
+PROCESSLIST
+PROFILING
+REFERENTIAL_CONSTRAINTS
+ROUTINES
+SCHEMATA
+SCHEMA_PRIVILEGES
+SESSION_STATUS
+SESSION_VARIABLES
+STATISTICS
+SYSTEM_VARIABLES
+TABLES
+TABLESPACES
+TABLE_CONSTRAINTS
+TABLE_PRIVILEGES
+TRIGGERS
+USER_PRIVILEGES
+VIEWS
+GEOMETRY_COLUMNS
+SPATIAL_REF_SYS
+CLIENT_STATISTICS
+INDEX_STATISTICS
+USER_STATISTICS
+INNODB_LOCKS
+INNODB_CMPMEM
+INNODB_CMP_PER_INDEX
+INNODB_LOCK_WAITS
+TABLE_STATISTICS
+INNODB_BUFFER_PAGE_LRU
+INNODB_SYS_FIELDS
+INNODB_SYS_COLUMNS
+INNODB_SYS_FOREIGN_COLS
+INNODB_BUFFER_POOL_STATS
+INNODB_TRX
+INNODB_SYS_FOREIGN
+INNODB_SYS_TABLES
+INNODB_BUFFER_PAGE
+INNODB_METRICS
+INNODB_SYS_INDEXES
+INNODB_SYS_VIRTUAL
+DROP TABLE t1, t2, s1;
diff --git a/mysql-test/suite/sql_sequence/rebuild.test b/mysql-test/suite/sql_sequence/rebuild.test
new file mode 100644
index 00000000000..66b99ba0e94
--- /dev/null
+++ b/mysql-test/suite/sql_sequence/rebuild.test
@@ -0,0 +1,18 @@
+--source include/have_innodb.inc
+
+--echo #
+--echo # MDEV-15977 Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt
+--echo #
+
+CREATE SEQUENCE s1 ENGINE=InnoDB;
+ALTER TABLE s1 FORCE;
+CREATE TABLE t1 (a INT) ENGINE=MyISAM;
+CREATE TABLE t2 (b VARCHAR(64)) ENGINE=MyISAM;
+CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.PARTITIONS;
+INSERT INTO t1 VALUES (1);
+select * from t1;
+select * from t2;
+
+# Cleanup
+DROP TABLE t1, t2, s1;
+
diff --git a/sql/sql_sequence.cc b/sql/sql_sequence.cc
index a7b5def9193..b69b52505f4 100644
--- a/sql/sql_sequence.cc
+++ b/sql/sql_sequence.cc
@@ -487,9 +487,12 @@ int SEQUENCE::read_initial_values(TABLE *table)
       Doing mysql_lock_tables() may have started a read only transaction.
       If that happend, it's better that we commit it now, as a lot of
       code assumes that there is no active stmt transaction directly after
-      open_tables()
+      open_tables().
+      But we also don't want to commit the stmt transaction while in a
+      substatement, see MDEV-15977.
     */
-    if (!has_active_transaction && !thd->transaction.stmt.is_empty())
+    if (!has_active_transaction && !thd->transaction.stmt.is_empty() &&
+        !thd->in_sub_stmt)
       trans_commit_stmt(thd);
   }
   write_unlock(table);

From d930422e9e84aa1bc265963225dd29295203e9d3 Mon Sep 17 00:00:00 2001
From: Faustin Lammler 
Date: Fri, 29 Nov 2019 13:21:23 +0100
Subject: [PATCH 39/59] Fix the line break warning (groff/lintian).

The lintian Debian tool is complaining about:
  'W: mariadb-test: manpage-has-errors-from-man
  usr/share/man/man1/mysql-test-run.pl.1.gz 246: warning [p 2, 6.0i, div
  '3tbd1,1', 0.3i]: can't break line'

See: https://salsa.debian.org/faust-guest/mariadb-10.3/-/jobs/431900

The following command permits to catch the problematic lines:
  $ groff -man -Tascii ./mysql-test-run.pl.1 | less

Closes #1419
---
 man/mysql-test-run.pl.1 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/man/mysql-test-run.pl.1 b/man/mysql-test-run.pl.1
index 8b8eafd7bdd..abf1d1bc240 100644
--- a/man/mysql-test-run.pl.1
+++ b/man/mysql-test-run.pl.1
@@ -1937,8 +1937,10 @@ Run stress test, providing options to mysql\-stress\-test\&.pl\&. Options are se
 .\" suite option: mysql-test-run.pl
 \fB\-\-suite[s]=\fR\fB\fIsuite_name...\fR\fR
 .sp
-Comma separated list of suite names to run. The default is: "main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,handler-,heap-,innodb-,innodb_fts-,
-innodb_zip-,maria-,multi_source-,optimizer_unfixed_bugs-,parts-,percona-,perfschema-,
+Comma separated list of suite names to run. The default is:
+"main-,archive-,binlog-,csv-,federated-,funcs_1-,funcs_2-,
+handler-,heap-,innodb-,innodb_fts-,innodb_zip-,maria-,
+multi_source-,optimizer_unfixed_bugs-,parts-,perfschema-,
 plugins-,roles-,rpl-,sys_vars-,unit-,vcol-"\&.
 .RE
 .sp

From e3d3bbf59829e93e83ab05d831e92a742ffd7e32 Mon Sep 17 00:00:00 2001
From: Anel Husakovic 
Date: Thu, 28 Nov 2019 15:08:29 +0100
Subject: [PATCH 40/59] Using `variables` instead of `values` in mysqld --help
 documentation would be more accurate

---
 mysql-test/r/mysqld--help.result | 2 +-
 scripts/mysql_install_db.sh      | 2 +-
 sql/mysqld.cc                    | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/mysql-test/r/mysqld--help.result b/mysql-test/r/mysqld--help.result
index 825c7e786a3..bececa14d7a 100644
--- a/mysql-test/r/mysqld--help.result
+++ b/mysql-test/r/mysqld--help.result
@@ -1107,5 +1107,5 @@ userstat FALSE
 verbose TRUE
 wait-timeout 28800
 
-To see what values a running MySQL server is using, type
+To see what variables a running MySQL server is using, type
 'mysqladmin variables' instead of 'mysqld --verbose --help'.
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index fb1663d9d69..fe7375494fe 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -214,7 +214,7 @@ cannot_find_file()
   echo "If you compiled from source, you need to either run 'make install' to"
   echo "copy the software into the correct location ready for operation."
   echo "If you don't want to do a full install, you can use the --srcdir"
-  echo "option to only install the mysql database and privilege tables"
+  echo "option to only install the mysql database and privilege tables."
   echo
   echo "If you are using a binary release, you must either be at the top"
   echo "level of the extracted archive, or pass the --basedir option"
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index 96daeab867d..2aedec595c0 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -7240,7 +7240,7 @@ because execution stopped before plugins were initialized.");
   }
 
   puts("\n\
-To see what values a running MySQL server is using, type\n\
+To see what variables a running MySQL server is using, type\n\
 'mysqladmin variables' instead of 'mysqld --verbose --help'.");
   }
   DBUG_VOID_RETURN;

From 3ff8fb5141850aebcf37578c108bfbea99a5d53e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 3 Dec 2019 07:34:46 +0200
Subject: [PATCH 41/59] InnoDB: Remove unused get_wkb_of_default_point()

The function get_wkb_of_default_point() should never have been
added, and the cleanup in commit 56ff6f1b0b248befb80675ba36a3251c7844f410
should have removed it.

The unnecessary code was added in
mysql/mysql-server@0a27b72171c4449f506ad4e93df8c29fead1ed72
and mostly disabled in
mysql/mysql-server@8f11af7734509821b654f2c330dff5374c89073c.

In MariaDB, the types DATA_POINT and DATA_VAR_POINT are never used.
Instead, DATA_GEOMETRY continues to be used since 10.2.2, introduced by
mysql/mysql-server@673bad7c7e17701b69e29d0fbc4e2d68c1a7b613
in MySQL 5.7.1.
---
 storage/innobase/gis/gis0geo.cc    | 32 ------------------------------
 storage/innobase/include/gis0geo.h | 13 ------------
 2 files changed, 45 deletions(-)

diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index cad3877d3e9..fb55945549e 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -801,35 +801,3 @@ rtree_area_overlapping(
 
 	return(area);
 }
-
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in]	n_dims		dimensions
-@param[out]	wkb		wkb buffer for default POINT
-@param[in]	len		length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
-	uint	n_dims,
-	uchar*	wkb,
-	uint	len)
-{
-  // JAN: TODO: MYSQL 5.7 GIS
-  #define GEOM_HEADER_SIZE 16
-	if (len < GEOM_HEADER_SIZE + sizeof(double) * n_dims) {
-		return(0);
-	}
-
-	/** POINT wkb comprises SRID, wkb header(byte order and type)
-	and coordinates of the POINT */
-	len = GEOM_HEADER_SIZE + sizeof(double) * n_dims;
-	/** We always use 0 as default coordinate */
-	memset(wkb, 0, len);
-	/** We don't need to write SRID, write 0x01 for Byte Order */
-	mach_write_to_n_little_endian(wkb + SRID_SIZE, 1, 0x01);
-	/** Write wkbType::wkbPoint for the POINT type */
-	mach_write_to_n_little_endian(wkb + SRID_SIZE + 1, 4, wkbPoint);
-
-	return(len);
-}
diff --git a/storage/innobase/include/gis0geo.h b/storage/innobase/include/gis0geo.h
index 3b71815d0fe..dea6d63f4e0 100644
--- a/storage/innobase/include/gis0geo.h
+++ b/storage/innobase/include/gis0geo.h
@@ -54,19 +54,6 @@ enum wkbByteOrder
   wkbNDR = 1     /* Little Endian */
 };
 
-/** Get the wkb of default POINT value, which represents POINT(0 0)
-if it's of dimension 2, etc.
-@param[in]	n_dims		dimensions
-@param[out]	wkb		wkb buffer for default POINT
-@param[in]	len		length of wkb buffer
-@return non-0 indicate the length of wkb of the default POINT,
-0 if the buffer is too small */
-uint
-get_wkb_of_default_point(
-	uint	n_dims,
-	uchar*	wkb,
-	uint	len);
-
 /*************************************************************//**
 Calculate minimal bounding rectangle (mbr) of the spatial object
 stored in "well-known binary representation" (wkb) format.

From 88073dae79c240eb82e923364aeaed907b25f096 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= 
Date: Tue, 3 Dec 2019 08:04:46 +0200
Subject: [PATCH 42/59] MDEV-21198 : Galera test failure on
 galera_var_notify_cmd

Add proper wsrep sync wait.
---
 .../suite/galera/r/galera_var_notify_cmd.result | 17 +++++++++--------
 .../suite/galera/t/galera_var_notify_cmd.test   |  8 ++++----
 2 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/mysql-test/suite/galera/r/galera_var_notify_cmd.result b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
index b02124cda70..2b390d0db8d 100644
--- a/mysql-test/suite/galera/r/galera_var_notify_cmd.result
+++ b/mysql-test/suite/galera/r/galera_var_notify_cmd.result
@@ -1,10 +1,11 @@
 connection node_1;
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-COUNT(DISTINCT uuid) = 2
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
+COUNT(DISTINCT uuid)
+2
+SELECT MAX(size) FROM mtr_wsrep_notify.status;
+MAX(size)
+2
+SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;
+COUNT(DISTINCT idx)
 1
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-MAX(size) = 2
-1
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
-COUNT(DISTINCT idx) = 2
-0
diff --git a/mysql-test/suite/galera/t/galera_var_notify_cmd.test b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
index b261f878ced..2b0852b4870 100644
--- a/mysql-test/suite/galera/t/galera_var_notify_cmd.test
+++ b/mysql-test/suite/galera/t/galera_var_notify_cmd.test
@@ -3,10 +3,10 @@
 # notifications into a table.
 #
 
---source include/have_innodb.inc
 --source include/galera_cluster.inc
 
 --connection node_1
-SELECT COUNT(DISTINCT uuid) = 2 FROM mtr_wsrep_notify.membership;
-SELECT MAX(size) = 2 FROM mtr_wsrep_notify.status;
-SELECT COUNT(DISTINCT idx) = 2 FROM mtr_wsrep_notify.status;
+SET SESSION wsrep_sync_wait=15;
+SELECT COUNT(DISTINCT uuid) FROM mtr_wsrep_notify.membership;
+SELECT MAX(size) FROM mtr_wsrep_notify.status;
+SELECT COUNT(DISTINCT idx) FROM mtr_wsrep_notify.status;

From 543f22a2d0633e645fb49a360c55528d8cb008fb Mon Sep 17 00:00:00 2001
From: Eugene Kosov 
Date: Wed, 27 Nov 2019 11:58:20 +0700
Subject: [PATCH 43/59] check parameters of io_submit() and
 LinuxAIOHandler::reserve_slot()

Ensure that pointer to a buffer which is used for both reads and writes
is properly aligned.

I've intentially put permanent check right before io_submit() call instead
of the time of setting iocb date. I think that'll make check better.

LinuxAIOHandler::resever_slot(): check arguments alignment in debug builds
---
 storage/innobase/os/os0file.cc | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 210ee85798c..b32a2fa77ef 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -1792,6 +1792,9 @@ LinuxAIOHandler::resubmit(Slot* slot)
 
 	iocb->data = slot;
 
+	ut_a(reinterpret_cast(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+	     == 0);
+
 	/* Resubmit an I/O request */
 	int	ret = io_submit(m_array->io_ctx(m_segment), 1, &iocb);
 	ut_a(ret != -EINVAL);
@@ -2160,6 +2163,9 @@ AIO::linux_dispatch(Slot* slot)
 
 	io_ctx_index = (slot->pos * m_n_segments) / m_slots.size();
 
+	ut_a(reinterpret_cast(iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+	     == 0);
+
 	int	ret = io_submit(io_ctx(io_ctx_index), 1, &iocb);
 	ut_a(ret != -EINVAL);
 
@@ -2352,6 +2358,8 @@ AIO::is_linux_native_aio_supported()
 		io_prep_pread(p_iocb, fd, ptr, 512, 0);
 	}
 
+	ut_a(reinterpret_cast(p_iocb->u.c.buf) % OS_FILE_LOG_BLOCK_SIZE
+	     == 0);
 	int	err = io_submit(io_ctx, 1, &p_iocb);
 	ut_a(err != -EINVAL);
 
@@ -6271,6 +6279,10 @@ AIO::reserve_slot(
 	os_offset_t		offset,
 	ulint			len)
 {
+	ut_ad(reinterpret_cast(buf) % OS_FILE_LOG_BLOCK_SIZE == 0);
+	ut_ad(offset % OS_FILE_LOG_BLOCK_SIZE == 0);
+	ut_ad(len % OS_FILE_LOG_BLOCK_SIZE == 0);
+
 #ifdef WIN_ASYNC_IO
 	ut_a((len & 0xFFFFFFFFUL) == len);
 #endif /* WIN_ASYNC_IO */

From abbff37eb4f849532a01941c869db3384f772639 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 3 Dec 2019 11:58:24 +0200
Subject: [PATCH 44/59] MDEV-13564 follow-up: Harden an assertion

mlog_write_initial_log_record_low(): Do not allow the MLOG_TRUNCATE
record to be written.
---
 storage/innobase/include/mtr0log.ic | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic
index b7ba92ff1a5..23a840d95a6 100644
--- a/storage/innobase/include/mtr0log.ic
+++ b/storage/innobase/include/mtr0log.ic
@@ -1,7 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -187,7 +187,6 @@ mlog_write_initial_log_record_low(
 	      || type == MLOG_FILE_CREATE2
 	      || type == MLOG_FILE_RENAME2
 	      || type == MLOG_INDEX_LOAD
-	      || type == MLOG_TRUNCATE
 	      || type == MLOG_FILE_WRITE_CRYPT_DATA
 	      || mtr->is_named_space(space_id));
 

From cef2b34f25b45198868be0c06e00a74a1c1ad062 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:28:41 +0300
Subject: [PATCH 45/59] MDEV-18929 2nd execution of SP does not detect
 ER_VERS_NOT_VERSIONED

Wrong assertion condition. SYSTEM_TIME_ALL indicates that
vers_setup_conds() is done. In case FOR SYSTEM_TIME ALL is specified
in command the assertion passes but not checks anything.
---
 mysql-test/suite/versioning/r/delete.result | 14 ++++++++++++++
 mysql-test/suite/versioning/t/delete.test   | 15 +++++++++++++++
 sql/sql_delete.cc                           |  2 +-
 sql/sql_update.cc                           |  2 +-
 sql/table.h                                 |  4 ++++
 5 files changed, 35 insertions(+), 2 deletions(-)

diff --git a/mysql-test/suite/versioning/r/delete.result b/mysql-test/suite/versioning/r/delete.result
index 26ade83acd7..5aa239b9cb8 100644
--- a/mysql-test/suite/versioning/r/delete.result
+++ b/mysql-test/suite/versioning/r/delete.result
@@ -116,3 +116,17 @@ x
 2
 1
 drop table t1;
+#
+# MDEV-18929 2nd execution of SP does not detect ER_VERS_NOT_VERSIONED
+#
+create or replace table t1 (a int) with system versioning;
+replace into t1 values (1), (2);
+create or replace trigger tr before delete on t1 for each row delete from xx;
+create or replace procedure pr() delete from t1;
+call pr;
+ERROR 42S02: Table 'test.xx' doesn't exist
+call pr;
+ERROR 42S02: Table 'test.xx' doesn't exist
+drop procedure pr;
+drop trigger tr;
+drop table t1;
diff --git a/mysql-test/suite/versioning/t/delete.test b/mysql-test/suite/versioning/t/delete.test
index 4f1ba4b1d8e..492463f9395 100644
--- a/mysql-test/suite/versioning/t/delete.test
+++ b/mysql-test/suite/versioning/t/delete.test
@@ -79,4 +79,19 @@ delete from t1;
 select x from t1 for system_time all;
 drop table t1;
 
+--echo #
+--echo # MDEV-18929 2nd execution of SP does not detect ER_VERS_NOT_VERSIONED
+--echo #
+create or replace table t1 (a int) with system versioning;
+replace into t1 values (1), (2);
+create or replace trigger tr before delete on t1 for each row delete from xx;
+create or replace procedure pr() delete from t1;
+--error ER_NO_SUCH_TABLE
+call pr;
+--error ER_NO_SUCH_TABLE
+call pr;
+drop procedure pr;
+drop trigger tr;
+drop table t1;
+
 --source suite/versioning/common_finish.inc
diff --git a/sql/sql_delete.cc b/sql/sql_delete.cc
index 78bccd7a506..929455977e6 100644
--- a/sql/sql_delete.cc
+++ b/sql/sql_delete.cc
@@ -919,7 +919,7 @@ int mysql_prepare_delete(THD *thd, TABLE_LIST *table_list,
 
   DBUG_ASSERT(table_list->table);
   // conds could be cached from previous SP call
-  DBUG_ASSERT(!table_list->vers_conditions.is_set() ||
+  DBUG_ASSERT(!table_list->vers_conditions.need_setup() ||
               !*conds || thd->stmt_arena->is_stmt_execute());
   if (select_lex->vers_setup_conds(thd, table_list))
     DBUG_RETURN(TRUE);
diff --git a/sql/sql_update.cc b/sql/sql_update.cc
index d3b771acdad..10b62af3d6f 100644
--- a/sql/sql_update.cc
+++ b/sql/sql_update.cc
@@ -1266,7 +1266,7 @@ bool mysql_prepare_update(THD *thd, TABLE_LIST *table_list,
 
   DBUG_ASSERT(table_list->table);
   // conds could be cached from previous SP call
-  DBUG_ASSERT(!table_list->vers_conditions.is_set() ||
+  DBUG_ASSERT(!table_list->vers_conditions.need_setup() ||
               !*conds || thd->stmt_arena->is_stmt_execute());
   if (select_lex->vers_setup_conds(thd, table_list))
     DBUG_RETURN(TRUE);
diff --git a/sql/table.h b/sql/table.h
index 11ede736127..6214f38585a 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1912,6 +1912,10 @@ struct vers_select_conds_t
   {
     return orig_type != SYSTEM_TIME_UNSPECIFIED;
   }
+  bool need_setup() const
+  {
+    return type != SYSTEM_TIME_UNSPECIFIED && type != SYSTEM_TIME_ALL;
+  }
   bool resolve_units(THD *thd);
   bool eq(const vers_select_conds_t &conds) const;
 };

From 2daacddf6be8c3e796f403409ca3e80fd1ceda8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= 
Date: Tue, 3 Dec 2019 14:34:12 +0200
Subject: [PATCH 46/59] Update versioning.alter after typo fix

---
 mysql-test/suite/versioning/r/alter.result | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mysql-test/suite/versioning/r/alter.result b/mysql-test/suite/versioning/r/alter.result
index 532412e3574..53e169812b4 100644
--- a/mysql-test/suite/versioning/r/alter.result
+++ b/mysql-test/suite/versioning/r/alter.result
@@ -528,9 +528,9 @@ ERROR HY000: Table `t` is already system-versioned
 #
 use mysql;
 create or replace table t (x int) with system versioning;
-ERROR HY000: System versioning tables in the `mysql` database are not suported
+ERROR HY000: System versioning tables in the `mysql` database are not supported
 alter table user add system versioning;
-ERROR HY000: System versioning tables in the `mysql` database are not suported
+ERROR HY000: System versioning tables in the `mysql` database are not supported
 use test;
 # MDEV-15956 Strange ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN upon ALTER on versioning column
 create or replace table t1 (i int, j int as (i), s timestamp(6) as row start, e timestamp(6) as row end, period for system_time(s,e)) with system versioning;

From 4670a23957304fbb28f635f3c064b03b452424fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= 
Date: Tue, 3 Dec 2019 14:37:45 +0200
Subject: [PATCH 47/59] Re-record sql_sequence.rebuild with sorted_result

---
 mysql-test/suite/sql_sequence/rebuild.result | 220 +++++++++----------
 mysql-test/suite/sql_sequence/rebuild.test   |   2 +
 2 files changed, 112 insertions(+), 110 deletions(-)

diff --git a/mysql-test/suite/sql_sequence/rebuild.result b/mysql-test/suite/sql_sequence/rebuild.result
index f18281a75d2..c8dc47ad8fa 100644
--- a/mysql-test/suite/sql_sequence/rebuild.result
+++ b/mysql-test/suite/sql_sequence/rebuild.result
@@ -12,98 +12,11 @@ a
 1
 select * from t2;
 b
-t2
-t1
-s1
-users
-threads
-table_lock_waits_summary_by_table
-table_io_waits_summary_by_table
-table_io_waits_summary_by_index_usage
-socket_summary_by_instance
-socket_summary_by_event_name
-socket_instances
-setup_timers
-setup_objects
-setup_instruments
-setup_consumers
-setup_actors
-session_connect_attrs
-session_account_connect_attrs
-rwlock_instances
-performance_timers
-objects_summary_global_by_type
-mutex_instances
-hosts
-host_cache
-file_summary_by_instance
-file_summary_by_event_name
-file_instances
-events_waits_summary_global_by_event_name
-events_waits_summary_by_user_by_event_name
-events_waits_summary_by_thread_by_event_name
-events_waits_summary_by_instance
-events_waits_summary_by_host_by_event_name
-events_waits_summary_by_account_by_event_name
-events_waits_history_long
-events_waits_history
-events_waits_current
-events_statements_summary_global_by_event_name
-events_statements_summary_by_user_by_event_name
-events_statements_summary_by_thread_by_event_name
-events_statements_summary_by_host_by_event_name
-events_statements_summary_by_digest
-events_statements_summary_by_account_by_event_name
-events_statements_history_long
-events_statements_history
-events_statements_current
-events_stages_summary_global_by_event_name
-events_stages_summary_by_user_by_event_name
-events_stages_summary_by_thread_by_event_name
-events_stages_summary_by_host_by_event_name
-events_stages_summary_by_account_by_event_name
-events_stages_history_long
-events_stages_history
-events_stages_current
-cond_instances
-accounts
-user
-transaction_registry
-time_zone_transition_type
-time_zone_transition
-time_zone_name
-time_zone_leap_second
-time_zone
-tables_priv
-table_stats
-slow_log
-servers
-roles_mapping
-proxies_priv
-procs_priv
-proc
-plugin
-innodb_table_stats
-innodb_index_stats
-index_stats
-host
-help_topic
-help_relation
-help_keyword
-help_category
-gtid_slave_pos
-general_log
-func
-event
-db
-columns_priv
-column_stats
-test_suppressions
-global_suppressions
 ALL_PLUGINS
 APPLICABLE_ROLES
 CHARACTER_SETS
 CHECK_CONSTRAINTS
+CLIENT_STATISTICS
 COLLATIONS
 COLLATION_CHARACTER_SET_APPLICABILITY
 COLUMNS
@@ -112,8 +25,26 @@ ENABLED_ROLES
 ENGINES
 EVENTS
 FILES
+GEOMETRY_COLUMNS
 GLOBAL_STATUS
 GLOBAL_VARIABLES
+INDEX_STATISTICS
+INNODB_BUFFER_PAGE
+INNODB_BUFFER_PAGE_LRU
+INNODB_BUFFER_POOL_STATS
+INNODB_CMPMEM
+INNODB_CMP_PER_INDEX
+INNODB_LOCKS
+INNODB_LOCK_WAITS
+INNODB_METRICS
+INNODB_SYS_COLUMNS
+INNODB_SYS_FIELDS
+INNODB_SYS_FOREIGN
+INNODB_SYS_FOREIGN_COLS
+INNODB_SYS_INDEXES
+INNODB_SYS_TABLES
+INNODB_SYS_VIRTUAL
+INNODB_TRX
 KEY_CACHES
 KEY_COLUMN_USAGE
 PARAMETERS
@@ -127,35 +58,104 @@ SCHEMATA
 SCHEMA_PRIVILEGES
 SESSION_STATUS
 SESSION_VARIABLES
+SPATIAL_REF_SYS
 STATISTICS
 SYSTEM_VARIABLES
 TABLES
 TABLESPACES
 TABLE_CONSTRAINTS
 TABLE_PRIVILEGES
+TABLE_STATISTICS
 TRIGGERS
 USER_PRIVILEGES
-VIEWS
-GEOMETRY_COLUMNS
-SPATIAL_REF_SYS
-CLIENT_STATISTICS
-INDEX_STATISTICS
 USER_STATISTICS
-INNODB_LOCKS
-INNODB_CMPMEM
-INNODB_CMP_PER_INDEX
-INNODB_LOCK_WAITS
-TABLE_STATISTICS
-INNODB_BUFFER_PAGE_LRU
-INNODB_SYS_FIELDS
-INNODB_SYS_COLUMNS
-INNODB_SYS_FOREIGN_COLS
-INNODB_BUFFER_POOL_STATS
-INNODB_TRX
-INNODB_SYS_FOREIGN
-INNODB_SYS_TABLES
-INNODB_BUFFER_PAGE
-INNODB_METRICS
-INNODB_SYS_INDEXES
-INNODB_SYS_VIRTUAL
+VIEWS
+accounts
+column_stats
+columns_priv
+cond_instances
+db
+event
+events_stages_current
+events_stages_history
+events_stages_history_long
+events_stages_summary_by_account_by_event_name
+events_stages_summary_by_host_by_event_name
+events_stages_summary_by_thread_by_event_name
+events_stages_summary_by_user_by_event_name
+events_stages_summary_global_by_event_name
+events_statements_current
+events_statements_history
+events_statements_history_long
+events_statements_summary_by_account_by_event_name
+events_statements_summary_by_digest
+events_statements_summary_by_host_by_event_name
+events_statements_summary_by_thread_by_event_name
+events_statements_summary_by_user_by_event_name
+events_statements_summary_global_by_event_name
+events_waits_current
+events_waits_history
+events_waits_history_long
+events_waits_summary_by_account_by_event_name
+events_waits_summary_by_host_by_event_name
+events_waits_summary_by_instance
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_by_user_by_event_name
+events_waits_summary_global_by_event_name
+file_instances
+file_summary_by_event_name
+file_summary_by_instance
+func
+general_log
+global_suppressions
+gtid_slave_pos
+help_category
+help_keyword
+help_relation
+help_topic
+host
+host_cache
+hosts
+index_stats
+innodb_index_stats
+innodb_table_stats
+mutex_instances
+objects_summary_global_by_type
+performance_timers
+plugin
+proc
+procs_priv
+proxies_priv
+roles_mapping
+rwlock_instances
+s1
+servers
+session_account_connect_attrs
+session_connect_attrs
+setup_actors
+setup_consumers
+setup_instruments
+setup_objects
+setup_timers
+slow_log
+socket_instances
+socket_summary_by_event_name
+socket_summary_by_instance
+t1
+t2
+table_io_waits_summary_by_index_usage
+table_io_waits_summary_by_table
+table_lock_waits_summary_by_table
+table_stats
+tables_priv
+test_suppressions
+threads
+time_zone
+time_zone_leap_second
+time_zone_name
+time_zone_transition
+time_zone_transition_type
+transaction_registry
+user
+users
 DROP TABLE t1, t2, s1;
diff --git a/mysql-test/suite/sql_sequence/rebuild.test b/mysql-test/suite/sql_sequence/rebuild.test
index 66b99ba0e94..7c00e0be7cc 100644
--- a/mysql-test/suite/sql_sequence/rebuild.test
+++ b/mysql-test/suite/sql_sequence/rebuild.test
@@ -10,7 +10,9 @@ CREATE TABLE t1 (a INT) ENGINE=MyISAM;
 CREATE TABLE t2 (b VARCHAR(64)) ENGINE=MyISAM;
 CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW INSERT INTO t2 SELECT TABLE_NAME FROM INFORMATION_SCHEMA.PARTITIONS;
 INSERT INTO t1 VALUES (1);
+--sorted_result
 select * from t1;
+--sorted_result
 select * from t2;
 
 # Cleanup

From bf2f391664c56334ff9229e448bb3efa166c40b7 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:46:49 +0300
Subject: [PATCH 48/59] MDEV-21147 Assertion `marked_for_read()' upon UPDATE on
 versioned table via view

Unit prepare prematurely fixed field which must be fixed via
setup_conds() to correctly update table->covering_keys.

Call vers_setup_conds() directly instead, because actually everything
else is not needed.
---
 mysql-test/suite/versioning/r/update.result | 4 ++++
 mysql-test/suite/versioning/t/update.test   | 5 +++++
 sql/sql_derived.cc                          | 3 ++-
 3 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result
index 64aa7c7068c..94f6f8fa998 100644
--- a/mysql-test/suite/versioning/r/update.result
+++ b/mysql-test/suite/versioning/r/update.result
@@ -295,5 +295,9 @@ primary key (pk)
 create or replace view v1 as select * from t1;
 insert into t1 values  (1, null, 'd') ,  (2, null, 'i') ;
 update v1 set a= null where b = '';
+create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
+insert into t1 values (1,1),(2,2);
+create or replace view v1 as select * from t1;
+update v1 set id= 2 where k = 0;
 drop view v1;
 drop table t1;
diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test
index baf3c1ec876..0af3c450ce5 100644
--- a/mysql-test/suite/versioning/t/update.test
+++ b/mysql-test/suite/versioning/t/update.test
@@ -214,6 +214,11 @@ create or replace view v1 as select * from t1;
 insert into t1 values  (1, null, 'd') ,  (2, null, 'i') ;
 update v1 set a= null where b = '';
 
+create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
+insert into t1 values (1,1),(2,2);
+create or replace view v1 as select * from t1;
+update v1 set id= 2 where k = 0;
+
 # cleanup
 drop view v1;
 drop table t1;
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 652353fb722..9d6748937ad 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -707,8 +707,9 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
       case SQLCOM_DELETE_MULTI:
       case SQLCOM_UPDATE:
       case SQLCOM_UPDATE_MULTI:
-        if ((res= unit->prepare(derived, derived->derived_result, 0)))
+        if ((res= unit->first_select()->vers_setup_conds(thd, derived->merge_underlying_list)))
           goto exit;
+        derived->where= and_items(thd, derived->where, derived->merge_underlying_list->where);
       default:
         break;
       }

From 8a46b706aab428998e0a3d0315c7c3d67752fddc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Vicen=C8=9Biu=20Ciorbaru?= 
Date: Tue, 3 Dec 2019 14:47:55 +0200
Subject: [PATCH 49/59] Update innodb_i_s_tables_disabled.result post typo fix

---
 .../mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
index 8d5b6270318..61f005c1758 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/innodb_i_s_tables_disabled.result
@@ -79,7 +79,7 @@ buffer_LRU_batch_flush_avg_time_thread	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL
 buffer_flush_adaptive_avg_time_est	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Estimated time (ms) spent for adaptive flushing recently.
 buffer_LRU_batch_flush_avg_time_est	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Estimated time (ms) spent for LRU batch flushing recently.
 buffer_flush_avg_time	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Avg time (ms) spent for flushing recently.
-buffer_flush_adaptive_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Numner of adaptive flushes passed during the recent Avg period.
+buffer_flush_adaptive_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of adaptive flushes passed during the recent Avg period.
 buffer_LRU_batch_flush_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of LRU batch flushes passed during the recent Avg period.
 buffer_flush_avg_pass	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Number of flushes passed during the recent Avg period.
 buffer_LRU_get_free_loops	buffer	0	NULL	NULL	NULL	0	NULL	NULL	NULL	NULL	NULL	NULL	NULL	disabled	counter	Total loops in LRU get free.

From ccc5e57730ae480d739adb44fd9a51773ae755ad Mon Sep 17 00:00:00 2001
From: Oleksandr Byelkin 
Date: Tue, 3 Dec 2019 15:44:41 +0100
Subject: [PATCH 50/59] vew CC v 3.1

---
 libmariadb | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libmariadb b/libmariadb
index f035fc5f7fd..c8833751cf4 160000
--- a/libmariadb
+++ b/libmariadb
@@ -1 +1 @@
-Subproject commit f035fc5f7fda5ac01d557073ef219c7e8d65fe10
+Subproject commit c8833751cf48d0085d9d7a4285aafdc967a63a4d

From f7d35ffc7691bbbf65101fb1a496e441a2b00a83 Mon Sep 17 00:00:00 2001
From: Oleksandr Byelkin 
Date: Tue, 3 Dec 2019 20:39:16 +0100
Subject: [PATCH 51/59] Galera test fix after merge.

---
 .../suite/galera/r/galera_as_slave_gtid_myisam.result     | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
index d9a87571655..0e5c6425d6a 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_gtid_myisam.result
@@ -1,21 +1,29 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connection node_2;
 ALTER TABLE mysql.gtid_slave_pos engine = InnoDB;
 START SLAVE;
+connection node_1;
 CREATE TABLE t1 (f1 INTEGER PRIMARY KEY) ENGINE=MyISAM;
 INSERT INTO t1 VALUES(1);
 SELECT LENGTH(@@global.gtid_binlog_state) > 1;
 LENGTH(@@global.gtid_binlog_state) > 1
 1
+connection node_2;
 gtid_binlog_state_equal
 0
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
 SELECT COUNT(*) = 0 FROM t1;
 COUNT(*) = 0
 1
 gtid_binlog_state_equal
 0
 #cleanup
+connection node_1;
 DROP TABLE t1;
 reset master;
+connection node_2;
 STOP SLAVE;
 RESET SLAVE ALL;
 reset master;
+connection node_3;
 reset master;

From 477629d2cd3176850ef65eacad16f44bbc20fa2b Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:46:49 +0300
Subject: [PATCH 52/59] MDEV-21147 Assertion `marked_for_read()' upon UPDATE on
 versioned table via view

Unit prepare prematurely fixed field which must be fixed via
setup_conds() to correctly update table->covering_keys.

Call vers_setup_conds() directly instead, because actually everything
else is not needed.
---
 mysql-test/suite/versioning/r/update.result | 12 ++++++++++++
 mysql-test/suite/versioning/t/update.test   | 14 ++++++++++++++
 sql/sql_derived.cc                          |  9 ++++++++-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/versioning/r/update.result b/mysql-test/suite/versioning/r/update.result
index 64aa7c7068c..e7c617f9196 100644
--- a/mysql-test/suite/versioning/r/update.result
+++ b/mysql-test/suite/versioning/r/update.result
@@ -295,5 +295,17 @@ primary key (pk)
 create or replace view v1 as select * from t1;
 insert into t1 values  (1, null, 'd') ,  (2, null, 'i') ;
 update v1 set a= null where b = '';
+create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
+insert into t1 values (1,1),(2,2);
+create or replace view v1 as select * from t1;
+update v1 set id= 2 where k = 0;
+create or replace table t1 (a int) with system versioning;
+create or replace view v1 as select * from t1;
+create or replace procedure sp() update v1 set xx = 1;
+call sp;
+ERROR 42S22: Unknown column 'xx' in 'field list'
+call sp;
+ERROR 42S22: Unknown column 'xx' in 'field list'
+drop procedure sp;
 drop view v1;
 drop table t1;
diff --git a/mysql-test/suite/versioning/t/update.test b/mysql-test/suite/versioning/t/update.test
index baf3c1ec876..548505bd39a 100644
--- a/mysql-test/suite/versioning/t/update.test
+++ b/mysql-test/suite/versioning/t/update.test
@@ -214,7 +214,21 @@ create or replace view v1 as select * from t1;
 insert into t1 values  (1, null, 'd') ,  (2, null, 'i') ;
 update v1 set a= null where b = '';
 
+create or replace table t1 (id int, k int, primary key (id)) engine=innodb with system versioning;
+insert into t1 values (1,1),(2,2);
+create or replace view v1 as select * from t1;
+update v1 set id= 2 where k = 0;
+
+create or replace table t1 (a int) with system versioning;
+create or replace view v1 as select * from t1;
+create or replace procedure sp() update v1 set xx = 1;
+--error ER_BAD_FIELD_ERROR
+call sp;
+--error ER_BAD_FIELD_ERROR
+call sp;
+
 # cleanup
+drop procedure sp;
 drop view v1;
 drop table t1;
 
diff --git a/sql/sql_derived.cc b/sql/sql_derived.cc
index 652353fb722..1f465a100c9 100644
--- a/sql/sql_derived.cc
+++ b/sql/sql_derived.cc
@@ -707,8 +707,15 @@ bool mysql_derived_prepare(THD *thd, LEX *lex, TABLE_LIST *derived)
       case SQLCOM_DELETE_MULTI:
       case SQLCOM_UPDATE:
       case SQLCOM_UPDATE_MULTI:
-        if ((res= unit->prepare(derived, derived->derived_result, 0)))
+        if ((res= first_select->vers_setup_conds(thd,
+                                                 derived->merge_underlying_list)))
           goto exit;
+        if (derived->merge_underlying_list->where)
+        {
+          Query_arena_stmt on_stmt_arena(thd);
+          derived->where= and_items(thd, derived->where,
+                                    derived->merge_underlying_list->where);
+        }
       default:
         break;
       }

From f6d8640d678799244cd9aede6abfd4493e139665 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 21:26:44 +0300
Subject: [PATCH 53/59] MDEV-18929 2nd execution of SP does not detect
 ER_VERS_NOT_VERSIONED

Related to 87731177 and Bug#47649.

Don't set Query_arena::STMT_EXECUTED for any error
code. skip_setup_conds() depends on STMT_INITIALIZED_FOR_SP, but
sp_lex_keeper::reset_lex_and_exec_core() sets it to STMT_EXECUTED on
ER_TABLE_NOT_LOCKED_FOR_WRITE. There are other error codes that can
break skip_setup_conds() (ER_IT_IS_A_VIEW, ER_NON_UPDATABLE_TABLE,
etc).
---
 sql/sp_head.cc | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 48166fac4c6..ab7faf51849 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -3379,11 +3379,7 @@ sp_lex_keeper::reset_lex_and_exec_core(THD *thd, uint *nextp,
     Update the state of the active arena if no errors on
     open_tables stage.
   */
-  if (likely(!res) || likely(!thd->is_error()) ||
-      (thd->get_stmt_da()->sql_errno() != ER_CANT_REOPEN_TABLE &&
-       thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE &&
-       thd->get_stmt_da()->sql_errno() != ER_NO_SUCH_TABLE_IN_ENGINE &&
-       thd->get_stmt_da()->sql_errno() != ER_UPDATE_TABLE_USED))
+  if (likely(!res) || likely(!thd->is_error()))
     thd->stmt_arena->state= Query_arena::STMT_EXECUTED;
 
   /*

From c9b9eb331570704d020fcc7c7894f19febe7f26d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= 
Date: Wed, 4 Dec 2019 11:46:37 +0200
Subject: [PATCH 54/59] MDEV-18497 : CTAS async replication from mariadb master
 crashes galera nodes (#1410)

In MariaDB 10.2 master could have been configured so that there
is extra annotate events. When we peak next event type for CTAS we
need to skip annotate events.
---
 .../galera/r/galera_as_slave_ctas.result      | 14 +++++++++++
 sql/slave.cc                                  | 24 ++++++++++++-------
 2 files changed, 29 insertions(+), 9 deletions(-)

diff --git a/mysql-test/suite/galera/r/galera_as_slave_ctas.result b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
index 79114824008..13cbbc905e3 100644
--- a/mysql-test/suite/galera/r/galera_as_slave_ctas.result
+++ b/mysql-test/suite/galera/r/galera_as_slave_ctas.result
@@ -1,14 +1,28 @@
+connect node_2a, 127.0.0.1, root, , test, $NODE_MYPORT_2;
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_2;
 START SLAVE;
+connection node_1;
 SHOW VARIABLES LIKE 'binlog_format';
 Variable_name	Value
 binlog_format	ROW
+connection node_1;
 CREATE TABLE source (f1 INTEGER PRIMARY KEY) ENGINE=InnoDB;
 CREATE TABLE target AS SELECT * FROM source;
+connection node_2;
+connection node_3;
+connection node_1;
 DROP TABLE target;
 INSERT INTO source VALUES(1);
 CREATE TABLE target AS SELECT * FROM source;
+connection node_2;
+connection node_3;
+connection node_1;
 DROP TABLE source;
 DROP TABLE target;
+connection node_3;
+connection node_2;
 STOP SLAVE;
 RESET SLAVE ALL;
+connection node_1;
 RESET MASTER;
diff --git a/sql/slave.cc b/sql/slave.cc
index 17abf8d53f3..83edc52c3fd 100644
--- a/sql/slave.cc
+++ b/sql/slave.cc
@@ -7397,24 +7397,30 @@ err:
 #ifdef WITH_WSREP
 enum Log_event_type wsrep_peak_event(rpl_group_info *rgi, ulonglong* event_size)
 {
+  enum Log_event_type ev_type;
+
   mysql_mutex_lock(&rgi->rli->data_lock);
 
   unsigned long long event_pos= rgi->event_relay_log_pos;
+  unsigned long long orig_future_pos= rgi->future_event_relay_log_pos;
   unsigned long long future_pos= rgi->future_event_relay_log_pos;
 
-  /* scan the log to read next event */
-  my_b_seek(rgi->rli->cur_log, future_pos);
-  rgi->rli->event_relay_log_pos= future_pos;
-  rgi->event_relay_log_pos= future_pos;
-
-  Log_event* ev = next_event(rgi, event_size);
-  enum Log_event_type ev_type= (ev) ? ev->get_type_code() : UNKNOWN_EVENT;
-  delete ev;
+  /* scan the log to read next event and we skip
+     annotate events. */
+  do {
+    my_b_seek(rgi->rli->cur_log, future_pos);
+    rgi->rli->event_relay_log_pos= future_pos;
+    rgi->event_relay_log_pos= future_pos;
+    Log_event* ev= next_event(rgi, event_size);
+    ev_type= (ev) ? ev->get_type_code() : UNKNOWN_EVENT;
+    delete ev;
+    future_pos+= *event_size;
+  } while (ev_type == ANNOTATE_ROWS_EVENT);
 
   /* scan the log back and re-set the positions to original values */
   rgi->rli->event_relay_log_pos= event_pos;
   rgi->event_relay_log_pos= event_pos;
-  my_b_seek(rgi->rli->cur_log, future_pos);
+  my_b_seek(rgi->rli->cur_log, orig_future_pos);
 
   mysql_mutex_unlock(&rgi->rli->data_lock);
 

From c4ed1bee5b0dcaf878080d2bdc193f7d28cff78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Wed, 4 Dec 2019 18:10:31 +0200
Subject: [PATCH 55/59] MDEV-21172 Memory leak after failed ADD PRIMARY KEY

---
 .../suite/innodb/r/instant_alter,4k.rdiff     | 60 ++++++++++++-------
 .../suite/innodb/r/instant_alter.result       | 23 ++++++-
 .../suite/innodb/r/instant_alter_bugs.result  |  1 +
 mysql-test/suite/innodb/t/instant_alter.test  | 12 ++++
 .../suite/innodb/t/instant_alter_bugs.test    |  2 +
 storage/innobase/handler/handler0alter.cc     |  3 +-
 6 files changed, 78 insertions(+), 23 deletions(-)

diff --git a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
index c362174e5ba..cb65d12b09f 100644
--- a/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
+++ b/mysql-test/suite/innodb/r/instant_alter,4k.rdiff
@@ -119,7 +119,16 @@
  connection default;
  InnoDB		0 transactions not purged
  DROP TABLE t1,t2,t3,t4,big;
-@@ -698,7 +712,7 @@
+@@ -515,6 +529,8 @@
+ CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ ALTER TABLE t1 ADD d TEXT;
+ ALTER TABLE t1 ADD PRIMARY KEY (a,b);
++Warnings:
++Warning	139	Row size too large (> 1979). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+ DROP TABLE t1;
+ CREATE TABLE t1
+@@ -703,7 +719,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -128,7 +137,7 @@
  connection default;
  ROLLBACK;
  connection analyze;
-@@ -708,7 +722,7 @@
+@@ -713,7 +729,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -137,7 +146,7 @@
  connection default;
  BEGIN;
  UPDATE t2 SET d1 = repeat(id, 200);
-@@ -719,7 +733,7 @@
+@@ -724,7 +740,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -146,7 +155,7 @@
  connection default;
  ROLLBACK;
  connection analyze;
-@@ -729,7 +743,7 @@
+@@ -734,7 +750,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -155,7 +164,7 @@
  connection default;
  ALTER TABLE t2 DROP p;
  affected rows: 0
-@@ -778,7 +792,9 @@
+@@ -783,7 +799,9 @@
  info: Records: 0  Duplicates: 0  Warnings: 0
  ALTER TABLE t3 ADD COLUMN b BLOB NOT NULL;
  affected rows: 0
@@ -166,7 +175,7 @@
  INSERT INTO t3 SET id=4;
  ERROR HY000: Field 'c2' doesn't have a default value
  INSERT INTO t3 SET id=4, c2=0, b=0xf09f98b1;
-@@ -791,7 +807,9 @@
+@@ -796,7 +814,9 @@
  ALTER TABLE t3 CHANGE t phrase TEXT DEFAULT 0xc3a4c3a448,
  CHANGE b b BLOB NOT NULL DEFAULT 'binary line of business';
  affected rows: 4
@@ -177,7 +186,7 @@
  INSERT INTO t3 SET id=5, c2=9;
  Warnings:
  Note	1265	Data truncated for column 'c7' at row 1
-@@ -805,7 +823,9 @@
+@@ -810,7 +830,9 @@
  5	9	POLYGON((1 1,2 2,3 3,1 1))	1970-01-01 03:00:42	1970-01-01 03:00:42	NULL	03:00:42	1970-01-01	ääH	binary line of business
  ALTER TABLE t3 DROP c3, DROP c7;
  affected rows: 0
@@ -188,7 +197,7 @@
  SELECT * FROM t3;
  id	c2	c4	c5	c6	c8	phrase	b
  1	1	1970-01-01 03:00:42	1970-01-01 03:00:42	NULL	1970-01-01	The quick brown fox jumps over the lazy dog	
-@@ -833,6 +853,8 @@
+@@ -838,6 +860,8 @@
  (id INT PRIMARY KEY, c1 VARCHAR(4000), c2 VARCHAR(4000), c3 VARCHAR(1000),
  p POINT NOT NULL DEFAULT ST_GeomFromText('POINT(0 0)'), SPATIAL INDEX(p))
  ENGINE=InnoDB ROW_FORMAT=COMPACT;
@@ -197,7 +206,7 @@
  BEGIN;
  INSERT INTO big
  SET id=1, c1=REPEAT('a', 200), c2=REPEAT('b', 200), c3=REPEAT('c', 159);
-@@ -850,13 +872,15 @@
+@@ -855,13 +879,15 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -215,7 +224,7 @@
  CHECKSUM TABLE big;
  Table	Checksum
  test.big	1705165209
-@@ -873,7 +897,7 @@
+@@ -878,7 +904,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -224,7 +233,7 @@
  connection default;
  ROLLBACK;
  CHECKSUM TABLE big;
-@@ -886,7 +910,7 @@
+@@ -891,7 +917,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -233,7 +242,16 @@
  connection default;
  InnoDB		0 transactions not purged
  DROP TABLE t1,t2,t3,t4,big;
-@@ -1155,7 +1179,7 @@
+@@ -977,6 +1003,8 @@
+ CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ ALTER TABLE t1 ADD d TEXT;
+ ALTER TABLE t1 ADD PRIMARY KEY (a,b);
++Warnings:
++Warning	139	Row size too large (> 1982). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.
+ ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+ DROP TABLE t1;
+ CREATE TABLE t1
+@@ -1165,7 +1193,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -242,7 +260,7 @@
  connection default;
  ROLLBACK;
  connection analyze;
-@@ -1165,7 +1189,7 @@
+@@ -1175,7 +1203,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -251,7 +269,7 @@
  connection default;
  BEGIN;
  UPDATE t2 SET d1 = repeat(id, 200);
-@@ -1176,7 +1200,7 @@
+@@ -1186,7 +1214,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -260,7 +278,7 @@
  connection default;
  ROLLBACK;
  connection analyze;
-@@ -1186,7 +1210,7 @@
+@@ -1196,7 +1224,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/t2';
  clust_index_size
@@ -269,7 +287,7 @@
  connection default;
  ALTER TABLE t2 DROP p;
  affected rows: 0
-@@ -1307,7 +1331,7 @@
+@@ -1317,7 +1345,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -278,7 +296,7 @@
  connection default;
  ALTER TABLE big ADD COLUMN
  (d1 INT DEFAULT 0, d2 VARCHAR(20) DEFAULT 'abcde',
-@@ -1330,7 +1354,7 @@
+@@ -1340,7 +1368,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -287,7 +305,7 @@
  connection default;
  ROLLBACK;
  CHECKSUM TABLE big;
-@@ -1343,7 +1367,7 @@
+@@ -1353,7 +1381,7 @@
  SELECT clust_index_size FROM INFORMATION_SCHEMA.INNODB_SYS_TABLESTATS
  WHERE name = 'test/big';
  clust_index_size
@@ -296,10 +314,10 @@
  connection default;
  InnoDB		0 transactions not purged
  DROP TABLE t1,t2,t3,t4,big;
-@@ -1431,5 +1455,5 @@
+@@ -1446,5 +1474,5 @@
  FROM information_schema.global_status
  WHERE variable_name = 'innodb_instant_alter_column';
  instants
--54
-+55
+-57
++58
  SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter.result b/mysql-test/suite/innodb/r/instant_alter.result
index 72f6eee72b8..aadb7021887 100644
--- a/mysql-test/suite/innodb/r/instant_alter.result
+++ b/mysql-test/suite/innodb/r/instant_alter.result
@@ -512,6 +512,13 @@ CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
+SET innodb_strict_mode = ON;
+CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=REDUNDANT;
+ALTER TABLE t1 ADD d TEXT;
+ALTER TABLE t1 ADD PRIMARY KEY (b,a);
+ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+DROP TABLE t1;
+SET innodb_strict_mode = OFF;
 CREATE TABLE t1
 (id INT PRIMARY KEY, c2 INT UNIQUE,
 c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@@ -969,6 +976,13 @@ CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
+SET innodb_strict_mode = ON;
+CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=COMPACT;
+ALTER TABLE t1 ADD d TEXT;
+ALTER TABLE t1 ADD PRIMARY KEY (b,a);
+ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+DROP TABLE t1;
+SET innodb_strict_mode = OFF;
 CREATE TABLE t1
 (id INT PRIMARY KEY, c2 INT UNIQUE,
 c3 POINT NOT NULL DEFAULT ST_GeomFromText('POINT(3 4)'),
@@ -1426,10 +1440,17 @@ CHECK TABLE t1;
 Table	Op	Msg_type	Msg_text
 test.t1	check	status	OK
 DROP TABLE t1;
+SET innodb_strict_mode = ON;
+CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC;
+ALTER TABLE t1 ADD d TEXT;
+ALTER TABLE t1 ADD PRIMARY KEY (b,a);
+ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+DROP TABLE t1;
+SET innodb_strict_mode = OFF;
 disconnect analyze;
 SELECT variable_value-@old_instant instants
 FROM information_schema.global_status
 WHERE variable_name = 'innodb_instant_alter_column';
 instants
-54
+57
 SET GLOBAL innodb_purge_rseg_truncate_frequency= @saved_frequency;
diff --git a/mysql-test/suite/innodb/r/instant_alter_bugs.result b/mysql-test/suite/innodb/r/instant_alter_bugs.result
index 9e6c537cf7e..d07067fa19f 100644
--- a/mysql-test/suite/innodb/r/instant_alter_bugs.result
+++ b/mysql-test/suite/innodb/r/instant_alter_bugs.result
@@ -169,3 +169,4 @@ DROP FOREIGN KEY fk1,
 CHANGE b d INT UNSIGNED,
 ADD c INT;
 DROP TABLE t2, t1;
+# End of 10.3 tests
diff --git a/mysql-test/suite/innodb/t/instant_alter.test b/mysql-test/suite/innodb/t/instant_alter.test
index 12d8b877d05..be79d7437c3 100644
--- a/mysql-test/suite/innodb/t/instant_alter.test
+++ b/mysql-test/suite/innodb/t/instant_alter.test
@@ -396,6 +396,18 @@ DELETE FROM t1;
 CHECK TABLE t1;
 DROP TABLE t1;
 
+# MDEV-21172 Memory leak during ADD PRIMARY KEY
+
+SET innodb_strict_mode = ON;
+eval CREATE TABLE t1 (a INT, b VARCHAR(500), c TEXT, UNIQUE(a,b)) $engine;
+ALTER TABLE t1 ADD d TEXT;
+--error 0,ER_TOO_BIG_ROWSIZE
+ALTER TABLE t1 ADD PRIMARY KEY (b,a);
+# Exploit MDEV-17468 to force the table definition to be reloaded
+ALTER TABLE t1 ADD va INT AS (a) VIRTUAL;
+DROP TABLE t1;
+SET innodb_strict_mode = OFF;
+
 dec $format;
 let $redundant_4k= 0;
 }
diff --git a/mysql-test/suite/innodb/t/instant_alter_bugs.test b/mysql-test/suite/innodb/t/instant_alter_bugs.test
index 0edbb672584..a2626ba34a1 100644
--- a/mysql-test/suite/innodb/t/instant_alter_bugs.test
+++ b/mysql-test/suite/innodb/t/instant_alter_bugs.test
@@ -169,3 +169,5 @@ ALTER TABLE t2
     CHANGE b d INT UNSIGNED,
     ADD c INT;
 DROP TABLE t2, t1;
+
+--echo # End of 10.3 tests
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 785c8a970d4..63cb89d4e98 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -5541,6 +5541,7 @@ new_table_failed:
 				if (index) {
 					dict_mem_index_free(index);
 				}
+error_handling_drop_uncached_1:
 				while (++a < ctx->num_to_add_index) {
 					dict_mem_index_free(ctx->add_index[a]);
 				}
@@ -5552,7 +5553,7 @@ new_table_failed:
 			ctx->add_index[a] = index;
 			if (!info.row_size_is_acceptable(*index)) {
 				error = DB_TOO_BIG_RECORD;
-				goto error_handling;
+				goto error_handling_drop_uncached_1;
 			}
 			index->parser = index_defs[a].parser;
 			index->has_new_v_col = has_new_v_col;

From d759f764f6b115ca7ad7644ae3ee2e19c71c6138 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Thu, 5 Dec 2019 15:11:18 +0300
Subject: [PATCH 56/59] MDEV-21233 Assertion `m_extra_cache' failed in
 ha_partition::late_extra_cache

Incorrect assertion of EXTRA_CACHE for
HA_EXTRA_PREPARE_FOR_UPDATE. The latter is related to read cache, but
must operate without it as a noop.

Related to Bug#55458 and MDEV-20441.
---
 mysql-test/suite/versioning/r/partition.result |  9 +++++++++
 mysql-test/suite/versioning/t/partition.test   | 13 +++++++++++++
 sql/ha_partition.cc                            |  1 -
 3 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/versioning/r/partition.result b/mysql-test/suite/versioning/r/partition.result
index a6fa5fcf2ad..aa884743b2f 100644
--- a/mysql-test/suite/versioning/r/partition.result
+++ b/mysql-test/suite/versioning/r/partition.result
@@ -605,3 +605,12 @@ Table	Op	Msg_type	Msg_text
 test.t1	check	note	Not supported for non-INTERVAL history partitions
 test.t1	check	note	The storage engine for the table doesn't support check
 drop table t1;
+#
+# MDEV-21233 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache
+#
+create table t1 (id int, a varchar(8)) with system versioning partition by key (id) partitions 2;
+insert into t1 values  (1,'foo'),(2,'bar');
+create table t2 (b int);
+insert into t2 values (1),(2);
+update t1, t2 set a = 1;
+drop table t1, t2;
diff --git a/mysql-test/suite/versioning/t/partition.test b/mysql-test/suite/versioning/t/partition.test
index dcbb6e4c293..8898088b1bc 100644
--- a/mysql-test/suite/versioning/t/partition.test
+++ b/mysql-test/suite/versioning/t/partition.test
@@ -553,5 +553,18 @@ check table t1;
 # cleanup
 drop table t1;
 
+--echo #
+--echo # MDEV-21233 Assertion `m_extra_cache' failed in ha_partition::late_extra_cache
+--echo #
+create table t1 (id int, a varchar(8)) with system versioning partition by key (id) partitions 2;
+insert into t1 values  (1,'foo'),(2,'bar');
+
+create table t2 (b int);
+insert into t2 values (1),(2);
+
+update t1, t2 set a = 1;
+
+# cleanup
+drop table t1, t2;
 
 --source suite/versioning/common_finish.inc
diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc
index 09aef634c94..a7942f493d7 100644
--- a/sql/ha_partition.cc
+++ b/sql/ha_partition.cc
@@ -9227,7 +9227,6 @@ void ha_partition::late_extra_cache(uint partition_id)
   }
   if (m_extra_prepare_for_update)
   {
-    DBUG_ASSERT(m_extra_cache);
     (void) file->extra(HA_EXTRA_PREPARE_FOR_UPDATE);
   }
   m_extra_cache_part_id= partition_id;

From 1fbd9bb2c5d134209ac2aae073f7a78797c1c04e Mon Sep 17 00:00:00 2001
From: Robert Bindar 
Date: Thu, 5 Dec 2019 18:26:52 +0200
Subject: [PATCH 57/59] Merge pull request #1261 from robertbindar/mdev-17978

MDEV-17978 Server crash in SHOW CREATE SEQUENCE on a broken view
---
 mysql-test/suite/sql_sequence/view.result | 10 ++++++++++
 mysql-test/suite/sql_sequence/view.test   | 11 +++++++++++
 sql/sql_show.cc                           |  3 ++-
 3 files changed, 23 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/sql_sequence/view.result b/mysql-test/suite/sql_sequence/view.result
index bd773dcc042..0f39a637deb 100644
--- a/mysql-test/suite/sql_sequence/view.result
+++ b/mysql-test/suite/sql_sequence/view.result
@@ -24,3 +24,13 @@ ERROR 42S02: 'test.v1' is not a SEQUENCE
 SELECT PREVIOUS VALUE FOR v1;
 ERROR 42S02: 'test.v1' is not a SEQUENCE
 drop view v1;
+#
+# MDEV 17978 Server crashes in mysqld_show_create_get_fields
+# upon SHOW CREATE SEQUENCE on a broken view
+#
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP TABLE t1;
+SHOW CREATE SEQUENCE v1;
+ERROR 42S02: 'test.v1' is not a SEQUENCE
+DROP VIEW v1;
diff --git a/mysql-test/suite/sql_sequence/view.test b/mysql-test/suite/sql_sequence/view.test
index fe968604b5b..5b970432a34 100644
--- a/mysql-test/suite/sql_sequence/view.test
+++ b/mysql-test/suite/sql_sequence/view.test
@@ -27,3 +27,14 @@ SELECT NEXT VALUE FOR v1;
 --error ER_NOT_SEQUENCE
 SELECT PREVIOUS VALUE FOR v1;
 drop view v1;
+
+--echo #
+--echo # MDEV 17978 Server crashes in mysqld_show_create_get_fields
+--echo # upon SHOW CREATE SEQUENCE on a broken view
+--echo #
+CREATE TABLE t1 (a INT);
+CREATE VIEW v1 AS SELECT * FROM t1;
+DROP TABLE t1;
+--error ER_NOT_SEQUENCE
+SHOW CREATE SEQUENCE v1;
+DROP VIEW v1;
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index a853d3df6f6..85e915bb65a 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -1316,7 +1316,8 @@ mysqld_show_create_get_fields(THD *thd, TABLE_LIST *table_list,
     goto exit;
   }
   else if (lex->table_type == TABLE_TYPE_SEQUENCE &&
-           table_list->table->s->table_type != TABLE_TYPE_SEQUENCE)
+           (!table_list->table ||
+            table_list->table->s->table_type != TABLE_TYPE_SEQUENCE))
   {
     my_error(ER_NOT_SEQUENCE, MYF(0),
              table_list->db.str, table_list->table_name.str);

From be92dce61353952da593b32f3f52b81b89ee7219 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Thu, 5 Dec 2019 23:45:57 +0300
Subject: [PATCH 58/59] MDEV-21234 Server crashes in in setup_on_expr upon 3rd
 execution of SP

Versioned conditions in on_expr can not be rebuilt at optimization
stage on non-conventional arena.
---
 mysql-test/suite/versioning/r/select.result | 24 +++++++++++++++++
 mysql-test/suite/versioning/t/select.test   | 29 +++++++++++++++++++++
 sql/sql_select.cc                           | 15 ++++++++++-
 3 files changed, 67 insertions(+), 1 deletion(-)

diff --git a/mysql-test/suite/versioning/r/select.result b/mysql-test/suite/versioning/r/select.result
index 9b6738d4eb9..f1bdcccce59 100644
--- a/mysql-test/suite/versioning/r/select.result
+++ b/mysql-test/suite/versioning/r/select.result
@@ -586,6 +586,30 @@ call p;
 i
 drop procedure p;
 drop table t1;
+#
+# MDEV-21234 Server crashes in in setup_on_expr upon 3rd execution of SP
+#
+create table t1 (a varchar(8));
+insert into t1 values ('foo'),('bar');
+create table t2 (b date);
+create procedure pr() insert into t2 select * from t1;
+call pr;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+prepare stmt from 'insert into t2 select * from t1';
+execute stmt;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+alter table t1 add system versioning;
+call pr;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+call pr;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+execute stmt;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+execute stmt;
+ERROR 22007: Incorrect date value: 'foo' for column `test`.`t2`.`b` at row 1
+drop prepare stmt;
+drop procedure pr;
+drop table t1, t2;
 call verify_trt_dummy(34);
 No	A	B	C	D
 1	1	1	1	1
diff --git a/mysql-test/suite/versioning/t/select.test b/mysql-test/suite/versioning/t/select.test
index 3fbeaf7578f..069fe7a9a8d 100644
--- a/mysql-test/suite/versioning/t/select.test
+++ b/mysql-test/suite/versioning/t/select.test
@@ -392,6 +392,35 @@ call p;
 drop procedure p;
 drop table t1;
 
+--echo #
+--echo # MDEV-21234 Server crashes in in setup_on_expr upon 3rd execution of SP
+--echo #
+create table t1 (a varchar(8));
+insert into t1 values ('foo'),('bar');
+create table t2 (b date);
+
+create procedure pr() insert into t2 select * from t1;
+--error ER_TRUNCATED_WRONG_VALUE
+call pr;
+prepare stmt from 'insert into t2 select * from t1';
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+alter table t1 add system versioning;
+--error ER_TRUNCATED_WRONG_VALUE
+call pr;
+--error ER_TRUNCATED_WRONG_VALUE
+call pr;
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+--error ER_TRUNCATED_WRONG_VALUE
+execute stmt;
+drop prepare stmt;
+
+# cleanup
+drop procedure pr;
+drop table t1, t2;
+
+
 call verify_trt_dummy(34);
 
 -- source suite/versioning/common_finish.inc
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 4c83c1d84e5..275c46141cd 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -1713,7 +1713,20 @@ JOIN::optimize_inner()
     }
   }
   
-  conds= optimize_cond(this, conds, join_list, FALSE,
+  bool ignore_on_expr= false;
+  /*
+    PS/SP note: on_expr of versioned table can not be reallocated
+    (see build_equal_items() below) because it can be not rebuilt
+    at second invocation.
+  */
+  if (!thd->stmt_arena->is_conventional() && thd->mem_root != thd->stmt_arena->mem_root)
+    for (TABLE_LIST *tbl= tables_list; tbl; tbl= tbl->next_local)
+      if (tbl->table && tbl->on_expr && tbl->table->versioned())
+      {
+        ignore_on_expr= true;
+        break;
+      }
+  conds= optimize_cond(this, conds, join_list, ignore_on_expr,
                        &cond_value, &cond_equal, OPT_LINK_EQUAL_FIELDS);
   
   if (thd->is_error())

From e5e5877740f248de848219ee3a1d2881cd5c5b82 Mon Sep 17 00:00:00 2001
From: Elena Stepanova 
Date: Fri, 6 Dec 2019 00:18:10 +0200
Subject: [PATCH 59/59] List of unstable tests for 10.3.21 release

---
 mysql-test/unstable-tests | 534 +++++++++-----------------------------
 1 file changed, 128 insertions(+), 406 deletions(-)

diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 8a8eca4dc67..6463c4a6d9a 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,271 +23,140 @@
 #
 ##############################################################################
 #
-# Based on 10.3 9c6fec88b10bfe51d87f63e6a6ea474cd18d1952
+# Based on 10.3 be92dce61353952da593b32f3f52b81b89ee7219
 
-main.alter_table                      : Modified in 10.3.18
-main.alter_table_mdev539_maria        : Include file modified in 10.3.18
-main.alter_table_mdev539_myisam       : Include file modified in 10.3.18
 main.alter_table_trans                : MDEV-12084 - timeout
-main.analyze                          : Modified in 10.3.18
-main.analyze_format_json              : Modified in 10.3.18
-main.analyze_stmt                     : Modified in 10.3.18
-main.analyze_stmt_orderby             : Modified in 10.3.18
-main.analyze_stmt_privileges2         : Modified in 10.3.18
 main.analyze_stmt_slow_query_log      : MDEV-12237 - Wrong result
 main.auth_named_pipe                  : MDEV-14724 - System error 2
 main.auto_increment_ranges_innodb     : Include file modified in 10.3.19
 main.auto_increment_ranges_myisam     : Include file modified in 10.3.19
-main.bootstrap                        : Modified in 10.3.18
-main.bug13633383                      : Modified in 10.3.18
-main.cast                             : Modified in 10.2.27
 main.compare                          : Modified in 10.3.19
-main.compound                         : Modified in 10.3.18
-main.compress                         : Include file modified in 10.3.18
 main.connect                          : MDEV-17282 - Wrong result
 main.connect2                         : MDEV-13885 - Server crash
-main.constraints                      : Modified in 10.3.18
 main.count_distinct2                  : MDEV-11768 - timeout
-main.create                           : Modified in 10.3.18
 main.create_delayed                   : MDEV-10605 - failed with timeout
 main.create_drop_event                : MDEV-16271 - Wrong result
-main.cte_nonrecursive                 : Modified in 10.3.18
-main.cte_recursive                    : Modified in 10.3.18
-main.ctype_create                     : Modified in 10.2.27
-main.ctype_latin1_de                  : Modified in 10.2.27
 main.ctype_uca                        : Include file modified in 10.3.19
 main.ctype_uca_innodb                 : Include file modified in 10.3.19
 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_utf16_def                  : Configuration modified in 10.3.18
 main.ctype_utf16le                    : MDEV-10675: timeout or extra warnings
 main.ctype_utf8                       : Include file modified in 10.3.19
-main.ctype_utf8mb4                    : Modified in 10.3.18
-main.ctype_utf8mb4_heap               : Include file modified in 10.3.18
-main.ctype_utf8mb4_innodb             : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison; include file modified in 10.3.18
-main.ctype_utf8mb4_myisam             : Include file modified in 10.3.18
-main.custom_aggregates_i_s            : Modified in 10.3.18
+main.ctype_utf8mb4_innodb             : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison
 main.debug_sync                       : MDEV-10607 - internal error
-main.default                          : Modified in 10.3.18
-main.derived                          : Modified in 10.3.18
-main.derived_cond_pushdown            : MDEV-20532 - Floating point differences; modified in 10.3.18
+main.derived_cond_pushdown            : MDEV-20532 - Floating point differences
 main.derived_opt                      : MDEV-11768 - timeout
-main.derived_split_innodb             : Modified in 10.3.18
-main.derived_view                     : Modified in 10.3.18
 main.dirty_close                      : MDEV-19368 - mysqltest failed but provided no output
-main.distinct                         : MDEV-14194 - Crash; modified in 10.3.18
+main.distinct                         : MDEV-14194 - Crash
 main.drop_bad_db_type                 : MDEV-15676 - Wrong result; modified in 10.3.19
 main.drop_debug                       : Modified in 10.1.42
-main.dyncol                           : MDEV-19455 - Extra warning; modified in 10.3.18
-main.events_1                         : Modified in 10.3.18
-main.events_2                         : MDEV-13277 - Crash; modified in 10.3.18
-main.events_bugs                      : MDEV-12892 - Crash; modified in 10.3.18
-main.events_grant                     : Modified in 10.3.18
+main.dyncol                           : MDEV-19455 - Extra warning
+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.except                           : Modified in 10.3.18
-main.explain_json                     : Modified in 10.3.18
 main.flush                            : MDEV-19368 - mysqltest failed but provided no output
-main.flush2                           : Modified in 10.2.27
-main.func_hybrid_type                 : Modified in 10.3.18
-main.func_isnull                      : Modified in 10.3.18
 main.func_json                        : Modified in 10.3.19
 main.func_math                        : MDEV-20532 - Floating point differences; modified in 10.3.19
 main.func_misc                        : Modified in 10.3.19
-main.func_str                         : Modified in 10.3.18
-main.function_defaults                : Modified in 10.3.18
 main.gis                              : MDEV-13411 - wrong result on P8
-main.grant                            : Configuration added in 10.3.18
-main.grant2                           : Configuration added in 10.3.18
-main.grant4                           : Configuration added in 10.3.18
-main.grant_cache_no_prot              : Include file modified in 10.2.27
-main.grant_cache_ps_prot              : Include file modified in 10.2.27
-main.grant_explain_non_select         : Modified in 10.3.18
-main.greedy_optimizer                 : Modified in 10.3.18
-main.group_by                         : Modified in 10.3.18
-main.group_min_max                    : Modified in 10.3.18
-main.handlersocket                    : Configuration added in 10.3.18
 main.host_cache_size_functionality    : MDEV-10606 - sporadic failure on shutdown
-main.index_intersect                  : Modified in 10.3.18
 main.index_intersect_innodb           : MDEV-10643 - failed with timeout
 main.index_merge_innodb               : MDEV-7142 - Plan mismatch; modified in 10.3.19
 main.index_merge_myisam               : Modified in 10.3.19
-main.information_schema               : Modified in 10.3.18
-main.information_schema-big           : Modified in 10.3.18
 main.information_schema_db            : Modified in 10.3.19
-main.information_schema_parameters    : Modified in 10.3.18
-main.information_schema_routines      : Modified in 10.3.18
-main.innodb_ext_key                   : Modified in 10.3.18
-main.innodb_icp                       : Modified in 10.3.18
 main.innodb_mysql_lock                : MDEV-7861 - Wrong result
-main.intersect                        : Modified in 10.3.18
-main.invisible_field_debug            : Modified in 10.3.18
-main.join                             : Modified in 10.3.18
-main.join_cache                       : MDEV-17743 - Bad address from storage engine MyISAM; modified in 10.3.18
-main.join_nested_jcl6                 : Modified in 10.3.18
-main.join_outer                       : Modified in 10.2.27
-main.join_outer_innodb                : Modified in 10.3.18
-main.join_outer_jcl6                  : Modified in 10.3.18
-main.kill                             : Modified in 10.3.18
+main.join                             : Modified in 10.1.42
+main.join_cache                       : MDEV-17743 - Bad address from storage engine MyISAM
+main.kill                             : Modified in 10.2.28
 main.kill-2                           : MDEV-13257 - Wrong result
 main.kill_processlist-6619            : MDEV-10793 - Wrong result
-main.limit_rows_examined              : Modified in 10.3.18
 main.loaddata                         : MDEV-19368 - mysqltest failed but provided no output
 main.locale                           : MDEV-20521 - Missing warning
-main.log_slow                         : MDEV-13263 - Wrong result; modified in 10.3.18
+main.log_slow                         : MDEV-13263 - Wrong result
 main.log_slow_debug                   : Modified in 10.3.19
 main.log_tables-big                   : MDEV-13408 - wrong result
 main.mdev-504                         : MDEV-15171 - warning
-main.mdev13607                        : Modified in 10.3.18
 main.mdev375                          : MDEV-10607 - sporadic "can't connect"
-main.merge                            : MDEV-10607 - sporadic "can't connect"; modified in 10.3.18
-main.mrr_icp_extra                    : Modified in 10.3.18
-main.multi_update                     : Modified in 10.3.18
+main.merge                            : MDEV-10607 - sporadic "can't connect"
 main.multi_update_debug               : MDEV-20136 - Debug sync point wait timed out
 main.myisam                           : Modified in 10.3.19
-main.myisam_explain_non_select_all    : Modified in 10.3.18
-main.myisam_icp                       : Modified in 10.3.18
-main.myisam_mrr                       : Modified in 10.3.18
-main.mysql                            : Modified in 10.3.18
-main.mysql_client_test                : MDEV-19369 - error: 5888, status: 23, errno: 2; modified in 10.3.18
+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_comments                   : Modified in 10.3.18
 main.mysql_upgrade_noengine           : MDEV-14355 - Wrong result
-main.mysql_upgrade_ssl                : MDEV-13492 - Unknown SSL error
-main.mysqlcheck                       : Modified in 10.3.18
-main.mysqldump                        : MDEV-14800 - Stack smashing detected; modified in 10.3.18
-main.mysqldump-compat-102             : Modified in 10.3.18
-main.mysqldump-max                    : Modified in 10.2.27
-main.mysqldump-nl                     : Modified in 10.3.18
-main.mysqldump-utf8mb4                : Modified in 10.3.18
+main.mysqld_option_err                : MDEV-21236 - Wrong error
+main.mysqldump                        : MDEV-14800 - Stack smashing detected
 main.mysqlhotcopy_myisam              : MDEV-10995 - Hang on debug
 main.mysqlslap                        : MDEV-11801 - timeout
 main.mysqltest                        : MDEV-13887 - Wrong result
-main.named_pipe                       : Include file modified in 10.3.18
 main.old-mode                         : MDEV-19373 - Wrong result
-main.openssl_1                        : MDEV-13492 - Unknown SSL error; modified in 10.3.18
 main.openssl_6975                     : MDEV-17184 - Failures with OpenSSL 1.1.1
-main.opt_tvc                          : Modified in 10.3.18
+main.order_by                         : Modified in 10.3.21
 main.order_by_innodb                  : Modified in 10.3.19
 main.order_by_optimizer_innodb        : MDEV-10683 - Wrong result
 main.partition_debug_sync             : MDEV-15669 - Deadlock found when trying to get lock; modified in 10.3.19
-main.partition_example                : Configuration added in 10.3.18
 main.partition_innodb                 : Modified in 10.3.19
 main.partition_innodb_plugin          : MDEV-12901 - Valgrind warnings
 main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1
-main.partition_key_cache              : Modified in 10.2.27
-main.partition_pruning                : Modified in 10.3.18
-main.partition_range                  : Modified in 10.3.18
+main.partition_mrr_aria               : Added in 10.3.21
+main.partition_mrr_innodb             : Added in 10.3.21
+main.partition_mrr_myisam             : Added in 10.3.21
+main.partition_pruning                : Modified in 10.3.21
 main.partition_ucs2                   : Added in 10.3.19
 main.partition_utf8                   : Modified in 10.3.19
-main.plugin                           : Configuration added in 10.3.18
-main.plugin_innodb                    : Configuration added in 10.3.18
-main.plugin_load                      : Configuration modified in 10.3.18
-main.plugin_load_option               : Configuration modified in 10.3.18
-main.plugin_not_embedded              : Configuration added in 10.3.18
-main.pool_of_threads                  : MDEV-18135 - SSL error: key too small; modified in 10.3.18
+main.pool_of_threads                  : MDEV-18135 - SSL error: key too small
 main.processlist                      : Modified in 10.3.19
 main.processlist_notembedded          : Added in 10.3.19
-main.ps                               : MDEV-11017 - Sporadic wrong Prepared_stmt_count; configuration modified in 10.3.18
+main.ps                               : MDEV-11017 - Sporadic wrong Prepared_stmt_count
 main.query_cache                      : MDEV-16180 - Wrong result
-main.query_cache_debug                : MDEV-15281 - Query cache is disabled; modified in 10.3.18
-main.query_cache_notembedded          : Modified in 10.3.18
-main.query_cache_ps_no_prot           : Modified in 10.3.18
-main.range                            : Modified in 10.3.18
-main.range_interrupted-13751          : Modified in 10.3.18
-main.range_mrr_icp                    : Modified in 10.3.18
-main.range_vs_index_merge             : Modified in 10.3.18
+main.query_cache_debug                : MDEV-15281 - Query cache is disabled
 main.range_vs_index_merge_innodb      : MDEV-15283 - Server has gone away
-main.repair                           : Modified in 10.3.18
-main.schema                           : Modified in 10.3.18
-main.select                           : MDEV-20532 - Floating point differences; modified in 10.3.18
+main.select                           : MDEV-20532 - Floating point differences
 main.select_jcl6                      : MDEV-20532 - Floating point differences
 main.select_pkeycache                 : MDEV-20532 - Floating point differences
-main.selectivity                      : Modified in 10.3.19
-main.selectivity_innodb               : Modified in 10.3.18
-main.selectivity_no_engine            : Modified in 10.3.18
+main.selectivity                      : Modified in 10.3.21
 main.set_statement                    : MDEV-13183 - Wrong result
 main.set_statement_notembedded        : MDEV-19414 - Wrong result
-main.shm                              : MDEV-12727 - Mismatch, ERROR 2013; include file modified in 10.3.18
-main.show_bad_definer-5553            : Modified in 10.3.18
-main.show_check                       : Modified in 10.3.18
+main.shm                              : MDEV-12727 - Mismatch, ERROR 2013
 main.show_explain                     : MDEV-10674 - Wrong result code
 main.sp                               : MDEV-7866 - Mismatch; modified in 10.3.19
-main.sp-anchor-type                   : Modified in 10.3.18
 main.sp-code                          : Modified in 10.3.19
-main.sp-error                         : Modified in 10.3.18
-main.sp-security                      : MDEV-10607 - sporadic "can't connect"; modified in 10.3.18
+main.sp-security                      : MDEV-10607 - sporadic "can't connect"
 main.sp_notembedded                   : MDEV-10607 - internal error
-main.ssl                              : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.3.18
-main.ssl-big                          : Modified in 10.3.18
+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_compress                     : Modified in 10.3.18
-main.ssl_connect                      : MDEV-13492 - Unknown SSL error
-main.ssl_crl                          : MDEV-19119 - Wrong error code
+main.ssl_crl                          : MDEV-19119 - Wrong error code; modified in 10.3.21
 main.ssl_timeout                      : MDEV-11244 - Crash
 main.stat_tables                      : Modified in 10.3.19
-main.stat_tables-enospc               : Modified in 10.3.18
 main.stat_tables_par                  : MDEV-13266 - Wrong result
 main.stat_tables_par_innodb           : MDEV-14155 - Wrong rounding
-main.statistics                       : Modified in 10.3.18
 main.status                           : MDEV-13255 - Wrong result
-main.subselect                        : MDEV-20551 - Valgrind failure; modified in 10.3.18
-main.subselect2                       : Modified in 10.3.18
-main.subselect3                       : Modified in 10.3.18
-main.subselect3_jcl6                  : Modified in 10.3.18
-main.subselect4                       : Modified in 10.3.18
-main.subselect_exists2in              : Modified in 10.3.18
-main.subselect_extra                  : Modified in 10.3.18
+main.subselect                        : MDEV-20551 - Valgrind failure
 main.subselect_innodb                 : MDEV-10614 - Wrong result
-main.subselect_mat_cost               : Modified in 10.3.18
-main.subselect_mat_cost_bugs          : Modified in 10.3.18
 main.subselect_sj                     : Modified in 10.3.19
-main.subselect_sj2                    : Modified in 10.2.27
-main.subselect_sj2_jcl6               : Modified in 10.3.18
-main.subselect_sj2_mat                : Modified in 10.3.18
-main.subselect_sj_jcl6                : Modified in 10.3.18
-main.subselect_sj_mat                 : Modified in 10.3.18
-main.subselect_sj_nonmerged           : Modified in 10.3.18
 main.sum_distinct-big                 : Modified in 10.3.19
-main.system_mysql_db_fix50117         : Modified in 10.3.18
-main.system_time_debug                : Added in 10.3.18
-main.table_options-5867               : Configuration added in 10.3.18
 main.table_value_constr               : Modified in 10.3.19
 main.tc_heuristic_recover             : MDEV-14189 - Wrong result
-main.trigger                          : Modified in 10.3.18
-main.trigger-compat                   : Modified in 10.3.18
-main.trigger_notembedded              : Modified in 10.3.18
-main.truncate_badse                   : Configuration added in 10.3.18
 main.type_blob                        : MDEV-15195 - Wrong result
-main.type_date                        : Modified in 10.3.18
-main.type_datetime                    : Modified in 10.3.18
+main.type_date                        : Modified in 10.1.42
+main.type_datetime                    : Modified in 10.1.42
 main.type_datetime_hires              : MDEV-10687 - Timeout
 main.type_float                       : MDEV-20532 - Floating point differences
-main.type_int                         : Modified in 10.3.18
+main.type_int                         : Modified in 10.1.42
 main.type_newdecimal                  : Modified in 10.3.19
-main.type_time_6065                   : Modified in 10.3.18
-main.type_varchar                     : Configuration added in 10.3.18
-main.union                            : Modified in 10.3.18
-main.upgrade                          : Configuration added in 10.3.18
-main.userstat                         : MDEV-12904 - SSL errors; configuration added in 10.3.18
-main.variables                        : Modified in 10.3.18
-main.variables-notembedded            : Modified in 10.2.27
-main.view                             : Modified in 10.3.18
+main.uniques_crash-7912               : MDEV-21210 - Excessive memory consumption
+main.userstat                         : MDEV-12904 - SSL errors
 main.wait_timeout                     : MDEV-19023 - Lost connection to MySQL server during query
-main.win                              : Modified in 10.3.18
-main.win_percentile                   : Modified in 10.3.18
 main.xa                               : MDEV-11769 - lock wait timeout
-main.xtradb_mrr                       : Modified in 10.3.18
 
 #-----------------------------------------------------------------------
 
 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.discover_5438        : Configuration added in 10.3.18
 archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
 
 #-----------------------------------------------------------------------
@@ -297,20 +166,15 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
 #-----------------------------------------------------------------------
 
 binlog.binlog_commit_wait            : MDEV-10150 - Mismatch
-binlog.binlog_innodb                 : Configuration added in 10.3.18
 binlog.binlog_killed                 : MDEV-12925 - Wrong result
-binlog.binlog_max_extension          : MDEV-19762 - Crash on shutdown; modified in 10.3.18
-binlog.binlog_mixed_cache_stat       : Include file modified in 10.3.18
-binlog.binlog_mysqlbinlog2           : Modified in 10.2.27
+binlog.binlog_max_extension          : MDEV-19762 - Crash on shutdown
 binlog.binlog_mysqlbinlog_row        : Modified in 10.3.19
 binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ
 binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ
-binlog.binlog_row_cache_stat         : Include file modified in 10.3.18
-binlog.binlog_row_drop_tmp_tbl       : Include file modified in 10.3.18
-binlog.binlog_stm_cache_stat         : Include file modified in 10.3.18
-binlog.binlog_stm_drop_tmp_tbl       : Include file modified in 10.3.18
+binlog.binlog_row_drop_tmp_tbl       : Include file modified in 10.1.42
+binlog.binlog_stm_drop_tmp_tbl       : Include file modified in 10.1.42
 binlog.binlog_xa_recover             : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog         : MDEV-19764 - Out of memory; modified in 10.3.18
+binlog.flashback-largebinlog         : MDEV-19764 - Out of memory
 binlog.load_data_stm_view            : MDEV-16948 - Wrong result
 binlog.read_only                     : Added in 10.3.19
 binlog.read_only_statement           : Added in 10.3.19
@@ -326,7 +190,6 @@ binlog_encryption.encryption_combo                       : MDEV-14199 - Table is
 binlog_encryption.mysqlbinlog                            : Modified in 10.3.19
 binlog_encryption.rpl_binlog_errors                      : MDEV-12742 - Crash; include file modified in 10.3.19
 binlog_encryption.rpl_checksum                           : MDEV-16951 - Wrong result
-binlog_encryption.rpl_corruption                         : MDEV-20953 - Wrong error code
 binlog_encryption.rpl_gtid_basic                         : MDEV-16947 - Server failed to start
 binlog_encryption.rpl_loadfile                           : MDEV-16645 - Timeout in include
 binlog_encryption.rpl_parallel                           : MDEV-10653 - Timeout in include
@@ -341,14 +204,6 @@ binlog_encryption.rpl_typeconv                           : MDEV-14362 - Lost con
 
 #-----------------------------------------------------------------------
 
-compat/oracle.sp                   : Modified in 10.3.18
-compat/oracle.sp-package           : Modified in 10.3.18
-compat/oracle.sp-package-mysqldump : Modified in 10.3.18
-compat/oracle.sp-package-security  : Modified in 10.3.18
-compat/oracle.type_blob            : Modified in 10.3.18
-
-#-----------------------------------------------------------------------
-
 connect.alter            : MDEV-18135 - SSL error: key too small
 connect.drop-open-error  : MDEV-18135 - SSL error: key too small
 connect.grant            : Modified in 10.3.19
@@ -370,10 +225,8 @@ connect.zip              : MDEV-13884 - Wrong result
 encryption.create_or_replace                     : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace
 encryption.debug_key_management                  : MDEV-13841 - Timeout
 encryption.encrypt_and_grep                      : MDEV-13765 - Wrong result
-encryption.file_creation                         : Added in 10.3.18
 encryption.innochecksum                          : MDEV-13644 - Assertion failure
 encryption.innodb-bad-key-change2                : MDEV-19118 - Can't connect to local MySQL server through socket
-encryption.innodb-checksum-algorithm             : MDEV-16896 - Server crash
 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
@@ -388,7 +241,7 @@ encryption.innodb-remove-encryption              : MDEV-16493 - Timeout in wait
 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         : Configuration modified in 10.3.18
+encryption.innodb_encrypt_log_corruption         : MDEV-14379 - Server crash
 encryption.innodb_encrypt_temporary_tables       : MDEV-20142 - Wrong result
 encryption.innodb_encryption                     : MDEV-15675 - Timeout
 encryption.innodb_encryption-page-compression    : MDEV-12630 - crash or assertion failure
@@ -401,7 +254,6 @@ encryption.innodb_onlinealter_encryption         : MDEV-17287 - SIGABRT on serve
 encryption.innodb_scrub                          : MDEV-8139 - scrubbing tests need fixing
 encryption.innodb_scrub_background               : MDEV-8139 - scrubbing tests need fixing
 encryption.innodb_scrub_compressed               : MDEV-8139 - scrubbing tests need fixing
-encryption.tempfiles                             : Modified in 10.2.27
 
 #-----------------------------------------------------------------------
 
@@ -422,42 +274,14 @@ federated.federated_bug_585688   : MDEV-14805 - Server crash, MDEV-12907 - Valgr
 federated.federated_innodb       : MDEV-10617 - Wrong checksum
 federated.federated_partition    : MDEV-10417 - Fails on Mips
 federated.federated_transactions : MDEV-10617 - Wrong checksum
-federated.federatedx             : MDEV-10617 - Wrong checksum
+federated.federatedx             : MDEV-10617 - Wrong checksum; modified in 10.3.21
 federated.federatedx_versioning  : Modified in 10.3.19
 
 #-----------------------------------------------------------------------
 
-funcs_1.innodb_storedproc_07      : Include file modified in 10.3.18
-funcs_1.innodb_storedproc_08      : Include file modified in 10.3.18
-funcs_1.innodb_trig_03e           : Modified in 10.3.18
-funcs_1.is_basics_mixed           : Modified in 10.3.19
-funcs_1.is_columns                : Modified in 10.3.18
-funcs_1.is_columns_innodb         : Modified in 10.3.18
-funcs_1.is_columns_memory         : Modified in 10.3.18
-funcs_1.is_columns_myisam         : Modified in 10.3.18
-funcs_1.is_routines               : Include file modified in 10.3.18
-funcs_1.is_routines_embedded      : Include file modified in 10.3.18
-funcs_1.is_schemata               : Include file modified in 10.3.18
-funcs_1.is_schemata_embedded      : Include file modified in 10.3.18
-funcs_1.is_schemata_is_mysql_test : Modified in 10.3.18
-funcs_1.is_tables                 : Include file modified in 10.3.18
-funcs_1.is_tables_embedded        : Include file modified in 10.3.18
-funcs_1.is_tables_innodb          : Include file modified in 10.3.18
-funcs_1.is_tables_memory          : Include file modified in 10.3.18
-funcs_1.is_tables_myisam          : Include file modified in 10.3.18
-funcs_1.is_tables_myisam_embedded : Include file modified in 10.3.18
-funcs_1.is_triggers               : Include file modified in 10.3.18
-funcs_1.is_triggers_embedded      : Include file modified in 10.3.18
-funcs_1.memory_storedproc_07      : Include file modified in 10.3.18
-funcs_1.memory_storedproc_08      : Include file modified in 10.3.18
-funcs_1.memory_trig_03e           : Modified in 10.3.18
-funcs_1.memory_views              : MDEV-11773 - timeout
-funcs_1.myisam_storedproc_07      : Include file modified in 10.3.18
-funcs_1.myisam_storedproc_08      : Include file modified in 10.3.18
-funcs_1.myisam_trig_03e           : Modified in 10.3.18
-funcs_1.processlist_val_no_prot   : MDEV-11223 - Wrong result
-funcs_1.processlist_val_ps        : MDEV-12175 - Wrong plan
-funcs_1.storedproc                : Modified in 10.3.18
+funcs_1.memory_views            : MDEV-11773 - timeout
+funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result
+funcs_1.processlist_val_ps      : MDEV-12175 - Wrong plan
 
 #-----------------------------------------------------------------------
 
@@ -466,8 +290,7 @@ funcs_2.myisam_charset : MDEV-11535 - Timeout
 
 #-----------------------------------------------------------------------
 
-funcs_2/charset.*              : MDEV-10999 - Not maintained
-funcs_2/charset.charset_master : Modified in 10.3.18
+funcs_2/charset.* : MDEV-10999 - Not maintained
 
 #-----------------------------------------------------------------------
 
@@ -480,35 +303,28 @@ galera_3nodes.* : Suite is not stable yet
 #-----------------------------------------------------------------------
 
 gcol.gcol_rollback              : MDEV-16954 - Unknown storage engine 'InnoDB'
-gcol.gcol_select_innodb         : Include file modified in 10.2.27
-gcol.gcol_select_myisam         : Include file modified in 10.2.27
-gcol.innodb_virtual_basic       : MDEV-16950 - Failing assertion; modified in 10.3.18
+gcol.innodb_virtual_basic       : MDEV-16950 - Failing assertion
 gcol.innodb_virtual_debug       : MDEV-19114 - Assertion failure
 gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result; modified in 10.3.19
 gcol.innodb_virtual_fk_restart  : MDEV-17466 - Assertion failure
-gcol.innodb_virtual_index       : Modified in 10.3.18
 
 #-----------------------------------------------------------------------
 
 innodb.101_compatibility                     : MDEV-13891 - Wrong result
 innodb.alter_algorithm                       : Modified in 10.3.19
-innodb.alter_copy                            : MDEV-16181 - Assertion failure; modified in 10.3.18
+innodb.alter_copy                            : MDEV-16181 - Assertion failure
 innodb.alter_crash                           : MDEV-16944 - The process cannot access the file
 innodb.alter_large_dml                       : MDEV-20148 - Debug sync point wait timed out
-innodb.auto_increment_dup                    : Modified in 10.3.18
 innodb.autoinc_persist                       : MDEV-15282 - Assertion failure
 innodb.binlog_consistent                     : MDEV-10618 - Server fails to start
 innodb.blob-crash                            : MDEV-20481 - Crash during recovery
 innodb.doublewrite                           : MDEV-12905 - Server crash
-innodb.foreign-keys                          : Modified in 10.3.18
-innodb.foreign_key                           : Modified in 10.3.18
 innodb.group_commit_crash                    : MDEV-14191 - InnoDB registration failed
 innodb.group_commit_crash_no_optimize_thread : MDEV-13830	- Assertion failure
-innodb.ibuf_not_empty                        : MDEV-19021 - Wrong result; modified in 10.3.19
+innodb.ibuf_not_empty                        : MDEV-19021 - Wrong result; modified in 10.3.21
 innodb.information_schema_grants             : Added in 10.3.19
-innodb.innodb-32k-crash                      : MDEV-20194 - Extra warning
-innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup
-innodb.innodb-alter                          : Modified in 10.3.18
+innodb.innodb-32k-crash                      : MDEV-20194 - Extra warning; modified in 10.3.21
+innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup; modified in 10.3.21
 innodb.innodb-alter-debug                    : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
 innodb.innodb-alter-nullable                 : Modified in 10.3.19
 innodb.innodb-alter-table                    : MDEV-10619 - Testcase timeout
@@ -517,21 +333,18 @@ innodb.innodb-bigblob                        : MDEV-18655 - ASAN unknown crash
 innodb.innodb-blob                           : MDEV-12053 - Client crash
 innodb.innodb-change-buffer-recovery         : MDEV-19115 - Lost connection to MySQL server during query; modified in 10.3.19
 innodb.innodb-fk                             : MDEV-13832 - Assertion failure on shutdown
-innodb.innodb-fkcheck                        : Modified in 10.3.18
-innodb.innodb-get-fk                         : MDEV-13276 - Server crash; modified in 10.3.18
+innodb.innodb-get-fk                         : MDEV-13276 - Server crash
 innodb.innodb-index-online                   : MDEV-14809 - Cannot save statistics
-innodb.innodb-mdev7046                       : Modified in 10.3.18
+innodb.innodb-mdev-7513                      : Modified in 10.3.21
 innodb.innodb-page_compression_default       : MDEV-13644 - Assertion failure
 innodb.innodb-page_compression_lzma          : MDEV-14353 - Wrong result
 innodb.innodb-page_compression_snappy        : MDEV-13644 - Assertion failure
 innodb.innodb-page_compression_tables        : MDEV-13644 - Assertion failure
 innodb.innodb-page_compression_zip           : MDEV-10641 - mutex problem
-innodb.innodb-read-view                      : Added in 10.3.18
-innodb.innodb-system-table-view              : Modified in 10.3.18
 innodb.innodb-table-online                   : MDEV-13894 - Wrong result
 innodb.innodb-virtual-columns-debug          : Modified in 10.3.19
 innodb.innodb-wl5522                         : MDEV-13644 - Assertion failure
-innodb.innodb-wl5522-debug                   : MDEV-14200 - Wrong errno; modified in 10.3.18
+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             : MDEV-16964 - Assertion failure
 innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
@@ -540,16 +353,12 @@ 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
 innodb.innodb_bug59641                       : MDEV-13830 - Assertion failure
-innodb.innodb_bug68148                       : Modified in 10.3.18
-innodb.innodb_bug84958                       : Added in 10.3.18
-innodb.innodb_bulk_create_index_debug        : Include file modified in 10.3.18
-innodb.innodb_bulk_create_index_flush        : Configuration added in 10.3.18
 innodb.innodb_bulk_create_index_replication  : MDEV-15273 - Slave failed to start
 innodb.innodb_defrag_stats_many_tables       : MDEV-14198 - Table is full
 innodb.innodb_force_recovery                 : Modified in 10.3.19
 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_max_recordsize_32k             : MDEV-14801 - Operation failed; modified in 10.3.21
+innodb.innodb_max_recordsize_64k             : MDEV-15203 - Wrong result; modified in 10.3.21
 innodb.innodb_monitor                        : MDEV-10939 - Testcase timeout
 innodb.innodb_mysql                          : MDEV-19873 - Wrong result
 innodb.innodb_simulate_comp_failures_small   : MDEV-20526 - ASAN use-after-poison
@@ -558,9 +367,9 @@ innodb.innodb_stats_persistent               : MDEV-17745 - Wrong result; modifi
 innodb.innodb_stats_persistent_debug         : MDEV-14801 - Operation failed
 innodb.innodb_sys_semaphore_waits            : MDEV-10331 - Semaphore wait
 innodb.innodb_zip_innochecksum2              : MDEV-13882 - Warning: difficult to find free blocks
-innodb.instant_alter                         : Modified in 10.3.18
+innodb.instant_alter                         : Modified in 10.3.21
 innodb.instant_alter_bugs                    : Modified in 10.3.19
-innodb.log_alter_table                       : Configuration added in 10.3.18
+innodb.instant_alter_debug                   : Modified in 10.3.21
 innodb.log_corruption                        : MDEV-13251 - Wrong result
 innodb.log_data_file_size                    : MDEV-14204 - Server failed to start
 innodb.log_file_name                         : MDEV-14193 - Exception
@@ -570,75 +379,71 @@ innodb.purge_secondary                       : MDEV-15681 - Wrong result
 innodb.purge_secondary_mdev-16222            : MDEV-20528 - Debug sync point wait timed out
 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; modified in 10.3.18
+innodb.recovery_shutdown                     : MDEV-15671 - Checksum mismatch in datafile
 innodb.row_format_redundant                  : MDEV-15192 - Trying to access missing tablespace
+innodb.row_size_error_log_warnings_3         : Added in 10.3.21
 innodb.stat_tables                           : Added in 10.3.19
 innodb.table_definition_cache_debug          : MDEV-14206 - Extra warning
 innodb.table_flags                           : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start
 innodb.temporary_table                       : MDEV-13265 - Wrong result
 innodb.temporary_table_optimization          : Modified in 10.3.19
-innodb.trx_id_future                         : Modified in 10.3.18
+innodb.trx_id_future                         : Modified in 10.1.42
+innodb.undo_log                              : Modified in 10.3.21
 innodb.undo_truncate                         : MDEV-17340 - Server hung; MDEV-20840 - Sporadic timeout
-innodb.undo_truncate_recover                 : MDEV-17679 - Server has gone away; modified in 10.3.18
+innodb.undo_truncate_recover                 : MDEV-17679 - Server has gone away
 innodb.update_time                           : MDEV-14804 - Wrong result
 innodb.xa_recovery                           : MDEV-15279 - mysqld got exception
 
 #-----------------------------------------------------------------------
 
-innodb_fts.concurrent_insert           : Modified in 10.3.19
+innodb_fts.concurrent_insert           : MDEV-21223 - Server crash; modified in 10.3.19
 innodb_fts.crash_recovery              : Modified in 10.3.19
-innodb_fts.innodb_fts_misc             : Modified in 10.3.19
+innodb_fts.innodb_fts_misc             : Modified in 10.3.21
 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
 innodb_fts.sync                        : MDEV-14808 - Wrong result
-innodb_fts.sync_ddl                    : MDEV-18654 - Assertion failure
+innodb_fts.sync_ddl                    : MDEV-21223 - Server crash; MDEV-18654 - Assertion failure
 
 #-----------------------------------------------------------------------
 
 innodb_gis.alter_spatial_index   : MDEV-13745 - Server crash
-innodb_gis.rtree_compress2       : MDEV-16269 - Wrong result; modified in 10.3.18
+innodb_gis.rtree_compress2       : MDEV-16269 - Wrong result
 innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded
 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
 innodb_gis.types                 : MDEV-15679 - Table is marked as crashed
-innodb_gis.update_root           : Modified in 10.3.18
 
 #-----------------------------------------------------------------------
 
-innodb_zip.cmp_per_index    : MDEV-14490 - Table is marked as crashed
-innodb_zip.innochecksum_3   : MDEV-13279 - Extra warnings
-innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.3.18
-innodb_zip.wl6470_1         : MDEV-14240 - Assertion failure
-innodb_zip.wl6501_1         : MDEV-10891 - Can't create UNIX socket
-innodb_zip.wl6501_scale_1   : MDEV-13254 - Timeout, MDEV-14104 - Error 192
+innodb_zip.bug53591                 : Modified in 10.3.21
+innodb_zip.cmp_per_index            : MDEV-14490 - Table is marked as crashed
+innodb_zip.innochecksum_3           : MDEV-13279 - Extra warnings
+innodb_zip.prefix_index_liftedlimit : Modified in 10.3.21
+innodb_zip.wl5522_debug_zip         : MDEV-11600 - Operating system error number 2
+innodb_zip.wl6470_1                 : MDEV-14240 - Assertion failure
+innodb_zip.wl6501_1                 : MDEV-10891 - Can't create UNIX socket
+innodb_zip.wl6501_scale_1           : MDEV-13254 - Timeout, MDEV-14104 - Error 192
 
 #-----------------------------------------------------------------------
 
-maria.icp                : Modified in 10.3.18
 maria.insert_select      : MDEV-12757 - Timeout
 maria.insert_select-7314 : MDEV-16492 - Timeout
 maria.lock               : Modified in 10.3.19
 maria.maria              : MDEV-14430 - Extra warning
-maria.maria-big          : Modified in 10.3.18
-maria.maria-gis-recovery : Modified in 10.3.18
-maria.maria-no-logging   : MDEV-20196 - Crash on shutdown or server can't start; modified in 10.3.18
-maria.maria-recover      : Modified in 10.3.18
-maria.maria-recovery     : Modified in 10.3.18
-maria.maria3             : Modified in 10.3.18
-maria.partition          : Added in 10.3.18
+maria.maria-no-logging   : MDEV-20196 - Crash on shutdown or server can't start
 
 #-----------------------------------------------------------------------
 
 mariabackup.absolute_ibdata_paths       : MDEV-16571 - Wrong result
 mariabackup.apply-log-only              : MDEV-20135 - Timeout
-mariabackup.big_innodb_log              : Added in 10.3.18
 mariabackup.data_directory              : MDEV-15270 - Error on exec
 mariabackup.extra_lsndir_stream         : Added in 10.3.19
 mariabackup.full_backup                 : MDEV-16571 - Wrong result
 mariabackup.huge_lsn                    : MDEV-15662 - Sequence number is in the future; MDEV-18569 - Table doesn't exist
+mariabackup.incremental_backup          : MDEV-21222 - Memory allocation failure; modified in 10.3.21
 mariabackup.incremental_encrypted       : MDEV-15667 - timeout
 mariabackup.incremental_rocksdb         : MDEV-20954 - Cannot access the file
 mariabackup.log_checksum_mismatch       : MDEV-16571 - Wrong result
@@ -672,7 +477,7 @@ mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message
 
 multi_source.gtid        : MDEV-14202 - Crash
 multi_source.info_logs   : MDEV-12629 - Valgrind, MDEV-10042 - wrong result
-multi_source.mdev-8874   : Re-enabled in 10.3.18
+multi_source.load_data   : MDEV-21235 - Slave crash
 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
@@ -691,23 +496,7 @@ parts.partition_debug                  : Modified in 10.3.19
 parts.partition_debug_innodb           : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.3.19
 parts.partition_debug_myisam           : Modified in 10.3.19
 parts.partition_exch_qa_10             : MDEV-11765 - wrong result
-parts.partition_exch_qa_4_innodb       : Include file modified in 10.3.18
-parts.partition_exch_qa_4_myisam       : Include file modified in 10.3.18
-parts.partition_exch_qa_8_innodb       : Include file modified in 10.3.18
-parts.partition_exch_qa_8_myisam       : Include file modified in 10.3.18
 parts.partition_innodb_status_file     : MDEV-12901 - Valgrind
-parts.partition_mgm_lc0_archive        : Include file modified in 10.3.18
-parts.partition_mgm_lc0_innodb         : Include file modified in 10.3.18
-parts.partition_mgm_lc0_memory         : Include file modified in 10.3.18
-parts.partition_mgm_lc0_myisam         : Include file modified in 10.3.18
-parts.partition_mgm_lc1_archive        : Include file modified in 10.3.18
-parts.partition_mgm_lc1_innodb         : Include file modified in 10.3.18
-parts.partition_mgm_lc1_memory         : Include file modified in 10.3.18
-parts.partition_mgm_lc1_myisam         : Include file modified in 10.3.18
-parts.partition_mgm_lc2_archive        : Include file modified in 10.3.18
-parts.partition_mgm_lc2_innodb         : Include file modified in 10.3.18
-parts.partition_mgm_lc2_memory         : Include file modified in 10.3.18
-parts.partition_mgm_lc2_myisam         : Include file modified in 10.3.18
 parts.partition_special_innodb         : MDEV-16942 - Timeout
 parts.reorganize_partition_innodb      : Added in 10.3.19
 
@@ -717,40 +506,27 @@ percona.* : MDEV-10997 - Not maintained
 
 #-----------------------------------------------------------------------
 
-perfschema.connect_attrs                        : MDEV-17283 - Wrong result
-perfschema.dml_file_instances                   : MDEV-15179 - Wrong result
-perfschema.dml_threads                          : MDEV-17746 - Wrong errno
-perfschema.func_file_io                         : MDEV-5708 - fails for s390x
-perfschema.func_mutex                           : MDEV-5708 - fails for s390x
-perfschema.hostcache_ipv4_addrinfo_again_allow  : MDEV-12759 - Crash
-perfschema.hostcache_ipv6_addrinfo_again_allow  : MDEV-12752 - Crash; configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_again_deny   : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_bad_allow    : MDEV-13260 - Crash; configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_bad_deny     : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_good_allow   : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_good_deny    : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_noname_allow : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_addrinfo_noname_deny  : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_auth_plugin           : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_blocked               : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_max_con               : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_nameinfo_again_allow  : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_nameinfo_again_deny   : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_nameinfo_noname_allow : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_nameinfo_noname_deny  : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_passwd                : Configuration modified in 10.3.18
-perfschema.hostcache_ipv6_ssl                   : MDEV-10696 - Crash; configuration modified in 10.3.18
-perfschema.privilege_table_io                   : MDEV-13184 - Extra lines
-perfschema.relaylog                             : MDEV-18134 - Wrong result
-perfschema.rpl_gtid_func                        : MDEV-16897 - Wrong result
-perfschema.socket_instances_func                : MDEV-20140 - Wrong result
-perfschema.socket_summary_by_event_name_func    : MDEV-10622 - Wrong result
-perfschema.socket_summary_by_instance_func      : MDEV-19413 - Wrong result
-perfschema.stage_mdl_function                   : Include file modified in 10.3.18
-perfschema.stage_mdl_global                     : MDEV-11803 - wrong result on slow builders; include file modified in 10.3.18
-perfschema.stage_mdl_procedure                  : MDEV-11545 - Missing row; include file modified in 10.3.18
-perfschema.stage_mdl_table                      : MDEV-12638 - Wrong result; include file modified in 10.3.18
-perfschema.threads_mysql                        : MDEV-10677 - Wrong result
+perfschema.connect_attrs                       : MDEV-17283 - Wrong result
+perfschema.dml_file_instances                  : MDEV-15179 - Wrong result
+perfschema.dml_threads                         : MDEV-17746 - Wrong errno
+perfschema.func_file_io                        : MDEV-5708 - fails for s390x
+perfschema.func_mutex                          : MDEV-5708 - fails for s390x
+perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash
+perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash
+perfschema.hostcache_ipv6_addrinfo_bad_allow   : MDEV-13260 - Crash
+perfschema.hostcache_ipv6_ssl                  : MDEV-10696 - Crash
+perfschema.misc                                : Modified in 10.3.21
+perfschema.privilege_table_io                  : MDEV-13184 - Extra lines
+perfschema.relaylog                            : MDEV-18134 - Wrong result
+perfschema.rpl_gtid_func                       : MDEV-16897 - Wrong result
+perfschema.socket_instances_func               : MDEV-20140 - Wrong result
+perfschema.socket_summary_by_event_name_func   : MDEV-10622 - Wrong result
+perfschema.socket_summary_by_instance_func     : MDEV-19413 - Wrong result
+perfschema.stage_mdl_global                    : MDEV-11803 - wrong result on slow builders
+perfschema.stage_mdl_procedure                 : MDEV-11545 - Missing row
+perfschema.stage_mdl_table                     : MDEV-12638 - Wrong result
+perfschema.start_server_low_digest             : MDEV-21221 - Wrong result
+perfschema.threads_mysql                       : MDEV-10677 - Wrong result
 
 #-----------------------------------------------------------------------
 
@@ -761,8 +537,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained
 plugins.feedback_plugin_load     : Modified in 10.3.19
 plugins.feedback_plugin_send     : MDEV-7932, MDEV-11118 - Connection problems and such
 plugins.processlist              : MDEV-16574 - Wrong result
-plugins.qc_info                  : Modified in 10.3.18
-plugins.server_audit             : MDEV-14295 - Wrong result
+plugins.server_audit             : MDEV-14295 - Wrong result; modified in 10.3.21
 plugins.thread_pool_server_audit : MDEV-14295 - Wrong result
 
 #-----------------------------------------------------------------------
@@ -803,10 +578,7 @@ rocksdb_sys_vars.rocksdb_rate_limiter_bytes_per_sec_basic : MDEV-16639 - Crash
 
 #-----------------------------------------------------------------------
 
-roles.acl_statistics             : Configuration added in 10.3.18
-roles.create_and_grant_role      : MDEV-11772 - wrong result
-roles.definer                    : Modified in 10.3.18
-roles.show_create_database-10463 : Modified in 10.3.18
+roles.create_and_grant_role : MDEV-11772 - wrong result
 
 #-----------------------------------------------------------------------
 
@@ -816,7 +588,7 @@ rpl.create_or_replace_mix               : MDEV-20523 - Wrong result
 rpl.create_or_replace_statement         : MDEV-20523 - Wrong result
 rpl.create_select                       : MDEV-14121 - Assertion failure
 rpl.last_insert_id                      : MDEV-10625 - warnings in error log
-rpl.mdev_17588                          : Modified in 10.3.18
+rpl.mdev_17588                          : Modified in 10.1.42
 rpl.rpl_000011                          : Modified in 10.3.19
 rpl.rpl_auto_increment                  : MDEV-10417 - Fails on Mips
 rpl.rpl_auto_increment_bug45679         : MDEV-10417 - Fails on Mips
@@ -825,7 +597,7 @@ rpl.rpl_binlog_errors                   : MDEV-12742 - Crash
 rpl.rpl_binlog_index                    : MDEV-9501 - Failed registering on master
 rpl.rpl_colSize                         : MDEV-16112 - Server crash
 rpl.rpl_corruption                      : MDEV-20527 - Slave stopped with wrong error code
-rpl.rpl_create_or_replace_fail          : Added in 10.3.18
+rpl.rpl_create_or_replace_fail          : Added in 10.1.42
 rpl.rpl_ctype_latin1                    : MDEV-14813 - Wrong result on Mac
 rpl.rpl_ddl                             : MDEV-10417 - Fails on Mips
 rpl.rpl_domain_id_filter_io_crash       : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
@@ -834,7 +606,6 @@ rpl.rpl_domain_id_filter_restart        : MDEV-10684 - Wrong result; MDEV-19043
 rpl.rpl_drop_db_fail                    : MDEV-16898 - Slave fails to start
 rpl.rpl_extra_col_master_innodb         : MDEV-16570 - Extra warning
 rpl.rpl_extra_col_master_myisam         : MDEV-14203 - Extra warning
-rpl.rpl_failed_drop_tbl_binlog          : Added in 10.3.18
 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-9501 - Failed registering on master, MDEV-13643 - Lost connection
@@ -855,11 +626,11 @@ rpl.rpl_invoked_features                : MDEV-10417 - Fails on Mips
 rpl.rpl_ip_mix                          : Modified in 10.3.19
 rpl.rpl_ip_mix2                         : Modified in 10.3.19
 rpl.rpl_ipv4_as_ipv6                    : MDEV-20147 - Incorrect checksum for freed object
-rpl.rpl_known_bugs_detection            : Modified in 10.2.27
+rpl.rpl_known_bugs_detection            : Modified in 10.1.42
 rpl.rpl_mariadb_slave_capability        : MDEV-11018 - Extra lines in binlog
 rpl.rpl_mdev12179                       : MDEV-19043 - Table marked as crashed
 rpl.rpl_mdev6020                        : MDEV-15272 - Server crash
-rpl.rpl_mdev_17614                      : Added in 10.3.18
+rpl.rpl_mdev_17614                      : Added in 10.1.42
 rpl.rpl_mixed_mixing_engines            : MDEV-14489 - Sync slave with master failed
 rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed
 rpl.rpl_non_direct_row_mixing_engines   : MDEV-16561 - Timeout in master_pos_wait
@@ -882,18 +653,20 @@ rpl.rpl_row_001                         : MDEV-16653 - MTR's internal check fail
 rpl.rpl_row_basic_11bugs                : MDEV-12171 - Server failed to start
 rpl.rpl_row_basic_2myisam               : MDEV-13875 - command "diff_files" failed
 rpl.rpl_row_drop_create_temp_table      : MDEV-14487 - Wrong result
+rpl.rpl_row_end_of_statement_loss       : MDEV-21237 - Server crash
 rpl.rpl_row_find_row_debug              : Modified in 10.3.19
 rpl.rpl_row_img_blobs                   : MDEV-13875 - command "diff_files" failed
 rpl.rpl_row_img_eng_min                 : MDEV-13875 - diff_files failed
 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_type_conv_err_msg           : Added in 10.3.18
 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_after_sync_row        : MDEV-21031 - Wrong result; MDEV-14366 - Wrong result
 rpl.rpl_semi_sync_event_after_sync      : MDEV-11806 - warnings
+rpl.rpl_semi_sync_gtid_reconnect        : Added in 10.3.21
+rpl.rpl_semi_sync_skip_repl             : MDEV-21223 - Server crash
 rpl.rpl_semi_sync_slave_reply_fail      : Added in 10.3.19
 rpl.rpl_semi_sync_uninstall_plugin      : MDEV-7140 - Assorted failures
 rpl.rpl_semi_sync_wait_point            : MDEV-11807 - timeout in wait condition
@@ -912,7 +685,7 @@ rpl.rpl_stm_multi_query                 : MDEV-9501 - Failed registering on mast
 rpl.rpl_stm_relay_ign_space             : MDEV-14360 - Test assertion
 rpl.rpl_stm_stop_middle_group           : MDEV-13791 - Server crash
 rpl.rpl_sync                            : MDEV-13830 - Assertion failure
-rpl.rpl_sync_with_innodb_thd_conc       : Added in 10.3.18
+rpl.rpl_sync_with_innodb_thd_conc       : Added in 10.1.42
 rpl.rpl_temporal_mysql56_to_mariadb53   : MDEV-9501 - Failed registering on master
 rpl.rpl_temporary_error2                : MDEV-10634 - Wrong number of retries
 rpl.rpl_test_framework                  : MDEV-19368 - mysqltest failed but provided no output
@@ -946,8 +719,9 @@ sphinx.union-5539 : MDEV-10986 - Sporadic failures
 
 #-----------------------------------------------------------------------
 
-spider.*         : MDEV-9329, MDEV-18737 - tests are too memory-consuming
-spider.basic_sql : MDEV-11186 - Internal check fails
+spider.*                 : MDEV-9329, MDEV-18737 - tests are too memory-consuming
+spider.basic_sql         : MDEV-11186 - Internal check fails
+spider.pushdown_not_like : Added in 10.3.21
 
 #-----------------------------------------------------------------------
 
@@ -973,6 +747,8 @@ spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained
 
 sql_sequence.concurrent_create : MDEV-16635 - Server crash
 sql_sequence.other             : Modified in 10.3.19
+sql_sequence.rebuild           : Added in 10.3.21
+sql_sequence.view              : Modified in 10.3.21
 
 #-----------------------------------------------------------------------
 
@@ -984,49 +760,16 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
 
 #-----------------------------------------------------------------------
 
-sys_vars.aria_recover_options_basic                : Modified in 10.3.18
 sys_vars.autocommit_func2                          : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.binlog_cache_size_basic                   : Modified in 10.3.18
-sys_vars.binlog_stmt_cache_size_basic              : Modified in 10.3.18
-sys_vars.character_set_client_basic                : Modified in 10.3.18
-sys_vars.character_set_connection_basic            : Modified in 10.3.18
-sys_vars.character_set_database_basic              : Modified in 10.3.18
-sys_vars.character_set_results_basic               : Modified in 10.3.18
-sys_vars.character_set_server_basic                : Modified in 10.3.18
-sys_vars.character_set_server_func                 : Modified in 10.3.18
-sys_vars.collation_connection_basic                : Modified in 10.3.18
-sys_vars.collation_database_basic                  : Modified in 10.3.18
-sys_vars.collation_server_basic                    : Modified in 10.3.18
 sys_vars.delayed_insert_limit_func                 : Modified in 10.3.19
-sys_vars.expire_logs_days_basic                    : Modified in 10.2.27
-sys_vars.histogram_size_basic                      : Modified in 10.2.27
 sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
 sys_vars.innodb_change_buffering_debug_basic       : Modified in 10.3.19
-sys_vars.innodb_max_dirty_pages_pct_basic          : Modified in 10.3.18
-sys_vars.innodb_max_dirty_pages_pct_lwm_basic      : Modified in 10.3.18
-sys_vars.innodb_read_io_threads_basic              : Configuration added in 10.3.18
-sys_vars.innodb_write_io_threads_basic             : Configuration added in 10.3.18
 sys_vars.keep_files_on_create_basic                : MDEV-10676 - timeout
 sys_vars.log_slow_admin_statements_func            : MDEV-12235 - Server crash
-sys_vars.log_slow_verbosity_basic                  : Modified in 10.3.18
-sys_vars.max_connect_errors_basic                  : Modified in 10.2.27
-sys_vars.max_connections_basic                     : Modified in 10.3.18
-sys_vars.max_heap_table_size_basic                 : Modified in 10.2.27
-sys_vars.max_seeks_for_key_func                    : Modified in 10.3.18
-sys_vars.myisam_recover_options_basic              : Configuration added in 10.3.18
-sys_vars.myisam_sort_buffer_size_basic             : Modified in 10.3.18
-sys_vars.optimizer_switch_basic                    : Modified in 10.3.18
-sys_vars.optimizer_use_condition_selectivity_basic : Modified in 10.3.18
-sys_vars.replicate_ignore_table_basic              : Modified in 10.3.18
 sys_vars.rpl_init_slave_func                       : MDEV-10149 - Test assertion
 sys_vars.slow_query_log_func                       : MDEV-14273 - Wrong result
-sys_vars.sync_binlog_basic                         : Modified in 10.3.18
-sys_vars.sysvars_debug                             : Modified in 10.3.18
-sys_vars.sysvars_innodb                            : Modified in 10.3.18
-sys_vars.sysvars_server_embedded                   : Include file modified in 10.3.18
-sys_vars.sysvars_server_notembedded                : Include file modified in 10.3.18
+sys_vars.sysvars_innodb                            : Modified in 10.2.28
 sys_vars.thread_cache_size_func                    : MDEV-11775 - Wrong result
-sys_vars.userstat_basic                            : Modified in 10.3.18
 sys_vars.wait_timeout_func                         : MDEV-12896 - Wrong result
 sys_vars.wsrep_provider_basic                      : MDEV-19457 - Assertion failure
 
@@ -1036,10 +779,6 @@ tokudb.change_column_all_1000_10               : MDEV-12640 - Lost connection
 tokudb.change_column_bin                       : MDEV-12640 - Lost connection
 tokudb.change_column_char                      : MDEV-12822 - Lost connection
 tokudb.change_column_varbin                    : MDEV-17682 - Timeout
-tokudb.cluster_2968-0                          : Modified in 10.3.18
-tokudb.cluster_2968-1                          : Modified in 10.3.18
-tokudb.cluster_2968-2                          : Modified in 10.3.18
-tokudb.cluster_2968-3                          : Modified in 10.3.18
 tokudb.cluster_filter                          : MDEV-10678 - Wrong execution plan
 tokudb.cluster_filter_hidden                   : MDEV-10678 - Wrong execution plan
 tokudb.cluster_filter_unpack_varchar           : MDEV-10636 - Wrong execution plan
@@ -1057,7 +796,6 @@ tokudb.rows-32m-rand-insert                    : MDEV-12640 - Crash
 tokudb.rows-32m-seq-insert                     : MDEV-12640 - Crash
 tokudb.savepoint-5                             : MDEV-15280 - Wrong result
 tokudb.type_datetime                           : MDEV-15193 - Wrong result
-tokudb.type_varchar                            : Modified in 10.3.18
 
 #-----------------------------------------------------------------------
 
@@ -1078,14 +816,8 @@ tokudb_bugs.xa                : MDEV-11804 - Lock wait timeout
 
 #-----------------------------------------------------------------------
 
-tokudb_parts.partition_alter4_tokudb    : MDEV-12640 - Lost connection
-tokudb_parts.partition_debug_tokudb     : Include file modified in 10.3.19
-tokudb_parts.partition_exch_qa_4_tokudb : Include file modified in 10.3.18
-tokudb_parts.partition_exch_qa_8_tokudb : Include file modified in 10.3.18
-tokudb_parts.partition_mgm_lc0_tokudb   : Include file modified in 10.3.18
-tokudb_parts.partition_mgm_lc10_tokudb  : Include file modified in 10.3.18
-tokudb_parts.partition_mgm_lc1_tokudb   : Include file modified in 10.3.18
-tokudb_parts.partition_mgm_lc2_tokudb   : Include file modified in 10.3.18
+tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
+tokudb_parts.partition_debug_tokudb  : Include file modified in 10.3.19
 
 #-----------------------------------------------------------------------
 
@@ -1109,17 +841,9 @@ unit.mf_iocache                 : MDEV-20952 - ASAN stack-buffer-overflow
 
 #-----------------------------------------------------------------------
 
-vcol.cross_db               : Modified in 10.3.18
-vcol.not_supported          : MDEV-10639 - Testcase timeout
-vcol.update                 : Modified in 10.3.18
-vcol.vcol_keys_innodb       : MDEV-10639 - Testcase timeout; modified in 10.3.19
-vcol.vcol_misc              : MDEV-16651 - Wrong error message
-vcol.vcol_select_innodb     : Modified in 10.3.18
-vcol.vcol_select_myisam     : Modified in 10.3.18
-vcol.vcol_sql_mode          : Added in 10.3.18
-vcol.vcol_sql_mode_upgrade  : Added in 10.3.18
-vcol.vcol_trigger_sp_innodb : Include file modified in 10.3.18
-vcol.vcol_trigger_sp_myisam : Include file modified in 10.3.18
+vcol.not_supported    : MDEV-10639 - Testcase timeout
+vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout; modified in 10.3.19
+vcol.vcol_misc        : MDEV-16651 - Wrong error message
 
 #-----------------------------------------------------------------------
 
@@ -1127,30 +851,28 @@ versioning.alter            : Modified in 10.3.19
 versioning.auto_increment   : Include file modified in 10.3.19
 versioning.commit_id        : Include file modified in 10.3.19
 versioning.create           : Modified in 10.3.19
-versioning.cte              : Modified in 10.3.18
-versioning.delete           : Modified in 10.3.19
-versioning.derived          : Modified in 10.3.18
+versioning.delete           : Modified in 10.3.21
+versioning.delete_history   : Include file modified in 10.3.19
 versioning.foreign          : Modified in 10.3.19
 versioning.insert           : Include file modified in 10.3.19
 versioning.key_type         : Combinations added in 10.3.19
 versioning.online           : Modified in 10.3.19
-versioning.partition        : Modified in 10.3.19
+versioning.partition        : Modified in 10.3.21
 versioning.partition_innodb : Modified in 10.3.19
 versioning.replace          : Modified in 10.3.19
-versioning.select           : Include file modified in 10.3.19
+versioning.select           : Modified in 10.3.21
 versioning.select2          : Include file modified in 10.3.19
-versioning.truncate         : Include file modified in 10.3.19
 versioning.trx_id           : Modified in 10.3.19
-versioning.update           : MDEV-20955 - Wrong result code; modified in 10.3.19
+versioning.update           : MDEV-20955 - Wrong result code; modified in 10.3.21
 versioning.update-big       : Modified in 10.3.19
-versioning.view             : Modified in 10.3.19
+versioning.view             : Modified in 10.3.21
 
 #-----------------------------------------------------------------------
 
 wsrep.foreign_key                      : MDEV-14725 - WSREP has not yet prepared node
 wsrep.mdev_6832                        : MDEV-14195 - Check testcase failed
-wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.3.18
-wsrep.pool_of_threads                  : MDEV-17345 - WSREP has not yet prepared node for application use
+wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.1.42
+wsrep.pool_of_threads                  : MDEV-17345 - WSREP has not yet prepared node for application use; configuration modified in 10.3.21
 wsrep.variables                        : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.3.19
 
 #-----------------------------------------------------------------------