From 214023aa0e6ec00dcac386167a2b2cf9394b6c7e Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Fri, 18 Jan 2019 13:45:06 +1100 Subject: 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 # -- cgit v1.2.1 From 2cb4b152c8fc7bc5156961c2f87e5274d228377d Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 16 Nov 2019 14:59:54 +0100 Subject: ===================================================================== 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; -- cgit v1.2.1 From 9c0e462ff28b93127406eeb2db4b763423fabbe3 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 16 Nov 2019 15:59:16 +0100 Subject: 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); -- cgit v1.2.1 From 290972563673a7de32e10bb0e4bdb37295be1371 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Mon, 18 Nov 2019 11:50:58 +0530 Subject: 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(), -- cgit v1.2.1 From 5c68343db713b9a2881809f6e21107d73a7d7b46 Mon Sep 17 00:00:00 2001 From: seppo Date: Mon, 18 Nov 2019 15:18:00 +0200 Subject: 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. --- .../suite/galera/r/galera_as_slave_ctas.result | 14 ++++ mysql-test/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: -- cgit v1.2.1 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: 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 + -- cgit v1.2.1 From 8fbfcce911d43091f34e1412269db785a0273641 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 19 Nov 2019 17:09:43 +0700 Subject: 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) -- cgit v1.2.1 From 899c5bd5aad47a49d339ea211dd9671f80c49812 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 18 Nov 2019 23:26:21 +0700 Subject: 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 --- mysql-test/suite/innodb/r/innodb-32k-crash.result | 1 - mysql-test/suite/innodb/r/innodb-64k-crash.result | 1 - mysql-test/suite/innodb/r/innodb-mdev-7513.result | 1 - .../innodb/r/innodb_max_recordsize_32k.result | 1 - .../innodb/r/innodb_max_recordsize_64k.result | 1 - .../innodb/r/row_size_error_log_warnings_3.result | 21 +++++++++++++++++++ mysql-test/suite/innodb/r/undo_log.result | 1 - mysql-test/suite/innodb/t/innodb-32k-crash.test | 2 -- mysql-test/suite/innodb/t/innodb-64k-crash.test | 2 -- mysql-test/suite/innodb/t/innodb-mdev-7513.test | 1 - .../suite/innodb/t/innodb_max_recordsize_32k.test | 2 -- .../suite/innodb/t/innodb_max_recordsize_64k.test | 2 -- .../innodb/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) { -- cgit v1.2.1 From a51f3b09bb99f2927ce107727316caac2c426eb1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 21 Nov 2019 00:32:27 +0700 Subject: 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 */ -- cgit v1.2.1 From d30e51fafb8da04063b6b172c6fbe46ab59afd3e Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Mon, 11 Nov 2019 15:47:42 +0300 Subject: 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 - per segment in the array. */ - - 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); - } + /* Initialize the io_context_t array. One io_context_t + per segment in the array. */ + m_aio_ctx.resize(get_n_segments()); - 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 -- cgit v1.2.1 From 7a9eca1191c315b6009e4356d96bd3c4b9fa2415 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 18:33:52 +0100 Subject: 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 -- cgit v1.2.1 From 420789512fd0f90b150e5ccb61d127e6c80d712a Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 19:38:17 +0100 Subject: 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) /***********************************************************************/ -- cgit v1.2.1 From b4bfa12b0044f7e4659e919784a6ed2252ca21b8 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Thu, 21 Nov 2019 20:12:06 +0100 Subject: 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. */ /***********************************************************************/ -- cgit v1.2.1 From d8ace23d260033fc6588599e0a03e2832d20dae9 Mon Sep 17 00:00:00 2001 From: Hashir Sarwar Date: Wed, 23 Oct 2019 17:40:24 +0500 Subject: 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) -- cgit v1.2.1 From fb91774e4e6451298af51e31356a8b8fb1b19487 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sun, 24 Nov 2019 22:58:55 +0100 Subject: 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;} -- cgit v1.2.1 From 3551cd32a8df667e1257ae5118873b5d1ef1b631 Mon Sep 17 00:00:00 2001 From: willhan <526786050@qq.com> Date: Tue, 16 Apr 2019 22:10:05 +0800 Subject: 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 +- .../mysql-test/spider/r/pushdown_not_like.result | 63 ++++++++++ .../mysql-test/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; -- cgit v1.2.1 From 38839854b7c097b33f34b2228c4240fe837fda79 Mon Sep 17 00:00:00 2001 From: seppo Date: Tue, 26 Nov 2019 08:49:50 +0200 Subject: 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. --- .../galera/r/galera_as_slave_gtid_myisam.result | 21 +++++++ .../suite/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) -- cgit v1.2.1 From 23664bc7a582f03d1ccb680faec8c65f456e0c72 Mon Sep 17 00:00:00 2001 From: Seth Shelnutt Date: Thu, 21 Nov 2019 10:34:36 -0500 Subject: 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) -- cgit v1.2.1 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: 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, -- cgit v1.2.1 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: 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; } -- cgit v1.2.1 From 49ed1ae320856f4c2ad156283ff3b6138eeb21df Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Tue, 26 Nov 2019 22:57:55 +0700 Subject: 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); } -- cgit v1.2.1 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: 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, -- cgit v1.2.1 From f0da39be7fff39f0ee47abe272e0ef96f229c7e3 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Tue, 26 Nov 2019 19:22:46 +0100 Subject: - 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 | 44 ++++++++++++++++++++++++++----------------- storage/connect/tabrest.cpp | 5 +++-- storage/connect/tabxml.cpp | 4 +++- 7 files changed, 54 insertions(+), 35 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)) { - sprintf(buf, "%d", k); - - if (tdp->Uri) - strncat(strncat(fmt, sep, 128), buf, 128); - else - strncat(strncat(strncat(fmt, "[", 128), buf, 128), "]", 128); + n = sizeof(fmt) - (strlen(fmt) + 1); - if (all) - strncat(strncat(colname, "_", 64), buf, 64); + if (!tdp->Xcol || stricmp(tdp->Xcol, key)) { + sprintf(buf, "%d", k); - } else - strncat(fmt, (tdp->Uri ? sep : "[*]"), 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) { + n = sizeof(colname) - (strlen(colname) + 1); + strncat(strncat(colname, "_", n), buf, n - 1); + } // endif all + + } 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))) { -- cgit v1.2.1 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: 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 -- cgit v1.2.1 From 0e403db2c884b72bd0b5de404f38b6cef75ed58e Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Nov 2019 09:23:00 +0400 Subject: MENT-237 Audit to show INSERT DELAYED for the executing user. Add notifications about the user and connection that actually did the DELAYED insert. --- mysql-test/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 */ -- cgit v1.2.1 From bfa6db38cdbfcae5f7b59b3d7455407636d2740a Mon Sep 17 00:00:00 2001 From: Alexey Botchkov Date: Wed, 27 Nov 2019 09:31:47 +0400 Subject: 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) -- cgit v1.2.1 From 2855edf9ee0344e596ff4b9ee70a23421ae60405 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 23 Nov 2019 23:26:35 +0700 Subject: 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; } /* -- cgit v1.2.1 From 32ce5301a973688f250b64049a0db099100028c1 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 28 Nov 2019 22:50:46 +0100 Subject: 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 -- cgit v1.2.1 From bd11bd63ccbfa71dbd359314db6c4f116629a357 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Wed, 20 Nov 2019 21:27:30 +0300 Subject: 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 +++++++---- .../suite/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; -- cgit v1.2.1 From 866e5c250e27e32cd295d84988ffdf7ae64503b2 Mon Sep 17 00:00:00 2001 From: Daniel Black Date: Sun, 11 Feb 2018 14:42:11 +1100 Subject: 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) -- cgit v1.2.1 From 3cb60ec2c305f0b0ab9c3680eb787f8dcd78e57b Mon Sep 17 00:00:00 2001 From: Anel Husakovic Date: Fri, 29 Nov 2019 15:50:40 +0100 Subject: 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) -- cgit v1.2.1 From 3fb0fe400c3f6eb8f4d9f34e81db5516f4ecf3dc Mon Sep 17 00:00:00 2001 From: HF Date: Fri, 29 Nov 2019 21:25:52 +0000 Subject: 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; -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=''; 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; -- cgit v1.2.1 From 6fe2aae3ce8139864dfe45f2f9834f82ef54ff1e Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 30 Nov 2019 12:14:00 +0700 Subject: 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); -- cgit v1.2.1 From 33cf4da1838f3f13d8e973e7f46cc486f1183338 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 30 Nov 2019 18:19:20 +0700 Subject: 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 -- cgit v1.2.1 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: 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 -- .../galera/r/galera_forced_binlog_format.result | 6 +- mysql-test/suite/galera/r/galera_gtid.result | 10 +- mysql-test/suite/galera/r/galera_log_bin.result | 2 - .../suite/galera/r/galera_var_dirty_reads.result | 7 +- .../suite/galera/r/galera_var_notify_cmd.result | 2 +- .../galera/r/galera_var_reject_queries.result | 5 +- .../suite/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 | 30 ++--- mysql-test/suite/galera/t/MW-86-wait1-master.opt | 1 - mysql-test/suite/galera/t/MW-86-wait8-master.opt | 1 - mysql-test/suite/galera/t/MW-86-wait8.cnf | 10 ++ .../suite/galera/t/enforce_storage_engine2.cnf | 13 ++ .../suite/galera/t/enforce_storage_engine2.opt | 2 - .../t/galera_applier_ftwrl_table_alter-master.opt | 1 - .../galera/t/galera_applier_ftwrl_table_alter.cnf | 14 ++ .../galera/t/galera_bf_background_statistics.cnf | 9 ++ .../galera/t/galera_bf_background_statistics.opt | 1 - .../galera/t/galera_binlog_checksum-master.opt | 1 - .../suite/galera/t/galera_binlog_checksum.cnf | 13 ++ .../t/galera_binlog_event_max_size_max-master.opt | 1 - .../galera/t/galera_binlog_event_max_size_max.cnf | 9 ++ .../t/galera_binlog_event_max_size_min-master.opt | 1 - .../galera/t/galera_binlog_event_max_size_min.cnf | 9 ++ mysql-test/suite/galera/t/galera_flush-master.opt | 1 - mysql-test/suite/galera/t/galera_flush.cnf | 10 ++ mysql-test/suite/galera/t/galera_flush_local.cnf | 12 ++ mysql-test/suite/galera/t/galera_flush_local.opt | 3 - .../galera/t/galera_forced_binlog_format.test | 6 + mysql-test/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 +- mysql-test/suite/galera/t/galera_mdev_13787.cnf | 9 ++ mysql-test/suite/galera/t/galera_mdev_13787.opt | 1 - .../suite/galera/t/galera_query_cache-master.opt | 1 - mysql-test/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 ++ .../suite/galera/t/galera_sbr_binlog-master.opt | 1 - mysql-test/suite/galera/t/galera_sbr_binlog.cnf | 7 + .../t/galera_sst_mariabackup_table_options.cnf | 2 + .../t/galera_sst_mariabackup_table_options.opt | 2 - mysql-test/suite/galera/t/galera_udf-master.opt | 2 - mysql-test/suite/galera/t/galera_udf.cnf | 15 +++ .../suite/galera/t/galera_v1_row_events-master.opt | 1 - mysql-test/suite/galera/t/galera_v1_row_events.cnf | 13 ++ .../galera/t/galera_var_auto_inc_control_on.cnf | 13 ++ .../galera/t/galera_var_auto_inc_control_on.opt | 1 - .../suite/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 ++ .../suite/galera/t/galera_var_reject_queries.test | 6 +- mysql-test/suite/galera/t/galera_var_sst_auth.cnf | 12 ++ mysql-test/suite/galera/t/galera_var_sst_auth.opt | 1 - .../galera/t/galera_wsrep_log_conficts-master.opt | 1 - .../suite/galera/t/galera_wsrep_log_conficts.cnf | 12 ++ .../galera/t/galera_wsrep_new_cluster-master.opt | 1 - .../suite/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, 504 insertions(+), 177 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; -DROP TABLE t1; -SET GLOBAL general_log='OFF'; ---connection node_1 -SET GLOBAL general_log='OFF'; +--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; 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 -- cgit v1.2.1 From 2df2238cb86de237c6f57a25adb05dcdce020e8d Mon Sep 17 00:00:00 2001 From: Faustin Lammler Date: Fri, 21 Dec 2018 17:06:08 -0300 Subject: 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 +- .../suite/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 +- .../suite/sys_vars/r/sysvars_server_notembedded.result | 2 +- mysql-test/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 +- .../rocksdb/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,
-- 
cgit v1.2.1


From 7e917bba5d8318765ae3074bcb7c2634ea84ab45 Mon Sep 17 00:00:00 2001
From: Faustin Lammler 
Date: Fri, 29 Nov 2019 15:51:20 +0100
Subject: 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
-- 
cgit v1.2.1


From 8d2a57b4b7b9f6c7894ebf285a5c390e40fdc806 Mon Sep 17 00:00:00 2001
From: Robert Bindar 
Date: Tue, 16 Apr 2019 17:52:31 +0300
Subject: 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);
-- 
cgit v1.2.1


From d930422e9e84aa1bc265963225dd29295203e9d3 Mon Sep 17 00:00:00 2001
From: Faustin Lammler 
Date: Fri, 29 Nov 2019 13:21:23 +0100
Subject: 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
-- 
cgit v1.2.1


From e3d3bbf59829e93e83ab05d831e92a742ffd7e32 Mon Sep 17 00:00:00 2001
From: Anel Husakovic 
Date: Thu, 28 Nov 2019 15:08:29 +0100
Subject: 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;
-- 
cgit v1.2.1


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: 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.
-- 
cgit v1.2.1


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: MDEV-21198 : Galera test failure on galera_var_notify_cmd

Add proper wsrep sync wait.
---
 mysql-test/suite/galera/r/galera_var_notify_cmd.result | 17 +++++++++--------
 mysql-test/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;
-- 
cgit v1.2.1


From 543f22a2d0633e645fb49a360c55528d8cb008fb Mon Sep 17 00:00:00 2001
From: Eugene Kosov 
Date: Wed, 27 Nov 2019 11:58:20 +0700
Subject: 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 */
-- 
cgit v1.2.1


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: 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));
 
-- 
cgit v1.2.1


From cef2b34f25b45198868be0c06e00a74a1c1ad062 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:28:41 +0300
Subject: 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;
 };
-- 
cgit v1.2.1


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: 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;
-- 
cgit v1.2.1


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: 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
-- 
cgit v1.2.1


From bf2f391664c56334ff9229e448bb3efa166c40b7 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:46:49 +0300
Subject: 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;
       }
-- 
cgit v1.2.1


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: Update innodb_i_s_tables_disabled.result post typo fix

---
 storage/rocksdb/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.
-- 
cgit v1.2.1


From ccc5e57730ae480d739adb44fd9a51773ae755ad Mon Sep 17 00:00:00 2001
From: Oleksandr Byelkin 
Date: Tue, 3 Dec 2019 15:44:41 +0100
Subject: 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
-- 
cgit v1.2.1


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

---
 mysql-test/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;
-- 
cgit v1.2.1


From 477629d2cd3176850ef65eacad16f44bbc20fa2b Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 15:46:49 +0300
Subject: 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;
       }
-- 
cgit v1.2.1


From f6d8640d678799244cd9aede6abfd4493e139665 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Tue, 3 Dec 2019 21:26:44 +0300
Subject: 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;
 
   /*
-- 
cgit v1.2.1


From aab6cefe8dc132ec6a16e6af5c616765671ac9af Mon Sep 17 00:00:00 2001
From: Daniele Sciascia 
Date: Wed, 4 Dec 2019 08:21:14 +0100
Subject: MDEV-20848 Fixes for MTR test galera_sr.GCF-1060 (#1421)

This patch contains two fixes:

* wsrep_handle_mdl_conflict(): handle the case where SR transaction
  is in aborting state. Previously, a BF-BF conflict was reported, and
  the process would abort.
* wsrep_thd_bf_abort(): do not restore thread vars after calling
  wsrep_bf_abort(). Thread vars are already restored in wsrep-lib if
  necessary. This also removes the assumption that the caller of
  wsrep_thd_bf_abort() is the given bf_thd, which is not the case.

Also in this patch:

* Remove unnecessary check for active victim transaction in
  wsrep_thd_bf_abort(): the exact same check is performed later in
  wsrep_bf_abort().
* Make wsrep_thd_bf_abort() and wsrep_log_thd() const-correct.
* Change signature of wsrep_abort_thd() to take THD pointers instead
  of void pointers.
---
 include/mysql/service_wsrep.h           |  4 ++--
 include/thr_lock.h                      |  2 +-
 mysql-test/suite/galera_sr/disabled.def |  2 --
 sql/service_wsrep.cc                    | 10 +---------
 sql/wsrep_dummy.cc                      |  2 +-
 sql/wsrep_mysqld.cc                     | 12 +++++++++---
 sql/wsrep_thd.cc                        |  4 ++--
 sql/wsrep_thd.h                         |  6 +++---
 8 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h
index e7ac5e159cf..2f6b2be32a6 100644
--- a/include/mysql/service_wsrep.h
+++ b/include/mysql/service_wsrep.h
@@ -74,7 +74,7 @@ extern struct wsrep_service_st {
   const char*                 (*wsrep_thd_client_mode_str_func)(const MYSQL_THD thd);
   const char*                 (*wsrep_thd_transaction_state_str_func)(const MYSQL_THD thd);
   query_id_t                  (*wsrep_thd_transaction_id_func)(const MYSQL_THD thd);
-  my_bool                     (*wsrep_thd_bf_abort_func)(const MYSQL_THD bf_thd,
+  my_bool                     (*wsrep_thd_bf_abort_func)(MYSQL_THD bf_thd,
                                                          MYSQL_THD victim_thd,
                                                          my_bool signal);
   my_bool                     (*wsrep_thd_order_before_func)(const MYSQL_THD left, const MYSQL_THD right);
@@ -190,7 +190,7 @@ extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd)
 /* Return thd retry counter */
 extern "C" int wsrep_thd_retry_counter(const MYSQL_THD thd);
 /* BF abort victim_thd */
-extern "C" my_bool wsrep_thd_bf_abort(const MYSQL_THD bf_thd,
+extern "C" my_bool wsrep_thd_bf_abort(MYSQL_THD bf_thd,
                                       MYSQL_THD victim_thd,
                                       my_bool signal);
 /* Return true if left thd is ordered before right thd */
diff --git a/include/thr_lock.h b/include/thr_lock.h
index aa207eaf2c1..2873d40c58a 100644
--- a/include/thr_lock.h
+++ b/include/thr_lock.h
@@ -169,7 +169,7 @@ void thr_set_lock_wait_callback(void (*before_wait)(void),
 
 #ifdef WITH_WSREP
   typedef my_bool (* wsrep_thd_is_brute_force_fun)(const MYSQL_THD, my_bool);
-  typedef my_bool(* wsrep_abort_thd_fun)(const MYSQL_THD, MYSQL_THD, my_bool);
+  typedef my_bool(* wsrep_abort_thd_fun)(MYSQL_THD, MYSQL_THD, my_bool);
   typedef my_bool (* wsrep_on_fun)(const MYSQL_THD);
   void wsrep_thr_lock_init(
     wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun,
diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def
index d959c91a2a2..44354706143 100644
--- a/mysql-test/suite/galera_sr/disabled.def
+++ b/mysql-test/suite/galera_sr/disabled.def
@@ -1,6 +1,4 @@
 galera_sr_table_contents : missing file
 GCF-437 : test relies on InnoDB redo log size limitation
-GCF-1060 : MDEV-20848 Galera test failure on galera_sr.GCF_1060
 galera_sr_ddl_master : MDEV-20780 Galera test failure on galera_sr.galera_sr_ddl_master
 GCF-1043A : MDEV-21170 Galera test failure on galera_sr.GCF-1043A
-
diff --git a/sql/service_wsrep.cc b/sql/service_wsrep.cc
index 5526c343d69..7a2aa55e0cc 100644
--- a/sql/service_wsrep.cc
+++ b/sql/service_wsrep.cc
@@ -196,18 +196,10 @@ extern "C" void wsrep_handle_SR_rollback(THD *bf_thd,
   }
 }
 
-extern "C" my_bool wsrep_thd_bf_abort(const THD *bf_thd, THD *victim_thd,
+extern "C" my_bool wsrep_thd_bf_abort(THD *bf_thd, THD *victim_thd,
                                       my_bool signal)
 {
-  /* Note: do not store/reset globals before wsrep_bf_abort() call
-     to avoid losing BF thd context. */
-  if (WSREP(victim_thd) && !victim_thd->wsrep_trx().active())
-  {
-    WSREP_DEBUG("BF abort for non active transaction");
-    wsrep_start_transaction(victim_thd, victim_thd->wsrep_next_trx_id());
-  }
   my_bool ret= wsrep_bf_abort(bf_thd, victim_thd);
-  wsrep_store_threadvars((THD*)bf_thd);
   /*
     Send awake signal if victim was BF aborted or does not
     have wsrep on. Note that this should never interrupt RSU
diff --git a/sql/wsrep_dummy.cc b/sql/wsrep_dummy.cc
index b7752b0fd5e..ac55dc5c843 100644
--- a/sql/wsrep_dummy.cc
+++ b/sql/wsrep_dummy.cc
@@ -115,7 +115,7 @@ const char* wsrep_thd_transaction_state_str(const THD*)
 query_id_t wsrep_thd_transaction_id(const THD *)
 { return 0; }
 
-my_bool wsrep_thd_bf_abort(const THD *, THD *, my_bool)
+my_bool wsrep_thd_bf_abort(THD *, THD *, my_bool)
 { return 0; }
 
 my_bool wsrep_thd_order_before(const THD*, const THD *)
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index d9346dfd4b6..bef574e07b2 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -2101,12 +2101,18 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
     if (wsrep_thd_is_toi(granted_thd) ||
         wsrep_thd_is_applying(granted_thd))
     {
-      if (wsrep_thd_is_SR(granted_thd) && !wsrep_thd_is_SR(request_thd))
+      if (wsrep_thd_is_aborting(granted_thd))
+      {
+        WSREP_DEBUG("BF thread waiting for SR in aborting state");
+        ticket->wsrep_report(wsrep_debug);
+        mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
+      }
+      else if (wsrep_thd_is_SR(granted_thd) && !wsrep_thd_is_SR(request_thd))
       {
         WSREP_MDL_LOG(INFO, "MDL conflict, DDL vs SR", 
                       schema, schema_len, request_thd, granted_thd);
         mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
-        wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
+        wsrep_abort_thd(request_thd, granted_thd, 1);
       }
       else
       {
@@ -2130,7 +2136,7 @@ void wsrep_handle_mdl_conflict(MDL_context *requestor_ctx,
                   wsrep_thd_transaction_state_str(granted_thd));
       ticket->wsrep_report(wsrep_debug);
       mysql_mutex_unlock(&granted_thd->LOCK_thd_data);
-      wsrep_abort_thd((void*)request_thd, (void*)granted_thd, 1);
+      wsrep_abort_thd(request_thd, granted_thd, 1);
     }
     else
     {
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 9d70875c027..8b535b41a43 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -345,7 +345,7 @@ void wsrep_fire_rollbacker(THD *thd)
 }
 
 
-int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
+int wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal)
 {
   DBUG_ENTER("wsrep_abort_thd");
   THD *victim_thd= (THD *) victim_thd_ptr;
@@ -373,7 +373,7 @@ int wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr, my_bool signal)
 
 bool wsrep_bf_abort(const THD* bf_thd, THD* victim_thd)
 {
-  WSREP_LOG_THD((THD*)bf_thd, "BF aborter before");
+  WSREP_LOG_THD(bf_thd, "BF aborter before");
   WSREP_LOG_THD(victim_thd, "victim before");
   wsrep::seqno bf_seqno(bf_thd->wsrep_trx().ws_meta().seqno());
 
diff --git a/sql/wsrep_thd.h b/sql/wsrep_thd.h
index 872570cd028..f98c15a5a85 100644
--- a/sql/wsrep_thd.h
+++ b/sql/wsrep_thd.h
@@ -88,8 +88,8 @@ void wsrep_create_appliers(long threads);
 void wsrep_create_rollbacker();
 
 bool wsrep_bf_abort(const THD*, THD*);
-int  wsrep_abort_thd(void *bf_thd_ptr, void *victim_thd_ptr,
-                                my_bool signal);
+int  wsrep_abort_thd(THD *bf_thd_ptr, THD *victim_thd_ptr, my_bool signal);
+
 extern void  wsrep_thd_set_PA_safe(void *thd_ptr, my_bool safe);
 
 /*
@@ -262,7 +262,7 @@ static inline void wsrep_override_error(THD* thd,
    @param message Optional message
    @param function Function where the call was made from
  */
-static inline void wsrep_log_thd(THD *thd,
+static inline void wsrep_log_thd(const THD *thd,
                                  const char *message,
                                  const char *function)
 {
-- 
cgit v1.2.1


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: 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.
---
 .../suite/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);
 
-- 
cgit v1.2.1


From 3cc0e0befb3d6012a7ed9649a2220bf6cc6c614f Mon Sep 17 00:00:00 2001
From: Elena Stepanova 
Date: Thu, 5 Dec 2019 01:28:11 +0200
Subject: List of unstable tests for 10.2.30 release

---
 mysql-test/unstable-tests | 453 ++++++++++------------------------------------
 1 file changed, 97 insertions(+), 356 deletions(-)

diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 1990da921ec..ea167255c03 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,241 +23,115 @@
 #
 ##############################################################################
 #
-# Based on 10.2 259edb1f60b5d4e9061a81e90c5a8ec9d0741751
+# Based on 10.2 c9b9eb331570704d020fcc7c7894f19febe7f26d
 
-main.alter_table_mdev539_maria        : Include file modified in 10.2.27
-main.alter_table_mdev539_myisam       : Include file modified in 10.2.27
 main.alter_table_trans                : MDEV-12084 - timeout
-main.analyze                          : Modified in 10.2.27
-main.analyze_format_json              : Modified in 10.2.27
-main.analyze_stmt                     : Modified in 10.2.27
-main.analyze_stmt_orderby             : Modified in 10.2.27
-main.analyze_stmt_privileges2         : Modified in 10.2.27
 main.analyze_stmt_slow_query_log      : MDEV-12237 - Wrong result
 main.auth_named_pipe                  : MDEV-14724 - System error 2
-main.bootstrap                        : Modified in 10.2.27
-main.bug13633383                      : Modified in 10.2.27
-main.cast                             : Modified in 10.2.27
 main.compare                          : Modified in 10.2.28
-main.compound                         : Modified in 10.2.27
-main.compress                         : Include file modified in 10.2.27
 main.connect                          : MDEV-17282 - Wrong result
 main.connect2                         : MDEV-13885 - Server crash
-main.constraints                      : Modified in 10.2.27
 main.count_distinct2                  : MDEV-11768 - timeout
-main.create                           : Modified in 10.2.27
 main.create_delayed                   : MDEV-10605 - failed with timeout
 main.create_drop_event                : MDEV-16271 - Wrong result
-main.cte_nonrecursive                 : Modified in 10.2.27
-main.cte_recursive                    : Modified in 10.2.27
-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.2.28
 main.ctype_uca_innodb                 : Include file modified in 10.2.28
-main.ctype_ucs                        : MDEV-17681 - Data too long for column; modified in 10.2.27
+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.2.27
 main.ctype_utf8                       : Include file modified in 10.2.28
-main.ctype_utf8mb4                    : Modified in 10.2.27
-main.ctype_utf8mb4_heap               : Include file modified in 10.2.27
-main.ctype_utf8mb4_innodb             : Include file modified in 10.2.27
-main.ctype_utf8mb4_myisam             : Include file modified in 10.2.27
 main.debug_sync                       : MDEV-10607 - internal error
-main.default                          : Modified in 10.2.27
-main.derived                          : Modified in 10.2.27
-main.derived_cond_pushdown            : Modified in 10.2.27
 main.derived_opt                      : MDEV-11768 - timeout
-main.derived_view                     : Modified in 10.2.27
 main.dirty_close                      : MDEV-19368 - mysqltest failed but provided no output
-main.distinct                         : MDEV-14194 - Crash; modified in 10.2.27
+main.distinct                         : MDEV-14194 - Crash
 main.drop_bad_db_type                 : MDEV-15676 - Wrong result; modified in 10.2.28
 main.drop_debug                       : Modified in 10.1.42
-main.dyncol                           : Modified in 10.2.27
-main.events_1                         : Modified in 10.2.27
-main.events_2                         : MDEV-13277 - Crash; modified in 10.2.27
-main.events_bugs                      : MDEV-12892 - Crash; modified in 10.2.27
-main.events_grant                     : Modified in 10.2.27
+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.explain_json                     : Modified in 10.2.27
 main.flush                            : MDEV-19368 - mysqltest failed but provided no output
-main.flush2                           : Modified in 10.2.27
-main.func_isnull                      : Modified in 10.2.27
 main.func_math                        : Modified in 10.2.28
-main.func_misc                        : Modified in 10.2.27
-main.function_defaults                : Modified in 10.2.27
 main.gis                              : MDEV-13411 - wrong result on P8
-main.grant                            : Configuration added in 10.2.27
-main.grant2                           : Configuration added in 10.2.27
-main.grant4                           : Configuration added in 10.2.27
-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.2.27
-main.greedy_optimizer                 : Modified in 10.2.27
-main.group_by                         : Modified in 10.2.27
-main.group_min_max                    : Modified in 10.2.27
-main.handlersocket                    : Configuration added in 10.2.27
 main.host_cache_size_functionality    : MDEV-10606 - sporadic failure on shutdown
-main.index_intersect                  : Modified in 10.2.27
 main.index_intersect_innodb           : MDEV-10643 - failed with timeout
 main.index_merge_innodb               : MDEV-7142 - Plan mismatch; modified in 10.2.28
 main.index_merge_myisam               : Modified in 10.2.28
-main.information_schema               : Modified in 10.2.27
-main.information_schema-big           : Modified in 10.2.27
 main.information_schema_db            : Modified in 10.2.28
-main.information_schema_parameters    : Modified in 10.2.27
-main.information_schema_routines      : Modified in 10.2.27
-main.innodb_ext_key                   : Modified in 10.2.27
-main.innodb_icp                       : Modified in 10.2.27
 main.innodb_mysql_lock                : MDEV-7861 - Wrong result
-main.join                             : Modified in 10.2.27
-main.join_cache                       : Modified in 10.2.27
-main.join_nested_jcl6                 : Modified in 10.2.27
-main.join_outer                       : Modified in 10.2.27
-main.join_outer_innodb                : Modified in 10.2.27
-main.join_outer_jcl6                  : Modified in 10.2.27
+main.join                             : Modified in 10.1.42
 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.2.27
 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.2.27
+main.log_slow                         : MDEV-13263 - Wrong result
 main.log_slow_debug                   : Modified in 10.2.28
 main.log_tables-big                   : MDEV-13408 - wrong result
 main.mdev-504                         : MDEV-15171 - warning
-main.mdev13607                        : Modified in 10.2.27
 main.mdev375                          : MDEV-10607 - sporadic "can't connect"
-main.merge                            : MDEV-10607 - sporadic "can't connect"; modified in 10.2.27
-main.mrr_icp_extra                    : Modified in 10.2.27
+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.2.28
-main.myisam_explain_non_select_all    : Modified in 10.2.27
-main.myisam_icp                       : Modified in 10.2.27
-main.myisam_mrr                       : Modified in 10.2.27
-main.mysql                            : Modified in 10.2.27
-main.mysql_client_test                : MDEV-19369 - error: 5888, status: 23, errno: 2; modified in 10.2.27
+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.2.27
 main.mysql_upgrade_noengine           : MDEV-14355 - Wrong result
-main.mysql_upgrade_ssl                : MDEV-13492 - Unknown SSL error
-main.mysqlcheck                       : Modified in 10.2.27
-main.mysqldump                        : MDEV-14800 - Stack smashing detected; modified in 10.2.27
-main.mysqldump-max                    : Modified in 10.2.27
-main.mysqldump-nl                     : Modified in 10.2.27
+main.mysqldump                        : MDEV-14800 - Stack smashing detected
 main.mysqlhotcopy_myisam              : MDEV-10995 - Hang on debug
 main.mysqlslap                        : MDEV-11801 - timeout
 main.mysqltest                        : MDEV-9269 - fails on Alpha; MDEV-13887 - Wrong result
-main.named_pipe                       : Include file modified in 10.2.27
 main.old-mode                         : MDEV-19373 - Wrong result
-main.openssl_1                        : MDEV-13492 - Unknown SSL error; modified in 10.2.27
 main.openssl_6975                     : MDEV-17184 - Failures with OpenSSL 1.1.1
+main.order_by                         : Modified in 10.2.30
 main.order_by_innodb                  : Modified in 10.2.28
 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.2.28
-main.partition_example                : Configuration added in 10.2.27
-main.partition_innodb                 : Modified in 10.2.27
 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.2.27
-main.plugin                           : Configuration added in 10.2.27
-main.plugin_innodb                    : Configuration added in 10.2.27
-main.plugin_load                      : Configuration modified in 10.2.27
-main.plugin_load_option               : Configuration modified in 10.2.27
-main.plugin_not_embedded              : Configuration added in 10.2.27
-main.pool_of_threads                  : Modified in 10.2.27
 main.processlist                      : Modified in 10.2.28
 main.processlist_notembedded          : Added in 10.2.28
-main.ps                               : Configuration modified in 10.2.27
 main.query_cache                      : MDEV-16180 - Wrong result
-main.query_cache_debug                : MDEV-15281 - Query cache is disabled; modified in 10.2.27
-main.query_cache_ps_no_prot           : Modified in 10.2.27
-main.range                            : Modified in 10.2.27
-main.range_interrupted-13751          : Modified in 10.2.27
-main.range_mrr_icp                    : Modified in 10.2.27
-main.range_vs_index_merge             : Modified in 10.2.27
+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.2.27
-main.schema                           : Modified in 10.2.27
-main.select                           : Modified in 10.2.27
-main.selectivity                      : Modified in 10.2.28
-main.selectivity_innodb               : Modified in 10.2.27
-main.selectivity_no_engine            : Modified in 10.2.27
+main.selectivity                      : Modified in 10.2.30
 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.2.27
-main.show_bad_definer-5553            : Modified in 10.2.27
-main.show_check                       : Modified in 10.2.27
+main.shm                              : MDEV-12727 - Mismatch, ERROR 2013
 main.show_explain                     : MDEV-10674 - Wrong result code
 main.sp                               : Modified in 10.2.28
 main.sp-code                          : Modified in 10.2.28
-main.sp-error                         : Modified in 10.2.27
-main.sp-security                      : MDEV-10607 - sporadic "can't connect"; modified in 10.2.27
+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.2.27
-main.ssl-big                          : Modified in 10.2.27
+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.2.27
-main.ssl_connect                      : MDEV-13492 - Unknown SSL error
 main.ssl_crl                          : MDEV-19119 - Wrong error code
 main.ssl_timeout                      : MDEV-11244 - Crash
 main.stat_tables                      : Modified in 10.2.28
-main.stat_tables-enospc               : Modified in 10.2.27
 main.stat_tables_par                  : MDEV-13266 - Wrong result
 main.stat_tables_par_innodb           : MDEV-14155 - Wrong rounding
-main.statistics                       : Modified in 10.2.27
 main.status                           : MDEV-13255 - Wrong result
-main.subselect                        : Modified in 10.2.27
-main.subselect2                       : Modified in 10.2.27
-main.subselect3                       : Modified in 10.2.27
-main.subselect3_jcl6                  : Modified in 10.2.27
-main.subselect4                       : Modified in 10.2.27
-main.subselect_exists2in              : Modified in 10.2.27
-main.subselect_extra                  : Modified in 10.2.27
 main.subselect_innodb                 : MDEV-10614 - Sporadic wrong results
-main.subselect_mat_cost               : Modified in 10.2.27
-main.subselect_mat_cost_bugs          : Modified in 10.2.27
 main.subselect_sj                     : Modified in 10.2.28
-main.subselect_sj2                    : Modified in 10.2.27
-main.subselect_sj2_mat                : Modified in 10.2.27
-main.subselect_sj_jcl6                : Modified in 10.2.27
-main.subselect_sj_mat                 : Modified in 10.2.27
-main.subselect_sj_nonmerged           : Modified in 10.2.27
 main.sum_distinct-big                 : Modified in 10.2.28
-main.table_options-5867               : Configuration added in 10.2.27
 main.tc_heuristic_recover             : MDEV-14189 - Wrong result
-main.trigger                          : Modified in 10.2.27
-main.trigger-compat                   : Modified in 10.2.27
-main.trigger_notembedded              : Modified in 10.2.27
-main.truncate_badse                   : Configuration added in 10.2.27
 main.type_blob                        : MDEV-15195 - Wrong result
-main.type_date                        : Modified in 10.2.27
-main.type_datetime                    : Modified in 10.2.27
+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_int                         : Modified in 10.2.27
+main.type_int                         : Modified in 10.1.42
 main.type_newdecimal                  : Modified in 10.2.28
-main.type_time_6065                   : Modified in 10.2.27
-main.type_varchar                     : Configuration added in 10.2.27
-main.union                            : Modified in 10.2.27
-main.upgrade                          : Configuration added in 10.2.27
-main.userstat                         : MDEV-12904 - SSL errors; configuration added in 10.2.27
-main.variables                        : Modified in 10.2.27
-main.variables-notembedded            : Modified in 10.2.27
-main.view                             : Modified in 10.2.27
+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.xa                               : MDEV-11769 - lock wait timeout
-main.xtradb_mrr                       : Modified in 10.2.27
 
 #-----------------------------------------------------------------------
 
 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.2.27
 archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
 
 #-----------------------------------------------------------------------
@@ -267,17 +141,12 @@ 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.2.27
 binlog.binlog_killed           : MDEV-12925 - Wrong result
-binlog.binlog_max_extension    : MDEV-19762 - Crash on shutdown; modified in 10.2.27
-binlog.binlog_mixed_cache_stat : Configuration added in 10.2.27
-binlog.binlog_mysqlbinlog2     : Modified in 10.2.27
-binlog.binlog_row_cache_stat   : Include file modified in 10.2.27
-binlog.binlog_row_drop_tmp_tbl : Include file modified in 10.2.27
-binlog.binlog_stm_cache_stat   : Include file modified in 10.2.27
-binlog.binlog_stm_drop_tmp_tbl : Include file modified in 10.2.27
+binlog.binlog_max_extension    : MDEV-19762 - Crash on shutdown
+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.2.27
+binlog.flashback-largebinlog   : MDEV-19764 - Out of memory
 binlog.load_data_stm_view      : MDEV-16948 - Wrong result
 
 #-----------------------------------------------------------------------
@@ -290,6 +159,7 @@ binlog_encryption.encryption_combo                       : MDEV-14199 - Table is
 binlog_encryption.mysqlbinlog                            : Modified in 10.2.28
 binlog_encryption.rpl_binlog_errors                      : MDEV-12742 - Crash
 binlog_encryption.rpl_checksum                           : MDEV-16951 - Wrong result
+binlog_encryption.rpl_corruption                         : Include file modified in 10.2.30
 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
@@ -319,10 +189,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.2.27
 encryption.innochecksum                       : MDEV-13644 - Assertion failure
 encryption.innodb-bad-key-change2             : MDEV-19118 - Can't connect 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
@@ -335,7 +203,7 @@ encryption.innodb-remove-encryption           : MDEV-16493 - Timeout in wait con
 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.2.27
+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
@@ -346,7 +214,6 @@ encryption.innodb_onlinealter_encryption      : MDEV-17287 - SIGABRT on server r
 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
 
 #-----------------------------------------------------------------------
 
@@ -371,37 +238,9 @@ federated.federatedx             : MDEV-10617 - Wrong checksum
 
 #-----------------------------------------------------------------------
 
-funcs_1.innodb_storedproc_07      : Include file modified in 10.2.27
-funcs_1.innodb_storedproc_08      : Include file modified in 10.2.27
-funcs_1.innodb_trig_03e           : Modified in 10.2.27
-funcs_1.is_basics_mixed           : Modified in 10.2.28
-funcs_1.is_columns                : Modified in 10.2.27
-funcs_1.is_columns_innodb         : Modified in 10.2.27
-funcs_1.is_columns_memory         : Modified in 10.2.27
-funcs_1.is_columns_myisam         : Modified in 10.2.27
-funcs_1.is_routines               : Include file modified in 10.2.27
-funcs_1.is_routines_embedded      : Include file modified in 10.2.27
-funcs_1.is_schemata               : Include file modified in 10.2.27
-funcs_1.is_schemata_embedded      : Include file modified in 10.2.27
-funcs_1.is_schemata_is_mysql_test : Modified in 10.2.27
-funcs_1.is_tables                 : Include file modified in 10.2.27
-funcs_1.is_tables_embedded        : Include file modified in 10.2.27
-funcs_1.is_tables_innodb          : Include file modified in 10.2.27
-funcs_1.is_tables_memory          : Include file modified in 10.2.27
-funcs_1.is_tables_myisam          : Include file modified in 10.2.27
-funcs_1.is_tables_myisam_embedded : Include file modified in 10.2.27
-funcs_1.is_triggers               : Include file modified in 10.2.27
-funcs_1.is_triggers_embedded      : Include file modified in 10.2.27
-funcs_1.memory_storedproc_07      : Include file modified in 10.2.27
-funcs_1.memory_storedproc_08      : Include file modified in 10.2.27
-funcs_1.memory_trig_03e           : Modified in 10.2.27
-funcs_1.memory_views              : MDEV-11773 - timeout
-funcs_1.myisam_storedproc_07      : Include file modified in 10.2.27
-funcs_1.myisam_storedproc_08      : Include file modified in 10.2.27
-funcs_1.myisam_trig_03e           : Modified in 10.2.27
-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.2.27
+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
 
 #-----------------------------------------------------------------------
 
@@ -410,8 +249,7 @@ funcs_2.myisam_charset : MDEV-11535 - Timeout
 
 #-----------------------------------------------------------------------
 
-funcs_2/charset.*              : MDEV-10999 - Not maintained
-funcs_2/charset.charset_master : Modified in 10.2.27
+funcs_2/charset.* : MDEV-10999 - Not maintained
 
 #-----------------------------------------------------------------------
 
@@ -424,48 +262,40 @@ 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.2.27
+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.2.28
-gcol.innodb_virtual_index       : Modified in 10.2.27
 
 #-----------------------------------------------------------------------
 
 innodb.101_compatibility                     : MDEV-13891 - Wrong result
-innodb.alter_copy                            : MDEV-16181 - Assertion failure; modified in 10.2.27
+innodb.alter_copy                            : MDEV-16181 - Assertion failure
 innodb.alter_crash                           : MDEV-16944 - The process cannot access the file
-innodb.auto_increment_dup                    : Modified in 10.2.27
 innodb.autoinc_persist                       : MDEV-15282 - Assertion failure
 innodb.binlog_consistent                     : MDEV-10618 - Server fails to start
+innodb.blob-crash                            : MDEV-20481 - Failures upon recovery
 innodb.doublewrite                           : MDEV-12905 - Server crash
-innodb.foreign-keys                          : Modified in 10.2.27
-innodb.foreign_key                           : Modified in 10.2.27
 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.2.28
+innodb.ibuf_not_empty                        : MDEV-19021 - Wrong result; modified in 10.2.30
 innodb.information_schema_grants             : Added in 10.2.28
-innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup
-innodb.innodb-alter                          : Modified in 10.2.27
+innodb.innodb-32k-crash                      : Modified in 10.2.30
+innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup; modified in 10.2.30
 innodb.innodb-alter-debug                    : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
 innodb.innodb-alter-table                    : MDEV-10619 - Testcase timeout
 innodb.innodb-autoinc                        : Modified in 10.2.28
 innodb.innodb-blob                           : MDEV-12053 - Client crash
 innodb.innodb-change-buffer-recovery         : MDEV-19115 - Lost connection to MySQL server during query; modified in 10.2.28
 innodb.innodb-fk                             : MDEV-13832 - Assertion failure on shutdown
-innodb.innodb-fkcheck                        : Modified in 10.2.27
-innodb.innodb-get-fk                         : MDEV-13276 - Server crash; modified in 10.2.27
+innodb.innodb-get-fk                         : MDEV-13276 - Server crash
 innodb.innodb-index-online                   : MDEV-14809 - Cannot save statistics
-innodb.innodb-mdev7046                       : Modified in 10.2.27
+innodb.innodb-mdev-7513                      : Modified in 10.2.30
 innodb.innodb-page_compression_default       : MDEV-13644 - Assertion failure
 innodb.innodb-page_compression_lzma          : MDEV-14353 - Wrong result
 innodb.innodb-page_compression_zip           : MDEV-10641 - mutex problem
-innodb.innodb-read-view                      : Added in 10.2.27
-innodb.innodb-system-table-view              : Configuration modified in 10.2.27
 innodb.innodb-table-online                   : MDEV-13894 - Wrong result
 innodb.innodb-virtual-columns-debug          : Modified in 10.2.28
-innodb.innodb-wl5522-debug                   : MDEV-14200 - Wrong errno; modified in 10.2.27
+innodb.innodb-wl5522-debug                   : MDEV-14200 - Wrong errno
 innodb.innodb_buffer_pool_dump_pct           : MDEV-20139 - Timeout in wait_condition.inc
 innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure
 innodb.innodb_bug14147491                    : MDEV-11808 - Index is corrupt
@@ -473,16 +303,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.2.27
-innodb.innodb_bug84958                       : Added in 10.2.27
-innodb.innodb_bulk_create_index_debug        : Include file modified in 10.2.27
-innodb.innodb_bulk_create_index_flush        : Configuration added in 10.2.27
 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.2.28
 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.2.30
+innodb.innodb_max_recordsize_64k             : MDEV-15203 - Wrong result; modified in 10.2.30
 innodb.innodb_monitor                        : MDEV-10939 - Testcase timeout
 innodb.innodb_mysql                          : MDEV-19873 - Wrong result
 innodb.innodb_stats                          : MDEV-10682 - wrong result
@@ -490,7 +316,6 @@ innodb.innodb_stats_persistent               : Modified in 10.2.28
 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.log_alter_table                       : Configuration added in 10.2.27
 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
@@ -499,71 +324,67 @@ innodb.monitor                               : MDEV-16179 - Wrong result
 innodb.purge_secondary                       : MDEV-15681 - Wrong result
 innodb.purge_thread_shutdown                 : MDEV-13792 - Wrong result
 innodb.read_only_recovery                    : MDEV-13886 - Server crash
-innodb.recovery_shutdown                     : MDEV-15671 - Checksum mismatch in datafile; modified in 10.2.27
+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.2.30
 innodb.stat_tables                           : Added in 10.2.28
 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.2.28
 innodb.trx_id_future                         : Modified in 10.1.42
+innodb.undo_log                              : Modified in 10.2.30
 innodb.undo_truncate                         : MDEV-17340 - Server hung
-innodb.undo_truncate_recover                 : MDEV-17679 - MySQL server has gone away; modified in 10.2.27
+innodb.undo_truncate_recover                 : MDEV-17679 - MySQL 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.2.28
+innodb_fts.concurrent_insert           : MDEV-21223 - Server crash; modified in 10.2.28
 innodb_fts.crash_recovery              : Modified in 10.2.28
-innodb_fts.innodb_fts_misc             : Modified in 10.2.28
+innodb_fts.innodb_fts_misc             : Modified in 10.2.30
 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-21223 - Server crash
 
 #-----------------------------------------------------------------------
 
-innodb_gis.rtree_compress2       : Modified in 10.2.27
 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.2.27
 
 #-----------------------------------------------------------------------
 
-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.2.27
-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.2.30
+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.2.30
+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.2.27
 maria.insert_select      : MDEV-12757 - Timeout
 maria.insert_select-7314 : MDEV-16492 - Timeout
 maria.lock               : Modified in 10.2.28
 maria.maria              : MDEV-14430 - Extra warning
-maria.maria-big          : Modified in 10.2.27
-maria.maria-gis-recovery : Modified in 10.2.27
-maria.maria-no-logging   : Modified in 10.2.27
-maria.maria-recover      : Modified in 10.2.27
-maria.maria-recovery     : Modified in 10.2.27
-maria.maria3             : Modified in 10.2.27
 
 #-----------------------------------------------------------------------
 
 mariabackup.apply-log-only          : MDEV-20135 - Timeout
-mariabackup.big_innodb_log          : Added in 10.2.27
 mariabackup.data_directory          : MDEV-15270 - Error on exec
 mariabackup.extra_lsndir_stream     : Added in 10.2.28
 mariabackup.full_backup             : MDEV-16571 - Wrong result
 mariabackup.huge_lsn                : MDEV-15662 - Sequence number is in the future
+mariabackup.incremental_backup      : MDEV-21222 - Memory allocation failure; modified in 10.2.30
 mariabackup.incremental_encrypted   : MDEV-15667 - Timeout
 mariabackup.mdev-14447              : MDEV-15201 - Timeout
 mariabackup.mdev-18438              : Added in 10.2.28
@@ -607,23 +428,7 @@ parts.partition_debug                  : Modified in 10.2.28
 parts.partition_debug_innodb           : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.2.28
 parts.partition_debug_myisam           : Modified in 10.2.28
 parts.partition_exch_qa_10             : MDEV-11765 - wrong result
-parts.partition_exch_qa_4_innodb       : Include file modified in 10.2.27
-parts.partition_exch_qa_4_myisam       : Include file modified in 10.2.27
-parts.partition_exch_qa_8_innodb       : Include file modified in 10.2.27
-parts.partition_exch_qa_8_myisam       : Include file modified in 10.2.27
 parts.partition_innodb_status_file     : MDEV-12901 - Valgrind
-parts.partition_mgm_lc0_archive        : Include file modified in 10.2.27
-parts.partition_mgm_lc0_innodb         : Include file modified in 10.2.27
-parts.partition_mgm_lc0_memory         : Include file modified in 10.2.27
-parts.partition_mgm_lc0_myisam         : Include file modified in 10.2.27
-parts.partition_mgm_lc1_archive        : Include file modified in 10.2.27
-parts.partition_mgm_lc1_innodb         : Include file modified in 10.2.27
-parts.partition_mgm_lc1_memory         : Include file modified in 10.2.27
-parts.partition_mgm_lc1_myisam         : Include file modified in 10.2.27
-parts.partition_mgm_lc2_archive        : Include file modified in 10.2.27
-parts.partition_mgm_lc2_innodb         : Include file modified in 10.2.27
-parts.partition_mgm_lc2_memory         : Include file modified in 10.2.27
-parts.partition_mgm_lc2_myisam         : Include file modified in 10.2.27
 parts.partition_special_innodb         : MDEV-16942 - Timeout
 parts.reorganize_partition_innodb      : Added in 10.2.28
 
@@ -633,39 +438,26 @@ 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.2.27
-perfschema.hostcache_ipv6_addrinfo_again_deny   : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_bad_allow    : MDEV-13260 - Crash; configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_bad_deny     : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_good_allow   : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_good_deny    : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_noname_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_addrinfo_noname_deny  : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_auth_plugin           : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_blocked               : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_max_con               : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_again_allow  : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_again_deny   : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_noname_allow : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_nameinfo_noname_deny  : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_passwd                : Configuration modified in 10.2.27
-perfschema.hostcache_ipv6_ssl                   : MDEV-10696 - Crash; configuration modified in 10.2.27
-perfschema.privilege_table_io                   : MDEV-13184 - Extra lines
-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.2.27
-perfschema.stage_mdl_global                     : MDEV-11803 - wrong result on slow builders; include file modified in 10.2.27
-perfschema.stage_mdl_procedure                  : MDEV-11545 - Missing row; include file modified in 10.2.27
-perfschema.stage_mdl_table                      : MDEV-12638 - Wrong result; include file modified in 10.2.27
-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.2.30
+perfschema.privilege_table_io                  : MDEV-13184 - Extra lines
+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
 
 #-----------------------------------------------------------------------
 
@@ -676,8 +468,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained
 plugins.feedback_plugin_load     : Modified in 10.2.28
 plugins.feedback_plugin_send     : MDEV-7932, MDEV-11118 - Connection problems and such
 plugins.processlist              : MDEV-16574 - Wrong result
-plugins.qc_info                  : Modified in 10.2.27
-plugins.server_audit             : MDEV-9562 - crashes on sol10-sparc
+plugins.server_audit             : MDEV-9562 - crashes on sol10-sparc; modified in 10.2.30
 plugins.thread_pool_server_audit : MDEV-14295 - Wrong result
 
 #-----------------------------------------------------------------------
@@ -714,10 +505,7 @@ rocksdb_rpl.rpl_binlog_xid_count : MDEV-16644 - Server crash
 
 #-----------------------------------------------------------------------
 
-roles.acl_statistics             : Configuration added in 10.2.27
-roles.create_and_grant_role      : MDEV-11772 - wrong result
-roles.definer                    : Modified in 10.2.27
-roles.show_create_database-10463 : Modified in 10.2.27
+roles.create_and_grant_role : MDEV-11772 - wrong result
 
 #-----------------------------------------------------------------------
 
@@ -727,14 +515,15 @@ 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.2.27
+rpl.mdev_17588                          : Modified in 10.1.42
 rpl.rpl_auto_increment                  : MDEV-10417 - Fails on Mips
 rpl.rpl_auto_increment_bug45679         : MDEV-10417 - Fails on Mips
 rpl.rpl_auto_increment_update_failure   : MDEV-10625 - warnings in error log
 rpl.rpl_binlog_errors                   : MDEV-12742 - Crash
 rpl.rpl_binlog_index                    : MDEV-9501 - Failed registering on master
 rpl.rpl_colSize                         : MDEV-16112 - Server crash
-rpl.rpl_create_or_replace_fail          : Added in 10.2.27
+rpl.rpl_corruption                      : Include file modified in 10.2.30
+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
@@ -743,7 +532,6 @@ rpl.rpl_domain_id_filter_restart        : MDEV-10684 - Wrong result
 rpl.rpl_drop_db_fail                    : MDEV-16898 - Slave fails to start
 rpl.rpl_extra_col_master_innodb         : MDEV-16570 - Extra warning
 rpl.rpl_extra_col_master_myisam         : MDEV-14203 - Extra warning
-rpl.rpl_failed_drop_tbl_binlog          : Added in 10.2.27
 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
@@ -761,11 +549,11 @@ rpl.rpl_insert_id                       : MDEV-15197 - Wrong result
 rpl.rpl_insert_id_pk                    : MDEV-16567 - Assertion failure
 rpl.rpl_insert_ignore                   : MDEV-14365 - Lost connection to MySQL server during query
 rpl.rpl_invoked_features                : MDEV-10417 - Fails on Mips
-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 - Warnings/errors
 rpl.rpl_mdev6020                        : MDEV-15272 - Server crash
-rpl.rpl_mdev_17614                      : Added in 10.2.27
+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
@@ -790,12 +578,12 @@ 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.2.27
 rpl.rpl_row_until                       : MDEV-14052 - Master will not send events with checksum
 rpl.rpl_semi_sync                       : MDEV-11220 - Wrong result
 rpl.rpl_semi_sync_after_sync            : MDEV-14366 - Wrong result
 rpl.rpl_semi_sync_after_sync_row        : MDEV-14366 - Wrong result
 rpl.rpl_semi_sync_event_after_sync      : MDEV-11806 - warnings
+rpl.rpl_semi_sync_gtid_reconnect        : Added in 10.2.30
 rpl.rpl_semi_sync_uninstall_plugin      : MDEV-7140 - Assorted failures
 rpl.rpl_semi_sync_wait_point            : MDEV-11807 - timeout in wait condition
 rpl.rpl_set_statement_default_master    : MDEV-13258 - Extra warning
@@ -811,7 +599,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.2.27
+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
@@ -836,8 +624,9 @@ sphinx.sphinx : Modified in 10.2.28
 
 #-----------------------------------------------------------------------
 
-spider.*         : MDEV-9329 - tests are too memory-consuming
-spider.basic_sql : MDEV-11186 - Internal check fails
+spider.*                 : MDEV-9329 - tests are too memory-consuming
+spider.basic_sql         : MDEV-11186 - Internal check fails
+spider.pushdown_not_like : Added in 10.2.30
 
 #-----------------------------------------------------------------------
 
@@ -865,45 +654,16 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
 
 #-----------------------------------------------------------------------
 
-sys_vars.aria_recover_options_basic                : Modified in 10.2.27
 sys_vars.autocommit_func2                          : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.binlog_cache_size_basic                   : Modified in 10.2.27
-sys_vars.binlog_stmt_cache_size_basic              : Modified in 10.2.27
-sys_vars.character_set_client_basic                : Modified in 10.2.27
-sys_vars.character_set_connection_basic            : Modified in 10.2.27
-sys_vars.character_set_database_basic              : Modified in 10.2.27
-sys_vars.character_set_results_basic               : Modified in 10.2.27
-sys_vars.character_set_server_basic                : Modified in 10.2.27
-sys_vars.character_set_server_func                 : Modified in 10.2.27
-sys_vars.collation_connection_basic                : Modified in 10.2.27
-sys_vars.collation_database_basic                  : Modified in 10.2.27
-sys_vars.collation_server_basic                    : Modified in 10.2.27
 sys_vars.delayed_insert_limit_func                 : Modified in 10.2.28
-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.2.28
-sys_vars.innodb_max_dirty_pages_pct_basic          : Modified in 10.2.27
-sys_vars.innodb_max_dirty_pages_pct_lwm_basic      : Modified in 10.2.27
-sys_vars.innodb_read_io_threads_basic              : Configuration added in 10.2.27
-sys_vars.innodb_write_io_threads_basic             : Configuration added in 10.2.27
 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.2.27
-sys_vars.max_connect_errors_basic                  : Modified in 10.2.27
-sys_vars.max_connections_basic                     : Modified in 10.2.27
-sys_vars.max_heap_table_size_basic                 : Modified in 10.2.27
-sys_vars.max_seeks_for_key_func                    : Modified in 10.2.27
-sys_vars.myisam_recover_options_basic              : Configuration added in 10.2.27
-sys_vars.myisam_sort_buffer_size_basic             : Modified in 10.2.27
-sys_vars.optimizer_switch_basic                    : Modified in 10.2.27
 sys_vars.rpl_init_slave_func                       : MDEV-10149 - Test assertion
 sys_vars.slow_query_log_func                       : MDEV-14273 - Wrong result
 sys_vars.sysvars_innodb                            : Modified in 10.2.28
-sys_vars.sysvars_server_embedded                   : Include file modified in 10.2.27
-sys_vars.sysvars_server_notembedded                : Include file modified in 10.2.27
 sys_vars.thread_cache_size_func                    : MDEV-11775 - Wrong result
-sys_vars.userstat_basic                            : Modified in 10.2.27
 sys_vars.wait_timeout_func                         : MDEV-12896 - Wrong result
 
 #-----------------------------------------------------------------------
@@ -912,10 +672,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.2.27
-tokudb.cluster_2968-1                          : Modified in 10.2.27
-tokudb.cluster_2968-2                          : Modified in 10.2.27
-tokudb.cluster_2968-3                          : Modified in 10.2.27
 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
@@ -933,7 +689,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.2.27
 
 #-----------------------------------------------------------------------
 
@@ -954,14 +709,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.2.28
-tokudb_parts.partition_exch_qa_4_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_exch_qa_8_tokudb : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc0_tokudb   : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc10_tokudb  : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc1_tokudb   : Include file modified in 10.2.27
-tokudb_parts.partition_mgm_lc2_tokudb   : Include file modified in 10.2.27
+tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
+tokudb_parts.partition_debug_tokudb  : Include file modified in 10.2.28
 
 #-----------------------------------------------------------------------
 
@@ -984,24 +733,16 @@ unit.ma_test_loghandler         : MDEV-10638 - record read not ok
 
 #-----------------------------------------------------------------------
 
-vcol.cross_db               : Modified in 10.2.27
-vcol.not_supported          : MDEV-10639 - Testcase timeout
-vcol.update                 : Modified in 10.2.27
-vcol.vcol_keys_innodb       : MDEV-10639 - Testcase timeout; modified in 10.2.28
-vcol.vcol_misc              : MDEV-16651 - Wrong error message
-vcol.vcol_select_innodb     : Modified in 10.2.27
-vcol.vcol_select_myisam     : Modified in 10.2.27
-vcol.vcol_sql_mode          : Added in 10.2.27
-vcol.vcol_sql_mode_upgrade  : Added in 10.2.27
-vcol.vcol_trigger_sp_innodb : Include file modified in 10.2.27
-vcol.vcol_trigger_sp_myisam : Include file modified in 10.2.27
+vcol.not_supported    : MDEV-10639 - Testcase timeout
+vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout; modified in 10.2.28
+vcol.vcol_misc        : MDEV-16651 - Wrong error message
 
 #-----------------------------------------------------------------------
 
 wsrep.foreign_key                      : MDEV-14725 - WSREP has not yet prepared node
 wsrep.mdev_6832                        : MDEV-14195 - Check testcase failed
-wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.2.27
-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.2.30
 wsrep.variables                        : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock
 
 #-----------------------------------------------------------------------
-- 
cgit v1.2.1


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: MDEV-21172 Memory leak after failed ADD PRIMARY KEY

---
 mysql-test/suite/innodb/r/instant_alter,4k.rdiff   | 60 ++++++++++++++--------
 mysql-test/suite/innodb/r/instant_alter.result     | 23 ++++++++-
 .../suite/innodb/r/instant_alter_bugs.result       |  1 +
 mysql-test/suite/innodb/t/instant_alter.test       | 12 +++++
 mysql-test/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;
-- 
cgit v1.2.1


From d759f764f6b115ca7ad7644ae3ee2e19c71c6138 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Thu, 5 Dec 2019 15:11:18 +0300
Subject: 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;
-- 
cgit v1.2.1


From 1fbd9bb2c5d134209ac2aae073f7a78797c1c04e Mon Sep 17 00:00:00 2001
From: Robert Bindar 
Date: Thu, 5 Dec 2019 18:26:52 +0200
Subject: 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);
-- 
cgit v1.2.1


From f5b76d8c40f38466c51bb9213bf8efa05c6423bd Mon Sep 17 00:00:00 2001
From: Kentoku 
Date: Fri, 6 Dec 2019 04:32:56 +0900
Subject: fix compiler warnings

---
 storage/spider/spd_conn.cc     | 6 ++++--
 storage/spider/spd_db_mysql.cc | 4 ++--
 storage/spider/spd_include.h   | 2 +-
 3 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc
index cf1c5733e71..5e5fa0eda52 100644
--- a/storage/spider/spd_conn.cc
+++ b/storage/spider/spd_conn.cc
@@ -4565,16 +4565,18 @@ SPIDER_IP_PORT_CONN* spider_create_ipport_conn(SPIDER_CONN *conn)
       goto err_malloc_key;
     }
 
-    ret->key = (char *) my_malloc(ret->key_len, MY_ZEROFILL | MY_WME);
+    ret->key = (char *) my_malloc(ret->key_len + conn->tgt_host_length + 1,
+      MY_ZEROFILL | MY_WME);
     if (!ret->key) {
       pthread_cond_destroy(&ret->cond);
       pthread_mutex_destroy(&ret->mutex);
       goto err_malloc_key;
     }
+    ret->remote_ip_str = ret->key + ret->key_len;
 
     memcpy(ret->key, conn->conn_key, ret->key_len);
 
-    strncpy(ret->remote_ip_str, conn->tgt_host, sizeof(ret->remote_ip_str));
+    memcpy(ret->remote_ip_str, conn->tgt_host, conn->tgt_host_length);
     ret->remote_port = conn->tgt_port;
     ret->conn_id = conn->conn_id;
     ret->ip_port_count = 1; // init
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index 0a634a60f42..1e8b5c40a03 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -14131,7 +14131,7 @@ int spider_mbase_handler::simple_action(
   SPIDER_DB_RESULT *res;
   SPIDER_SHARE *share = spider->share;
   uint pos = spider->conn_link_idx[link_idx];
-  spider_string *str;
+  spider_string *str = NULL;
   DBUG_ENTER("spider_mbase_handler::simple_action");
   switch (simple_action)
   {
@@ -14172,7 +14172,7 @@ int spider_mbase_handler::simple_action(
 #endif
     default:
       DBUG_ASSERT(0);
-      break;
+      DBUG_RETURN(0);
   }
   pthread_mutex_lock(&conn->mta_conn_mutex);
   SPIDER_SET_FILE_POS(&conn->mta_conn_mutex_file_pos);
diff --git a/storage/spider/spd_include.h b/storage/spider/spd_include.h
index 30a5d598709..2249d3e699c 100644
--- a/storage/spider/spd_include.h
+++ b/storage/spider/spd_include.h
@@ -1452,7 +1452,7 @@ typedef struct st_spider_ip_port_conn {
 #ifdef SPIDER_HAS_HASH_VALUE_TYPE
   my_hash_value_type key_hash_value;
 #endif
-  char               remote_ip_str[SPIDER_CONN_META_BUF_LEN];
+  char               *remote_ip_str;
   long               remote_port;
   ulong              ip_port_count;
   volatile ulong     waiting_count;
-- 
cgit v1.2.1


From be92dce61353952da593b32f3f52b81b89ee7219 Mon Sep 17 00:00:00 2001
From: Aleksey Midenkov 
Date: Thu, 5 Dec 2019 23:45:57 +0300
Subject: 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())
-- 
cgit v1.2.1


From e5e5877740f248de848219ee3a1d2881cd5c5b82 Mon Sep 17 00:00:00 2001
From: Elena Stepanova 
Date: Fri, 6 Dec 2019 00:18:10 +0200
Subject: 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
 
 #-----------------------------------------------------------------------
-- 
cgit v1.2.1


From 6484288cd260cc9ad34d93a35502e66c034f01a7 Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Sun, 8 Dec 2019 18:14:42 +0100
Subject: CONC-447 ERROR 2026 (HY000): SSL connection error: Certificate
 signature check failed

Enable CRL checking on Windows.
Enable certificate verification testing in client testing.
---
 include/sslopt-case.h             |  2 +-
 libmariadb                        |  2 +-
 mysql-test/t/ssl_7937.test        | 13 ++-----------
 mysql-test/t/ssl_crl_clients.test | 14 +++++++++++---
 4 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/include/sslopt-case.h b/include/sslopt-case.h
index fe53088e89b..fe83051c275 100644
--- a/include/sslopt-case.h
+++ b/include/sslopt-case.h
@@ -30,7 +30,7 @@
     */
       opt_use_ssl= 1;
     /* crl has no effect in yaSSL */  
-#ifdef HAVE_YASSL
+#if defined (HAVE_YASSL) && (!defined (_WIN32) || defined (MYSQL_SERVER))
       opt_ssl_crl= NULL;
       opt_ssl_crlpath= NULL;
 #endif
diff --git a/libmariadb b/libmariadb
index c8833751cf4..63df45ce3df 160000
--- a/libmariadb
+++ b/libmariadb
@@ -1 +1 @@
-Subproject commit c8833751cf48d0085d9d7a4285aafdc967a63a4d
+Subproject commit 63df45ce3df3fbc04d8fab9bceb77f9d1cccd4aa
diff --git a/mysql-test/t/ssl_7937.test b/mysql-test/t/ssl_7937.test
index aa8cd225d7b..59c13107e01 100644
--- a/mysql-test/t/ssl_7937.test
+++ b/mysql-test/t/ssl_7937.test
@@ -21,15 +21,6 @@ create procedure have_ssl()
 --exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
 
 --echo mysql --ssl --ssl-verify-server-cert -e "call test.have_ssl()"
-# this is the test where certificate verification fails.
-# but yassl doesn't support certificate verification, so
-# we fake the test result for yassl
-let yassl=`select variable_value='Unknown' from information_schema.session_status where variable_name='Ssl_session_cache_mode'`;
-if (!$yassl) {
-  --replace_result "self signed certificate in certificate chain" "Failed to verify the server certificate" "Error in the certificate." "Failed to verify the server certificate"
-  --exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
-}
-if ($yassl) {
-  --echo ERROR 2026 (HY000): SSL connection error: Failed to verify the server certificate
-}
+--replace_regex /SSL connection error.*certificate[^\n]*/SSL connection error: Failed to verify the server certificate/
+--exec $MYSQL --ssl --ssl-verify-server-cert -e "call test.have_ssl()" 2>&1
 drop procedure have_ssl;
diff --git a/mysql-test/t/ssl_crl_clients.test b/mysql-test/t/ssl_crl_clients.test
index fc954a2fc38..f1dc4909cc6 100644
--- a/mysql-test/t/ssl_crl_clients.test
+++ b/mysql-test/t/ssl_crl_clients.test
@@ -1,6 +1,12 @@
 # This test should work in embedded server after we fix mysqltest
 -- source include/not_embedded.inc
--- source include/have_openssl.inc
+
+if (`SELECT COUNT(*) = 0 FROM information_schema.GLOBAL_VARIABLES
+    WHERE (VARIABLE_NAME ='version_compile_os' AND VARIABLE_VALUE LIKE 'Win%' OR
+    VARIABLE_NAME='have_openssl' AND VARIABLE_VALUE='YES')`)
+{
+  skip Need openssl or Windows;
+}
 
 --echo # Test clients with and without CRL lists
 
@@ -14,10 +20,12 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
 --echo ############ Test mysql ##############
 
 --echo # Test mysql connecting to a server with a certificate revoked by -crl
+--replace_result "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
 --error 1
 --exec $MYSQL $ssl_crl test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
 
 --echo # Test mysql connecting to a server with a certificate revoked by -crlpath
+--replace_result "Server certificate validation failed. The certificate is revoked. Error 0x80092010(CRYPT_E_REVOKED)" "certificate revoked"
 --error 1
 --exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1
 
@@ -26,11 +34,11 @@ copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0;
 let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping;
 
 --echo # Test mysqladmin connecting to a server with a certificate revoked by -crl
---replace_regex /.*mysqladmin.*:/mysqladmin:/
+--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
 --error 1
 --exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1
 
 --echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath
---replace_regex /.*mysqladmin.*:/mysqladmin:/
+--replace_regex /.*mysqladmin.*:/mysqladmin:/ /SSL connection error: .*CRYPT_E_REVOKED./SSL connection error: certificate revoked/
 --error 1
 --exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1
-- 
cgit v1.2.1


From 6aa0fa3897bc9ce415efef0c0c039503881321ad Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Fri, 6 Dec 2019 21:02:46 +0100
Subject: CONC-417 Windows clients using Schannel often encounter error
 SEC_E_INVALID_TOKEN

reenable ssl_8k_key on Windows, which was affected by this bug
---
 mysql-test/t/ssl_8k_key.test | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/mysql-test/t/ssl_8k_key.test b/mysql-test/t/ssl_8k_key.test
index edfead46658..88f6b963cc4 100644
--- a/mysql-test/t/ssl_8k_key.test
+++ b/mysql-test/t/ssl_8k_key.test
@@ -1,6 +1,3 @@
-# schannel does not support keys longer than 4k
--- source include/not_windows.inc
-
 -- source include/have_ssl_communication.inc
 #
 # Bug#29784 YaSSL assertion failure when reading 8k key.
-- 
cgit v1.2.1


From fd1979bc9a535735ed3f3a7dbb67d09568dd8417 Mon Sep 17 00:00:00 2001
From: Alexey Botchkov 
Date: Mon, 9 Dec 2019 01:17:16 +0400
Subject: MDEV-18463 Don't allow multiple table CONSTRAINTs with the same name.

Add necessary checks.
---
 mysql-test/r/foreign_key.result | 26 ++++++++++++++++++++
 mysql-test/t/foreign_key.test   | 24 ++++++++++++++++++
 sql/sql_table.cc                | 54 +++++++++++++++++++++++++++++++++++++++--
 3 files changed, 102 insertions(+), 2 deletions(-)

diff --git a/mysql-test/r/foreign_key.result b/mysql-test/r/foreign_key.result
index a82151ddec0..c412be6bbdb 100644
--- a/mysql-test/r/foreign_key.result
+++ b/mysql-test/r/foreign_key.result
@@ -82,3 +82,29 @@ add foreign key (a) references t3 (a)
 on update set default on update set default);
 ERROR 42000: 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 'update set default)' at line 3
 drop table t_34455;
+#
+# MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
+#
+CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+DROP TABLE tfk;
+CREATE TABLE tfk (c1 INT, c2 INT,
+CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
+show create table tfk;
+Table	Create Table
+tfk	CREATE TABLE `tfk` (
+  `c1` int(11) DEFAULT NULL,
+  `c2` int(11) DEFAULT NULL,
+  KEY `sid` (`c1`),
+  CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `tpk` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+ERROR HY000: Duplicate CHECK constraint name 'sid'
+ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
+ERROR 42000: Duplicate key name 'sid'
+DROP TABLE tfk;
+DROP TABLE tpk;
diff --git a/mysql-test/t/foreign_key.test b/mysql-test/t/foreign_key.test
index 17c93332cb3..3a09a544532 100644
--- a/mysql-test/t/foreign_key.test
+++ b/mysql-test/t/foreign_key.test
@@ -117,4 +117,28 @@ alter table t_34455
 
 drop table t_34455;
 
+--echo #
+--echo # MDEV-18460 Don't allow multiple table CONSTRAINTs with the same name.
+--echo #
+
+CREATE TABLE tpk (id INT NOT NULL AUTO_INCREMENT PRIMARY KEY,name VARCHAR(100) NOT NULL) ENGINE=Innodb;
+--error ER_DUP_CONSTRAINT_NAME
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1), CONSTRAINT sid CHECK (c2>15));
+
+CREATE TABLE tfk (c1 INT, c2 INT, CONSTRAINT sid UNIQUE (c1));
+--error ER_DUP_CONSTRAINT_NAME
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+DROP TABLE tfk;
+
+CREATE TABLE tfk (c1 INT, c2 INT,
+  CONSTRAINT sid FOREIGN KEY (c1) REFERENCES tpk (id)) ENGINE=Innodb;
+show create table tfk;
+--error ER_DUP_CONSTRAINT_NAME
+ALTER TABLE tfk ADD CONSTRAINT sid CHECK (c2>15);
+--error ER_DUP_KEYNAME
+ALTER TABLE tfk ADD CONSTRAINT sid UNIQUE(c2);
+DROP TABLE tfk;
+
+DROP TABLE tpk;
+
 
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 4ad68d9d03b..878c09286b5 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -4196,10 +4196,10 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
         continue;
 
       {
-        /* Check that there's no repeating constraint names. */
+        /* Check that there's no repeating table CHECK constraint names. */
         List_iterator_fast
           dup_it(alter_info->check_constraint_list);
-        Virtual_column_info *dup_check;
+        const Virtual_column_info *dup_check;
         while ((dup_check= dup_it++) && dup_check != check)
         {
           if (check->name.length == dup_check->name.length &&
@@ -4212,6 +4212,27 @@ mysql_prepare_create_table(THD *thd, HA_CREATE_INFO *create_info,
         }
       }
 
+      /* Check that there's no repeating key constraint names. */
+      List_iterator_fast key_it(alter_info->key_list);
+      while (const Key *key= key_it++)
+      {
+        /*
+          Not all keys considered to be the CONSTRAINT
+          Noly Primary Key UNIQUE and Foreign keys.
+        */
+        if (key->type != Key::PRIMARY && key->type != Key::UNIQUE &&
+            key->type != Key::FOREIGN_KEY)
+          continue;
+
+        if (check->name.length == key->name.length &&
+            my_strcasecmp(system_charset_info,
+              check->name.str, key->name.str) == 0)
+        {
+          my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
+          DBUG_RETURN(TRUE);
+        }
+      }
+
       if (check_string_char_length(&check->name, 0, NAME_CHAR_LEN,
                                    system_charset_info, 1))
       {
@@ -8176,6 +8197,35 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
       }
     }
   }
+
+  if (!alter_info->check_constraint_list.is_empty())
+  {
+    /* Check the table FOREIGN KEYs for name duplications. */
+    List  fk_child_key_list;
+    FOREIGN_KEY_INFO *f_key;
+    table->file->get_foreign_key_list(thd, &fk_child_key_list);
+    List_iterator fk_key_it(fk_child_key_list);
+    while ((f_key= fk_key_it++))
+    {
+      List_iterator_fast
+        c_it(alter_info->check_constraint_list);
+      Virtual_column_info *check;
+      while ((check= c_it++))
+      {
+        if (!check->name.length || check->automatic_name)
+          continue;
+
+        if (check->name.length == f_key->foreign_id->length &&
+            my_strcasecmp(system_charset_info, f_key->foreign_id->str,
+                          check->name.str) == 0)
+        {
+          my_error(ER_DUP_CONSTRAINT_NAME, MYF(0), "CHECK", check->name.str);
+          goto err;
+        }
+      }
+    }
+  }
+
   /* Add new constraints */
   new_constraint_list.append(&alter_info->check_constraint_list);
 
-- 
cgit v1.2.1


From 9a6212008999da44b136605c1abf2cc9c7cc4b2c Mon Sep 17 00:00:00 2001
From: Teemu Ollakka 
Date: Mon, 9 Dec 2019 05:45:40 +0000
Subject: MDEV-21229 Update wsrep-lib to deal with libstdc++ vector assertion
 (#1423)

The assertion was caused by use of operator[] for an empty vector.
The wsrep-lib update changes vector operations which access
the underlying data array to use data() method which is valid
for empty vectors.
---
 wsrep-lib | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/wsrep-lib b/wsrep-lib
index c9513bd2e49..9b25cebdf11 160000
--- a/wsrep-lib
+++ b/wsrep-lib
@@ -1 +1 @@
-Subproject commit c9513bd2e49abbc0941689af1f2f2636a25e253e
+Subproject commit 9b25cebdf11e6da25d83e513a2e4b6db0515abad
-- 
cgit v1.2.1


From 59e14b96847e458909ca7fcf95b144fd6ccdb708 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Lindstr=C3=B6m?= 
Date: Mon, 9 Dec 2019 08:09:56 +0200
Subject: MDEV-21189: Dropping partition with 'wsrep_OSU_method=RSU' and
 'SESSION sql_log_bin = 0' cases the galera node to hang

Found two bugs

(1) have_committing_connections was missing mutex unlock on one
exit case. As this function is called on a loop it caused mutex
lock when we already owned the mutex. This could cause hang.

(2) wsrep_RSU_begin did set up error code when partition to
be dropped could not be MDL-locked because of concurrent
operations but wrong error code was propagated to upper layer
causing error to be ignored. This could have also caused
the hang.
---
 mysql-test/suite/galera/galera_4nodes.cnf         |   4 +
 mysql-test/suite/galera/r/galera_partition.result | 424 ++++++++++++++++++++
 mysql-test/suite/galera/t/galera_partition.cnf    |  18 +
 mysql-test/suite/galera/t/galera_partition.test   | 453 ++++++++++++++++++++++
 sql/wsrep_mysqld.cc                               |   3 +-
 5 files changed, 901 insertions(+), 1 deletion(-)
 create mode 100644 mysql-test/suite/galera/r/galera_partition.result
 create mode 100644 mysql-test/suite/galera/t/galera_partition.cnf
 create mode 100644 mysql-test/suite/galera/t/galera_partition.test

diff --git a/mysql-test/suite/galera/galera_4nodes.cnf b/mysql-test/suite/galera/galera_4nodes.cnf
index 1c195afd54b..426a6ae6d92 100644
--- a/mysql-test/suite/galera/galera_4nodes.cnf
+++ b/mysql-test/suite/galera/galera_4nodes.cnf
@@ -16,6 +16,7 @@ wsrep-sync-wait=15
 #galera_port=@OPT.port
 #ist_port=@OPT.port
 #sst_port=@OPT.port
+wsrep-on=1
 wsrep-cluster-address=gcomm://
 wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M'
 wsrep_node_incoming_address=127.0.0.1:@mysqld.1.port
@@ -25,6 +26,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.1.#sst_port'
 #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='base_port=@mysqld.2.#galera_port;gcache.size=10M'
 wsrep_node_incoming_address=127.0.0.1:@mysqld.2.port
@@ -35,6 +37,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.2.#sst_port'
 #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='base_port=@mysqld.3.#galera_port;gcache.size=10M'
 wsrep_node_incoming_address=127.0.0.1:@mysqld.3.port
@@ -45,6 +48,7 @@ wsrep_sst_receive_address='127.0.0.1:@mysqld.3.#sst_port'
 #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='base_port=@mysqld.4.#galera_port;gcache.size=10M'
 wsrep_node_incoming_address=127.0.0.1:@mysqld.4.port
diff --git a/mysql-test/suite/galera/r/galera_partition.result b/mysql-test/suite/galera/r/galera_partition.result
new file mode 100644
index 00000000000..d845de12c45
--- /dev/null
+++ b/mysql-test/suite/galera/r/galera_partition.result
@@ -0,0 +1,424 @@
+connection node_1;
+call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4;
+connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1;
+connection node_1;
+CREATE TABLE t1(
+id bigint unsigned NOT NULL AUTO_INCREMENT,
+dt datetime NOT NULL,
+PRIMARY KEY (id,dt),
+KEY dt_idx (dt)
+) ENGINE=InnoDB
+PARTITION BY RANGE( TO_DAYS(dt) ) (
+PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
+PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
+PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
+PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
+PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
+PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
+PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
+PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
+PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
+PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
+PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
+PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
+PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
+PARTITION rx2011 VALUES LESS THAN MAXVALUE);
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+DECLARE current_num int;
+SET current_num = 0;
+WHILE current_num < repeat_count do
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
+COMMIT;
+SET current_num = current_num + 1;
+END WHILE;
+END|
+insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
+insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
+insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
+insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
+insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
+insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
+insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
+insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
+insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
+insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
+insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
+insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
+insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
+insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
+insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
+insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
+insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
+insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
+insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
+insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
+insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
+insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
+insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
+insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
+insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
+insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
+insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
+insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
+insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
+insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
+insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
+insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
+insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
+insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
+insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
+insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
+insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
+insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
+insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
+insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
+insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
+insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
+insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
+insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
+insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
+insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
+insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
+insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
+insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
+insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
+insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
+insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
+insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
+insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
+insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
+insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
+insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
+insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
+insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
+insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
+insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
+insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
+insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
+insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
+insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
+insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
+insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
+insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
+insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
+insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
+insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
+insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
+insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
+insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
+insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
+insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
+insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
+insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
+insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
+insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
+insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
+insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
+insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
+insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
+insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
+insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
+insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
+insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
+insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
+insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
+insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
+insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
+insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
+insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
+insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
+insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
+insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
+insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
+insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
+insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
+insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
+insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
+insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
+insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
+insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
+insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
+insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
+insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
+insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
+insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
+insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
+insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
+insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
+insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
+insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
+insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
+insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
+insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
+insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
+insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
+insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
+insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
+insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
+insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
+insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
+insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
+insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
+insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
+insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
+insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
+insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
+insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
+insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
+insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
+insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
+insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
+insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
+insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
+insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
+insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
+insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
+insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
+insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
+insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
+insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
+insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
+insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
+insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
+insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
+insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
+insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
+insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
+insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
+insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
+insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
+insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
+insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
+insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
+insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
+insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
+insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
+insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
+insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
+insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
+insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
+insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
+insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
+insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
+insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
+insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
+insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
+insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
+insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
+insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
+insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
+insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
+insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
+insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
+insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
+insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
+insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
+insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
+insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
+insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
+insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
+insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
+insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
+insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
+insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
+insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
+insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
+insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
+insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
+insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
+insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
+insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
+insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
+insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
+insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
+insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
+insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
+insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
+insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
+insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
+insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
+insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
+insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
+insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
+insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
+insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
+insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
+insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
+insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
+insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
+insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
+insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
+insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
+insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
+insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
+insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
+insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
+insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
+insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
+insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
+insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
+insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
+insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
+insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
+insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
+insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
+insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
+insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
+insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
+insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
+insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
+insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
+insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
+insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
+insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
+insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
+insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
+insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
+insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
+insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
+insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
+insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
+insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
+insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
+insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
+insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
+insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
+insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
+insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
+insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
+insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
+insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
+insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
+insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
+insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
+insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
+insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
+insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
+insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
+insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
+insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
+insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
+insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
+insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
+insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
+insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
+insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
+insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
+insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
+insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
+insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
+insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
+insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
+insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
+insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
+insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
+insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
+insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
+insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
+insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
+insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
+insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
+insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
+insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
+insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
+insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
+insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
+insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
+insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
+insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
+insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
+insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
+insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
+insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
+insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
+insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
+insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
+insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
+insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
+insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
+insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
+insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
+insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
+insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
+insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
+insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
+insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
+insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
+insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
+insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
+insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
+insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
+insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
+insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
+insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
+insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
+insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
+insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
+insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
+insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
+insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
+insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
+insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
+insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
+insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
+insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
+insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
+insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
+insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
+insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
+insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
+insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
+insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
+insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
+insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
+insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
+insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
+insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
+insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
+insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
+insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
+insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
+insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
+insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
+insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
+insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
+SELECT COUNT(*) FROM t1;
+COUNT(*)
+350
+connection node_2;
+call p1(100);;
+connection node_1a;
+call p1(100);;
+connection node_3;
+call p1(100);;
+connection node_4;
+call p1(100);;
+connection node_1;
+SET SESSION wsrep_OSU_method='RSU';
+SELECT @@wsrep_OSU_method;
+@@wsrep_OSU_method
+RSU
+SET SESSION sql_log_bin = 0;
+ALTER TABLE t1 DROP PARTITION rx2009xx;
+ALTER TABLE t1 DROP PARTITION rx201004;
+ALTER TABLE t1 DROP PARTITION rx201008;
+SET SESSION wsrep_OSU_METHOD='TOI';
+SELECT @@wsrep_OSU_method;
+@@wsrep_OSU_method
+TOI
+connection node_2;
+connection node_3;
+connection node_4;
+connection node_1a;
+DROP TABLE t1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/galera/t/galera_partition.cnf b/mysql-test/suite/galera/t/galera_partition.cnf
new file mode 100644
index 00000000000..e6cb13ef523
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_partition.cnf
@@ -0,0 +1,18 @@
+!include ../galera_4nodes.cnf
+
+[mysqld.1]
+wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=10M;gmcast.segment=1'
+wsrep_slave_threads=10
+
+[mysqld.2]
+wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=10M;gmcast.segment=1'
+wsrep_slave_threads=10
+
+[mysqld.3]
+wsrep_provider_options='base_port=@mysqld.3.#galera_port;gcache.size=10M;gmcast.segment=2'
+wsrep_slave_threads=10
+
+[mysqld.4]
+wsrep_provider_options='base_port=@mysqld.4.#galera_port;gcache.size=10M;gmcast.segment=3'
+wsrep_slave_threads=10
+
diff --git a/mysql-test/suite/galera/t/galera_partition.test b/mysql-test/suite/galera/t/galera_partition.test
new file mode 100644
index 00000000000..a2044936cd1
--- /dev/null
+++ b/mysql-test/suite/galera/t/galera_partition.test
@@ -0,0 +1,453 @@
+--source include/galera_cluster.inc
+--source include/have_partition.inc
+
+--connection node_1
+
+call mtr.add_suppression("WSREP: RSU failed due to pending transactions, schema: test, query ALTER.*");
+call mtr.add_suppression("WSREP: ALTER TABLE isolation failure");
+
+--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--connect node_4, 127.0.0.1, root, , test, $NODE_MYPORT_4
+--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1
+
+--connection node_1
+
+CREATE TABLE t1(
+ id bigint unsigned NOT NULL AUTO_INCREMENT,
+ dt datetime NOT NULL,
+ PRIMARY KEY (id,dt),
+ KEY dt_idx (dt)
+) ENGINE=InnoDB
+PARTITION BY RANGE( TO_DAYS(dt) ) (
+PARTITION rx2009xx VALUES LESS THAN( TO_DAYS('2010-01-01 00:00:00') ),
+PARTITION rx201001 VALUES LESS THAN( TO_DAYS('2010-02-01 00:00:00') ),
+PARTITION rx201002 VALUES LESS THAN( TO_DAYS('2010-03-01 00:00:00') ),
+PARTITION rx201003 VALUES LESS THAN( TO_DAYS('2010-04-01 00:00:00') ),
+PARTITION rx201004 VALUES LESS THAN( TO_DAYS('2010-05-01 00:00:00') ),
+PARTITION rx201005 VALUES LESS THAN( TO_DAYS('2010-06-01 00:00:00') ),
+PARTITION rx201006 VALUES LESS THAN( TO_DAYS('2010-07-01 00:00:00') ),
+PARTITION rx201007 VALUES LESS THAN( TO_DAYS('2010-08-01 00:00:00') ),
+PARTITION rx201008 VALUES LESS THAN( TO_DAYS('2010-09-01 00:00:00') ),
+PARTITION rx201009 VALUES LESS THAN( TO_DAYS('2010-10-01 00:00:00') ),
+PARTITION rx201010 VALUES LESS THAN( TO_DAYS('2010-11-01 00:00:00') ),
+PARTITION rx201011 VALUES LESS THAN( TO_DAYS('2010-12-01 00:00:00') ),
+PARTITION rx201012 VALUES LESS THAN( TO_DAYS('2011-01-01 00:00:00') ),
+PARTITION rx2011 VALUES LESS THAN MAXVALUE);
+
+DELIMITER |;
+CREATE PROCEDURE p1 (repeat_count int)
+BEGIN
+  DECLARE current_num int;
+  SET current_num = 0;
+  WHILE current_num < repeat_count do
+    INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2010-02-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2010-03-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2010-04-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2010-06-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2010-10-21 00:00:00');
+    INSERT INTO t1 VALUES (NULL, '2012-02-21 00:00:00');
+    COMMIT;
+    SET current_num = current_num + 1;
+  END WHILE;
+END|
+DELIMITER ;|
+
+insert into t1 (id, dt) values (1, '2010-01-02 00:00:00');
+insert into t1 (id, dt) values (2, '2010-01-03 00:00:00');
+insert into t1 (id, dt) values (3, '2010-01-04 00:00:00');
+insert into t1 (id, dt) values (4, '2010-01-05 00:00:00');
+insert into t1 (id, dt) values (5, '2010-01-06 00:00:00');
+insert into t1 (id, dt) values (6, '2010-01-07 00:00:00');
+insert into t1 (id, dt) values (7, '2010-01-08 00:00:00');
+insert into t1 (id, dt) values (8, '2010-01-09 00:00:00');
+insert into t1 (id, dt) values (9, '2010-01-10 00:00:00');
+insert into t1 (id, dt) values (10, '2010-01-11 00:00:00');
+insert into t1 (id, dt) values (11, '2010-01-12 00:00:00');
+insert into t1 (id, dt) values (12, '2010-01-13 00:00:00');
+insert into t1 (id, dt) values (13, '2010-01-14 00:00:00');
+insert into t1 (id, dt) values (14, '2010-01-15 00:00:00');
+insert into t1 (id, dt) values (15, '2010-01-16 00:00:00');
+insert into t1 (id, dt) values (16, '2010-01-17 00:00:00');
+insert into t1 (id, dt) values (17, '2010-01-18 00:00:00');
+insert into t1 (id, dt) values (18, '2010-01-19 00:00:00');
+insert into t1 (id, dt) values (19, '2010-01-20 00:00:00');
+insert into t1 (id, dt) values (20, '2010-01-21 00:00:00');
+insert into t1 (id, dt) values (21, '2010-01-22 00:00:00');
+insert into t1 (id, dt) values (22, '2010-01-23 00:00:00');
+insert into t1 (id, dt) values (23, '2010-01-24 00:00:00');
+insert into t1 (id, dt) values (24, '2010-01-25 00:00:00');
+insert into t1 (id, dt) values (25, '2010-01-26 00:00:00');
+insert into t1 (id, dt) values (26, '2010-01-27 00:00:00');
+insert into t1 (id, dt) values (27, '2010-01-28 00:00:00');
+insert into t1 (id, dt) values (28, '2010-01-29 00:00:00');
+insert into t1 (id, dt) values (29, '2010-01-30 00:00:00');
+insert into t1 (id, dt) values (30, '2010-01-31 00:00:00');
+insert into t1 (id, dt) values (31, '2010-02-01 00:00:00');
+insert into t1 (id, dt) values (32, '2010-02-02 00:00:00');
+insert into t1 (id, dt) values (33, '2010-02-03 00:00:00');
+insert into t1 (id, dt) values (34, '2010-02-04 00:00:00');
+insert into t1 (id, dt) values (35, '2010-02-05 00:00:00');
+insert into t1 (id, dt) values (36, '2010-02-06 00:00:00');
+insert into t1 (id, dt) values (37, '2010-02-07 00:00:00');
+insert into t1 (id, dt) values (38, '2010-02-08 00:00:00');
+insert into t1 (id, dt) values (39, '2010-02-09 00:00:00');
+insert into t1 (id, dt) values (40, '2010-02-10 00:00:00');
+insert into t1 (id, dt) values (41, '2010-02-11 00:00:00');
+insert into t1 (id, dt) values (42, '2010-02-12 00:00:00');
+insert into t1 (id, dt) values (43, '2010-02-13 00:00:00');
+insert into t1 (id, dt) values (44, '2010-02-14 00:00:00');
+insert into t1 (id, dt) values (45, '2010-02-15 00:00:00');
+insert into t1 (id, dt) values (46, '2010-02-16 00:00:00');
+insert into t1 (id, dt) values (47, '2010-02-17 00:00:00');
+insert into t1 (id, dt) values (48, '2010-02-18 00:00:00');
+insert into t1 (id, dt) values (49, '2010-02-19 00:00:00');
+insert into t1 (id, dt) values (50, '2010-02-20 00:00:00');
+insert into t1 (id, dt) values (51, '2010-02-21 00:00:00');
+insert into t1 (id, dt) values (52, '2010-02-22 00:00:00');
+insert into t1 (id, dt) values (53, '2010-02-23 00:00:00');
+insert into t1 (id, dt) values (54, '2010-02-24 00:00:00');
+insert into t1 (id, dt) values (55, '2010-02-25 00:00:00');
+insert into t1 (id, dt) values (56, '2010-02-26 00:00:00');
+insert into t1 (id, dt) values (57, '2010-02-27 00:00:00');
+insert into t1 (id, dt) values (58, '2010-02-28 00:00:00');
+insert into t1 (id, dt) values (59, '2010-03-01 00:00:00');
+insert into t1 (id, dt) values (60, '2010-03-02 00:00:00');
+insert into t1 (id, dt) values (61, '2010-03-03 00:00:00');
+insert into t1 (id, dt) values (62, '2010-03-04 00:00:00');
+insert into t1 (id, dt) values (63, '2010-03-05 00:00:00');
+insert into t1 (id, dt) values (64, '2010-03-06 00:00:00');
+insert into t1 (id, dt) values (65, '2010-03-07 00:00:00');
+insert into t1 (id, dt) values (66, '2010-03-08 00:00:00');
+insert into t1 (id, dt) values (67, '2010-03-09 00:00:00');
+insert into t1 (id, dt) values (68, '2010-03-10 00:00:00');
+insert into t1 (id, dt) values (69, '2010-03-11 00:00:00');
+insert into t1 (id, dt) values (70, '2010-03-12 00:00:00');
+insert into t1 (id, dt) values (71, '2010-03-13 00:00:00');
+insert into t1 (id, dt) values (72, '2010-03-14 00:00:00');
+insert into t1 (id, dt) values (73, '2010-03-15 00:00:00');
+insert into t1 (id, dt) values (74, '2010-03-16 00:00:00');
+insert into t1 (id, dt) values (75, '2010-03-17 00:00:00');
+insert into t1 (id, dt) values (76, '2010-03-18 00:00:00');
+insert into t1 (id, dt) values (77, '2010-03-19 00:00:00');
+insert into t1 (id, dt) values (78, '2010-03-20 00:00:00');
+insert into t1 (id, dt) values (79, '2010-03-21 00:00:00');
+insert into t1 (id, dt) values (80, '2010-03-22 00:00:00');
+insert into t1 (id, dt) values (81, '2010-03-23 00:00:00');
+insert into t1 (id, dt) values (82, '2010-03-24 00:00:00');
+insert into t1 (id, dt) values (83, '2010-03-25 00:00:00');
+insert into t1 (id, dt) values (84, '2010-03-26 00:00:00');
+insert into t1 (id, dt) values (85, '2010-03-27 00:00:00');
+insert into t1 (id, dt) values (86, '2010-03-28 00:00:00');
+insert into t1 (id, dt) values (87, '2010-03-29 00:00:00');
+insert into t1 (id, dt) values (88, '2010-03-30 00:00:00');
+insert into t1 (id, dt) values (89, '2010-03-31 00:00:00');
+insert into t1 (id, dt) values (90, '2010-04-01 00:00:00');
+insert into t1 (id, dt) values (91, '2010-04-02 00:00:00');
+insert into t1 (id, dt) values (92, '2010-04-03 00:00:00');
+insert into t1 (id, dt) values (93, '2010-04-04 00:00:00');
+insert into t1 (id, dt) values (94, '2010-04-05 00:00:00');
+insert into t1 (id, dt) values (95, '2010-04-06 00:00:00');
+insert into t1 (id, dt) values (96, '2010-04-07 00:00:00');
+insert into t1 (id, dt) values (97, '2010-04-08 00:00:00');
+insert into t1 (id, dt) values (98, '2010-04-09 00:00:00');
+insert into t1 (id, dt) values (99, '2010-04-10 00:00:00');
+insert into t1 (id, dt) values (100, '2010-04-11 00:00:00');
+insert into t1 (id, dt) values (101, '2010-04-12 00:00:00');
+insert into t1 (id, dt) values (102, '2010-04-13 00:00:00');
+insert into t1 (id, dt) values (103, '2010-04-14 00:00:00');
+insert into t1 (id, dt) values (104, '2010-04-15 00:00:00');
+insert into t1 (id, dt) values (105, '2010-04-16 00:00:00');
+insert into t1 (id, dt) values (106, '2010-04-17 00:00:00');
+insert into t1 (id, dt) values (107, '2010-04-18 00:00:00');
+insert into t1 (id, dt) values (108, '2010-04-19 00:00:00');
+insert into t1 (id, dt) values (109, '2010-04-20 00:00:00');
+insert into t1 (id, dt) values (110, '2010-04-21 00:00:00');
+insert into t1 (id, dt) values (111, '2010-04-22 00:00:00');
+insert into t1 (id, dt) values (112, '2010-04-23 00:00:00');
+insert into t1 (id, dt) values (113, '2010-04-24 00:00:00');
+insert into t1 (id, dt) values (114, '2010-04-25 00:00:00');
+insert into t1 (id, dt) values (115, '2010-04-26 00:00:00');
+insert into t1 (id, dt) values (116, '2010-04-27 00:00:00');
+insert into t1 (id, dt) values (117, '2010-04-28 00:00:00');
+insert into t1 (id, dt) values (118, '2010-04-29 00:00:00');
+insert into t1 (id, dt) values (119, '2010-04-30 00:00:00');
+insert into t1 (id, dt) values (120, '2010-05-01 00:00:00');
+insert into t1 (id, dt) values (121, '2010-05-02 00:00:00');
+insert into t1 (id, dt) values (122, '2010-05-03 00:00:00');
+insert into t1 (id, dt) values (123, '2010-05-04 00:00:00');
+insert into t1 (id, dt) values (124, '2010-05-05 00:00:00');
+insert into t1 (id, dt) values (125, '2010-05-06 00:00:00');
+insert into t1 (id, dt) values (126, '2010-05-07 00:00:00');
+insert into t1 (id, dt) values (127, '2010-05-08 00:00:00');
+insert into t1 (id, dt) values (128, '2010-05-09 00:00:00');
+insert into t1 (id, dt) values (129, '2010-05-10 00:00:00');
+insert into t1 (id, dt) values (130, '2010-05-11 00:00:00');
+insert into t1 (id, dt) values (131, '2010-05-12 00:00:00');
+insert into t1 (id, dt) values (132, '2010-05-13 00:00:00');
+insert into t1 (id, dt) values (133, '2010-05-14 00:00:00');
+insert into t1 (id, dt) values (134, '2010-05-15 00:00:00');
+insert into t1 (id, dt) values (135, '2010-05-16 00:00:00');
+insert into t1 (id, dt) values (136, '2010-05-17 00:00:00');
+insert into t1 (id, dt) values (137, '2010-05-18 00:00:00');
+insert into t1 (id, dt) values (138, '2010-05-19 00:00:00');
+insert into t1 (id, dt) values (139, '2010-05-20 00:00:00');
+insert into t1 (id, dt) values (140, '2010-05-21 00:00:00');
+insert into t1 (id, dt) values (141, '2010-05-22 00:00:00');
+insert into t1 (id, dt) values (142, '2010-05-23 00:00:00');
+insert into t1 (id, dt) values (143, '2010-05-24 00:00:00');
+insert into t1 (id, dt) values (144, '2010-05-25 00:00:00');
+insert into t1 (id, dt) values (145, '2010-05-26 00:00:00');
+insert into t1 (id, dt) values (146, '2010-05-27 00:00:00');
+insert into t1 (id, dt) values (147, '2010-05-28 00:00:00');
+insert into t1 (id, dt) values (148, '2010-05-29 00:00:00');
+insert into t1 (id, dt) values (149, '2010-05-30 00:00:00');
+insert into t1 (id, dt) values (150, '2010-05-31 00:00:00');
+insert into t1 (id, dt) values (151, '2010-06-01 00:00:00');
+insert into t1 (id, dt) values (152, '2010-06-02 00:00:00');
+insert into t1 (id, dt) values (153, '2010-06-03 00:00:00');
+insert into t1 (id, dt) values (154, '2010-06-04 00:00:00');
+insert into t1 (id, dt) values (155, '2010-06-05 00:00:00');
+insert into t1 (id, dt) values (156, '2010-06-06 00:00:00');
+insert into t1 (id, dt) values (157, '2010-06-07 00:00:00');
+insert into t1 (id, dt) values (158, '2010-06-08 00:00:00');
+insert into t1 (id, dt) values (159, '2010-06-09 00:00:00');
+insert into t1 (id, dt) values (160, '2010-06-10 00:00:00');
+insert into t1 (id, dt) values (161, '2010-06-11 00:00:00');
+insert into t1 (id, dt) values (162, '2010-06-12 00:00:00');
+insert into t1 (id, dt) values (163, '2010-06-13 00:00:00');
+insert into t1 (id, dt) values (164, '2010-06-14 00:00:00');
+insert into t1 (id, dt) values (165, '2010-06-15 00:00:00');
+insert into t1 (id, dt) values (166, '2010-06-16 00:00:00');
+insert into t1 (id, dt) values (167, '2010-06-17 00:00:00');
+insert into t1 (id, dt) values (168, '2010-06-18 00:00:00');
+insert into t1 (id, dt) values (169, '2010-06-19 00:00:00');
+insert into t1 (id, dt) values (170, '2010-06-20 00:00:00');
+insert into t1 (id, dt) values (171, '2010-06-21 00:00:00');
+insert into t1 (id, dt) values (172, '2010-06-22 00:00:00');
+insert into t1 (id, dt) values (173, '2010-06-23 00:00:00');
+insert into t1 (id, dt) values (174, '2010-06-24 00:00:00');
+insert into t1 (id, dt) values (175, '2010-06-25 00:00:00');
+insert into t1 (id, dt) values (176, '2010-06-26 00:00:00');
+insert into t1 (id, dt) values (177, '2010-06-27 00:00:00');
+insert into t1 (id, dt) values (178, '2010-06-28 00:00:00');
+insert into t1 (id, dt) values (179, '2010-06-29 00:00:00');
+insert into t1 (id, dt) values (180, '2010-06-30 00:00:00');
+insert into t1 (id, dt) values (181, '2010-07-01 00:00:00');
+insert into t1 (id, dt) values (182, '2010-07-02 00:00:00');
+insert into t1 (id, dt) values (183, '2010-07-03 00:00:00');
+insert into t1 (id, dt) values (184, '2010-07-04 00:00:00');
+insert into t1 (id, dt) values (185, '2010-07-05 00:00:00');
+insert into t1 (id, dt) values (186, '2010-07-06 00:00:00');
+insert into t1 (id, dt) values (187, '2010-07-07 00:00:00');
+insert into t1 (id, dt) values (188, '2010-07-08 00:00:00');
+insert into t1 (id, dt) values (189, '2010-07-09 00:00:00');
+insert into t1 (id, dt) values (190, '2010-07-10 00:00:00');
+insert into t1 (id, dt) values (191, '2010-07-11 00:00:00');
+insert into t1 (id, dt) values (192, '2010-07-12 00:00:00');
+insert into t1 (id, dt) values (193, '2010-07-13 00:00:00');
+insert into t1 (id, dt) values (194, '2010-07-14 00:00:00');
+insert into t1 (id, dt) values (195, '2010-07-15 00:00:00');
+insert into t1 (id, dt) values (196, '2010-07-16 00:00:00');
+insert into t1 (id, dt) values (197, '2010-07-17 00:00:00');
+insert into t1 (id, dt) values (198, '2010-07-18 00:00:00');
+insert into t1 (id, dt) values (199, '2010-07-19 00:00:00');
+insert into t1 (id, dt) values (200, '2010-07-20 00:00:00');
+insert into t1 (id, dt) values (201, '2010-07-21 00:00:00');
+insert into t1 (id, dt) values (202, '2010-07-22 00:00:00');
+insert into t1 (id, dt) values (203, '2010-07-23 00:00:00');
+insert into t1 (id, dt) values (204, '2010-07-24 00:00:00');
+insert into t1 (id, dt) values (205, '2010-07-25 00:00:00');
+insert into t1 (id, dt) values (206, '2010-07-26 00:00:00');
+insert into t1 (id, dt) values (207, '2010-07-27 00:00:00');
+insert into t1 (id, dt) values (208, '2010-07-28 00:00:00');
+insert into t1 (id, dt) values (209, '2010-07-29 00:00:00');
+insert into t1 (id, dt) values (210, '2010-07-30 00:00:00');
+insert into t1 (id, dt) values (211, '2010-07-31 00:00:00');
+insert into t1 (id, dt) values (212, '2010-08-01 00:00:00');
+insert into t1 (id, dt) values (213, '2010-08-02 00:00:00');
+insert into t1 (id, dt) values (214, '2010-08-03 00:00:00');
+insert into t1 (id, dt) values (215, '2010-08-04 00:00:00');
+insert into t1 (id, dt) values (216, '2010-08-05 00:00:00');
+insert into t1 (id, dt) values (217, '2010-08-06 00:00:00');
+insert into t1 (id, dt) values (218, '2010-08-07 00:00:00');
+insert into t1 (id, dt) values (219, '2010-08-08 00:00:00');
+insert into t1 (id, dt) values (220, '2010-08-09 00:00:00');
+insert into t1 (id, dt) values (221, '2010-08-10 00:00:00');
+insert into t1 (id, dt) values (222, '2010-08-11 00:00:00');
+insert into t1 (id, dt) values (223, '2010-08-12 00:00:00');
+insert into t1 (id, dt) values (224, '2010-08-13 00:00:00');
+insert into t1 (id, dt) values (225, '2010-08-14 00:00:00');
+insert into t1 (id, dt) values (226, '2010-08-15 00:00:00');
+insert into t1 (id, dt) values (227, '2010-08-16 00:00:00');
+insert into t1 (id, dt) values (228, '2010-08-17 00:00:00');
+insert into t1 (id, dt) values (229, '2010-08-18 00:00:00');
+insert into t1 (id, dt) values (230, '2010-08-19 00:00:00');
+insert into t1 (id, dt) values (231, '2010-08-20 00:00:00');
+insert into t1 (id, dt) values (232, '2010-08-21 00:00:00');
+insert into t1 (id, dt) values (233, '2010-08-22 00:00:00');
+insert into t1 (id, dt) values (234, '2010-08-23 00:00:00');
+insert into t1 (id, dt) values (235, '2010-08-24 00:00:00');
+insert into t1 (id, dt) values (236, '2010-08-25 00:00:00');
+insert into t1 (id, dt) values (237, '2010-08-26 00:00:00');
+insert into t1 (id, dt) values (238, '2010-08-27 00:00:00');
+insert into t1 (id, dt) values (239, '2010-08-28 00:00:00');
+insert into t1 (id, dt) values (240, '2010-08-29 00:00:00');
+insert into t1 (id, dt) values (241, '2010-08-30 00:00:00');
+insert into t1 (id, dt) values (242, '2010-08-31 00:00:00');
+insert into t1 (id, dt) values (243, '2010-09-01 00:00:00');
+insert into t1 (id, dt) values (244, '2010-09-02 00:00:00');
+insert into t1 (id, dt) values (245, '2010-09-03 00:00:00');
+insert into t1 (id, dt) values (246, '2010-09-04 00:00:00');
+insert into t1 (id, dt) values (247, '2010-09-05 00:00:00');
+insert into t1 (id, dt) values (248, '2010-09-06 00:00:00');
+insert into t1 (id, dt) values (249, '2010-09-07 00:00:00');
+insert into t1 (id, dt) values (250, '2010-09-08 00:00:00');
+insert into t1 (id, dt) values (251, '2010-09-09 00:00:00');
+insert into t1 (id, dt) values (252, '2010-09-10 00:00:00');
+insert into t1 (id, dt) values (253, '2010-09-11 00:00:00');
+insert into t1 (id, dt) values (254, '2010-09-12 00:00:00');
+insert into t1 (id, dt) values (255, '2010-09-13 00:00:00');
+insert into t1 (id, dt) values (256, '2010-09-14 00:00:00');
+insert into t1 (id, dt) values (257, '2010-09-15 00:00:00');
+insert into t1 (id, dt) values (258, '2010-09-16 00:00:00');
+insert into t1 (id, dt) values (259, '2010-09-17 00:00:00');
+insert into t1 (id, dt) values (260, '2010-09-18 00:00:00');
+insert into t1 (id, dt) values (261, '2010-09-19 00:00:00');
+insert into t1 (id, dt) values (262, '2010-09-20 00:00:00');
+insert into t1 (id, dt) values (263, '2010-09-21 00:00:00');
+insert into t1 (id, dt) values (264, '2010-09-22 00:00:00');
+insert into t1 (id, dt) values (265, '2010-09-23 00:00:00');
+insert into t1 (id, dt) values (266, '2010-09-24 00:00:00');
+insert into t1 (id, dt) values (267, '2010-09-25 00:00:00');
+insert into t1 (id, dt) values (268, '2010-09-26 00:00:00');
+insert into t1 (id, dt) values (269, '2010-09-27 00:00:00');
+insert into t1 (id, dt) values (270, '2010-09-28 00:00:00');
+insert into t1 (id, dt) values (271, '2010-09-29 00:00:00');
+insert into t1 (id, dt) values (272, '2010-09-30 00:00:00');
+insert into t1 (id, dt) values (273, '2010-10-01 00:00:00');
+insert into t1 (id, dt) values (274, '2010-10-02 00:00:00');
+insert into t1 (id, dt) values (275, '2010-10-03 00:00:00');
+insert into t1 (id, dt) values (276, '2010-10-04 00:00:00');
+insert into t1 (id, dt) values (277, '2010-10-05 00:00:00');
+insert into t1 (id, dt) values (278, '2010-10-06 00:00:00');
+insert into t1 (id, dt) values (279, '2010-10-07 00:00:00');
+insert into t1 (id, dt) values (280, '2010-10-08 00:00:00');
+insert into t1 (id, dt) values (281, '2010-10-09 00:00:00');
+insert into t1 (id, dt) values (282, '2010-10-10 00:00:00');
+insert into t1 (id, dt) values (283, '2010-10-11 00:00:00');
+insert into t1 (id, dt) values (284, '2010-10-12 00:00:00');
+insert into t1 (id, dt) values (285, '2010-10-13 00:00:00');
+insert into t1 (id, dt) values (286, '2010-10-14 00:00:00');
+insert into t1 (id, dt) values (287, '2010-10-15 00:00:00');
+insert into t1 (id, dt) values (288, '2010-10-16 00:00:00');
+insert into t1 (id, dt) values (289, '2010-10-17 00:00:00');
+insert into t1 (id, dt) values (290, '2010-10-18 00:00:00');
+insert into t1 (id, dt) values (291, '2010-10-19 00:00:00');
+insert into t1 (id, dt) values (292, '2010-10-20 00:00:00');
+insert into t1 (id, dt) values (293, '2010-10-21 00:00:00');
+insert into t1 (id, dt) values (294, '2010-10-22 00:00:00');
+insert into t1 (id, dt) values (295, '2010-10-23 00:00:00');
+insert into t1 (id, dt) values (296, '2010-10-24 00:00:00');
+insert into t1 (id, dt) values (297, '2010-10-25 00:00:00');
+insert into t1 (id, dt) values (298, '2010-10-26 00:00:00');
+insert into t1 (id, dt) values (299, '2010-10-27 00:00:00');
+insert into t1 (id, dt) values (300, '2010-10-28 00:00:00');
+insert into t1 (id, dt) values (301, '2010-10-29 00:00:00');
+insert into t1 (id, dt) values (302, '2010-10-30 00:00:00');
+insert into t1 (id, dt) values (303, '2010-10-31 00:00:00');
+insert into t1 (id, dt) values (304, '2010-11-01 00:00:00');
+insert into t1 (id, dt) values (305, '2010-11-02 00:00:00');
+insert into t1 (id, dt) values (306, '2010-11-03 00:00:00');
+insert into t1 (id, dt) values (307, '2010-11-04 00:00:00');
+insert into t1 (id, dt) values (308, '2010-11-05 00:00:00');
+insert into t1 (id, dt) values (309, '2010-11-06 00:00:00');
+insert into t1 (id, dt) values (310, '2010-11-07 00:00:00');
+insert into t1 (id, dt) values (311, '2010-11-08 00:00:00');
+insert into t1 (id, dt) values (312, '2010-11-09 00:00:00');
+insert into t1 (id, dt) values (313, '2010-11-10 00:00:00');
+insert into t1 (id, dt) values (314, '2010-11-11 00:00:00');
+insert into t1 (id, dt) values (315, '2010-11-12 00:00:00');
+insert into t1 (id, dt) values (316, '2010-11-13 00:00:00');
+insert into t1 (id, dt) values (317, '2010-11-14 00:00:00');
+insert into t1 (id, dt) values (318, '2010-11-15 00:00:00');
+insert into t1 (id, dt) values (319, '2010-11-16 00:00:00');
+insert into t1 (id, dt) values (320, '2010-11-17 00:00:00');
+insert into t1 (id, dt) values (321, '2010-11-18 00:00:00');
+insert into t1 (id, dt) values (322, '2010-11-19 00:00:00');
+insert into t1 (id, dt) values (323, '2010-11-20 00:00:00');
+insert into t1 (id, dt) values (324, '2010-11-21 00:00:00');
+insert into t1 (id, dt) values (325, '2010-11-22 00:00:00');
+insert into t1 (id, dt) values (326, '2010-11-23 00:00:00');
+insert into t1 (id, dt) values (327, '2010-11-24 00:00:00');
+insert into t1 (id, dt) values (328, '2010-11-25 00:00:00');
+insert into t1 (id, dt) values (329, '2010-11-26 00:00:00');
+insert into t1 (id, dt) values (330, '2010-11-27 00:00:00');
+insert into t1 (id, dt) values (331, '2010-11-28 00:00:00');
+insert into t1 (id, dt) values (332, '2010-11-29 00:00:00');
+insert into t1 (id, dt) values (333, '2010-11-30 00:00:00');
+insert into t1 (id, dt) values (334, '2010-12-01 00:00:00');
+insert into t1 (id, dt) values (335, '2010-12-02 00:00:00');
+insert into t1 (id, dt) values (336, '2010-12-03 00:00:00');
+insert into t1 (id, dt) values (337, '2010-12-04 00:00:00');
+insert into t1 (id, dt) values (338, '2010-12-05 00:00:00');
+insert into t1 (id, dt) values (339, '2010-12-06 00:00:00');
+insert into t1 (id, dt) values (340, '2010-12-07 00:00:00');
+insert into t1 (id, dt) values (341, '2010-12-08 00:00:00');
+insert into t1 (id, dt) values (342, '2010-12-09 00:00:00');
+insert into t1 (id, dt) values (343, '2010-12-10 00:00:00');
+insert into t1 (id, dt) values (344, '2010-12-11 00:00:00');
+insert into t1 (id, dt) values (345, '2010-12-12 00:00:00');
+insert into t1 (id, dt) values (346, '2010-12-13 00:00:00');
+insert into t1 (id, dt) values (347, '2010-12-14 00:00:00');
+insert into t1 (id, dt) values (348, '2010-12-15 00:00:00');
+insert into t1 (id, dt) values (349, '2010-12-16 00:00:00');
+insert into t1 (id, dt) values (350, '2010-12-17 00:00:00');
+
+SELECT COUNT(*) FROM t1;
+
+--connection node_2
+--send call p1(100);
+
+--connection node_1a
+--send call p1(100);
+
+--connection node_3
+--send call p1(100);
+
+--connection node_4
+--send call p1(100);
+
+--connection node_1
+SET SESSION wsrep_OSU_method='RSU';
+SELECT @@wsrep_OSU_method;
+SET SESSION sql_log_bin = 0;
+
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx2009xx;
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx201004;
+--error 0,ER_LOCK_DEADLOCK
+ALTER TABLE t1 DROP PARTITION rx201008;
+
+SET SESSION wsrep_OSU_METHOD='TOI';
+SELECT @@wsrep_OSU_method;
+
+--connection node_2
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_3
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_4
+--error 0,ER_LOCK_DEADLOCK
+reap;
+
+--connection node_1a
+--error 0,ER_LOCK_DEADLOCK
+reap;
+DROP TABLE t1;
+DROP PROCEDURE p1;
+
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 062c9dcd74c..cfcc04bff2c 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -1784,7 +1784,7 @@ static int wsrep_RSU_begin(THD *thd, char *db_, char *table_)
     }
 
     my_error(ER_LOCK_DEADLOCK, MYF(0));
-    return(1);
+    return(-1);
   }
 
   wsrep_seqno_t seqno = wsrep->pause(wsrep);
@@ -2311,6 +2311,7 @@ static my_bool have_committing_connections()
 
     if (is_committing_connection(tmp))
     {
+      mysql_mutex_unlock(&LOCK_thread_count);
       return TRUE;
     }
   }
-- 
cgit v1.2.1


From 292015d486aa157422b43d99fabb5f81e6a382f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Mon, 9 Dec 2019 10:47:25 +0200
Subject: MDEV-21254 Remove unused keywords from the InnoDB SQL parser

The InnoDB internal SQL parser, which is used for updating the InnoDB
data dictionary tables (to be removed in MDEV-11655), persistent
statistics (to be refactored in MDEV-15020) and fulltext indexes,
implements some unused keywords and built-in functions:

OUT BINARY BLOB INTEGER FLOAT SUM DISTINCT READ
COMPACT BLOCK_SIZE
TO_CHAR TO_NUMBER BINARY_TO_NUMBER REPLSTR SYSDATE PRINTF ASSERT
RND RND_STR ROW_PRINTF UNSIGNED

Also, procedures are never declared with parameters. Only one top-level
procedure is declared and invoked at a time, and parameters are being
passed via pars_info_t.
---
 storage/innobase/eval/eval0eval.cc   |  295 +----
 storage/innobase/include/pars0grm.h  |  158 ++-
 storage/innobase/include/pars0pars.h |   35 +-
 storage/innobase/pars/lexyy.cc       | 1166 ++++++++-----------
 storage/innobase/pars/pars0grm.cc    | 2116 +++++++++++++++-------------------
 storage/innobase/pars/pars0grm.y     |  118 +-
 storage/innobase/pars/pars0lex.l     |   84 --
 storage/innobase/pars/pars0pars.cc   |  144 +--
 8 files changed, 1486 insertions(+), 2630 deletions(-)

diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc
index e02fc7f561b..6f709707f7f 100644
--- a/storage/innobase/eval/eval0eval.cc
+++ b/storage/innobase/eval/eval0eval.cc
@@ -30,9 +30,6 @@ Created 12/29/1997 Heikki Tuuri
 #include "row0sel.h"
 #include "rem0cmp.h"
 
-/** The RND function seed */
-static ulint	eval_rnd	= 128367121;
-
 /** Dummy adress used when we should allocate a buffer of size 0 in
 eval_node_alloc_val_buf */
 
@@ -310,119 +307,17 @@ eval_aggregate(
 /*===========*/
 	func_node_t*	node)	/*!< in: aggregate operation node */
 {
-	que_node_t*	arg;
 	lint		val;
-	lint		arg_val;
-	int		func;
 
 	ut_ad(que_node_get_type(node) == QUE_NODE_FUNC);
 
 	val = eval_node_get_int_val(node);
 
-	func = node->func;
-
-	if (func == PARS_COUNT_TOKEN) {
-
-		val = val + 1;
-	} else {
-		ut_ad(func == PARS_SUM_TOKEN);
-
-		arg = node->args;
-		arg_val = eval_node_get_int_val(arg);
-
-		val = val + arg_val;
-	}
-
+	ut_a(node->func == PARS_COUNT_TOKEN);
+	val = val + 1;
 	eval_node_set_int_val(node, val);
 }
 
-/*****************************************************************//**
-Evaluates a predefined function node where the function is not relevant
-in benchmarks. */
-static
-void
-eval_predefined_2(
-/*==============*/
-	func_node_t*	func_node)	/*!< in: predefined function node */
-{
-	que_node_t*	arg;
-	que_node_t*	arg1;
-	que_node_t*	arg2 = 0; /* remove warning (??? bug ???) */
-	lint		int_val;
-	byte*		data;
-	ulint		len1;
-	ulint		len2;
-	int		func;
-	ulint		i;
-
-	ut_ad(que_node_get_type(func_node) == QUE_NODE_FUNC);
-
-	arg1 = func_node->args;
-
-	if (arg1) {
-		arg2 = que_node_get_next(arg1);
-	}
-
-	func = func_node->func;
-
-	if (func == PARS_PRINTF_TOKEN) {
-
-		arg = arg1;
-
-		while (arg) {
-			dfield_print(que_node_get_val(arg));
-
-			arg = que_node_get_next(arg);
-		}
-
-		putc('\n', stderr);
-
-	} else if (func == PARS_ASSERT_TOKEN) {
-
-		if (!eval_node_get_ibool_val(arg1)) {
-			fputs("SQL assertion fails in a stored procedure!\n",
-			      stderr);
-		}
-
-		ut_a(eval_node_get_ibool_val(arg1));
-
-		/* This function, or more precisely, a debug procedure,
-		returns no value */
-
-	} else if (func == PARS_RND_TOKEN) {
-
-		len1 = (ulint) eval_node_get_int_val(arg1);
-		len2 = (ulint) eval_node_get_int_val(arg2);
-
-		ut_ad(len2 >= len1);
-
-		if (len2 > len1) {
-			int_val = (lint) (len1
-					  + (eval_rnd % (len2 - len1 + 1)));
-		} else {
-			int_val = (lint) len1;
-		}
-
-		eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
-
-		eval_node_set_int_val(func_node, int_val);
-
-	} else if (func == PARS_RND_STR_TOKEN) {
-
-		len1 = (ulint) eval_node_get_int_val(arg1);
-
-		data = eval_node_ensure_val_buf(func_node, len1);
-
-		for (i = 0; i < len1; i++) {
-			data[i] = (byte)(97 + (eval_rnd % 3));
-
-			eval_rnd = ut_rnd_gen_next_ulint(eval_rnd);
-		}
-	} else {
-		ut_error;
-	}
-}
-
 /*****************************************************************//**
 Evaluates a notfound-function node. */
 UNIV_INLINE
@@ -493,46 +388,6 @@ eval_substr(
 	dfield_set_data(dfield, str1 + len1, len2);
 }
 
-/*****************************************************************//**
-Evaluates a replstr-procedure node. */
-static
-void
-eval_replstr(
-/*=========*/
-	func_node_t*	func_node)	/*!< in: function node */
-{
-	que_node_t*	arg1;
-	que_node_t*	arg2;
-	que_node_t*	arg3;
-	que_node_t*	arg4;
-	byte*		str1;
-	byte*		str2;
-	ulint		len1;
-	ulint		len2;
-
-	arg1 = func_node->args;
-	arg2 = que_node_get_next(arg1);
-
-	ut_ad(que_node_get_type(arg1) == QUE_NODE_SYMBOL);
-
-	arg3 = que_node_get_next(arg2);
-	arg4 = que_node_get_next(arg3);
-
-	str1 = static_cast(dfield_get_data(que_node_get_val(arg1)));
-	str2 = static_cast(dfield_get_data(que_node_get_val(arg2)));
-
-	len1 = (ulint) eval_node_get_int_val(arg3);
-	len2 = (ulint) eval_node_get_int_val(arg4);
-
-	if ((dfield_get_len(que_node_get_val(arg1)) < len1 + len2)
-	    || (dfield_get_len(que_node_get_val(arg2)) < len2)) {
-
-		ut_error;
-	}
-
-	ut_memcpy(str1 + len1, str2, len2);
-}
-
 /*****************************************************************//**
 Evaluates an instr-function node. */
 static
@@ -605,44 +460,6 @@ match_found:
 	eval_node_set_int_val(func_node, int_val);
 }
 
-/*****************************************************************//**
-Evaluates a predefined function node. */
-UNIV_INLINE
-void
-eval_binary_to_number(
-/*==================*/
-	func_node_t*	func_node)	/*!< in: function node */
-{
-	que_node_t*	arg1;
-	dfield_t*	dfield;
-	byte*		str1;
-	byte*		str2;
-	ulint		len1;
-	ulint		int_val;
-
-	arg1 = func_node->args;
-
-	dfield = que_node_get_val(arg1);
-
-	str1 = static_cast(dfield_get_data(dfield));
-	len1 = dfield_get_len(dfield);
-
-	if (len1 > 4) {
-		ut_error;
-	}
-
-	if (len1 == 4) {
-		str2 = str1;
-	} else {
-		int_val = 0;
-		str2 = (byte*) &int_val;
-
-		ut_memcpy(str2 + (4 - len1), str1, len1);
-	}
-
-	eval_node_copy_and_alloc_val(func_node, str2, 4);
-}
-
 /*****************************************************************//**
 Evaluates a predefined function node. */
 static
@@ -734,95 +551,12 @@ eval_to_binary(
 }
 
 /*****************************************************************//**
-Evaluates a predefined function node. */
-UNIV_INLINE
-void
-eval_predefined(
-/*============*/
-	func_node_t*	func_node)	/*!< in: function node */
+Evaluate LENGTH(). */
+inline void eval_length(func_node_t* func_node)
 {
-	que_node_t*	arg1;
-	lint		int_val;
-	byte*		data;
-	int		func;
-
-	func = func_node->func;
-
-	arg1 = func_node->args;
-
-	if (func == PARS_LENGTH_TOKEN) {
-
-		int_val = (lint) dfield_get_len(que_node_get_val(arg1));
-
-	} else if (func == PARS_TO_CHAR_TOKEN) {
-
-		/* Convert number to character string as a
-		signed decimal integer. */
-
-		ulint	uint_val;
-		int	int_len;
-
-		int_val = eval_node_get_int_val(arg1);
-
-		/* Determine the length of the string. */
-
-		if (int_val == 0) {
-			int_len = 1; /* the number 0 occupies 1 byte */
-		} else {
-			int_len = 0;
-			if (int_val < 0) {
-				uint_val = ((ulint) -int_val - 1) + 1;
-				int_len++; /* reserve space for minus sign */
-			} else {
-				uint_val = (ulint) int_val;
-			}
-			for (; uint_val > 0; int_len++) {
-				uint_val /= 10;
-			}
-		}
-
-		/* allocate the string */
-		data = eval_node_ensure_val_buf(func_node, int_len + 1);
-
-		/* add terminating NUL character */
-		data[int_len] = 0;
-
-		/* convert the number */
-
-		if (int_val == 0) {
-			data[0] = '0';
-		} else {
-			int tmp;
-			if (int_val < 0) {
-				data[0] = '-'; /* preceding minus sign */
-				uint_val = ((ulint) -int_val - 1) + 1;
-			} else {
-				uint_val = (ulint) int_val;
-			}
-			for (tmp = int_len; uint_val > 0; uint_val /= 10) {
-				data[--tmp] = (byte)
-					('0' + (byte)(uint_val % 10));
-			}
-		}
-
-		dfield_set_len(que_node_get_val(func_node), int_len);
-
-		return;
-
-	} else if (func == PARS_TO_NUMBER_TOKEN) {
-
-		int_val = atoi((char*)
-			       dfield_get_data(que_node_get_val(arg1)));
-
-	} else if (func == PARS_SYSDATE_TOKEN) {
-		int_val = (lint) time(NULL);
-	} else {
-		eval_predefined_2(func_node);
-
-		return;
-	}
-
-	eval_node_set_int_val(func_node, int_val);
+	eval_node_set_int_val(func_node,
+			      dfield_get_len(que_node_get_val
+					     (func_node->args)));
 }
 
 /*****************************************************************//**
@@ -852,8 +586,7 @@ eval_func(
 
 		if (dfield_is_null(que_node_get_val(arg))
 		    && (fclass != PARS_FUNC_CMP)
-		    && (func != PARS_NOTFOUND_TOKEN)
-		    && (func != PARS_PRINTF_TOKEN)) {
+		    && (func != PARS_NOTFOUND_TOKEN)) {
 			ut_error;
 		}
 
@@ -878,24 +611,20 @@ eval_func(
 		case PARS_SUBSTR_TOKEN:
 			eval_substr(func_node);
 			return;
-		case PARS_REPLSTR_TOKEN:
-			eval_replstr(func_node);
-			return;
 		case PARS_INSTR_TOKEN:
 			eval_instr(func_node);
 			return;
-		case PARS_BINARY_TO_NUMBER_TOKEN:
-			eval_binary_to_number(func_node);
-			return;
 		case PARS_CONCAT_TOKEN:
 			eval_concat(func_node);
 			return;
 		case PARS_TO_BINARY_TOKEN:
 			eval_to_binary(func_node);
 			return;
-		default:
-			eval_predefined(func_node);
+		case PARS_LENGTH_TOKEN:
+			eval_length(func_node);
 			return;
+		default:
+			ut_error;
 		}
 	case PARS_FUNC_LOGICAL:
 		eval_logical(func_node);
diff --git a/storage/innobase/include/pars0grm.h b/storage/innobase/include/pars0grm.h
index 90a7468bc9a..58d424abfdc 100644
--- a/storage/innobase/include/pars0grm.h
+++ b/storage/innobase/include/pars0grm.h
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.4.2.  */
 
 /* Bison interface for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    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
@@ -30,6 +31,9 @@
    This special exception was added by the Free Software Foundation in
    version 2.2 of Bison.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 #ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED
 # define YY_YY_PARS0GRM_TAB_H_INCLUDED
 /* Debug traces.  */
@@ -58,91 +62,71 @@ extern int yydebug;
     PARS_NE_TOKEN = 268,
     PARS_PROCEDURE_TOKEN = 269,
     PARS_IN_TOKEN = 270,
-    PARS_OUT_TOKEN = 271,
-    PARS_BINARY_TOKEN = 272,
-    PARS_BLOB_TOKEN = 273,
-    PARS_INT_TOKEN = 274,
-    PARS_FLOAT_TOKEN = 275,
-    PARS_CHAR_TOKEN = 276,
-    PARS_IS_TOKEN = 277,
-    PARS_BEGIN_TOKEN = 278,
-    PARS_END_TOKEN = 279,
-    PARS_IF_TOKEN = 280,
-    PARS_THEN_TOKEN = 281,
-    PARS_ELSE_TOKEN = 282,
-    PARS_ELSIF_TOKEN = 283,
-    PARS_LOOP_TOKEN = 284,
-    PARS_WHILE_TOKEN = 285,
-    PARS_RETURN_TOKEN = 286,
-    PARS_SELECT_TOKEN = 287,
-    PARS_SUM_TOKEN = 288,
-    PARS_COUNT_TOKEN = 289,
-    PARS_DISTINCT_TOKEN = 290,
-    PARS_FROM_TOKEN = 291,
-    PARS_WHERE_TOKEN = 292,
-    PARS_FOR_TOKEN = 293,
-    PARS_DDOT_TOKEN = 294,
-    PARS_READ_TOKEN = 295,
-    PARS_ORDER_TOKEN = 296,
-    PARS_BY_TOKEN = 297,
-    PARS_ASC_TOKEN = 298,
-    PARS_DESC_TOKEN = 299,
-    PARS_INSERT_TOKEN = 300,
-    PARS_INTO_TOKEN = 301,
-    PARS_VALUES_TOKEN = 302,
-    PARS_UPDATE_TOKEN = 303,
-    PARS_SET_TOKEN = 304,
-    PARS_DELETE_TOKEN = 305,
-    PARS_CURRENT_TOKEN = 306,
-    PARS_OF_TOKEN = 307,
-    PARS_CREATE_TOKEN = 308,
-    PARS_TABLE_TOKEN = 309,
-    PARS_INDEX_TOKEN = 310,
-    PARS_UNIQUE_TOKEN = 311,
-    PARS_CLUSTERED_TOKEN = 312,
-    PARS_ON_TOKEN = 313,
-    PARS_ASSIGN_TOKEN = 314,
-    PARS_DECLARE_TOKEN = 315,
-    PARS_CURSOR_TOKEN = 316,
-    PARS_SQL_TOKEN = 317,
-    PARS_OPEN_TOKEN = 318,
-    PARS_FETCH_TOKEN = 319,
-    PARS_CLOSE_TOKEN = 320,
-    PARS_NOTFOUND_TOKEN = 321,
-    PARS_TO_CHAR_TOKEN = 322,
-    PARS_TO_NUMBER_TOKEN = 323,
-    PARS_TO_BINARY_TOKEN = 324,
-    PARS_BINARY_TO_NUMBER_TOKEN = 325,
-    PARS_SUBSTR_TOKEN = 326,
-    PARS_REPLSTR_TOKEN = 327,
-    PARS_CONCAT_TOKEN = 328,
-    PARS_INSTR_TOKEN = 329,
-    PARS_LENGTH_TOKEN = 330,
-    PARS_SYSDATE_TOKEN = 331,
-    PARS_PRINTF_TOKEN = 332,
-    PARS_ASSERT_TOKEN = 333,
-    PARS_RND_TOKEN = 334,
-    PARS_RND_STR_TOKEN = 335,
-    PARS_ROW_PRINTF_TOKEN = 336,
-    PARS_COMMIT_TOKEN = 337,
-    PARS_ROLLBACK_TOKEN = 338,
-    PARS_WORK_TOKEN = 339,
-    PARS_UNSIGNED_TOKEN = 340,
-    PARS_EXIT_TOKEN = 341,
-    PARS_FUNCTION_TOKEN = 342,
-    PARS_LOCK_TOKEN = 343,
-    PARS_SHARE_TOKEN = 344,
-    PARS_MODE_TOKEN = 345,
-    PARS_LIKE_TOKEN = 346,
-    PARS_LIKE_TOKEN_EXACT = 347,
-    PARS_LIKE_TOKEN_PREFIX = 348,
-    PARS_LIKE_TOKEN_SUFFIX = 349,
-    PARS_LIKE_TOKEN_SUBSTR = 350,
-    PARS_TABLE_NAME_TOKEN = 351,
-    PARS_COMPACT_TOKEN = 352,
-    PARS_BLOCK_SIZE_TOKEN = 353,
-    PARS_BIGINT_TOKEN = 354,
-    NEG = 355
+    PARS_INT_TOKEN = 271,
+    PARS_CHAR_TOKEN = 272,
+    PARS_IS_TOKEN = 273,
+    PARS_BEGIN_TOKEN = 274,
+    PARS_END_TOKEN = 275,
+    PARS_IF_TOKEN = 276,
+    PARS_THEN_TOKEN = 277,
+    PARS_ELSE_TOKEN = 278,
+    PARS_ELSIF_TOKEN = 279,
+    PARS_LOOP_TOKEN = 280,
+    PARS_WHILE_TOKEN = 281,
+    PARS_RETURN_TOKEN = 282,
+    PARS_SELECT_TOKEN = 283,
+    PARS_COUNT_TOKEN = 284,
+    PARS_FROM_TOKEN = 285,
+    PARS_WHERE_TOKEN = 286,
+    PARS_FOR_TOKEN = 287,
+    PARS_DDOT_TOKEN = 288,
+    PARS_ORDER_TOKEN = 289,
+    PARS_BY_TOKEN = 290,
+    PARS_ASC_TOKEN = 291,
+    PARS_DESC_TOKEN = 292,
+    PARS_INSERT_TOKEN = 293,
+    PARS_INTO_TOKEN = 294,
+    PARS_VALUES_TOKEN = 295,
+    PARS_UPDATE_TOKEN = 296,
+    PARS_SET_TOKEN = 297,
+    PARS_DELETE_TOKEN = 298,
+    PARS_CURRENT_TOKEN = 299,
+    PARS_OF_TOKEN = 300,
+    PARS_CREATE_TOKEN = 301,
+    PARS_TABLE_TOKEN = 302,
+    PARS_INDEX_TOKEN = 303,
+    PARS_UNIQUE_TOKEN = 304,
+    PARS_CLUSTERED_TOKEN = 305,
+    PARS_ON_TOKEN = 306,
+    PARS_ASSIGN_TOKEN = 307,
+    PARS_DECLARE_TOKEN = 308,
+    PARS_CURSOR_TOKEN = 309,
+    PARS_SQL_TOKEN = 310,
+    PARS_OPEN_TOKEN = 311,
+    PARS_FETCH_TOKEN = 312,
+    PARS_CLOSE_TOKEN = 313,
+    PARS_NOTFOUND_TOKEN = 314,
+    PARS_TO_BINARY_TOKEN = 315,
+    PARS_SUBSTR_TOKEN = 316,
+    PARS_CONCAT_TOKEN = 317,
+    PARS_INSTR_TOKEN = 318,
+    PARS_LENGTH_TOKEN = 319,
+    PARS_COMMIT_TOKEN = 320,
+    PARS_ROLLBACK_TOKEN = 321,
+    PARS_WORK_TOKEN = 322,
+    PARS_EXIT_TOKEN = 323,
+    PARS_FUNCTION_TOKEN = 324,
+    PARS_LOCK_TOKEN = 325,
+    PARS_SHARE_TOKEN = 326,
+    PARS_MODE_TOKEN = 327,
+    PARS_LIKE_TOKEN = 328,
+    PARS_LIKE_TOKEN_EXACT = 329,
+    PARS_LIKE_TOKEN_PREFIX = 330,
+    PARS_LIKE_TOKEN_SUFFIX = 331,
+    PARS_LIKE_TOKEN_SUBSTR = 332,
+    PARS_TABLE_NAME_TOKEN = 333,
+    PARS_BIGINT_TOKEN = 334,
+    NEG = 335
   };
 #endif
 
diff --git a/storage/innobase/include/pars0pars.h b/storage/innobase/include/pars0pars.h
index f74d3700eca..f54c50e5b85 100644
--- a/storage/innobase/include/pars0pars.h
+++ b/storage/innobase/include/pars0pars.h
@@ -48,29 +48,15 @@ extern int	yydebug;
 NOT re-entrant */
 extern sym_tab_t*	pars_sym_tab_global;
 
-extern pars_res_word_t	pars_to_char_token;
-extern pars_res_word_t	pars_to_number_token;
 extern pars_res_word_t	pars_to_binary_token;
-extern pars_res_word_t	pars_binary_to_number_token;
 extern pars_res_word_t	pars_substr_token;
-extern pars_res_word_t	pars_replstr_token;
 extern pars_res_word_t	pars_concat_token;
 extern pars_res_word_t	pars_length_token;
 extern pars_res_word_t	pars_instr_token;
-extern pars_res_word_t	pars_sysdate_token;
-extern pars_res_word_t	pars_printf_token;
-extern pars_res_word_t	pars_assert_token;
-extern pars_res_word_t	pars_rnd_token;
-extern pars_res_word_t	pars_rnd_str_token;
 extern pars_res_word_t	pars_count_token;
-extern pars_res_word_t	pars_sum_token;
-extern pars_res_word_t	pars_distinct_token;
-extern pars_res_word_t	pars_binary_token;
-extern pars_res_word_t	pars_blob_token;
 extern pars_res_word_t	pars_int_token;
 extern pars_res_word_t	pars_bigint_token;
 extern pars_res_word_t	pars_char_token;
-extern pars_res_word_t	pars_float_token;
 extern pars_res_word_t	pars_update_token;
 extern pars_res_word_t	pars_asc_token;
 extern pars_res_word_t	pars_desc_token;
@@ -236,17 +222,6 @@ pars_insert_statement(
 	que_node_t*	values_list,	/*!< in: value expression list or NULL */
 	sel_node_t*	select);	/*!< in: select condition or NULL */
 /*********************************************************************//**
-Parses a procedure parameter declaration.
-@return own: symbol table node of type SYM_VAR */
-sym_node_t*
-pars_parameter_declaration(
-/*=======================*/
-	sym_node_t*	node,	/*!< in: symbol table node allocated for the
-				id of the parameter */
-	ulint		param_type,
-				/*!< in: PARS_INPUT or PARS_OUTPUT */
-	pars_res_word_t* type);	/*!< in: pointer to a type token */
-/*********************************************************************//**
 Parses an elsif element.
 @return elsif node */
 elsif_node_t*
@@ -358,8 +333,6 @@ pars_column_def(
 	pars_res_word_t*	type,		/*!< in: data type */
 	sym_node_t*		len,		/*!< in: length of column, or
 						NULL */
-	void*			is_unsigned,	/*!< in: if not NULL, column
-						is of type UNSIGNED. */
 	void*			is_not_null);	/*!< in: if not NULL, column
 						is of type NOT NULL. */
 /*********************************************************************//**
@@ -370,9 +343,7 @@ pars_create_table(
 /*==============*/
 	sym_node_t*	table_sym,	/*!< in: table name node in the symbol
 					table */
-	sym_node_t*	column_defs,	/*!< in: list of column names */
-	sym_node_t*	compact,	/* in: non-NULL if COMPACT table. */
-	sym_node_t*	block_size);	/* in: block size (can be NULL) */
+	sym_node_t*	column_defs);	/*!< in: list of column names */
 /*********************************************************************//**
 Parses an index creation operation.
 @return index create subgraph */
@@ -394,7 +365,6 @@ pars_procedure_definition(
 /*======================*/
 	sym_node_t*	sym_node,	/*!< in: procedure id node in the symbol
 					table */
-	sym_node_t*	param_list,	/*!< in: parameter declaration list */
 	que_node_t*	stat_list);	/*!< in: statement list */
 
 /*************************************************************//**
@@ -672,7 +642,6 @@ struct proc_node_t{
 	que_common_t	common;		/*!< type: QUE_NODE_PROC */
 	sym_node_t*	proc_id;	/*!< procedure name symbol in the symbol
 					table of this same procedure */
-	sym_node_t*	param_list;	/*!< input and output parameters */
 	que_node_t*	stat_list;	/*!< statement list */
 	sym_tab_t*	sym_tab;	/*!< symbol table of this procedure */
 };
@@ -747,7 +716,7 @@ struct col_assign_node_t{
 #define	PARS_FUNC_LOGICAL	2	/*!< AND, OR, NOT */
 #define PARS_FUNC_CMP		3	/*!< comparison operators */
 #define	PARS_FUNC_PREDEFINED	4	/*!< TO_NUMBER, SUBSTR, ... */
-#define	PARS_FUNC_AGGREGATE	5	/*!< COUNT, DISTINCT, SUM */
+#define	PARS_FUNC_AGGREGATE	5	/*!< COUNT */
 #define	PARS_FUNC_OTHER		6	/*!< these are not real functions,
 					e.g., := */
 /* @} */
diff --git a/storage/innobase/pars/lexyy.cc b/storage/innobase/pars/lexyy.cc
index e7f3981e0fe..1e93ec3ed50 100644
--- a/storage/innobase/pars/lexyy.cc
+++ b/storage/innobase/pars/lexyy.cc
@@ -356,8 +356,8 @@ static void yynoreturn yy_fatal_error ( const char* msg  );
 	(yy_hold_char) = *yy_cp; \
 	*yy_cp = '\0'; \
 	(yy_c_buf_p) = yy_cp;
-#define YY_NUM_RULES 123
-#define YY_END_OF_BUFFER 124
+#define YY_NUM_RULES 102
+#define YY_END_OF_BUFFER 103
 /* This struct is not used in this scanner,
    but its presence is necessary. */
 struct yy_trans_info
@@ -365,53 +365,42 @@ struct yy_trans_info
 	flex_int32_t yy_verify;
 	flex_int32_t yy_nxt;
 	};
-static const flex_int16_t yy_accept[404] =
+static const flex_int16_t yy_accept[307] =
     {   0,
-        0,    0,  118,  118,    0,    0,    0,    0,  124,  122,
-      121,  121,    8,  122,  113,    5,  102,  108,  111,  109,
-      106,  110,  122,  112,    1,  122,  107,  105,  103,  104,
-      116,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-      114,  115,  118,  119,    6,    7,    9,   10,  121,    4,
-       97,  117,    2,    1,    3,   98,   99,  101,  100,    0,
-       95,    0,   95,   95,   95,   95,   95,   44,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   28,   17,   25,   95,   95,   95,   95,
-
-       95,   95,   54,   62,   95,   14,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   95,  118,  119,  119,  120,    6,    7,
-        9,   10,    2,    0,   96,   13,   45,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   27,   95,   95,   95,   41,
-       95,   95,   95,   95,   21,   95,   95,   95,   95,   95,
-       15,   95,   95,   95,   18,   95,   95,   95,   95,   95,
-       81,   95,   95,   95,   51,   95,   12,   95,   36,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-
-        0,   96,   95,   95,   95,   95,   20,   95,   24,   95,
-       95,   95,   95,   95,   95,   95,   95,   95,   95,   95,
-       46,   95,   30,   95,   88,   95,   95,   39,   95,   95,
-       95,   95,   95,   48,   95,   93,   90,   32,   92,   95,
-       11,   65,   95,   95,   95,   42,   95,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   29,   95,   95,   95,
-       95,   95,   95,   95,   95,   95,   86,    0,   95,   26,
-       95,   95,   95,   67,   95,   95,   95,   95,   37,   95,
-       95,   95,   95,   95,   95,   31,   66,   23,   95,   59,
-       95,   76,   95,   95,   95,   43,   95,   95,   95,   95,
-
-       95,   95,   95,   95,   91,   95,   95,   56,   95,   95,
-       95,   95,   95,   95,   95,   40,   33,    0,   80,   94,
-       19,   95,   95,   84,   95,   75,   55,   95,   64,   95,
-       52,   95,   95,   47,   95,   77,   95,   79,   95,   95,
-       34,   95,   95,   95,   35,   73,   95,   95,   95,   95,
-       60,   95,   50,   49,   95,   95,   95,   57,   53,   63,
-       95,   95,   22,   95,   95,   74,   82,   95,   95,   78,
-       95,   69,   95,   95,   95,   95,   95,   38,   89,   68,
-       95,   85,   95,   95,   95,   87,   95,   95,   61,   16,
-       95,   71,   70,   95,   58,   83,   95,   95,   95,   95,
-
-       95,   72,    0
+        0,    0,   97,   97,    0,    0,    0,    0,  103,  101,
+      100,  100,    8,  101,   92,    5,   81,   87,   90,   88,
+       85,   89,  101,   91,    1,  101,   86,   84,   82,   83,
+       95,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       93,   94,   97,   98,    6,    7,    9,   10,  100,    4,
+       76,   96,    2,    1,    3,   77,   78,   80,   79,    0,
+       74,    0,   74,   74,   74,   74,   36,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       23,   17,   20,   74,   74,   74,   74,   74,   74,   46,
+
+       52,   74,   14,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   74,   74,   74,   97,   98,
+       98,   99,    6,    7,    9,   10,    2,    0,   75,   13,
+       37,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   22,   74,   74,   34,   74,
+       74,   74,   74,   18,   74,   74,   74,   74,   74,   15,
+       74,   74,   74,   74,   74,   74,   74,   43,   74,   12,
+       74,   74,   74,   74,   74,   74,   74,   74,   74,   74,
+        0,   75,   74,   74,   19,   74,   74,   74,   74,   74,
+       74,   74,   74,   74,   74,   38,   25,   74,   67,   74,
+
+       32,   74,   74,   74,   74,   40,   74,   72,   69,   27,
+       71,   74,   11,   55,   74,   74,   74,   74,   74,   74,
+       74,   74,   24,   74,   74,   74,   74,   74,   74,   66,
+        0,   21,   74,   57,   74,   74,   74,   31,   74,   74,
+       74,   74,   74,   26,   56,   74,   49,   74,   62,   74,
+       74,   35,   74,   74,   74,   74,   70,   74,   48,   74,
+       74,   74,   74,   33,   28,    0,   73,   74,   64,   61,
+       47,   74,   54,   74,   44,   74,   39,   63,   74,   74,
+       29,   74,   30,   60,   74,   50,   42,   41,   74,   45,
+       53,   74,   74,   74,   74,   74,   74,   68,   58,   74,
+
+       65,   74,   51,   16,   59,    0
     } ;
 
 static const YY_CHAR yy_ec[256] =
@@ -424,12 +413,12 @@ static const YY_CHAR yy_ec[256] =
        17,   17,   17,   17,   17,   17,   17,   18,   19,   20,
        21,   22,   23,   24,   25,   26,   27,   28,   29,   30,
        31,   32,   33,   34,   35,   36,   37,   38,   39,   40,
-       41,   42,   43,   44,   45,   46,   47,   48,   49,   50,
-        1,    1,    1,    1,   51,    1,   34,   34,   34,   34,
+       41,   42,   43,   44,   45,   46,   47,   48,   49,   34,
+        1,    1,    1,    1,   50,    1,   34,   34,   34,   34,
 
-       34,   34,   34,   34,   34,   34,   34,   52,   34,   34,
-       34,   34,   53,   34,   54,   34,   34,   34,   34,   34,
-       34,   34,   55,    1,   56,    1,    1,    1,    1,    1,
+       34,   34,   34,   34,   34,   34,   34,   51,   34,   34,
+       34,   34,   52,   34,   53,   34,   34,   34,   34,   34,
+       34,   34,   54,    1,   55,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -446,418 +435,324 @@ static const YY_CHAR yy_ec[256] =
         1,    1,    1,    1,    1
     } ;
 
-static const YY_CHAR yy_meta[57] =
+static const YY_CHAR yy_meta[56] =
     {   0,
         1,    1,    1,    2,    3,    1,    1,    4,    1,    1,
         5,    1,    1,    1,    1,    6,    7,    1,    1,    1,
         8,    1,    1,    6,    9,    9,    9,    9,    9,    9,
         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
         9,    9,    9,    9,    9,    9,    9,    9,    9,    9,
-        9,    9,    9,    9,    1,    1
+        9,    9,    9,    1,    1
     } ;
 
-static const flex_int16_t yy_base[417] =
+static const flex_int16_t yy_base[320] =
     {   0,
-        0,    0,  296,  281,  283,  280,  261,  252,  253, 1285,
-       55,   57, 1285,    0, 1285, 1285, 1285, 1285, 1285, 1285,
-     1285, 1285,  211,  213,   46,  202, 1285,   43, 1285,  199,
-     1285,   46,   50,   56,   52,   66,   64,   51,   81,   92,
-       91,   94,   96,  111,  113,  116,  130,  134,   53,  143,
-     1285, 1285,    0,  106,    0,  206,    0,  205,  141,    0,
-     1285, 1285,  177,   56,  152, 1285, 1285, 1285, 1285,  161,
-      140,  147,  152,  154,  155,  161,  167,  171,  177,  172,
-      184,  174,  188,  189,  191,  194,  203,  212,  217,  219,
-      222,  223,  228,  224,  226,  233,  235,  239,  244,  251,
-
-      256,  260,  261,  262,  265,  271,  266,  281,  277,  287,
-      282,  288,  303,  306,  307,  292,  310,  321,  322,  323,
-      324,  325,  335,  338,    0,  112,  173, 1285,    0,  152,
-        0,  145,  130,   59,    0,  339,  341,  353,  351,  354,
-      365,  367,  355,  372,  376,  383,  379,  386,  388,  385,
-      398,  392,  402,  401,  414,  415,  416,  417,  426,  430,
-      432,  437,  433,  439,  442,  443,  449,  456,  460,  461,
-      463,  470,  472,  473,  479,  483,  485,  489,  492,  495,
-      498,  499,  502,  508,  509,  514,  515,  518,  520,  527,
-      530,  534,  536,  541,  543,  553,  555,  557,  559,  568,
-
-       41,    0,  564,  569,  570,  573,  574,  585,  580,  589,
-      586,  595,  598,  600,  605,  610,  611,  617,  620,  615,
-      622,  627,  626,  631,  641,  642,  646,  647,  648,  651,
-      652,  653,  657,  662,  663,  667,  669,  673,  680,  682,
-      684,  685,  686,  687,  689,  696,  698,  700,  701,  703,
-      699,  710,  714,  716,  729,  732,  731,  733,  735,  734,
-      746,  747,  748,  752,  753,  759,  749,   39,  769,  770,
-      771,  773,  774,  780,  783,  784,  787,  785,  786,  802,
-      800,  803,  816,  817,  818,  819,  820,  823,  833,  835,
-      836,  837,  838,  839,  848,  849,  852,  853,  854,  859,
-
-      863,  870,  868,  872,  875,  884,  885,  887,  889,  890,
-      888,  904,  906,  907,  908,  918,  919,   73,  921,  922,
-      923,  924,  933,  934,  936,  937,  938,  939,  940,  949,
-      952,  955,  953,  965,  969,  970,  971,  972,  974,  975,
-      981,  984,  986,  988,  990,  991, 1000, 1006, 1004, 1009,
-     1016, 1018, 1020, 1021, 1025, 1027, 1032, 1034, 1038, 1039,
-     1041, 1043, 1048, 1050, 1052, 1055, 1059, 1064, 1066, 1068,
-     1071, 1073, 1077, 1084, 1086, 1087, 1091, 1093, 1098, 1100,
-     1102, 1104, 1105, 1111, 1114, 1116, 1117, 1118, 1120, 1127,
-     1129, 1130, 1134, 1139, 1141, 1145, 1146, 1148, 1150, 1151,
-
-     1155, 1157, 1285, 1197, 1206, 1215, 1218, 1221, 1225, 1234,
-     1243, 1252, 1261, 1268, 1272, 1275
+        0,    0,  262,  259,  249,  244,  239,  234,  236,  960,
+       54,   56,  960,    0,  960,  960,  960,  960,  960,  960,
+      960,  960,  217,  220,   45,  186,  960,   42,  960,  184,
+      960,   45,   49,   55,   51,   65,   80,   50,   69,   94,
+       90,   92,  104,   60,  114,  116,  131,  134,  135,  149,
+      960,  960,    0,   61,    0,  194,    0,  197,  133,    0,
+      960,  960,  163,   53,  143,  960,  960,  960,  960,  147,
+      125,  123,  138,  151,  152,  153,  155,  166,  169,  173,
+      170,  171,  176,  180,  193,  182,  200,  204,  206,  209,
+      210,  211,  213,  224,  225,  226,  235,  240,  242,  245,
+
+      251,  252,  255,  256,  258,  261,  270,  274,  272,  277,
+      289,  288,  276,  294,  295,  300,  304,  305,    0,   79,
+      110,  960,    0,  116,    0,  113,   98,   58,    0,  306,
+      315,  316,  318,  319,  322,  328,  329,  332,  334,  338,
+      344,  353,  351,  354,  366,  360,  367,  369,  376,  378,
+      381,  385,  388,  382,  394,  400,  403,  404,  406,  407,
+      410,  417,  423,  424,  426,  429,  433,  440,  442,  443,
+      444,  445,  454,  456,  459,  461,  472,  473,  474,  477,
+       53,    0,  475,  478,  479,  490,  502,  504,  505,  507,
+      508,  509,  511,  518,  520,  523,  524,  525,  529,  538,
+
+      541,  542,  543,  545,  547,  544,  556,  557,  558,  559,
+      560,  569,  572,  574,  578,  581,  579,  583,  588,  590,
+      600,  601,  602,  607,  611,  613,  612,  618,  622,  629,
+       41,  634,  636,  638,  639,  643,  645,  648,  649,  650,
+      655,  659,  661,  660,  670,  675,  676,  679,  680,  682,
+      686,  689,  691,  696,  693,  700,  705,  706,  709,  711,
+      712,  716,  722,  723,  726,   72,  727,  736,  737,  738,
+      739,  740,  742,  743,  752,  753,  755,  757,  758,  759,
+      764,  770,  769,  771,  774,  784,  785,  786,  787,  789,
+      790,  791,  796,  801,  802,  803,  806,  807,  812,  817,
+
+      816,  823,  826,  828,  832,  960,  872,  881,  890,  893,
+      896,  900,  909,  918,  927,  936,  943,  947,  950
     } ;
 
-static const flex_int16_t yy_def[417] =
+static const flex_int16_t yy_def[320] =
     {   0,
-      403,    1,  404,  404,  405,  405,  406,  406,  403,  403,
-      403,  403,  403,  407,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  408,  403,  403,  403,  403,
-      403,  409,  409,  409,  409,  409,   34,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      403,  403,  410,  411,  412,  403,  413,  403,  403,  407,
-      403,  403,  403,  403,  408,  403,  403,  403,  403,  414,
-      409,  415,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  410,  411,  411,  403,  412,  403,
-      413,  403,  403,  403,  416,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-
-      403,  416,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  403,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  403,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-      409,  409,  409,  409,  409,  409,  409,  409,  409,  409,
-
-      409,  409,    0,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403
+      306,    1,  307,  307,  308,  308,  309,  309,  306,  306,
+      306,  306,  306,  310,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  311,  306,  306,  306,  306,
+      306,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      306,  306,  313,  314,  315,  306,  316,  306,  306,  310,
+      306,  306,  306,  306,  311,  306,  306,  306,  306,  317,
+      312,  318,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  313,  314,
+      314,  306,  315,  306,  316,  306,  306,  306,  319,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      306,  319,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      306,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  306,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+      312,  312,  312,  312,  312,  312,  312,  312,  312,  312,
+
+      312,  312,  312,  312,  312,    0,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306
     } ;
 
-static const flex_int16_t yy_nxt[1342] =
+static const flex_int16_t yy_nxt[1016] =
     {   0,
        10,   11,   12,   13,   10,   14,   15,   16,   17,   18,
        19,   20,   21,   22,   23,   24,   25,   26,   27,   28,
        29,   30,   31,   10,   32,   33,   34,   35,   36,   37,
        38,   38,   39,   38,   38,   40,   41,   42,   43,   44,
        38,   45,   46,   47,   48,   49,   50,   38,   38,   38,
-       38,   38,   38,   38,   51,   52,   59,   59,   59,   59,
-       63,   70,   64,   67,   68,   70,   70,   70,   70,   72,
-       63,   70,   64,   72,   72,   72,   72,  122,   75,   72,
-       84,   70,   76,   73,   85,   77,  135,   79,   74,   72,
-      318,   80,   89,  268,   81,   71,   70,   82,   78,   90,
-
-       83,   86,   91,   87,   72,   92,   70,   70,   93,   70,
-       94,   70,  201,   88,   72,   72,  127,   72,   95,   72,
-       97,  128,  403,   96,   98,  103,   70,  403,   70,  100,
-       99,   70,  101,  104,   72,  105,   72,  106,  102,   72,
-      107,  109,   59,   59,  112,   70,  133,  113,  132,   70,
-      110,  111,  108,   72,  117,   70,  114,   72,   70,  130,
-      115,  118,   70,   72,  116,  134,   72,   70,  119,   70,
-       70,  120,  403,  121,  123,   72,   70,   72,   72,  136,
-      137,  124,   70,  127,   72,  139,   70,   70,  128,   70,
-       72,  140,   70,  133,   72,   72,  138,   72,  141,   70,
-
-       72,  143,  149,   70,   70,  142,   70,   72,  132,   70,
-      144,   72,   72,  130,   72,  151,  145,   72,   70,   69,
-      146,  147,   66,   62,  152,   61,   72,   70,  148,  150,
-      156,  153,   70,  154,   70,   72,  155,   70,   70,   70,
-       72,   70,   72,   70,  157,   72,   72,   72,   70,   72,
-       70,   72,  403,  163,   70,   58,   72,  159,   72,   70,
-      158,  161,   72,  160,   58,  162,   70,   72,  164,  165,
-      168,   70,  166,  167,   72,   70,   70,   70,  170,   72,
-       70,   70,  169,   72,   72,   72,   70,   56,   72,   72,
-       56,   54,   70,  173,   72,  172,   70,   70,  174,  171,
-
-       72,  178,   70,   70,   72,   72,   54,   70,  403,  175,
-       72,   72,  403,  176,  181,   72,  179,  182,   70,  177,
-      180,   70,   70,  184,  403,   70,   72,  186,  183,   72,
-       72,  185,  188,   72,  190,  191,   70,   70,   70,   70,
-       70,  187,  403,  189,   72,   72,   72,   72,   72,  192,
-       70,  196,  403,   70,   70,  194,   70,  403,   72,  403,
-      197,   72,   72,  198,   72,  195,   70,  199,   70,   70,
-       70,  403,  193,  403,   72,  403,   72,   72,   72,  200,
-       70,  203,   70,  204,  403,  403,  205,   70,   72,  206,
-       72,   70,  207,  208,   70,   72,  209,  403,   70,   72,
-
-       70,   70,   72,   70,  403,  214,   72,   70,   72,   72,
-      403,   72,  216,   70,  210,   72,   70,   70,  211,  212,
-      220,   72,  213,  215,   72,   72,  217,  218,  221,   70,
-       70,   70,   70,  219,  403,  403,  403,   72,   72,   72,
-       72,   70,  223,  226,  222,   70,  224,   70,   70,   72,
-      227,  403,   70,   72,   70,   72,   72,   70,   70,  225,
-       72,  230,   72,  229,   70,   72,   72,  231,  228,  403,
-      233,   70,   72,  235,  403,   70,   70,  236,   70,   72,
-      234,  403,  232,   72,   72,   70,   72,   70,   70,  239,
-      237,  403,  240,   72,   70,   72,   72,  403,   70,  238,
-
-       70,  243,   72,  403,   70,  241,   72,   70,   72,  242,
-       70,  245,   72,   70,   70,   72,  246,   70,   72,  403,
-      244,   72,   72,   70,   70,   72,  403,  247,  403,   70,
-       70,   72,   72,   70,  250,   70,  252,   72,   72,  248,
-      403,   72,   70,   72,  403,   70,  403,  403,  249,   70,
-       72,   70,  251,   72,  255,  253,   70,   72,   70,   72,
-      254,  258,  259,  403,   72,  256,   72,  403,   70,  403,
-       70,  257,   70,  260,   70,  262,   72,  263,   72,   70,
-       72,  261,   72,   70,   70,   70,  403,   72,   70,   70,
-      403,   72,   72,   72,  266,   70,   72,   72,  265,  264,
-
-       70,   70,  267,   72,   70,  269,  270,  271,   72,   72,
-       70,  403,   72,   70,  272,   70,  403,  274,   72,  273,
-       70,   72,  277,   72,  278,   70,   70,  276,   72,  275,
-       70,  403,   70,   72,   72,   70,  403,   70,   72,  281,
-       72,   70,   70,   72,  283,   72,   70,  403,  279,   72,
-       72,  403,  403,  280,   72,  282,   70,   70,  284,  285,
-      286,   70,   70,   70,   72,   72,   70,   70,   70,   72,
-       72,   72,   70,  287,   72,   72,   72,   70,   70,  403,
-       72,  403,   70,  403,   70,   72,   72,  293,   70,  288,
-       72,  289,   72,  291,  292,   70,   72,   70,  290,   70,
-
-       70,   70,   70,   72,   70,   72,  294,   72,   72,   72,
-       72,   70,   72,   70,   70,   70,   70,  298,   70,   72,
-      295,   72,   72,   72,   72,   70,   72,  296,  302,   70,
-      297,   70,  403,   72,  403,  403,  304,   72,  303,   72,
-      299,  300,  305,  301,   70,  403,   70,   70,   70,   70,
-       70,  403,   72,  307,   72,   72,   72,   72,   72,  306,
-      308,   70,   70,   70,   70,  309,  310,   70,   70,   72,
-       72,   72,   72,  403,   70,   72,   72,  313,  311,  403,
-      315,  316,   72,  403,   70,   70,   70,  317,   70,   70,
-      312,  314,   72,   72,   72,   70,   72,   72,   70,   70,
-
-       70,   70,   70,   72,  403,  403,   72,   72,   72,   72,
-       72,  323,  319,  325,  320,   70,  403,   70,   70,  403,
-      403,  321,  403,   72,  322,   72,   72,  324,  326,  403,
-      327,   70,   70,   70,   70,   70,  403,  328,   70,   72,
-       72,   72,   72,   72,  329,  331,   72,  403,   70,  403,
-       70,   70,   70,   70,   70,  332,   72,  330,   72,   72,
-       72,   72,   72,   70,   70,  333,  335,   70,   70,   70,
-      336,   72,   72,  403,   70,   72,   72,   72,   70,  334,
-      339,  338,   72,   70,  403,   70,   72,   70,  403,  403,
-       70,   72,  337,   72,  343,   72,  341,  340,   72,   70,
-
-       70,  403,   70,   70,   70,   70,  342,   72,   72,  344,
-       72,   72,   72,   72,  349,  345,  403,  403,  403,   70,
-      403,   70,   70,   70,  350,  346,  348,   72,  347,   72,
-       72,   72,  351,   70,   70,  353,   70,   70,   70,   70,
-      403,   72,   72,  352,   72,   72,   72,   72,   70,   70,
-      354,   70,   70,   70,   70,   70,   72,   72,  403,   72,
-       72,   72,   72,   72,   70,  403,  356,   70,   70,  403,
-       70,  403,   72,  355,  357,   72,   72,  360,   72,  358,
-       70,  361,  359,  403,   70,   70,   70,   70,   72,   70,
-       70,  362,   72,   72,   72,   72,   70,   72,   72,   70,
-
-      403,   70,  403,   70,   72,   70,   70,   72,  364,   72,
-      363,   72,  368,   72,   72,   70,  366,  403,  365,   70,
-      369,   70,  403,   72,   70,  367,  403,   72,  370,   72,
-      371,   70,   72,   70,  373,   70,   70,  403,  403,   72,
-       70,   72,   70,   72,   72,  372,  374,   70,   72,   70,
-       72,  403,  403,   70,   70,   72,   70,   72,   70,  376,
-      377,   72,   72,   70,   72,   70,   72,   70,  375,  403,
-       70,   72,  403,   72,   70,   72,  403,  380,   72,   70,
-      379,   70,   72,   70,  378,  403,   70,   72,   70,   72,
-      403,   72,   70,  381,   72,  403,   72,  403,  382,   70,
-
-       72,   70,   70,  383,  403,  385,   70,   72,   70,   72,
-       72,  386,  384,   70,   72,   70,   72,   70,  389,   70,
-       70,   72,  403,   72,  387,   72,   70,   72,   72,   70,
-      390,   70,   70,   70,   72,   70,  388,   72,  403,   72,
-       72,   72,   70,   72,   70,   70,  395,  403,  391,   70,
-       72,  403,   72,   72,   70,  393,   70,   72,  396,  392,
-       70,   70,   72,   70,   72,   70,   70,  394,   72,   72,
-       70,   72,   70,   72,   72,  400,  397,  403,   72,  401,
-       72,  403,  403,  403,  399,  403,  403,  403,  403,  403,
-      398,  403,  403,  403,  403,  403,  402,   53,   53,   53,
-
-       53,   53,   53,   53,   53,   53,   55,   55,   55,   55,
-       55,   55,   55,   55,   55,   57,   57,   57,   57,   57,
-       57,   57,   57,   57,   60,  403,   60,   65,   65,   65,
-       71,   71,  403,   71,  125,  125,  125,  125,  403,  125,
-      125,  125,  125,  126,  126,  126,  126,  126,  126,  126,
-      126,  126,  129,  129,  129,  403,  129,  129,  129,  129,
-      129,  131,  403,  131,  131,  131,  131,  131,  131,  131,
-      135,  403,  403,  403,  403,  403,  135,   72,   72,  403,
-       72,  202,  403,  202,    9,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403
+       38,   38,   38,   51,   52,   59,   59,   59,   59,   63,
+       70,   64,   67,   68,   70,   70,   70,   63,   72,   64,
+       70,  121,   72,   72,   72,   70,  122,   75,   72,   83,
+       70,   76,   73,   72,   70,  129,   78,   74,   72,  306,
+       79,  266,   72,   80,  306,   70,   81,   77,   91,   82,
+
+       84,  104,   85,   72,  231,   70,   92,   70,   87,   70,
+      181,   93,   86,   72,  127,   72,  126,   72,   88,   70,
+      121,   89,   94,  124,   90,  122,   95,   72,   97,   70,
+       98,   70,   96,  100,   59,   59,   99,   72,   70,   72,
+       70,  101,  105,  102,  107,  103,   70,  108,   72,   70,
+       70,  128,  106,   70,   72,  111,  109,   72,   72,  116,
+      110,   72,  112,  306,   70,  130,   70,   70,   70,  113,
+       70,  114,   72,  115,   72,   72,   72,  131,   72,  127,
+      117,   70,  132,  133,   70,   70,   70,  118,   70,   72,
+      134,   70,   72,   72,   72,   70,   72,   70,  140,   72,
+
+      126,  124,  142,   72,   69,   72,   66,  135,   70,  137,
+      138,  143,  141,  136,  147,   70,   72,  139,  144,   70,
+      146,   70,  145,   72,   70,   70,   70,   72,   70,   72,
+       62,   61,   72,   72,   72,  306,   72,   58,  152,   70,
+       70,   70,   58,  148,  150,  149,  151,   72,   72,   72,
+       70,   56,  157,  153,  154,   70,   56,   70,   72,  156,
+       70,  155,  159,   72,  158,   72,   70,   70,   72,   54,
+       70,   70,   54,   70,   72,   72,   70,  161,   72,   72,
+      162,   72,  163,  160,   72,   70,  306,   70,  306,   70,
+      306,   70,   70,   72,  164,   72,  166,   72,  169,   72,
+
+       72,  165,  171,   70,   70,  167,  306,  170,  306,   70,
+       70,   72,   72,  168,  172,   70,  173,   72,   72,   70,
+       70,   70,  176,   72,  306,  174,  175,   72,   72,   72,
+       70,   70,  178,   70,   70,  177,  179,   70,   72,   72,
+      306,   72,   72,   70,   70,   72,  180,   70,  183,   70,
+      184,   72,   72,   70,  306,   72,  306,   72,  189,   70,
+      185,   72,  191,  306,  186,  188,   70,   72,   70,   70,
+      187,  190,  306,  306,   72,   70,   72,   72,  306,  195,
+      196,   70,   70,   72,   70,  192,  193,  306,  194,   72,
+       72,   70,   72,   70,  197,  200,   70,   70,  198,   72,
+
+       70,   72,  306,   70,   72,   72,  306,  202,   72,   70,
+      199,   72,  306,  203,  201,   70,  204,   72,   70,   70,
+      206,   70,   70,   72,  207,   70,   72,   72,  208,   72,
+       72,  205,   70,   72,  211,  306,  212,  209,   70,   70,
+       72,   70,  306,  210,   70,  213,   72,   72,   70,   72,
+      216,  215,   72,  306,  214,   70,   72,   70,   70,   70,
+       70,  219,  306,   72,  218,   72,   72,   72,   72,   70,
+      217,   70,  306,  306,   70,  306,   70,   72,  306,   72,
+      222,  224,   72,  220,   72,  226,  221,   70,   70,   70,
+       70,  223,   70,   70,   70,   72,   72,   72,   72,  225,
+
+       72,   72,   72,  306,  306,   70,  306,  306,  306,  229,
+      306,  230,  232,   72,  228,  233,  227,   70,  234,   70,
+       70,  306,   70,   70,   70,   72,   70,   72,   72,  237,
+       72,   72,   72,   70,   72,   70,  236,  240,   70,   70,
+       70,   72,  242,   72,   70,  235,   72,   72,   72,  241,
+      238,  239,   72,   70,  244,  306,   70,   70,   70,   70,
+       70,   72,   70,  243,   72,   72,   72,   72,   72,  245,
+       72,   70,   70,   70,   70,   70,  306,  306,  306,   72,
+       72,   72,   72,   72,   70,  246,  248,   70,  249,   70,
+      247,  306,   72,   70,   70,   72,   70,   72,   70,  250,
+
+      306,   72,   72,   70,   72,   70,   72,  251,  255,  253,
+      306,   72,  306,   72,  256,   70,   70,   70,  257,  252,
+      254,  306,   70,   72,   72,   72,   70,   70,   70,  259,
+       72,  306,  306,   70,   72,   72,   72,   70,  306,  260,
+      263,   72,  306,  258,   70,   72,  264,  306,  306,   70,
+      265,   70,   72,   70,   70,  261,  262,   72,   70,   72,
+       70,   72,   72,   70,   70,   70,   72,  268,   72,  306,
+       70,   72,   72,   72,   70,   70,   70,  271,   72,  267,
+      306,  306,   72,   72,   72,   70,  269,  272,  270,  275,
+       70,   70,  306,   72,   70,   70,  273,   70,   72,   72,
+
+      274,   70,   72,   72,   70,   72,   70,  276,   70,   72,
+      306,   70,   72,  278,   72,   70,   72,  282,  280,   72,
+       70,   70,  277,   72,   70,  306,   70,   70,   72,   72,
+      279,   70,   72,  281,   72,   72,  306,   70,   70,   72,
+      286,   70,   70,  283,  287,   72,   72,  284,  285,   72,
+       72,   70,   70,   70,   70,   70,  306,   70,   70,   72,
+       72,   72,   72,   72,  288,   72,   72,   70,   70,  306,
+       70,  291,   70,   70,   70,   72,   72,  289,   72,   70,
+       72,   72,   72,  290,   70,   70,   70,   72,  306,   70,
+      306,  292,   72,   72,   72,  293,  295,   72,  296,   70,
+
+       70,   70,   70,  294,   70,   70,   70,   72,   72,   72,
+       72,   70,   72,   72,   72,  297,   70,   70,   70,   72,
+      306,   70,   70,  299,   72,   72,   72,   70,  298,   72,
+       72,   70,   70,  303,  306,   72,  301,  306,   70,   72,
+       72,   70,  300,   70,  302,  304,   72,   70,  306,   72,
+      306,   72,  306,  306,  306,   72,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  305,   53,   53,   53,   53,   53,   53,   53,   53,
+       53,   55,   55,   55,   55,   55,   55,   55,   55,   55,
+       57,   57,   57,   57,   57,   57,   57,   57,   57,   60,
+
+      306,   60,   65,   65,   65,   71,   71,  306,   71,  119,
+      119,  119,  119,  306,  119,  119,  119,  119,  120,  120,
+      120,  120,  120,  120,  120,  120,  120,  123,  123,  123,
+      306,  123,  123,  123,  123,  123,  125,  306,  125,  125,
+      125,  125,  125,  125,  125,  129,  306,  306,  306,  306,
+      306,  129,   72,   72,  306,   72,  182,  306,  182,    9,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306
     } ;
 
-static const flex_int16_t yy_chk[1342] =
+static const flex_int16_t yy_chk[1016] =
     {   0,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
         1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,   11,   11,   12,   12,
-       25,   32,   25,   28,   28,   33,   38,   35,   49,   32,
-       64,   34,   64,   33,   38,   35,   49,   49,   33,   34,
-       35,   36,   33,   32,   35,   33,  318,   34,   32,   36,
-      268,   34,   37,  201,   34,   37,   39,   34,   33,   37,
-
-       34,   36,   37,   36,   39,   37,   41,   40,   37,   42,
-       39,   43,  134,   36,   41,   40,   54,   42,   39,   43,
-       40,   54,  126,   39,   40,   43,   44,  126,   45,   41,
-       40,   46,   42,   43,   44,   43,   45,   43,   42,   46,
-       43,   45,   59,   59,   46,   47,  133,   46,  132,   48,
-       45,   45,   44,   47,   47,   71,   46,   48,   50,  130,
-       46,   47,   72,   71,   46,   70,   50,   73,   47,   74,
-       75,   48,   65,   48,   50,   73,   76,   74,   75,   73,
-       74,   50,   77,  127,   76,   75,   78,   80,  127,   82,
-       77,   76,   79,   63,   78,   80,   74,   82,   76,   81,
-
-       79,   79,   82,   83,   84,   77,   85,   81,   58,   86,
-       80,   83,   84,   56,   85,   84,   80,   86,   87,   30,
-       81,   81,   26,   24,   84,   23,   87,   88,   81,   83,
-       87,   84,   89,   85,   90,   88,   86,   91,   92,   94,
-       89,   95,   90,   93,   88,   91,   92,   94,   96,   95,
-       97,   93,    9,   95,   98,    8,   96,   90,   97,   99,
-       89,   92,   98,   91,    7,   93,  100,   99,   95,   95,
-       99,  101,   97,   98,  100,  102,  103,  104,  100,  101,
-      105,  107,   99,  102,  103,  104,  106,    6,  105,  107,
-        5,    4,  109,  105,  106,  102,  108,  111,  106,  101,
-
-      109,  109,  110,  112,  108,  111,    3,  116,    0,  107,
-      110,  112,    0,  108,  110,  116,  109,  111,  113,  108,
-      109,  114,  115,  112,    0,  117,  113,  113,  111,  114,
-      115,  112,  115,  117,  116,  117,  118,  119,  120,  121,
-      122,  114,    0,  115,  118,  119,  120,  121,  122,  118,
-      123,  121,    0,  124,  136,  120,  137,    0,  123,    0,
-      122,  124,  136,  123,  137,  120,  139,  123,  138,  140,
-      143,    0,  119,    0,  139,    0,  138,  140,  143,  124,
-      141,  138,  142,  139,    0,    0,  140,  144,  141,  141,
-      142,  145,  142,  142,  147,  144,  143,    0,  146,  145,
-
-      150,  148,  147,  149,    0,  147,  146,  152,  150,  148,
-        0,  149,  149,  151,  144,  152,  154,  153,  145,  146,
-      152,  151,  146,  148,  154,  153,  150,  150,  153,  155,
-      156,  157,  158,  151,    0,    0,    0,  155,  156,  157,
-      158,  159,  155,  158,  154,  160,  155,  161,  163,  159,
-      159,    0,  162,  160,  164,  161,  163,  165,  166,  157,
-      162,  163,  164,  162,  167,  165,  166,  164,  161,    0,
-      165,  168,  167,  166,    0,  169,  170,  167,  171,  168,
-      165,    0,  164,  169,  170,  172,  171,  173,  174,  170,
-      168,    0,  171,  172,  175,  173,  174,    0,  176,  169,
-
-      177,  174,  175,    0,  178,  172,  176,  179,  177,  173,
-      180,  177,  178,  181,  182,  179,  178,  183,  180,    0,
-      176,  181,  182,  184,  185,  183,    0,  179,    0,  186,
-      187,  184,  185,  188,  182,  189,  184,  186,  187,  180,
-        0,  188,  190,  189,    0,  191,    0,    0,  181,  192,
-      190,  193,  183,  191,  190,  186,  194,  192,  195,  193,
-      188,  193,  193,    0,  194,  191,  195,    0,  196,    0,
-      197,  192,  198,  193,  199,  195,  196,  196,  197,  203,
-      198,  194,  199,  200,  204,  205,    0,  203,  206,  207,
-        0,  200,  204,  205,  199,  209,  206,  207,  198,  197,
-
-      208,  211,  200,  209,  210,  203,  204,  205,  208,  211,
-      212,    0,  210,  213,  206,  214,    0,  210,  212,  208,
-      215,  213,  213,  214,  214,  216,  217,  212,  215,  211,
-      220,    0,  218,  216,  217,  219,    0,  221,  220,  217,
-      218,  223,  222,  219,  219,  221,  224,    0,  215,  223,
-      222,    0,    0,  216,  224,  218,  225,  226,  220,  222,
-      224,  227,  228,  229,  225,  226,  230,  231,  232,  227,
-      228,  229,  233,  226,  230,  231,  232,  234,  235,    0,
-      233,    0,  236,    0,  237,  234,  235,  233,  238,  227,
-      236,  229,  237,  231,  232,  239,  238,  240,  230,  241,
-
-      242,  243,  244,  239,  245,  240,  235,  241,  242,  243,
-      244,  246,  245,  247,  251,  248,  249,  245,  250,  246,
-      240,  247,  251,  248,  249,  252,  250,  243,  250,  253,
-      244,  254,    0,  252,    0,    0,  252,  253,  251,  254,
-      247,  248,  253,  249,  255,    0,  257,  256,  258,  260,
-      259,    0,  255,  255,  257,  256,  258,  260,  259,  254,
-      256,  261,  262,  263,  267,  258,  259,  264,  265,  261,
-      262,  263,  267,    0,  266,  264,  265,  262,  260,    0,
-      264,  265,  266,    0,  269,  270,  271,  266,  272,  273,
-      261,  263,  269,  270,  271,  274,  272,  273,  275,  276,
-
-      278,  279,  277,  274,    0,    0,  275,  276,  278,  279,
-      277,  275,  269,  277,  271,  281,    0,  280,  282,    0,
-        0,  272,    0,  281,  273,  280,  282,  276,  278,    0,
-      280,  283,  284,  285,  286,  287,    0,  281,  288,  283,
-      284,  285,  286,  287,  282,  284,  288,    0,  289,    0,
-      290,  291,  292,  293,  294,  285,  289,  283,  290,  291,
-      292,  293,  294,  295,  296,  289,  293,  297,  298,  299,
-      294,  295,  296,    0,  300,  297,  298,  299,  301,  291,
-      298,  297,  300,  303,    0,  302,  301,  304,    0,    0,
-      305,  303,  295,  302,  302,  304,  300,  299,  305,  306,
-
-      307,    0,  308,  311,  309,  310,  301,  306,  307,  303,
-      308,  311,  309,  310,  310,  304,    0,    0,    0,  312,
-        0,  313,  314,  315,  311,  306,  309,  312,  307,  313,
-      314,  315,  312,  316,  317,  314,  319,  320,  321,  322,
-        0,  316,  317,  313,  319,  320,  321,  322,  323,  324,
-      315,  325,  326,  327,  328,  329,  323,  324,    0,  325,
-      326,  327,  328,  329,  330,    0,  322,  331,  333,    0,
-      332,    0,  330,  321,  323,  331,  333,  330,  332,  325,
-      334,  332,  328,    0,  335,  336,  337,  338,  334,  339,
-      340,  333,  335,  336,  337,  338,  341,  339,  340,  342,
-
-        0,  343,    0,  344,  341,  345,  346,  342,  337,  343,
-      335,  344,  343,  345,  346,  347,  340,    0,  339,  349,
-      344,  348,    0,  347,  350,  342,    0,  349,  347,  348,
-      348,  351,  350,  352,  350,  353,  354,    0,    0,  351,
-      355,  352,  356,  353,  354,  349,  352,  357,  355,  358,
-      356,    0,    0,  359,  360,  357,  361,  358,  362,  356,
-      357,  359,  360,  363,  361,  364,  362,  365,  355,    0,
-      366,  363,    0,  364,  367,  365,    0,  364,  366,  368,
-      362,  369,  367,  370,  361,    0,  371,  368,  372,  369,
-        0,  370,  373,  365,  371,    0,  372,    0,  368,  374,
-
-      373,  375,  376,  369,    0,  373,  377,  374,  378,  375,
-      376,  374,  371,  379,  377,  380,  378,  381,  377,  382,
-      383,  379,    0,  380,  375,  381,  384,  382,  383,  385,
-      381,  386,  387,  388,  384,  389,  376,  385,    0,  386,
-      387,  388,  390,  389,  391,  392,  388,    0,  383,  393,
-      390,    0,  391,  392,  394,  385,  395,  393,  391,  384,
-      396,  397,  394,  398,  395,  399,  400,  387,  396,  397,
-      401,  398,  402,  399,  400,  399,  394,    0,  401,  400,
-      402,    0,    0,    0,  398,    0,    0,    0,    0,    0,
-      397,    0,    0,    0,    0,    0,  401,  404,  404,  404,
-
-      404,  404,  404,  404,  404,  404,  405,  405,  405,  405,
-      405,  405,  405,  405,  405,  406,  406,  406,  406,  406,
-      406,  406,  406,  406,  407,    0,  407,  408,  408,  408,
-      409,  409,    0,  409,  410,  410,  410,  410,    0,  410,
-      410,  410,  410,  411,  411,  411,  411,  411,  411,  411,
-      411,  411,  412,  412,  412,    0,  412,  412,  412,  412,
-      412,  413,    0,  413,  413,  413,  413,  413,  413,  413,
-      414,    0,    0,    0,    0,    0,  414,  415,  415,    0,
-      415,  416,    0,  416,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403,  403,  403,  403,  403,  403,  403,  403,  403,  403,
-      403
+        1,    1,    1,    1,    1,   11,   11,   12,   12,   25,
+       32,   25,   28,   28,   33,   38,   35,   64,   32,   64,
+       34,   54,   33,   38,   35,   44,   54,   33,   34,   35,
+       36,   33,   32,   44,   39,  266,   34,   32,   36,  120,
+       34,  231,   39,   34,  120,   37,   34,   33,   39,   34,
+
+       36,   44,   36,   37,  181,   41,   39,   42,   37,   40,
+      128,   39,   36,   41,  127,   42,  126,   40,   37,   43,
+      121,   37,   40,  124,   37,  121,   40,   43,   41,   45,
+       42,   46,   40,   43,   59,   59,   42,   45,   72,   46,
+       71,   43,   45,   43,   46,   43,   47,   46,   71,   48,
+       49,   70,   45,   73,   47,   47,   46,   48,   49,   49,
+       46,   73,   47,   65,   50,   73,   74,   75,   76,   47,
+       77,   48,   50,   48,   74,   75,   76,   74,   77,   63,
+       50,   78,   75,   76,   79,   81,   82,   50,   80,   78,
+       78,   83,   79,   81,   82,   84,   80,   86,   81,   83,
+
+       58,   56,   83,   84,   30,   86,   26,   79,   85,   80,
+       80,   83,   82,   79,   86,   87,   85,   80,   83,   88,
+       85,   89,   84,   87,   90,   91,   92,   88,   93,   89,
+       24,   23,   90,   91,   92,    9,   93,    8,   92,   94,
+       95,   96,    7,   87,   89,   88,   90,   94,   95,   96,
+       97,    6,   96,   92,   92,   98,    5,   99,   97,   95,
+      100,   94,   97,   98,   96,   99,  101,  102,  100,    4,
+      103,  104,    3,  105,  101,  102,  106,   99,  103,  104,
+      102,  105,  103,   98,  106,  107,    0,  109,    0,  108,
+        0,  113,  110,  107,  104,  109,  106,  108,  108,  113,
+
+      110,  105,  110,  112,  111,  107,    0,  109,    0,  114,
+      115,  112,  111,  107,  111,  116,  112,  114,  115,  117,
+      118,  130,  115,  116,    0,  113,  114,  117,  118,  130,
+      131,  132,  117,  133,  134,  116,  117,  135,  131,  132,
+        0,  133,  134,  136,  137,  135,  118,  138,  132,  139,
+      133,  136,  137,  140,    0,  138,    0,  139,  138,  141,
+      134,  140,  140,    0,  135,  137,  143,  141,  142,  144,
+      136,  139,    0,    0,  143,  146,  142,  144,    0,  143,
+      144,  145,  147,  146,  148,  141,  141,    0,  142,  145,
+      147,  149,  148,  150,  145,  148,  151,  154,  145,  149,
+
+      152,  150,    0,  153,  151,  154,    0,  151,  152,  155,
+      147,  153,    0,  152,  150,  156,  153,  155,  157,  158,
+      154,  159,  160,  156,  155,  161,  157,  158,  156,  159,
+      160,  153,  162,  161,  159,    0,  160,  157,  163,  164,
+      162,  165,    0,  158,  166,  161,  163,  164,  167,  165,
+      164,  163,  166,    0,  162,  168,  167,  169,  170,  171,
+      172,  167,    0,  168,  166,  169,  170,  171,  172,  173,
+      165,  174,    0,    0,  175,    0,  176,  173,    0,  174,
+      172,  174,  175,  169,  176,  176,  171,  177,  178,  179,
+      183,  173,  180,  184,  185,  177,  178,  179,  183,  175,
+
+      180,  184,  185,    0,    0,  186,    0,    0,    0,  179,
+        0,  180,  183,  186,  178,  184,  177,  187,  186,  188,
+      189,    0,  190,  191,  192,  187,  193,  188,  189,  189,
+      190,  191,  192,  194,  193,  195,  188,  192,  196,  197,
+      198,  194,  194,  195,  199,  187,  196,  197,  198,  193,
+      190,  191,  199,  200,  198,    0,  201,  202,  203,  206,
+      204,  200,  205,  195,  201,  202,  203,  206,  204,  200,
+      205,  207,  208,  209,  210,  211,    0,    0,    0,  207,
+      208,  209,  210,  211,  212,  202,  204,  213,  205,  214,
+      203,    0,  212,  215,  217,  213,  216,  214,  218,  207,
+
+        0,  215,  217,  219,  216,  220,  218,  212,  218,  216,
+        0,  219,    0,  220,  219,  221,  222,  223,  220,  215,
+      217,    0,  224,  221,  222,  223,  225,  227,  226,  222,
+      224,    0,    0,  228,  225,  227,  226,  229,    0,  224,
+      227,  228,    0,  221,  230,  229,  228,    0,    0,  232,
+      229,  233,  230,  234,  235,  225,  226,  232,  236,  233,
+      237,  234,  235,  238,  239,  240,  236,  235,  237,    0,
+      241,  238,  239,  240,  242,  244,  243,  239,  241,  233,
+        0,    0,  242,  244,  243,  245,  236,  240,  237,  243,
+      246,  247,    0,  245,  248,  249,  241,  250,  246,  247,
+
+      242,  251,  248,  249,  252,  250,  253,  246,  255,  251,
+        0,  254,  252,  250,  253,  256,  255,  255,  253,  254,
+      257,  258,  248,  256,  259,    0,  260,  261,  257,  258,
+      251,  262,  259,  254,  260,  261,    0,  263,  264,  262,
+      261,  265,  267,  256,  262,  263,  264,  258,  260,  265,
+      267,  268,  269,  270,  271,  272,    0,  273,  274,  268,
+      269,  270,  271,  272,  263,  273,  274,  275,  276,    0,
+      277,  274,  278,  279,  280,  275,  276,  268,  277,  281,
+      278,  279,  280,  272,  283,  282,  284,  281,    0,  285,
+        0,  276,  283,  282,  284,  279,  282,  285,  285,  286,
+
+      287,  288,  289,  280,  290,  291,  292,  286,  287,  288,
+      289,  293,  290,  291,  292,  289,  294,  295,  296,  293,
+        0,  297,  298,  293,  294,  295,  296,  299,  292,  297,
+      298,  301,  300,  297,    0,  299,  295,    0,  302,  301,
+      300,  303,  294,  304,  296,  300,  302,  305,    0,  303,
+        0,  304,    0,    0,    0,  305,    0,    0,    0,    0,
+        0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+        0,  302,  307,  307,  307,  307,  307,  307,  307,  307,
+      307,  308,  308,  308,  308,  308,  308,  308,  308,  308,
+      309,  309,  309,  309,  309,  309,  309,  309,  309,  310,
+
+        0,  310,  311,  311,  311,  312,  312,    0,  312,  313,
+      313,  313,  313,    0,  313,  313,  313,  313,  314,  314,
+      314,  314,  314,  314,  314,  314,  314,  315,  315,  315,
+        0,  315,  315,  315,  315,  315,  316,    0,  316,  316,
+      316,  316,  316,  316,  316,  317,    0,    0,    0,    0,
+        0,  317,  318,  318,    0,  318,  319,    0,  319,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+
+      306,  306,  306,  306,  306,  306,  306,  306,  306,  306,
+      306,  306,  306,  306,  306
     } ;
 
 static yy_state_type yy_last_accepting_state;
@@ -961,9 +856,9 @@ string_append(
 	stringbuf_len += len;
 }
 
-#line 964 "lexyy.cc"
+#line 859 "lexyy.cc"
 
-#line 966 "lexyy.cc"
+#line 861 "lexyy.cc"
 
 #define INITIAL 0
 #define comment 1
@@ -1184,7 +1079,7 @@ YY_DECL
 #line 112 "pars0lex.l"
 
 
-#line 1187 "lexyy.cc"
+#line 1082 "lexyy.cc"
 
 	while ( /*CONSTCOND*/1 )		/* loops until end-of-file is reached */
 		{
@@ -1211,13 +1106,13 @@ yy_match:
 			while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 				{
 				yy_current_state = (int) yy_def[yy_current_state];
-				if ( yy_current_state >= 404 )
+				if ( yy_current_state >= 307 )
 					yy_c = yy_meta[yy_c];
 				}
 			yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
 			++yy_cp;
 			}
-		while ( yy_current_state != 403 );
+		while ( yy_current_state != 306 );
 		yy_cp = (yy_last_accepting_cpos);
 		yy_current_state = (yy_last_accepting_state);
 
@@ -1436,544 +1331,397 @@ case 18:
 YY_RULE_SETUP
 #line 252 "pars0lex.l"
 {
-			return(PARS_OUT_TOKEN);
+			return(PARS_INT_TOKEN);
 }
 	YY_BREAK
 case 19:
 YY_RULE_SETUP
 #line 256 "pars0lex.l"
 {
-			return(PARS_BINARY_TOKEN);
+			return(PARS_CHAR_TOKEN);
 }
 	YY_BREAK
 case 20:
 YY_RULE_SETUP
 #line 260 "pars0lex.l"
 {
-			return(PARS_BLOB_TOKEN);
+			return(PARS_IS_TOKEN);
 }
 	YY_BREAK
 case 21:
 YY_RULE_SETUP
 #line 264 "pars0lex.l"
 {
-			return(PARS_INT_TOKEN);
+			return(PARS_BEGIN_TOKEN);
 }
 	YY_BREAK
 case 22:
 YY_RULE_SETUP
 #line 268 "pars0lex.l"
 {
-			return(PARS_INT_TOKEN);
+			return(PARS_END_TOKEN);
 }
 	YY_BREAK
 case 23:
 YY_RULE_SETUP
 #line 272 "pars0lex.l"
 {
-			return(PARS_FLOAT_TOKEN);
+			return(PARS_IF_TOKEN);
 }
 	YY_BREAK
 case 24:
 YY_RULE_SETUP
 #line 276 "pars0lex.l"
 {
-			return(PARS_CHAR_TOKEN);
+			return(PARS_THEN_TOKEN);
 }
 	YY_BREAK
 case 25:
 YY_RULE_SETUP
 #line 280 "pars0lex.l"
 {
-			return(PARS_IS_TOKEN);
+			return(PARS_ELSE_TOKEN);
 }
 	YY_BREAK
 case 26:
 YY_RULE_SETUP
 #line 284 "pars0lex.l"
 {
-			return(PARS_BEGIN_TOKEN);
+			return(PARS_ELSIF_TOKEN);
 }
 	YY_BREAK
 case 27:
 YY_RULE_SETUP
 #line 288 "pars0lex.l"
 {
-			return(PARS_END_TOKEN);
+			return(PARS_LOOP_TOKEN);
 }
 	YY_BREAK
 case 28:
 YY_RULE_SETUP
 #line 292 "pars0lex.l"
 {
-			return(PARS_IF_TOKEN);
+			return(PARS_WHILE_TOKEN);
 }
 	YY_BREAK
 case 29:
 YY_RULE_SETUP
 #line 296 "pars0lex.l"
 {
-			return(PARS_THEN_TOKEN);
+			return(PARS_RETURN_TOKEN);
 }
 	YY_BREAK
 case 30:
 YY_RULE_SETUP
 #line 300 "pars0lex.l"
 {
-			return(PARS_ELSE_TOKEN);
+			return(PARS_SELECT_TOKEN);
 }
 	YY_BREAK
 case 31:
 YY_RULE_SETUP
 #line 304 "pars0lex.l"
 {
-			return(PARS_ELSIF_TOKEN);
+			return(PARS_COUNT_TOKEN);
 }
 	YY_BREAK
 case 32:
 YY_RULE_SETUP
 #line 308 "pars0lex.l"
 {
-			return(PARS_LOOP_TOKEN);
+			return(PARS_FROM_TOKEN);
 }
 	YY_BREAK
 case 33:
 YY_RULE_SETUP
 #line 312 "pars0lex.l"
 {
-			return(PARS_WHILE_TOKEN);
+			return(PARS_WHERE_TOKEN);
 }
 	YY_BREAK
 case 34:
 YY_RULE_SETUP
 #line 316 "pars0lex.l"
 {
-			return(PARS_RETURN_TOKEN);
+			return(PARS_FOR_TOKEN);
 }
 	YY_BREAK
 case 35:
 YY_RULE_SETUP
 #line 320 "pars0lex.l"
 {
-			return(PARS_SELECT_TOKEN);
+			return(PARS_ORDER_TOKEN);
 }
 	YY_BREAK
 case 36:
 YY_RULE_SETUP
 #line 324 "pars0lex.l"
 {
-			return(PARS_SUM_TOKEN);
+			return(PARS_BY_TOKEN);
 }
 	YY_BREAK
 case 37:
 YY_RULE_SETUP
 #line 328 "pars0lex.l"
 {
-			return(PARS_COUNT_TOKEN);
+			return(PARS_ASC_TOKEN);
 }
 	YY_BREAK
 case 38:
 YY_RULE_SETUP
 #line 332 "pars0lex.l"
 {
-			return(PARS_DISTINCT_TOKEN);
+			return(PARS_DESC_TOKEN);
 }
 	YY_BREAK
 case 39:
 YY_RULE_SETUP
 #line 336 "pars0lex.l"
 {
-			return(PARS_FROM_TOKEN);
+			return(PARS_INSERT_TOKEN);
 }
 	YY_BREAK
 case 40:
 YY_RULE_SETUP
 #line 340 "pars0lex.l"
 {
-			return(PARS_WHERE_TOKEN);
+			return(PARS_INTO_TOKEN);
 }
 	YY_BREAK
 case 41:
 YY_RULE_SETUP
 #line 344 "pars0lex.l"
 {
-			return(PARS_FOR_TOKEN);
+			return(PARS_VALUES_TOKEN);
 }
 	YY_BREAK
 case 42:
 YY_RULE_SETUP
 #line 348 "pars0lex.l"
 {
-			return(PARS_READ_TOKEN);
+			return(PARS_UPDATE_TOKEN);
 }
 	YY_BREAK
 case 43:
 YY_RULE_SETUP
 #line 352 "pars0lex.l"
 {
-			return(PARS_ORDER_TOKEN);
+			return(PARS_SET_TOKEN);
 }
 	YY_BREAK
 case 44:
 YY_RULE_SETUP
 #line 356 "pars0lex.l"
 {
-			return(PARS_BY_TOKEN);
+			return(PARS_DELETE_TOKEN);
 }
 	YY_BREAK
 case 45:
 YY_RULE_SETUP
 #line 360 "pars0lex.l"
 {
-			return(PARS_ASC_TOKEN);
+			return(PARS_CURRENT_TOKEN);
 }
 	YY_BREAK
 case 46:
 YY_RULE_SETUP
 #line 364 "pars0lex.l"
 {
-			return(PARS_DESC_TOKEN);
+			return(PARS_OF_TOKEN);
 }
 	YY_BREAK
 case 47:
 YY_RULE_SETUP
 #line 368 "pars0lex.l"
 {
-			return(PARS_INSERT_TOKEN);
+			return(PARS_CREATE_TOKEN);
 }
 	YY_BREAK
 case 48:
 YY_RULE_SETUP
 #line 372 "pars0lex.l"
 {
-			return(PARS_INTO_TOKEN);
+			return(PARS_TABLE_TOKEN);
 }
 	YY_BREAK
 case 49:
 YY_RULE_SETUP
 #line 376 "pars0lex.l"
 {
-			return(PARS_VALUES_TOKEN);
+			return(PARS_INDEX_TOKEN);
 }
 	YY_BREAK
 case 50:
 YY_RULE_SETUP
 #line 380 "pars0lex.l"
 {
-			return(PARS_UPDATE_TOKEN);
+			return(PARS_UNIQUE_TOKEN);
 }
 	YY_BREAK
 case 51:
 YY_RULE_SETUP
 #line 384 "pars0lex.l"
 {
-			return(PARS_SET_TOKEN);
+			return(PARS_CLUSTERED_TOKEN);
 }
 	YY_BREAK
 case 52:
 YY_RULE_SETUP
 #line 388 "pars0lex.l"
 {
-			return(PARS_DELETE_TOKEN);
+			return(PARS_ON_TOKEN);
 }
 	YY_BREAK
 case 53:
 YY_RULE_SETUP
 #line 392 "pars0lex.l"
 {
-			return(PARS_CURRENT_TOKEN);
+			return(PARS_DECLARE_TOKEN);
 }
 	YY_BREAK
 case 54:
 YY_RULE_SETUP
 #line 396 "pars0lex.l"
 {
-			return(PARS_OF_TOKEN);
+			return(PARS_CURSOR_TOKEN);
 }
 	YY_BREAK
 case 55:
 YY_RULE_SETUP
 #line 400 "pars0lex.l"
 {
-			return(PARS_CREATE_TOKEN);
+			return(PARS_OPEN_TOKEN);
 }
 	YY_BREAK
 case 56:
 YY_RULE_SETUP
 #line 404 "pars0lex.l"
 {
-			return(PARS_TABLE_TOKEN);
+			return(PARS_FETCH_TOKEN);
 }
 	YY_BREAK
 case 57:
 YY_RULE_SETUP
 #line 408 "pars0lex.l"
 {
-			return(PARS_COMPACT_TOKEN);
+			return(PARS_CLOSE_TOKEN);
 }
 	YY_BREAK
 case 58:
 YY_RULE_SETUP
 #line 412 "pars0lex.l"
 {
-			return(PARS_BLOCK_SIZE_TOKEN);
+			return(PARS_NOTFOUND_TOKEN);
 }
 	YY_BREAK
 case 59:
 YY_RULE_SETUP
 #line 416 "pars0lex.l"
 {
-			return(PARS_INDEX_TOKEN);
+			return(PARS_TO_BINARY_TOKEN);
 }
 	YY_BREAK
 case 60:
 YY_RULE_SETUP
 #line 420 "pars0lex.l"
 {
-			return(PARS_UNIQUE_TOKEN);
+			return(PARS_SUBSTR_TOKEN);
 }
 	YY_BREAK
 case 61:
 YY_RULE_SETUP
 #line 424 "pars0lex.l"
 {
-			return(PARS_CLUSTERED_TOKEN);
+			return(PARS_CONCAT_TOKEN);
 }
 	YY_BREAK
 case 62:
 YY_RULE_SETUP
 #line 428 "pars0lex.l"
 {
-			return(PARS_ON_TOKEN);
+			return(PARS_INSTR_TOKEN);
 }
 	YY_BREAK
 case 63:
 YY_RULE_SETUP
 #line 432 "pars0lex.l"
 {
-			return(PARS_DECLARE_TOKEN);
+			return(PARS_LENGTH_TOKEN);
 }
 	YY_BREAK
 case 64:
 YY_RULE_SETUP
 #line 436 "pars0lex.l"
 {
-			return(PARS_CURSOR_TOKEN);
+			return(PARS_COMMIT_TOKEN);
 }
 	YY_BREAK
 case 65:
 YY_RULE_SETUP
 #line 440 "pars0lex.l"
 {
-			return(PARS_OPEN_TOKEN);
+			return(PARS_ROLLBACK_TOKEN);
 }
 	YY_BREAK
 case 66:
 YY_RULE_SETUP
 #line 444 "pars0lex.l"
 {
-			return(PARS_FETCH_TOKEN);
+			return(PARS_WORK_TOKEN);
 }
 	YY_BREAK
 case 67:
 YY_RULE_SETUP
 #line 448 "pars0lex.l"
 {
-			return(PARS_CLOSE_TOKEN);
+			return(PARS_EXIT_TOKEN);
 }
 	YY_BREAK
 case 68:
 YY_RULE_SETUP
 #line 452 "pars0lex.l"
 {
-			return(PARS_NOTFOUND_TOKEN);
+			return(PARS_FUNCTION_TOKEN);
 }
 	YY_BREAK
 case 69:
 YY_RULE_SETUP
 #line 456 "pars0lex.l"
 {
-			return(PARS_TO_CHAR_TOKEN);
+			return(PARS_LOCK_TOKEN);
 }
 	YY_BREAK
 case 70:
 YY_RULE_SETUP
 #line 460 "pars0lex.l"
 {
-			return(PARS_TO_NUMBER_TOKEN);
+			return(PARS_SHARE_TOKEN);
 }
 	YY_BREAK
 case 71:
 YY_RULE_SETUP
 #line 464 "pars0lex.l"
 {
-			return(PARS_TO_BINARY_TOKEN);
+			return(PARS_MODE_TOKEN);
 }
 	YY_BREAK
 case 72:
 YY_RULE_SETUP
 #line 468 "pars0lex.l"
 {
-			return(PARS_BINARY_TO_NUMBER_TOKEN);
+                        return(PARS_LIKE_TOKEN);
 }
 	YY_BREAK
 case 73:
 YY_RULE_SETUP
 #line 472 "pars0lex.l"
 {
-			return(PARS_SUBSTR_TOKEN);
+			return(PARS_BIGINT_TOKEN);
 }
 	YY_BREAK
 case 74:
 YY_RULE_SETUP
 #line 476 "pars0lex.l"
-{
-			return(PARS_REPLSTR_TOKEN);
-}
-	YY_BREAK
-case 75:
-YY_RULE_SETUP
-#line 480 "pars0lex.l"
-{
-			return(PARS_CONCAT_TOKEN);
-}
-	YY_BREAK
-case 76:
-YY_RULE_SETUP
-#line 484 "pars0lex.l"
-{
-			return(PARS_INSTR_TOKEN);
-}
-	YY_BREAK
-case 77:
-YY_RULE_SETUP
-#line 488 "pars0lex.l"
-{
-			return(PARS_LENGTH_TOKEN);
-}
-	YY_BREAK
-case 78:
-YY_RULE_SETUP
-#line 492 "pars0lex.l"
-{
-			return(PARS_SYSDATE_TOKEN);
-}
-	YY_BREAK
-case 79:
-YY_RULE_SETUP
-#line 496 "pars0lex.l"
-{
-			return(PARS_PRINTF_TOKEN);
-}
-	YY_BREAK
-case 80:
-YY_RULE_SETUP
-#line 500 "pars0lex.l"
-{
-			return(PARS_ASSERT_TOKEN);
-}
-	YY_BREAK
-case 81:
-YY_RULE_SETUP
-#line 504 "pars0lex.l"
-{
-			return(PARS_RND_TOKEN);
-}
-	YY_BREAK
-case 82:
-YY_RULE_SETUP
-#line 508 "pars0lex.l"
-{
-			return(PARS_RND_STR_TOKEN);
-}
-	YY_BREAK
-case 83:
-YY_RULE_SETUP
-#line 512 "pars0lex.l"
-{
-			return(PARS_ROW_PRINTF_TOKEN);
-}
-	YY_BREAK
-case 84:
-YY_RULE_SETUP
-#line 516 "pars0lex.l"
-{
-			return(PARS_COMMIT_TOKEN);
-}
-	YY_BREAK
-case 85:
-YY_RULE_SETUP
-#line 520 "pars0lex.l"
-{
-			return(PARS_ROLLBACK_TOKEN);
-}
-	YY_BREAK
-case 86:
-YY_RULE_SETUP
-#line 524 "pars0lex.l"
-{
-			return(PARS_WORK_TOKEN);
-}
-	YY_BREAK
-case 87:
-YY_RULE_SETUP
-#line 528 "pars0lex.l"
-{
-			return(PARS_UNSIGNED_TOKEN);
-}
-	YY_BREAK
-case 88:
-YY_RULE_SETUP
-#line 532 "pars0lex.l"
-{
-			return(PARS_EXIT_TOKEN);
-}
-	YY_BREAK
-case 89:
-YY_RULE_SETUP
-#line 536 "pars0lex.l"
-{
-			return(PARS_FUNCTION_TOKEN);
-}
-	YY_BREAK
-case 90:
-YY_RULE_SETUP
-#line 540 "pars0lex.l"
-{
-			return(PARS_LOCK_TOKEN);
-}
-	YY_BREAK
-case 91:
-YY_RULE_SETUP
-#line 544 "pars0lex.l"
-{
-			return(PARS_SHARE_TOKEN);
-}
-	YY_BREAK
-case 92:
-YY_RULE_SETUP
-#line 548 "pars0lex.l"
-{
-			return(PARS_MODE_TOKEN);
-}
-	YY_BREAK
-case 93:
-YY_RULE_SETUP
-#line 552 "pars0lex.l"
-{
-                        return(PARS_LIKE_TOKEN);
-}
-	YY_BREAK
-case 94:
-YY_RULE_SETUP
-#line 556 "pars0lex.l"
-{
-			return(PARS_BIGINT_TOKEN);
-}
-	YY_BREAK
-case 95:
-YY_RULE_SETUP
-#line 560 "pars0lex.l"
 {
 			yylval = sym_tab_add_id(pars_sym_tab_global,
 							(byte*) yytext,
@@ -1981,9 +1729,9 @@ YY_RULE_SETUP
 			return(PARS_ID_TOKEN);
 }
 	YY_BREAK
-case 96:
+case 75:
 YY_RULE_SETUP
-#line 567 "pars0lex.l"
+#line 483 "pars0lex.l"
 {
 			yylval = sym_tab_add_id(pars_sym_tab_global,
 							(byte*) yytext,
@@ -1991,192 +1739,192 @@ YY_RULE_SETUP
 			return(PARS_TABLE_NAME_TOKEN);
 }
 	YY_BREAK
-case 97:
+case 76:
 YY_RULE_SETUP
-#line 574 "pars0lex.l"
+#line 490 "pars0lex.l"
 {
 			return(PARS_DDOT_TOKEN);
 }
 	YY_BREAK
-case 98:
+case 77:
 YY_RULE_SETUP
-#line 578 "pars0lex.l"
+#line 494 "pars0lex.l"
 {
 			return(PARS_ASSIGN_TOKEN);
 }
 	YY_BREAK
-case 99:
+case 78:
 YY_RULE_SETUP
-#line 582 "pars0lex.l"
+#line 498 "pars0lex.l"
 {
 			return(PARS_LE_TOKEN);
 }
 	YY_BREAK
-case 100:
+case 79:
 YY_RULE_SETUP
-#line 586 "pars0lex.l"
+#line 502 "pars0lex.l"
 {
 			return(PARS_GE_TOKEN);
 }
 	YY_BREAK
-case 101:
+case 80:
 YY_RULE_SETUP
-#line 590 "pars0lex.l"
+#line 506 "pars0lex.l"
 {
 			return(PARS_NE_TOKEN);
 }
 	YY_BREAK
-case 102:
+case 81:
 YY_RULE_SETUP
-#line 594 "pars0lex.l"
+#line 510 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 103:
+case 82:
 YY_RULE_SETUP
-#line 599 "pars0lex.l"
+#line 515 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 104:
+case 83:
 YY_RULE_SETUP
-#line 604 "pars0lex.l"
+#line 520 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 105:
+case 84:
 YY_RULE_SETUP
-#line 609 "pars0lex.l"
+#line 525 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 106:
+case 85:
 YY_RULE_SETUP
-#line 614 "pars0lex.l"
+#line 530 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 107:
+case 86:
 YY_RULE_SETUP
-#line 619 "pars0lex.l"
+#line 535 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 108:
+case 87:
 YY_RULE_SETUP
-#line 624 "pars0lex.l"
+#line 540 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 109:
+case 88:
 YY_RULE_SETUP
-#line 629 "pars0lex.l"
+#line 545 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 110:
+case 89:
 YY_RULE_SETUP
-#line 634 "pars0lex.l"
+#line 550 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 111:
+case 90:
 YY_RULE_SETUP
-#line 639 "pars0lex.l"
+#line 555 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 112:
+case 91:
 YY_RULE_SETUP
-#line 644 "pars0lex.l"
+#line 560 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 113:
+case 92:
 YY_RULE_SETUP
-#line 649 "pars0lex.l"
+#line 565 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 114:
+case 93:
 YY_RULE_SETUP
-#line 654 "pars0lex.l"
+#line 570 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 115:
+case 94:
 YY_RULE_SETUP
-#line 659 "pars0lex.l"
+#line 575 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 116:
+case 95:
 YY_RULE_SETUP
-#line 664 "pars0lex.l"
+#line 580 "pars0lex.l"
 {
 
 			return((int)(*yytext));
 }
 	YY_BREAK
-case 117:
+case 96:
 YY_RULE_SETUP
-#line 669 "pars0lex.l"
+#line 585 "pars0lex.l"
 BEGIN(comment); /* eat up comment */
 	YY_BREAK
-case 118:
-/* rule 118 can match eol */
+case 97:
+/* rule 97 can match eol */
 YY_RULE_SETUP
-#line 671 "pars0lex.l"
+#line 587 "pars0lex.l"
 
 	YY_BREAK
-case 119:
-/* rule 119 can match eol */
+case 98:
+/* rule 98 can match eol */
 YY_RULE_SETUP
-#line 672 "pars0lex.l"
+#line 588 "pars0lex.l"
 
 	YY_BREAK
-case 120:
+case 99:
 YY_RULE_SETUP
-#line 673 "pars0lex.l"
+#line 589 "pars0lex.l"
 BEGIN(INITIAL);
 	YY_BREAK
-case 121:
-/* rule 121 can match eol */
+case 100:
+/* rule 100 can match eol */
 YY_RULE_SETUP
-#line 675 "pars0lex.l"
+#line 591 "pars0lex.l"
 /* eat up whitespace */
 	YY_BREAK
-case 122:
+case 101:
 YY_RULE_SETUP
-#line 678 "pars0lex.l"
+#line 594 "pars0lex.l"
 {
 			fprintf(stderr,"Unrecognized character: %02x\n",
 				*yytext);
@@ -2186,12 +1934,12 @@ YY_RULE_SETUP
 			return(0);
 }
 	YY_BREAK
-case 123:
+case 102:
 YY_RULE_SETUP
-#line 687 "pars0lex.l"
+#line 603 "pars0lex.l"
 YY_FATAL_ERROR( "flex scanner jammed" );
 	YY_BREAK
-#line 2194 "lexyy.cc"
+#line 1942 "lexyy.cc"
 case YY_STATE_EOF(INITIAL):
 case YY_STATE_EOF(comment):
 case YY_STATE_EOF(quoted):
@@ -2492,7 +2240,7 @@ static int yy_get_next_buffer (void)
 		while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 			{
 			yy_current_state = (int) yy_def[yy_current_state];
-			if ( yy_current_state >= 404 )
+			if ( yy_current_state >= 307 )
 				yy_c = yy_meta[yy_c];
 			}
 		yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
@@ -2520,11 +2268,11 @@ static int yy_get_next_buffer (void)
 	while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
 		{
 		yy_current_state = (int) yy_def[yy_current_state];
-		if ( yy_current_state >= 404 )
+		if ( yy_current_state >= 307 )
 			yy_c = yy_meta[yy_c];
 		}
 	yy_current_state = yy_nxt[yy_base[yy_current_state] + yy_c];
-	yy_is_jam = (yy_current_state == 403);
+	yy_is_jam = (yy_current_state == 306);
 
 		return yy_is_jam ? 0 : yy_current_state;
 }
@@ -3077,7 +2825,7 @@ static void yyfree (void * ptr )
 
 #define YYTABLES_NAME "yytables"
 
-#line 687 "pars0lex.l"
+#line 603 "pars0lex.l"
 
 
 /**********************************************************************
diff --git a/storage/innobase/pars/pars0grm.cc b/storage/innobase/pars/pars0grm.cc
index a0a09771106..7e10a783310 100644
--- a/storage/innobase/pars/pars0grm.cc
+++ b/storage/innobase/pars/pars0grm.cc
@@ -1,8 +1,9 @@
-/* A Bison parser, made by GNU Bison 3.0.4.  */
+/* A Bison parser, made by GNU Bison 3.4.2.  */
 
 /* Bison implementation for Yacc-like parsers in C
 
-   Copyright (C) 1984, 1989-1990, 2000-2015 Free Software Foundation, Inc.
+   Copyright (C) 1984, 1989-1990, 2000-2015, 2018-2019 Free Software Foundation,
+   Inc.
 
    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
@@ -40,11 +41,14 @@
    define necessary library symbols; they are noted "INFRINGES ON
    USER NAME SPACE" below.  */
 
+/* Undocumented macros, especially those whose name start with YY_,
+   are private implementation details.  Do not rely on them.  */
+
 /* Identify Bison output.  */
 #define YYBISON 1
 
 /* Bison version.  */
-#define YYBISON_VERSION "3.0.4"
+#define YYBISON_VERSION "3.4.2"
 
 /* Skeleton name.  */
 #define YYSKELETON_NAME "yacc.c"
@@ -61,8 +65,8 @@
 
 
 
-/* Copy the first part of user declarations.  */
-#line 29 "pars0grm.y" /* yacc.c:339  */
+/* First part of user prologue.  */
+#line 29 "pars0grm.y"
 
 /* The value of the semantic attribute is a pointer to a query tree node
 que_node_t */
@@ -81,13 +85,17 @@ que_node_t */
 int
 yylex(void);
 
-#line 85 "pars0grm.cc" /* yacc.c:339  */
+#line 89 "pars0grm.cc"
 
 # ifndef YY_NULLPTR
-#  if defined __cplusplus && 201103L <= __cplusplus
-#   define YY_NULLPTR nullptr
+#  if defined __cplusplus
+#   if 201103L <= __cplusplus
+#    define YY_NULLPTR nullptr
+#   else
+#    define YY_NULLPTR 0
+#   endif
 #  else
-#   define YY_NULLPTR 0
+#   define YY_NULLPTR ((void*)0)
 #  endif
 # endif
 
@@ -99,8 +107,8 @@ yylex(void);
 # define YYERROR_VERBOSE 0
 #endif
 
-/* In a future release of Bison, this section will be replaced
-   by #include "pars0grm.tab.h".  */
+/* Use api.header.include to #include this header
+   instead of duplicating it here.  */
 #ifndef YY_YY_PARS0GRM_TAB_H_INCLUDED
 # define YY_YY_PARS0GRM_TAB_H_INCLUDED
 /* Debug traces.  */
@@ -129,91 +137,71 @@ extern int yydebug;
     PARS_NE_TOKEN = 268,
     PARS_PROCEDURE_TOKEN = 269,
     PARS_IN_TOKEN = 270,
-    PARS_OUT_TOKEN = 271,
-    PARS_BINARY_TOKEN = 272,
-    PARS_BLOB_TOKEN = 273,
-    PARS_INT_TOKEN = 274,
-    PARS_FLOAT_TOKEN = 275,
-    PARS_CHAR_TOKEN = 276,
-    PARS_IS_TOKEN = 277,
-    PARS_BEGIN_TOKEN = 278,
-    PARS_END_TOKEN = 279,
-    PARS_IF_TOKEN = 280,
-    PARS_THEN_TOKEN = 281,
-    PARS_ELSE_TOKEN = 282,
-    PARS_ELSIF_TOKEN = 283,
-    PARS_LOOP_TOKEN = 284,
-    PARS_WHILE_TOKEN = 285,
-    PARS_RETURN_TOKEN = 286,
-    PARS_SELECT_TOKEN = 287,
-    PARS_SUM_TOKEN = 288,
-    PARS_COUNT_TOKEN = 289,
-    PARS_DISTINCT_TOKEN = 290,
-    PARS_FROM_TOKEN = 291,
-    PARS_WHERE_TOKEN = 292,
-    PARS_FOR_TOKEN = 293,
-    PARS_DDOT_TOKEN = 294,
-    PARS_READ_TOKEN = 295,
-    PARS_ORDER_TOKEN = 296,
-    PARS_BY_TOKEN = 297,
-    PARS_ASC_TOKEN = 298,
-    PARS_DESC_TOKEN = 299,
-    PARS_INSERT_TOKEN = 300,
-    PARS_INTO_TOKEN = 301,
-    PARS_VALUES_TOKEN = 302,
-    PARS_UPDATE_TOKEN = 303,
-    PARS_SET_TOKEN = 304,
-    PARS_DELETE_TOKEN = 305,
-    PARS_CURRENT_TOKEN = 306,
-    PARS_OF_TOKEN = 307,
-    PARS_CREATE_TOKEN = 308,
-    PARS_TABLE_TOKEN = 309,
-    PARS_INDEX_TOKEN = 310,
-    PARS_UNIQUE_TOKEN = 311,
-    PARS_CLUSTERED_TOKEN = 312,
-    PARS_ON_TOKEN = 313,
-    PARS_ASSIGN_TOKEN = 314,
-    PARS_DECLARE_TOKEN = 315,
-    PARS_CURSOR_TOKEN = 316,
-    PARS_SQL_TOKEN = 317,
-    PARS_OPEN_TOKEN = 318,
-    PARS_FETCH_TOKEN = 319,
-    PARS_CLOSE_TOKEN = 320,
-    PARS_NOTFOUND_TOKEN = 321,
-    PARS_TO_CHAR_TOKEN = 322,
-    PARS_TO_NUMBER_TOKEN = 323,
-    PARS_TO_BINARY_TOKEN = 324,
-    PARS_BINARY_TO_NUMBER_TOKEN = 325,
-    PARS_SUBSTR_TOKEN = 326,
-    PARS_REPLSTR_TOKEN = 327,
-    PARS_CONCAT_TOKEN = 328,
-    PARS_INSTR_TOKEN = 329,
-    PARS_LENGTH_TOKEN = 330,
-    PARS_SYSDATE_TOKEN = 331,
-    PARS_PRINTF_TOKEN = 332,
-    PARS_ASSERT_TOKEN = 333,
-    PARS_RND_TOKEN = 334,
-    PARS_RND_STR_TOKEN = 335,
-    PARS_ROW_PRINTF_TOKEN = 336,
-    PARS_COMMIT_TOKEN = 337,
-    PARS_ROLLBACK_TOKEN = 338,
-    PARS_WORK_TOKEN = 339,
-    PARS_UNSIGNED_TOKEN = 340,
-    PARS_EXIT_TOKEN = 341,
-    PARS_FUNCTION_TOKEN = 342,
-    PARS_LOCK_TOKEN = 343,
-    PARS_SHARE_TOKEN = 344,
-    PARS_MODE_TOKEN = 345,
-    PARS_LIKE_TOKEN = 346,
-    PARS_LIKE_TOKEN_EXACT = 347,
-    PARS_LIKE_TOKEN_PREFIX = 348,
-    PARS_LIKE_TOKEN_SUFFIX = 349,
-    PARS_LIKE_TOKEN_SUBSTR = 350,
-    PARS_TABLE_NAME_TOKEN = 351,
-    PARS_COMPACT_TOKEN = 352,
-    PARS_BLOCK_SIZE_TOKEN = 353,
-    PARS_BIGINT_TOKEN = 354,
-    NEG = 355
+    PARS_INT_TOKEN = 271,
+    PARS_CHAR_TOKEN = 272,
+    PARS_IS_TOKEN = 273,
+    PARS_BEGIN_TOKEN = 274,
+    PARS_END_TOKEN = 275,
+    PARS_IF_TOKEN = 276,
+    PARS_THEN_TOKEN = 277,
+    PARS_ELSE_TOKEN = 278,
+    PARS_ELSIF_TOKEN = 279,
+    PARS_LOOP_TOKEN = 280,
+    PARS_WHILE_TOKEN = 281,
+    PARS_RETURN_TOKEN = 282,
+    PARS_SELECT_TOKEN = 283,
+    PARS_COUNT_TOKEN = 284,
+    PARS_FROM_TOKEN = 285,
+    PARS_WHERE_TOKEN = 286,
+    PARS_FOR_TOKEN = 287,
+    PARS_DDOT_TOKEN = 288,
+    PARS_ORDER_TOKEN = 289,
+    PARS_BY_TOKEN = 290,
+    PARS_ASC_TOKEN = 291,
+    PARS_DESC_TOKEN = 292,
+    PARS_INSERT_TOKEN = 293,
+    PARS_INTO_TOKEN = 294,
+    PARS_VALUES_TOKEN = 295,
+    PARS_UPDATE_TOKEN = 296,
+    PARS_SET_TOKEN = 297,
+    PARS_DELETE_TOKEN = 298,
+    PARS_CURRENT_TOKEN = 299,
+    PARS_OF_TOKEN = 300,
+    PARS_CREATE_TOKEN = 301,
+    PARS_TABLE_TOKEN = 302,
+    PARS_INDEX_TOKEN = 303,
+    PARS_UNIQUE_TOKEN = 304,
+    PARS_CLUSTERED_TOKEN = 305,
+    PARS_ON_TOKEN = 306,
+    PARS_ASSIGN_TOKEN = 307,
+    PARS_DECLARE_TOKEN = 308,
+    PARS_CURSOR_TOKEN = 309,
+    PARS_SQL_TOKEN = 310,
+    PARS_OPEN_TOKEN = 311,
+    PARS_FETCH_TOKEN = 312,
+    PARS_CLOSE_TOKEN = 313,
+    PARS_NOTFOUND_TOKEN = 314,
+    PARS_TO_BINARY_TOKEN = 315,
+    PARS_SUBSTR_TOKEN = 316,
+    PARS_CONCAT_TOKEN = 317,
+    PARS_INSTR_TOKEN = 318,
+    PARS_LENGTH_TOKEN = 319,
+    PARS_COMMIT_TOKEN = 320,
+    PARS_ROLLBACK_TOKEN = 321,
+    PARS_WORK_TOKEN = 322,
+    PARS_EXIT_TOKEN = 323,
+    PARS_FUNCTION_TOKEN = 324,
+    PARS_LOCK_TOKEN = 325,
+    PARS_SHARE_TOKEN = 326,
+    PARS_MODE_TOKEN = 327,
+    PARS_LIKE_TOKEN = 328,
+    PARS_LIKE_TOKEN_EXACT = 329,
+    PARS_LIKE_TOKEN_PREFIX = 330,
+    PARS_LIKE_TOKEN_SUFFIX = 331,
+    PARS_LIKE_TOKEN_SUBSTR = 332,
+    PARS_TABLE_NAME_TOKEN = 333,
+    PARS_BIGINT_TOKEN = 334,
+    NEG = 335
   };
 #endif
 
@@ -231,9 +219,7 @@ int yyparse (void);
 
 #endif /* !YY_YY_PARS0GRM_TAB_H_INCLUDED  */
 
-/* Copy the second part of user declarations.  */
 
-#line 237 "pars0grm.cc" /* yacc.c:358  */
 
 #ifdef short
 # undef short
@@ -254,13 +240,13 @@ typedef signed char yytype_int8;
 #ifdef YYTYPE_UINT16
 typedef YYTYPE_UINT16 yytype_uint16;
 #else
-typedef unsigned short int yytype_uint16;
+typedef unsigned short yytype_uint16;
 #endif
 
 #ifdef YYTYPE_INT16
 typedef YYTYPE_INT16 yytype_int16;
 #else
-typedef short int yytype_int16;
+typedef short yytype_int16;
 #endif
 
 #ifndef YYSIZE_T
@@ -272,7 +258,7 @@ typedef short int yytype_int16;
 #  include  /* INFRINGES ON USER NAME SPACE */
 #  define YYSIZE_T size_t
 # else
-#  define YYSIZE_T unsigned int
+#  define YYSIZE_T unsigned
 # endif
 #endif
 
@@ -308,15 +294,6 @@ typedef short int yytype_int16;
 # define YY_ATTRIBUTE_UNUSED YY_ATTRIBUTE ((__unused__))
 #endif
 
-#if !defined _Noreturn \
-     && (!defined __STDC_VERSION__ || __STDC_VERSION__ < 201112)
-# if defined _MSC_VER && 1200 <= _MSC_VER
-#  define _Noreturn __declspec (noreturn)
-# else
-#  define _Noreturn YY_ATTRIBUTE ((__noreturn__))
-# endif
-#endif
-
 /* Suppress unused-variable warnings by "using" E.  */
 #if ! defined lint || defined __GNUC__
 # define YYUSE(E) ((void) (E))
@@ -324,7 +301,7 @@ typedef short int yytype_int16;
 # define YYUSE(E) /* empty */
 #endif
 
-#if defined __GNUC__ && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
+#if defined __GNUC__ && ! defined __ICC && 407 <= __GNUC__ * 100 + __GNUC_MINOR__
 /* Suppress an incorrect diagnostic about yylval being uninitialized.  */
 # define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN \
     _Pragma ("GCC diagnostic push") \
@@ -344,6 +321,8 @@ typedef short int yytype_int16;
 #endif
 
 
+#define YY_ASSERT(E) ((void) (0 && (E)))
+
 #if ! defined yyoverflow || YYERROR_VERBOSE
 
 /* The parser invokes alloca or malloc; define the necessary symbols.  */
@@ -475,42 +454,42 @@ union yyalloc
 /* YYFINAL -- State number of the termination state.  */
 #define YYFINAL  5
 /* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   780
+#define YYLAST   603
 
 /* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  116
+#define YYNTOKENS  96
 /* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  72
+#define YYNNTS  64
 /* YYNRULES -- Number of rules.  */
-#define YYNRULES  178
+#define YYNRULES  150
 /* YYNSTATES -- Number of states.  */
-#define YYNSTATES  345
+#define YYNSTATES  300
 
-/* YYTRANSLATE[YYX] -- Symbol number corresponding to YYX as returned
-   by yylex, with out-of-bounds checking.  */
 #define YYUNDEFTOK  2
-#define YYMAXUTOK   355
+#define YYMAXUTOK   335
 
+/* YYTRANSLATE(TOKEN-NUM) -- Symbol number corresponding to TOKEN-NUM
+   as returned by yylex, with out-of-bounds checking.  */
 #define YYTRANSLATE(YYX)                                                \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
+  ((unsigned) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
 
 /* YYTRANSLATE[TOKEN-NUM] -- Symbol number corresponding to TOKEN-NUM
-   as returned by yylex, without out-of-bounds checking.  */
+   as returned by yylex.  */
 static const yytype_uint8 yytranslate[] =
 {
        0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,   108,     2,     2,
-     110,   111,   105,   104,   113,   103,     2,   106,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,   109,
-     101,   100,   102,   112,     2,     2,     2,     2,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,    88,     2,     2,
+      90,    91,    85,    84,    93,    83,     2,    86,     2,     2,
+       2,     2,     2,     2,     2,     2,     2,     2,     2,    89,
+      81,    80,    82,    92,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,   114,     2,   115,     2,     2,     2,     2,
+       2,     2,     2,    94,     2,    95,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
@@ -531,33 +510,29 @@ static const yytype_uint8 yytranslate[] =
       45,    46,    47,    48,    49,    50,    51,    52,    53,    54,
       55,    56,    57,    58,    59,    60,    61,    62,    63,    64,
       65,    66,    67,    68,    69,    70,    71,    72,    73,    74,
-      75,    76,    77,    78,    79,    80,    81,    82,    83,    84,
-      85,    86,    87,    88,    89,    90,    91,    92,    93,    94,
-      95,    96,    97,    98,    99,   107
+      75,    76,    77,    78,    79,    87
 };
 
 #if YYDEBUG
   /* YYRLINE[YYN] -- Source line where rule number YYN was defined.  */
 static const yytype_uint16 yyrline[] =
 {
-       0,   160,   160,   163,   164,   165,   166,   167,   168,   169,
-     170,   171,   172,   173,   174,   175,   176,   177,   178,   179,
-     180,   181,   182,   183,   184,   188,   189,   194,   195,   197,
-     198,   199,   200,   201,   202,   203,   204,   205,   206,   207,
-     208,   209,   211,   212,   213,   214,   215,   216,   217,   218,
-     219,   221,   226,   227,   228,   229,   231,   232,   233,   234,
-     235,   236,   237,   240,   242,   243,   247,   253,   258,   259,
-     260,   264,   268,   269,   274,   275,   276,   281,   282,   283,
-     287,   288,   293,   299,   306,   307,   308,   313,   315,   318,
-     322,   323,   327,   328,   333,   334,   339,   340,   341,   345,
-     346,   353,   368,   373,   376,   384,   390,   391,   396,   402,
-     411,   419,   427,   434,   442,   450,   456,   463,   469,   470,
-     475,   476,   478,   482,   489,   495,   505,   509,   513,   520,
-     527,   531,   539,   548,   549,   554,   555,   560,   561,   567,
-     568,   574,   575,   580,   581,   586,   597,   598,   603,   604,
-     608,   609,   613,   627,   628,   632,   637,   642,   643,   644,
-     645,   646,   650,   655,   663,   664,   665,   670,   676,   678,
-     679,   683,   691,   697,   698,   701,   703,   704,   708
+       0,   140,   140,   143,   144,   145,   146,   147,   148,   149,
+     150,   151,   152,   153,   154,   155,   156,   157,   158,   159,
+     160,   161,   162,   166,   167,   172,   173,   175,   176,   177,
+     178,   179,   180,   181,   182,   183,   184,   185,   186,   187,
+     189,   190,   191,   192,   193,   194,   195,   196,   197,   199,
+     204,   205,   206,   207,   208,   211,   213,   214,   218,   224,
+     228,   229,   234,   235,   236,   241,   242,   243,   247,   248,
+     256,   257,   258,   263,   265,   268,   272,   273,   277,   278,
+     283,   284,   289,   290,   291,   295,   296,   303,   318,   323,
+     326,   334,   340,   341,   346,   352,   361,   369,   377,   384,
+     392,   400,   407,   413,   414,   419,   420,   422,   426,   433,
+     439,   449,   453,   457,   464,   471,   475,   483,   492,   493,
+     498,   499,   504,   505,   511,   519,   520,   525,   526,   530,
+     531,   535,   549,   550,   554,   559,   564,   565,   566,   570,
+     576,   578,   579,   583,   591,   597,   598,   601,   603,   604,
+     608
 };
 #endif
 
@@ -570,39 +545,30 @@ static const char *const yytname[] =
   "PARS_STR_LIT", "PARS_NULL_LIT", "PARS_ID_TOKEN", "PARS_AND_TOKEN",
   "PARS_OR_TOKEN", "PARS_NOT_TOKEN", "PARS_GE_TOKEN", "PARS_LE_TOKEN",
   "PARS_NE_TOKEN", "PARS_PROCEDURE_TOKEN", "PARS_IN_TOKEN",
-  "PARS_OUT_TOKEN", "PARS_BINARY_TOKEN", "PARS_BLOB_TOKEN",
-  "PARS_INT_TOKEN", "PARS_FLOAT_TOKEN", "PARS_CHAR_TOKEN", "PARS_IS_TOKEN",
-  "PARS_BEGIN_TOKEN", "PARS_END_TOKEN", "PARS_IF_TOKEN", "PARS_THEN_TOKEN",
-  "PARS_ELSE_TOKEN", "PARS_ELSIF_TOKEN", "PARS_LOOP_TOKEN",
-  "PARS_WHILE_TOKEN", "PARS_RETURN_TOKEN", "PARS_SELECT_TOKEN",
-  "PARS_SUM_TOKEN", "PARS_COUNT_TOKEN", "PARS_DISTINCT_TOKEN",
+  "PARS_INT_TOKEN", "PARS_CHAR_TOKEN", "PARS_IS_TOKEN", "PARS_BEGIN_TOKEN",
+  "PARS_END_TOKEN", "PARS_IF_TOKEN", "PARS_THEN_TOKEN", "PARS_ELSE_TOKEN",
+  "PARS_ELSIF_TOKEN", "PARS_LOOP_TOKEN", "PARS_WHILE_TOKEN",
+  "PARS_RETURN_TOKEN", "PARS_SELECT_TOKEN", "PARS_COUNT_TOKEN",
   "PARS_FROM_TOKEN", "PARS_WHERE_TOKEN", "PARS_FOR_TOKEN",
-  "PARS_DDOT_TOKEN", "PARS_READ_TOKEN", "PARS_ORDER_TOKEN",
-  "PARS_BY_TOKEN", "PARS_ASC_TOKEN", "PARS_DESC_TOKEN",
-  "PARS_INSERT_TOKEN", "PARS_INTO_TOKEN", "PARS_VALUES_TOKEN",
-  "PARS_UPDATE_TOKEN", "PARS_SET_TOKEN", "PARS_DELETE_TOKEN",
-  "PARS_CURRENT_TOKEN", "PARS_OF_TOKEN", "PARS_CREATE_TOKEN",
-  "PARS_TABLE_TOKEN", "PARS_INDEX_TOKEN", "PARS_UNIQUE_TOKEN",
-  "PARS_CLUSTERED_TOKEN", "PARS_ON_TOKEN", "PARS_ASSIGN_TOKEN",
-  "PARS_DECLARE_TOKEN", "PARS_CURSOR_TOKEN", "PARS_SQL_TOKEN",
-  "PARS_OPEN_TOKEN", "PARS_FETCH_TOKEN", "PARS_CLOSE_TOKEN",
-  "PARS_NOTFOUND_TOKEN", "PARS_TO_CHAR_TOKEN", "PARS_TO_NUMBER_TOKEN",
-  "PARS_TO_BINARY_TOKEN", "PARS_BINARY_TO_NUMBER_TOKEN",
-  "PARS_SUBSTR_TOKEN", "PARS_REPLSTR_TOKEN", "PARS_CONCAT_TOKEN",
-  "PARS_INSTR_TOKEN", "PARS_LENGTH_TOKEN", "PARS_SYSDATE_TOKEN",
-  "PARS_PRINTF_TOKEN", "PARS_ASSERT_TOKEN", "PARS_RND_TOKEN",
-  "PARS_RND_STR_TOKEN", "PARS_ROW_PRINTF_TOKEN", "PARS_COMMIT_TOKEN",
-  "PARS_ROLLBACK_TOKEN", "PARS_WORK_TOKEN", "PARS_UNSIGNED_TOKEN",
-  "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN", "PARS_LOCK_TOKEN",
-  "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN", "PARS_LIKE_TOKEN",
-  "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX",
+  "PARS_DDOT_TOKEN", "PARS_ORDER_TOKEN", "PARS_BY_TOKEN", "PARS_ASC_TOKEN",
+  "PARS_DESC_TOKEN", "PARS_INSERT_TOKEN", "PARS_INTO_TOKEN",
+  "PARS_VALUES_TOKEN", "PARS_UPDATE_TOKEN", "PARS_SET_TOKEN",
+  "PARS_DELETE_TOKEN", "PARS_CURRENT_TOKEN", "PARS_OF_TOKEN",
+  "PARS_CREATE_TOKEN", "PARS_TABLE_TOKEN", "PARS_INDEX_TOKEN",
+  "PARS_UNIQUE_TOKEN", "PARS_CLUSTERED_TOKEN", "PARS_ON_TOKEN",
+  "PARS_ASSIGN_TOKEN", "PARS_DECLARE_TOKEN", "PARS_CURSOR_TOKEN",
+  "PARS_SQL_TOKEN", "PARS_OPEN_TOKEN", "PARS_FETCH_TOKEN",
+  "PARS_CLOSE_TOKEN", "PARS_NOTFOUND_TOKEN", "PARS_TO_BINARY_TOKEN",
+  "PARS_SUBSTR_TOKEN", "PARS_CONCAT_TOKEN", "PARS_INSTR_TOKEN",
+  "PARS_LENGTH_TOKEN", "PARS_COMMIT_TOKEN", "PARS_ROLLBACK_TOKEN",
+  "PARS_WORK_TOKEN", "PARS_EXIT_TOKEN", "PARS_FUNCTION_TOKEN",
+  "PARS_LOCK_TOKEN", "PARS_SHARE_TOKEN", "PARS_MODE_TOKEN",
+  "PARS_LIKE_TOKEN", "PARS_LIKE_TOKEN_EXACT", "PARS_LIKE_TOKEN_PREFIX",
   "PARS_LIKE_TOKEN_SUFFIX", "PARS_LIKE_TOKEN_SUBSTR",
-  "PARS_TABLE_NAME_TOKEN", "PARS_COMPACT_TOKEN", "PARS_BLOCK_SIZE_TOKEN",
-  "PARS_BIGINT_TOKEN", "'='", "'<'", "'>'", "'-'", "'+'", "'*'", "'/'",
-  "NEG", "'%'", "';'", "'('", "')'", "'?'", "','", "'{'", "'}'", "$accept",
-  "top_statement", "statement", "statement_list", "exp", "function_name",
-  "question_mark_list", "stored_procedure_call",
-  "predefined_procedure_call", "predefined_procedure_name",
+  "PARS_TABLE_NAME_TOKEN", "PARS_BIGINT_TOKEN", "'='", "'<'", "'>'", "'-'",
+  "'+'", "'*'", "'/'", "NEG", "'%'", "';'", "'('", "')'", "'?'", "','",
+  "'{'", "'}'", "$accept", "top_statement", "statement", "statement_list",
+  "exp", "function_name", "question_mark_list", "stored_procedure_call",
   "user_function_call", "table_list", "variable_list", "exp_list",
   "select_item", "select_item_list", "select_list", "search_condition",
   "for_update_clause", "lock_shared_clause", "order_direction",
@@ -611,16 +577,14 @@ static const char *const yytname[] =
   "cursor_positioned", "update_statement_start",
   "update_statement_searched", "update_statement_positioned",
   "delete_statement_start", "delete_statement_searched",
-  "delete_statement_positioned", "row_printf_statement",
-  "assignment_statement", "elsif_element", "elsif_list", "else_part",
-  "if_statement", "while_statement", "for_statement", "exit_statement",
-  "return_statement", "open_cursor_statement", "close_cursor_statement",
-  "fetch_statement", "column_def", "column_def_list", "opt_column_len",
-  "opt_unsigned", "opt_not_null", "compact", "block_size", "create_table",
-  "column_list", "unique_def", "clustered_def", "create_index",
-  "table_name", "commit_statement", "rollback_statement", "type_name",
-  "parameter_declaration", "parameter_declaration_list",
-  "variable_declaration", "variable_declaration_list",
+  "delete_statement_positioned", "assignment_statement", "elsif_element",
+  "elsif_list", "else_part", "if_statement", "while_statement",
+  "for_statement", "exit_statement", "return_statement",
+  "open_cursor_statement", "close_cursor_statement", "fetch_statement",
+  "column_def", "column_def_list", "opt_column_len", "opt_not_null",
+  "create_table", "column_list", "unique_def", "clustered_def",
+  "create_index", "table_name", "commit_statement", "rollback_statement",
+  "type_name", "variable_declaration", "variable_declaration_list",
   "cursor_declaration", "function_declaration", "declaration",
   "declaration_list", "procedure_definition", YY_NULLPTR
 };
@@ -639,17 +603,15 @@ static const yytype_uint16 yytoknum[] =
      305,   306,   307,   308,   309,   310,   311,   312,   313,   314,
      315,   316,   317,   318,   319,   320,   321,   322,   323,   324,
      325,   326,   327,   328,   329,   330,   331,   332,   333,   334,
-     335,   336,   337,   338,   339,   340,   341,   342,   343,   344,
-     345,   346,   347,   348,   349,   350,   351,   352,   353,   354,
-      61,    60,    62,    45,    43,    42,    47,   355,    37,    59,
+      61,    60,    62,    45,    43,    42,    47,   335,    37,    59,
       40,    41,    63,    44,   123,   125
 };
 # endif
 
-#define YYPACT_NINF -176
+#define YYPACT_NINF -129
 
 #define yypact_value_is_default(Yystate) \
-  (!!((Yystate) == (-176)))
+  (!!((Yystate) == (-129)))
 
 #define YYTABLE_NINF -1
 
@@ -660,41 +622,36 @@ static const yytype_uint16 yytoknum[] =
      STATE-NUM.  */
 static const yytype_int16 yypact[] =
 {
-      20,    21,    41,   -64,   -59,  -176,  -176,    48,    54,  -176,
-     -74,    12,    12,    45,    48,  -176,  -176,  -176,  -176,  -176,
-    -176,  -176,    69,  -176,    12,  -176,     8,   -32,   -43,  -176,
-    -176,  -176,  -176,   -13,  -176,    72,    81,   445,  -176,    75,
-     -11,    42,   530,   530,  -176,    16,    99,    67,    -3,    78,
-     -14,   108,   109,   110,  -176,  -176,  -176,    86,    36,    44,
-    -176,   122,  -176,   216,  -176,    22,    23,    25,     6,    26,
-      93,    27,    33,    93,    46,    51,    53,    56,    61,    63,
-      64,    66,    68,    70,    71,    76,    79,    89,    94,    95,
-      86,  -176,   530,  -176,  -176,  -176,  -176,    43,   530,    49,
-    -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,
-    -176,   530,   530,   570,    77,   603,    80,    96,  -176,   674,
-    -176,   -38,   118,   161,    -3,  -176,  -176,   129,    -3,    -3,
-    -176,   148,  -176,   163,  -176,  -176,  -176,  -176,    97,  -176,
-    -176,  -176,   530,  -176,   100,  -176,  -176,   481,  -176,  -176,
-    -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,
-    -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,
-     102,   674,   149,   220,   155,    14,    91,   530,   530,   530,
-     530,   530,   445,   219,   530,   530,   530,   530,   530,   530,
-     530,   530,   445,   530,   -24,   218,   267,    -3,   530,  -176,
-     221,  -176,   117,  -176,   179,   228,   124,   674,   -65,   530,
-     185,   674,  -176,  -176,  -176,  -176,   220,   220,    19,    19,
-     674,   136,  -176,    19,    19,    19,     3,     3,    14,    14,
-     -57,   326,   554,   231,   128,  -176,   130,  -176,    -1,  -176,
-     610,   142,  -176,   131,   238,   242,   141,  -176,   130,  -176,
-     -52,  -176,   530,   -51,   246,   445,   530,  -176,   227,   233,
-    -176,   229,  -176,   151,  -176,   252,   530,    -3,   225,   530,
-     530,   221,    12,  -176,   -48,   207,   156,   153,   164,   674,
-    -176,  -176,   445,   626,  -176,   250,  -176,  -176,  -176,  -176,
-     230,   194,   655,   674,  -176,   173,   187,   238,    -3,  -176,
-    -176,  -176,   445,  -176,  -176,   270,   245,   445,   284,   204,
-    -176,   192,  -176,   181,   445,   203,   253,  -176,   386,   193,
-    -176,   286,   205,  -176,   296,   217,   299,   279,  -176,   303,
-    -176,   307,  -176,   -47,  -176,    30,  -176,  -176,  -176,  -176,
-     305,  -176,  -176,  -176,  -176
+       5,    34,    46,   -28,   -41,  -129,  -129,   -12,    45,    57,
+      23,  -129,     9,  -129,  -129,  -129,    20,    -9,  -129,  -129,
+    -129,  -129,     2,  -129,    83,    87,   278,  -129,    93,    28,
+      71,   427,   427,  -129,   335,   105,    85,    -1,   104,   -27,
+     129,   132,   133,    76,    77,  -129,   141,  -129,   149,  -129,
+      61,    19,    62,   118,    65,    66,   118,    68,    69,    70,
+      72,    73,    74,    75,    78,    79,    82,    84,    89,    90,
+      91,    94,   138,  -129,   427,  -129,  -129,  -129,  -129,    86,
+     427,    96,  -129,  -129,  -129,  -129,  -129,   427,   427,   438,
+      92,   454,    95,  -129,     1,  -129,   -24,   130,   157,    -1,
+    -129,  -129,   144,    -1,    -1,  -129,   139,  -129,   154,  -129,
+    -129,  -129,    98,  -129,  -129,  -129,   108,  -129,  -129,   345,
+    -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,
+    -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,  -129,
+    -129,   112,     1,   135,   285,   143,    -8,    15,   427,   427,
+     427,   427,   427,   278,   203,   427,   427,   427,   427,   427,
+     427,   427,   427,   278,   124,   204,   381,    -1,   427,  -129,
+     209,  -129,   120,  -129,   173,   215,   131,   427,   180,     1,
+    -129,  -129,  -129,  -129,   285,   285,    30,    30,     1,    10,
+    -129,    30,    30,    30,    60,    60,    -8,    -8,     1,   -39,
+     192,   137,  -129,   136,  -129,   -13,  -129,   472,   146,  -129,
+     147,   225,   227,   151,  -129,   136,  -129,   -21,     0,   229,
+     278,   427,  -129,   213,   219,  -129,   427,   220,  -129,   237,
+     427,    -1,   214,   427,   427,   209,    23,  -129,    14,   196,
+     160,   158,   162,  -129,  -129,   278,   486,  -129,   231,     1,
+    -129,  -129,  -129,   218,   194,   517,     1,  -129,   175,  -129,
+     225,    -1,  -129,  -129,  -129,   278,  -129,  -129,   251,   234,
+     278,   266,   260,  -129,   181,   278,   201,   239,  -129,   235,
+     184,   271,  -129,   272,   208,   275,   258,  -129,  -129,  -129,
+      17,  -129,    -7,  -129,  -129,   277,  -129,  -129,  -129,  -129
 };
 
   /* YYDEFACT[STATE-NUM] -- Default reduction number in state STATE-NUM.
@@ -702,67 +659,60 @@ static const yytype_int16 yypact[] =
      means the default is an error.  */
 static const yytype_uint8 yydefact[] =
 {
-       0,     0,     0,     0,     0,     1,     2,   164,     0,   165,
-       0,     0,     0,     0,     0,   160,   161,   157,   159,   158,
-     162,   163,   168,   166,     0,   169,   175,     0,     0,   170,
-     173,   174,   176,     0,   167,     0,     0,     0,   177,     0,
-       0,     0,     0,     0,   127,    84,     0,     0,     0,     0,
-     148,     0,     0,     0,    68,    69,    70,     0,     0,     0,
-     126,     0,    25,     0,     3,     0,     0,     0,     0,     0,
-      90,     0,     0,    90,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     1,     2,     0,     0,   140,
+       0,   141,   147,   136,   138,   137,     0,     0,   142,   145,
+     146,   148,     0,   139,     0,     0,     0,   149,     0,     0,
+       0,     0,     0,   112,    70,     0,     0,     0,     0,   127,
+       0,     0,     0,     0,     0,   111,     0,    23,     0,     3,
+       0,     0,     0,    76,     0,     0,    76,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,   172,     0,    29,    30,    31,    32,    27,     0,    33,
-      52,    53,    54,    55,    56,    57,    58,    59,    60,    61,
-      62,     0,     0,     0,     0,     0,     0,     0,    87,    80,
-      85,    89,     0,     0,     0,   153,   154,     0,     0,     0,
-     149,   150,   128,     0,   129,   115,   155,   156,     0,   178,
-      26,     4,    77,    11,     0,   104,    12,     0,   110,   111,
-      16,    17,   113,   114,    14,    15,    13,    10,     8,     5,
-       6,     7,     9,    18,    20,    19,    23,    24,    21,    22,
-       0,   116,     0,    49,     0,    38,     0,     0,     0,     0,
+       0,     0,     0,   144,     0,    27,    28,    29,    30,    25,
+       0,    31,    50,    51,    52,    53,    54,     0,     0,     0,
+       0,     0,     0,    73,    68,    71,    75,     0,     0,     0,
+     132,   133,     0,     0,     0,   128,   129,   113,     0,   114,
+     134,   135,     0,   150,    24,    10,     0,    90,    11,     0,
+      96,    97,    14,    15,    99,   100,    12,    13,     9,     7,
+       4,     5,     6,     8,    16,    18,    17,    21,    22,    19,
+      20,     0,   101,     0,    47,     0,    36,     0,     0,     0,
        0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
-       0,    77,     0,     0,     0,    74,     0,     0,     0,   102,
-       0,   112,     0,   151,     0,    74,    63,    78,     0,    77,
-       0,    91,   171,    50,    51,    39,    47,    48,    44,    45,
-      46,   120,    41,    40,    42,    43,    35,    34,    36,    37,
-       0,     0,     0,     0,     0,    75,    88,    86,    90,    72,
-       0,     0,   106,   109,     0,     0,    75,   131,   130,    64,
-       0,    67,     0,     0,     0,     0,     0,   118,   122,     0,
-      28,     0,    83,     0,    81,     0,     0,     0,    92,     0,
-       0,     0,     0,   133,     0,     0,     0,     0,     0,    79,
-     103,   108,   121,     0,   119,     0,   124,    82,    76,    73,
-       0,    94,     0,   105,   107,   135,   141,     0,     0,    71,
-      66,    65,     0,   123,    93,     0,    99,     0,     0,   137,
-     142,   143,   134,     0,   117,     0,     0,   101,     0,     0,
-     138,   139,     0,   145,     0,     0,     0,     0,   136,     0,
-     132,     0,   146,     0,    95,    96,   125,   140,   144,   152,
-       0,    97,    98,   100,   147
+       0,     0,    65,     0,     0,    62,     0,     0,     0,    88,
+       0,    98,     0,   130,     0,    62,    55,    65,     0,    77,
+     143,    48,    49,    37,    45,    46,    42,    43,    44,   105,
+      39,    38,    40,    41,    33,    32,    34,    35,    66,     0,
+       0,     0,    63,    74,    72,    76,    60,     0,     0,    92,
+      95,     0,     0,    63,   116,   115,    56,     0,     0,     0,
+       0,     0,   103,   107,     0,    26,     0,     0,    69,     0,
+       0,     0,    78,     0,     0,     0,     0,   118,     0,     0,
+       0,     0,     0,    89,    94,   106,     0,   104,     0,    67,
+     109,    64,    61,     0,    80,     0,    91,    93,   120,   124,
+       0,     0,    59,    58,    57,     0,   108,    79,     0,    85,
+       0,     0,   122,   119,     0,   102,     0,     0,    87,     0,
+       0,     0,   117,     0,     0,     0,     0,   121,   123,   125,
+       0,    81,    82,   110,   131,     0,    83,    84,    86,   126
 };
 
   /* YYPGOTO[NTERM-NUM].  */
 static const yytype_int16 yypgoto[] =
 {
-    -176,  -176,   -62,  -175,   -40,  -176,  -176,  -176,  -176,  -176,
-    -176,  -176,   111,  -166,   119,  -176,  -176,   -67,  -176,  -176,
-    -176,  -176,   -33,  -176,  -176,    47,  -176,   240,  -176,  -176,
-    -176,  -176,  -176,  -176,  -176,  -176,    59,  -176,  -176,  -176,
-    -176,  -176,  -176,  -176,  -176,  -176,  -176,    17,  -176,  -176,
-    -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -176,  -115,
-    -176,  -176,   -12,   313,  -176,   293,  -176,  -176,  -176,   295,
-    -176,  -176
+    -129,  -129,   -48,  -128,   -30,  -129,  -129,  -129,  -129,  -129,
+     113,   110,   123,  -129,  -129,   -52,  -129,  -129,  -129,  -129,
+     -40,  -129,  -129,    55,  -129,   238,  -129,  -129,  -129,  -129,
+    -129,  -129,  -129,    88,  -129,  -129,  -129,  -129,  -129,  -129,
+    -129,  -129,  -129,  -129,    35,  -129,  -129,  -129,  -129,  -129,
+    -129,  -129,  -129,   -96,  -129,  -129,    81,   290,  -129,  -129,
+    -129,   286,  -129,  -129
 };
 
   /* YYDEFGOTO[NTERM-NUM].  */
 static const yytype_int16 yydefgoto[] =
 {
-      -1,     2,    62,    63,   207,   114,   250,    64,    65,    66,
-     247,   238,   236,   208,   120,   121,   122,   148,   291,   306,
-     343,   317,    67,    68,    69,   242,   243,   149,    70,    71,
-      72,    73,    74,    75,    76,    77,   257,   258,   259,    78,
-      79,    80,    81,    82,    83,    84,    85,   273,   274,   309,
-     321,   330,   311,   323,    86,   333,   131,   204,    87,   127,
-      88,    89,    20,     9,    10,    25,    26,    30,    31,    32,
-      33,     3
+      -1,     2,    47,    48,    94,    90,   217,    49,   214,   205,
+     203,   199,    95,    96,    97,   120,   254,   269,   298,   278,
+      50,    51,    52,   209,   210,   121,    53,    54,    55,    56,
+      57,    58,    59,   222,   223,   224,    60,    61,    62,    63,
+      64,    65,    66,    67,   237,   238,   272,   282,    68,   290,
+     106,   174,    69,   102,    70,    71,    16,    11,    12,    19,
+      20,    21,    22,     3
 };
 
   /* YYTABLE[YYPACT[STATE-NUM]] -- What to do in state STATE-NUM.  If
@@ -770,232 +720,189 @@ static const yytype_int16 yydefgoto[] =
      number is the opposite.  If YYTABLE_NINF, syntax error.  */
 static const yytype_uint16 yytable[] =
 {
-      21,   140,   113,   115,   125,   119,   152,   221,   195,   199,
-      37,   233,    27,   201,   202,    24,   181,   231,    35,    93,
-      94,    95,    96,    97,   135,   230,    98,   181,     4,    15,
-      16,    17,   181,    18,     1,   145,   266,    13,    45,    14,
-     129,     5,   130,   253,    36,     6,   251,    28,   252,   116,
-     117,     7,   171,   144,   260,     8,   252,   170,   173,   277,
-     280,   278,   252,   296,   339,   297,   340,    22,    28,    11,
-      12,   175,   176,   341,   342,   196,    24,    34,    99,    39,
-     282,   234,   239,   100,   101,   102,   103,   104,    40,   105,
-     106,   107,   108,   126,   183,   109,   110,    90,    91,   177,
-     178,    92,   179,   180,   181,   183,   123,   211,   189,   190,
-     183,    19,   267,   124,   128,   132,   133,   134,    45,   111,
-     136,   118,   187,   188,   189,   190,   112,   314,   137,   138,
-     147,   141,   318,   142,   143,   146,   150,   216,   217,   218,
-     219,   220,   151,    41,   223,   224,   225,   226,   227,   228,
-     229,   172,   289,   232,   197,   154,   119,   174,   240,   140,
-     155,    42,   156,   255,   256,   157,    43,    44,    45,   140,
-     158,   268,   159,   160,    46,   161,   198,   162,   200,   163,
-     164,    47,   183,   313,    48,   165,    49,   191,   166,    50,
-     193,   184,   185,   186,   187,   188,   189,   190,   167,    51,
-      52,    53,   215,   168,   169,   203,   194,   206,    54,   205,
-     209,   212,   279,    55,    56,   213,   283,    57,    58,    59,
-     140,   214,    60,    41,   222,   235,   211,   244,   241,   292,
-     293,   179,   180,   181,   245,   246,   249,   254,   263,   264,
-     139,    42,   270,   265,   271,   272,    43,    44,    45,   275,
-      61,   276,   140,   281,    46,   256,   140,   285,   286,   288,
-     295,    47,   287,   290,    48,   298,    49,   299,   300,    50,
-      93,    94,    95,    96,    97,   303,   301,    98,   304,    51,
-      52,    53,   305,   308,   310,   315,   316,   319,    54,   320,
-     322,   324,   325,    55,    56,   326,   329,    57,    58,    59,
-     116,   117,    60,   332,   328,   331,   335,   334,   336,   337,
-     338,   183,   344,   153,   312,   237,   248,   284,   294,    29,
-     184,   185,   186,   187,   188,   189,   190,    23,    38,    99,
-      61,     0,     0,    41,   100,   101,   102,   103,   104,     0,
-     105,   106,   107,   108,     0,     0,   109,   110,     0,     0,
-     261,    42,     0,     0,     0,     0,    43,    44,    45,     0,
-       0,     0,     0,     0,    46,     0,     0,     0,     0,     0,
-     111,    47,     0,     0,    48,     0,    49,   112,     0,    50,
-       0,     0,     0,     0,     0,     0,     0,     0,     0,    51,
-      52,    53,     0,    41,     0,     0,     0,     0,    54,     0,
-       0,     0,     0,    55,    56,     0,     0,    57,    58,    59,
-     327,    42,    60,     0,     0,     0,    43,    44,    45,     0,
-       0,     0,     0,     0,    46,     0,     0,     0,     0,     0,
-       0,    47,     0,     0,    48,     0,    49,     0,     0,    50,
-      61,     0,     0,     0,     0,     0,     0,     0,     0,    51,
-      52,    53,    41,     0,     0,     0,     0,     0,    54,     0,
-       0,     0,     0,    55,    56,     0,     0,    57,    58,    59,
-      42,     0,    60,     0,     0,    43,    44,    45,     0,     0,
-       0,     0,     0,    46,    93,    94,    95,    96,    97,     0,
-      47,    98,     0,    48,     0,    49,     0,     0,    50,     0,
-      61,     0,     0,     0,     0,     0,     0,     0,    51,    52,
-      53,     0,     0,     0,     0,     0,     0,    54,     0,     0,
-       0,     0,    55,    56,     0,     0,    57,    58,    59,     0,
-       0,    60,   210,    93,    94,    95,    96,    97,     0,     0,
-      98,     0,     0,    99,     0,     0,     0,     0,   100,   101,
-     102,   103,   104,     0,   105,   106,   107,   108,     0,    61,
-     109,   110,   177,   178,     0,   179,   180,   181,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,     0,   177,   178,
-       0,   179,   180,   181,   111,     0,     0,     0,     0,     0,
-       0,   112,    99,     0,     0,     0,   182,   100,   101,   102,
-     103,   104,     0,   105,   106,   107,   108,     0,     0,   109,
-     110,   177,   178,     0,   179,   180,   181,     0,   177,   178,
-       0,   179,   180,   181,     0,     0,     0,     0,     0,     0,
-       0,     0,   192,   111,   177,   178,     0,   179,   180,   181,
-     112,     0,     0,     0,     0,   183,     0,     0,     0,   269,
-       0,     0,   302,     0,   184,   185,   186,   187,   188,   189,
-     190,   183,     0,   177,   178,   262,   179,   180,   181,     0,
-     184,   185,   186,   187,   188,   189,   190,     0,     0,     0,
-       0,     0,   177,   178,   307,   179,   180,   181,     0,     0,
-       0,     0,     0,     0,   183,     0,     0,     0,     0,     0,
-       0,   183,     0,   184,   185,   186,   187,   188,   189,   190,
-     184,   185,   186,   187,   188,   189,   190,   183,     0,     0,
-       0,     0,     0,     0,     0,     0,   184,   185,   186,   187,
-     188,   189,   190,     0,     0,     0,     0,     0,     0,     0,
-       0,     0,     0,     0,     0,     0,   183,     0,     0,     0,
-       0,     0,     0,     0,     0,   184,   185,   186,   187,   188,
-     189,   190,     0,     0,     0,   183,     0,     0,     0,     0,
-       0,     0,     0,     0,   184,   185,   186,   187,   188,   189,
-     190
+     114,    89,    91,   169,   124,   152,   100,   171,   172,   148,
+     149,   117,   150,   151,   152,   165,    10,    30,   230,     1,
+     104,    26,   105,   148,   149,   189,   150,   151,   152,   296,
+     297,    31,   141,   220,   221,   200,    32,    33,    34,    13,
+      14,     4,    35,   152,   142,    24,     5,    34,    36,     7,
+     144,    37,   225,    38,   226,    17,    39,   146,   147,   116,
+      25,     6,    17,     9,    10,   154,    40,    41,    42,   166,
+     241,   206,   242,   152,   154,    43,    44,   101,    45,     8,
+     231,   155,   156,   157,   158,   159,   160,   161,   154,   179,
+      28,   243,   245,   226,    29,   155,   156,   157,   158,   159,
+     160,   161,    15,   154,    46,   259,   183,   260,   294,    23,
+     295,    72,    98,   158,   159,   160,   161,    73,   184,   185,
+     186,   187,   188,    74,    99,   191,   192,   193,   194,   195,
+     196,   197,   198,   154,   103,   252,   107,   275,   207,   108,
+     109,   114,   279,   110,   111,   160,   161,   198,   112,   119,
+     115,   118,   114,   232,   122,   123,    30,   126,   127,   128,
+     167,   129,   130,   131,   132,   274,    34,   133,   134,   113,
+      31,   135,   168,   136,   143,    32,    33,    34,   137,   138,
+     139,    35,   162,   140,   145,   164,   170,    36,   176,   173,
+      37,   246,    38,   175,   181,    39,   249,   114,   177,    30,
+     179,   180,   182,   255,   256,    40,    41,    42,   190,   201,
+     211,   202,   227,    31,    43,    44,   208,    45,    32,    33,
+      34,   212,   213,   216,    35,   219,   234,   114,   228,   229,
+      36,   114,   236,    37,   239,    38,   244,   221,    39,   248,
+     235,   240,    30,    46,   251,   250,   253,   261,    40,    41,
+      42,   262,   266,   263,   264,   286,    31,    43,    44,   267,
+      45,    32,    33,    34,   268,   271,   276,    35,   277,   280,
+     281,   283,   284,    36,   285,   287,    37,   288,    38,   289,
+     291,    39,   292,   293,   299,    30,    46,   218,   215,   204,
+     257,    40,    41,    42,   125,   273,   150,   151,   152,    31,
+      43,    44,    18,    45,    32,    33,    34,     0,    27,     0,
+      35,   247,     0,     0,     0,     0,    36,   258,     0,    37,
+       0,    38,     0,     0,    39,     0,     0,     0,     0,    46,
+       0,     0,     0,     0,    40,    41,    42,     0,    75,    76,
+      77,    78,    79,    43,    44,    80,    45,     0,    75,    76,
+      77,    78,    79,     0,     0,    80,     0,     0,   154,     0,
+       0,     0,     0,     0,    92,   155,   156,   157,   158,   159,
+     160,   161,    46,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,    75,    76,    77,    78,    79,   178,
+      81,    80,     0,     0,     0,    82,    83,    84,    85,    86,
+      81,     0,     0,     0,     0,    82,    83,    84,    85,    86,
+      92,     0,     0,     0,     0,     0,     0,     0,    87,     0,
+      93,     0,     0,     0,     0,    88,     0,     0,    87,     0,
+      75,    76,    77,    78,    79,    88,    81,    80,     0,     0,
+       0,    82,    83,    84,    85,    86,   148,   149,     0,   150,
+     151,   152,     0,     0,     0,     0,     0,     0,     0,     0,
+     153,     0,   148,   149,    87,   150,   151,   152,     0,     0,
+       0,    88,     0,     0,     0,     0,     0,     0,     0,   163,
+     148,   149,    81,   150,   151,   152,     0,    82,    83,    84,
+      85,    86,     0,     0,   148,   149,     0,   150,   151,   152,
+       0,     0,     0,     0,     0,   233,     0,     0,   265,     0,
+      87,   154,     0,     0,     0,     0,     0,    88,   155,   156,
+     157,   158,   159,   160,   161,   148,   149,   154,   150,   151,
+     152,     0,     0,     0,   155,   156,   157,   158,   159,   160,
+     161,     0,   270,     0,     0,   154,     0,     0,     0,     0,
+       0,     0,   155,   156,   157,   158,   159,   160,   161,   154,
+       0,     0,     0,     0,     0,     0,   155,   156,   157,   158,
+     159,   160,   161,     0,     0,     0,     0,     0,     0,     0,
+       0,     0,     0,     0,     0,     0,     0,     0,     0,     0,
+     154,     0,     0,     0,     0,     0,     0,   155,   156,   157,
+     158,   159,   160,   161
 };
 
 static const yytype_int16 yycheck[] =
 {
-      12,    63,    42,    43,     7,    45,    73,   182,    46,   124,
-      23,    35,    24,   128,   129,     7,    13,   192,    61,     3,
-       4,     5,     6,     7,    57,   191,    10,    13,     7,    17,
-      18,    19,    13,    21,    14,    68,    37,   111,    32,   113,
-      54,     0,    56,   209,    87,   109,   111,    60,   113,    33,
-      34,   110,    92,    47,   111,     7,   113,    90,    98,   111,
-     111,   113,   113,   111,   111,   113,   113,    22,    60,    15,
-      16,   111,   112,    43,    44,   113,     7,   109,    62,     7,
-     255,   105,   197,    67,    68,    69,    70,    71,     7,    73,
-      74,    75,    76,    96,    91,    79,    80,    22,   109,     8,
-       9,    59,    11,    12,    13,    91,     7,   147,   105,   106,
-      91,    99,   113,    46,    36,     7,     7,     7,    32,   103,
-      84,   105,   103,   104,   105,   106,   110,   302,    84,     7,
-      37,   109,   307,   110,   109,   109,   109,   177,   178,   179,
-     180,   181,   109,     7,   184,   185,   186,   187,   188,   189,
-     190,   108,   267,   193,    36,   109,   196,   108,   198,   221,
-     109,    25,   109,    27,    28,   109,    30,    31,    32,   231,
-     109,   238,   109,   109,    38,   109,    15,   109,    49,   109,
-     109,    45,    91,   298,    48,   109,    50,   110,   109,    53,
-     110,   100,   101,   102,   103,   104,   105,   106,   109,    63,
-      64,    65,   111,   109,   109,    57,   110,   110,    72,    46,
-     110,   109,   252,    77,    78,    66,   256,    81,    82,    83,
-     282,    66,    86,     7,     5,     7,   266,   110,     7,   269,
-     270,    11,    12,    13,    55,     7,   112,    52,     7,   111,
-      24,    25,   100,   113,   113,     7,    30,    31,    32,     7,
-     114,   110,   314,     7,    38,    28,   318,    24,    29,     7,
-     272,    45,   111,    38,    48,    58,    50,   111,   115,    53,
-       3,     4,     5,     6,     7,    25,   112,    10,    48,    63,
-      64,    65,    88,   110,    97,    15,    41,     3,    72,    85,
-      98,   110,    89,    77,    78,    42,    10,    81,    82,    83,
-      33,    34,    86,     7,   111,   100,     7,    90,    29,     6,
-       3,    91,     7,    73,   297,   196,   205,   258,   271,    26,
-     100,   101,   102,   103,   104,   105,   106,    14,    33,    62,
-     114,    -1,    -1,     7,    67,    68,    69,    70,    71,    -1,
-      73,    74,    75,    76,    -1,    -1,    79,    80,    -1,    -1,
-      24,    25,    -1,    -1,    -1,    -1,    30,    31,    32,    -1,
-      -1,    -1,    -1,    -1,    38,    -1,    -1,    -1,    -1,    -1,
-     103,    45,    -1,    -1,    48,    -1,    50,   110,    -1,    53,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,
-      64,    65,    -1,     7,    -1,    -1,    -1,    -1,    72,    -1,
-      -1,    -1,    -1,    77,    78,    -1,    -1,    81,    82,    83,
-      24,    25,    86,    -1,    -1,    -1,    30,    31,    32,    -1,
-      -1,    -1,    -1,    -1,    38,    -1,    -1,    -1,    -1,    -1,
-      -1,    45,    -1,    -1,    48,    -1,    50,    -1,    -1,    53,
-     114,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,
-      64,    65,     7,    -1,    -1,    -1,    -1,    -1,    72,    -1,
-      -1,    -1,    -1,    77,    78,    -1,    -1,    81,    82,    83,
-      25,    -1,    86,    -1,    -1,    30,    31,    32,    -1,    -1,
-      -1,    -1,    -1,    38,     3,     4,     5,     6,     7,    -1,
-      45,    10,    -1,    48,    -1,    50,    -1,    -1,    53,    -1,
-     114,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    63,    64,
-      65,    -1,    -1,    -1,    -1,    -1,    -1,    72,    -1,    -1,
-      -1,    -1,    77,    78,    -1,    -1,    81,    82,    83,    -1,
-      -1,    86,    51,     3,     4,     5,     6,     7,    -1,    -1,
-      10,    -1,    -1,    62,    -1,    -1,    -1,    -1,    67,    68,
-      69,    70,    71,    -1,    73,    74,    75,    76,    -1,   114,
-      79,    80,     8,     9,    -1,    11,    12,    13,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,     8,     9,
-      -1,    11,    12,    13,   103,    -1,    -1,    -1,    -1,    -1,
-      -1,   110,    62,    -1,    -1,    -1,    26,    67,    68,    69,
-      70,    71,    -1,    73,    74,    75,    76,    -1,    -1,    79,
-      80,     8,     9,    -1,    11,    12,    13,    -1,     8,     9,
-      -1,    11,    12,    13,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    29,   103,     8,     9,    -1,    11,    12,    13,
-     110,    -1,    -1,    -1,    -1,    91,    -1,    -1,    -1,    39,
-      -1,    -1,    26,    -1,   100,   101,   102,   103,   104,   105,
-     106,    91,    -1,     8,     9,   111,    11,    12,    13,    -1,
-     100,   101,   102,   103,   104,   105,   106,    -1,    -1,    -1,
-      -1,    -1,     8,     9,    29,    11,    12,    13,    -1,    -1,
-      -1,    -1,    -1,    -1,    91,    -1,    -1,    -1,    -1,    -1,
-      -1,    91,    -1,   100,   101,   102,   103,   104,   105,   106,
-     100,   101,   102,   103,   104,   105,   106,    91,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,   100,   101,   102,   103,
-     104,   105,   106,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,    -1,    91,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,    -1,   100,   101,   102,   103,   104,
-     105,   106,    -1,    -1,    -1,    91,    -1,    -1,    -1,    -1,
-      -1,    -1,    -1,    -1,   100,   101,   102,   103,   104,   105,
-     106
+      48,    31,    32,    99,    56,    13,     7,   103,   104,     8,
+       9,    51,    11,    12,    13,    39,     7,     7,    31,    14,
+      47,    19,    49,     8,     9,   153,    11,    12,    13,    36,
+      37,    21,    72,    23,    24,   163,    26,    27,    28,    16,
+      17,     7,    32,    13,    74,    54,     0,    28,    38,    90,
+      80,    41,    91,    43,    93,    53,    46,    87,    88,    40,
+      69,    89,    53,    18,     7,    73,    56,    57,    58,    93,
+      91,   167,    93,    13,    73,    65,    66,    78,    68,    91,
+      93,    80,    81,    82,    83,    84,    85,    86,    73,   119,
+       7,    91,   220,    93,     7,    80,    81,    82,    83,    84,
+      85,    86,    79,    73,    94,    91,    91,    93,    91,    89,
+      93,    18,     7,    83,    84,    85,    86,    89,   148,   149,
+     150,   151,   152,    52,    39,   155,   156,   157,   158,   159,
+     160,   161,   162,    73,    30,   231,     7,   265,   168,     7,
+       7,   189,   270,    67,    67,    85,    86,   177,     7,    31,
+      89,    89,   200,   205,    89,    89,     7,    89,    89,    89,
+      30,    89,    89,    89,    89,   261,    28,    89,    89,    20,
+      21,    89,    15,    89,    88,    26,    27,    28,    89,    89,
+      89,    32,    90,    89,    88,    90,    42,    38,    90,    50,
+      41,   221,    43,    39,    59,    46,   226,   245,    90,     7,
+     230,    89,    59,   233,   234,    56,    57,    58,     5,    85,
+      90,     7,    20,    21,    65,    66,     7,    68,    26,    27,
+      28,    48,     7,    92,    32,    45,    80,   275,    91,    93,
+      38,   279,     7,    41,     7,    43,     7,    24,    46,    20,
+      93,    90,     7,    94,     7,    25,    32,    51,    56,    57,
+      58,    91,    21,    95,    92,    20,    21,    65,    66,    41,
+      68,    26,    27,    28,    70,    90,    15,    32,    34,     3,
+      10,    90,    71,    38,    35,    91,    41,     6,    43,     7,
+      72,    46,     7,    25,     7,     7,    94,   177,   175,   166,
+     235,    56,    57,    58,    56,   260,    11,    12,    13,    21,
+      65,    66,    12,    68,    26,    27,    28,    -1,    22,    -1,
+      32,   223,    -1,    -1,    -1,    -1,    38,   236,    -1,    41,
+      -1,    43,    -1,    -1,    46,    -1,    -1,    -1,    -1,    94,
+      -1,    -1,    -1,    -1,    56,    57,    58,    -1,     3,     4,
+       5,     6,     7,    65,    66,    10,    68,    -1,     3,     4,
+       5,     6,     7,    -1,    -1,    10,    -1,    -1,    73,    -1,
+      -1,    -1,    -1,    -1,    29,    80,    81,    82,    83,    84,
+      85,    86,    94,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,     3,     4,     5,     6,     7,    44,
+      55,    10,    -1,    -1,    -1,    60,    61,    62,    63,    64,
+      55,    -1,    -1,    -1,    -1,    60,    61,    62,    63,    64,
+      29,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    83,    -1,
+      85,    -1,    -1,    -1,    -1,    90,    -1,    -1,    83,    -1,
+       3,     4,     5,     6,     7,    90,    55,    10,    -1,    -1,
+      -1,    60,    61,    62,    63,    64,     8,     9,    -1,    11,
+      12,    13,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      22,    -1,     8,     9,    83,    11,    12,    13,    -1,    -1,
+      -1,    90,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    25,
+       8,     9,    55,    11,    12,    13,    -1,    60,    61,    62,
+      63,    64,    -1,    -1,     8,     9,    -1,    11,    12,    13,
+      -1,    -1,    -1,    -1,    -1,    33,    -1,    -1,    22,    -1,
+      83,    73,    -1,    -1,    -1,    -1,    -1,    90,    80,    81,
+      82,    83,    84,    85,    86,     8,     9,    73,    11,    12,
+      13,    -1,    -1,    -1,    80,    81,    82,    83,    84,    85,
+      86,    -1,    25,    -1,    -1,    73,    -1,    -1,    -1,    -1,
+      -1,    -1,    80,    81,    82,    83,    84,    85,    86,    73,
+      -1,    -1,    -1,    -1,    -1,    -1,    80,    81,    82,    83,
+      84,    85,    86,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,    -1,
+      73,    -1,    -1,    -1,    -1,    -1,    -1,    80,    81,    82,
+      83,    84,    85,    86
 };
 
   /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
      symbol of state STATE-NUM.  */
 static const yytype_uint8 yystos[] =
 {
-       0,    14,   117,   187,     7,     0,   109,   110,     7,   179,
-     180,    15,    16,   111,   113,    17,    18,    19,    21,    99,
-     178,   178,    22,   179,     7,   181,   182,   178,    60,   181,
-     183,   184,   185,   186,   109,    61,    87,    23,   185,     7,
-       7,     7,    25,    30,    31,    32,    38,    45,    48,    50,
-      53,    63,    64,    65,    72,    77,    78,    81,    82,    83,
-      86,   114,   118,   119,   123,   124,   125,   138,   139,   140,
-     144,   145,   146,   147,   148,   149,   150,   151,   155,   156,
-     157,   158,   159,   160,   161,   162,   170,   174,   176,   177,
-      22,   109,    59,     3,     4,     5,     6,     7,    10,    62,
-      67,    68,    69,    70,    71,    73,    74,    75,    76,    79,
-      80,   103,   110,   120,   121,   120,    33,    34,   105,   120,
-     130,   131,   132,     7,    46,     7,    96,   175,    36,    54,
-      56,   172,     7,     7,     7,   138,    84,    84,     7,    24,
-     118,   109,   110,   109,    47,   138,   109,    37,   133,   143,
-     109,   109,   133,   143,   109,   109,   109,   109,   109,   109,
-     109,   109,   109,   109,   109,   109,   109,   109,   109,   109,
-     138,   120,   108,   120,   108,   120,   120,     8,     9,    11,
-      12,    13,    26,    91,   100,   101,   102,   103,   104,   105,
-     106,   110,    29,   110,   110,    46,   113,    36,    15,   175,
-      49,   175,   175,    57,   173,    46,   110,   120,   129,   110,
-      51,   120,   109,    66,    66,   111,   120,   120,   120,   120,
-     120,   119,     5,   120,   120,   120,   120,   120,   120,   120,
-     129,   119,   120,    35,   105,     7,   128,   130,   127,   175,
-     120,     7,   141,   142,   110,    55,     7,   126,   128,   112,
-     122,   111,   113,   129,    52,    27,    28,   152,   153,   154,
-     111,    24,   111,     7,   111,   113,    37,   113,   133,    39,
-     100,   113,     7,   163,   164,     7,   110,   111,   113,   120,
-     111,     7,   119,   120,   152,    24,    29,   111,     7,   175,
-      38,   134,   120,   120,   141,   178,   111,   113,    58,   111,
-     115,   112,    26,    25,    48,    88,   135,    29,   110,   165,
-      97,   168,   163,   175,   119,    15,    41,   137,   119,     3,
-      85,   166,    98,   169,   110,    89,    42,    24,   111,    10,
-     167,   100,     7,   171,    90,     7,    29,     6,     3,   111,
-     113,    43,    44,   136,     7
+       0,    14,    97,   159,     7,     0,    89,    90,    91,    18,
+       7,   153,   154,    16,    17,    79,   152,    53,   153,   155,
+     156,   157,   158,    89,    54,    69,    19,   157,     7,     7,
+       7,    21,    26,    27,    28,    32,    38,    41,    43,    46,
+      56,    57,    58,    65,    66,    68,    94,    98,    99,   103,
+     116,   117,   118,   122,   123,   124,   125,   126,   127,   128,
+     132,   133,   134,   135,   136,   137,   138,   139,   144,   148,
+     150,   151,    18,    89,    52,     3,     4,     5,     6,     7,
+      10,    55,    60,    61,    62,    63,    64,    83,    90,   100,
+     101,   100,    29,    85,   100,   108,   109,   110,     7,    39,
+       7,    78,   149,    30,    47,    49,   146,     7,     7,     7,
+      67,    67,     7,    20,    98,    89,    40,   116,    89,    31,
+     111,   121,    89,    89,   111,   121,    89,    89,    89,    89,
+      89,    89,    89,    89,    89,    89,    89,    89,    89,    89,
+      89,   116,   100,    88,   100,    88,   100,   100,     8,     9,
+      11,    12,    13,    22,    73,    80,    81,    82,    83,    84,
+      85,    86,    90,    25,    90,    39,    93,    30,    15,   149,
+      42,   149,   149,    50,   147,    39,    90,    90,    44,   100,
+      89,    59,    59,    91,   100,   100,   100,   100,   100,    99,
+       5,   100,   100,   100,   100,   100,   100,   100,   100,   107,
+      99,    85,     7,   106,   108,   105,   149,   100,     7,   119,
+     120,    90,    48,     7,   104,   106,    92,   102,   107,    45,
+      23,    24,   129,   130,   131,    91,    93,    20,    91,    93,
+      31,    93,   111,    33,    80,    93,     7,   140,   141,     7,
+      90,    91,    93,    91,     7,    99,   100,   129,    20,   100,
+      25,     7,   149,    32,   112,   100,   100,   119,   152,    91,
+      93,    51,    91,    95,    92,    22,    21,    41,    70,   113,
+      25,    90,   142,   140,   149,    99,    15,    34,   115,    99,
+       3,    10,   143,    90,    71,    35,    20,    91,     6,     7,
+     145,    72,     7,    25,    91,    93,    36,    37,   114,     7
 };
 
   /* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
 static const yytype_uint8 yyr1[] =
 {
-       0,   116,   117,   118,   118,   118,   118,   118,   118,   118,
-     118,   118,   118,   118,   118,   118,   118,   118,   118,   118,
-     118,   118,   118,   118,   118,   119,   119,   120,   120,   120,
-     120,   120,   120,   120,   120,   120,   120,   120,   120,   120,
-     120,   120,   120,   120,   120,   120,   120,   120,   120,   120,
-     120,   120,   121,   121,   121,   121,   121,   121,   121,   121,
-     121,   121,   121,   122,   122,   122,   123,   124,   125,   125,
-     125,   126,   127,   127,   128,   128,   128,   129,   129,   129,
-     130,   130,   130,   130,   131,   131,   131,   132,   132,   132,
-     133,   133,   134,   134,   135,   135,   136,   136,   136,   137,
-     137,   138,   139,   140,   140,   141,   142,   142,   143,   144,
-     145,   146,   147,   148,   149,   150,   151,   152,   153,   153,
-     154,   154,   154,   155,   156,   157,   158,   159,   160,   161,
-     162,   162,   163,   164,   164,   165,   165,   166,   166,   167,
-     167,   168,   168,   169,   169,   170,   171,   171,   172,   172,
-     173,   173,   174,   175,   175,   176,   177,   178,   178,   178,
-     178,   178,   179,   179,   180,   180,   180,   181,   182,   182,
-     182,   183,   184,   185,   185,   186,   186,   186,   187
+       0,    96,    97,    98,    98,    98,    98,    98,    98,    98,
+      98,    98,    98,    98,    98,    98,    98,    98,    98,    98,
+      98,    98,    98,    99,    99,   100,   100,   100,   100,   100,
+     100,   100,   100,   100,   100,   100,   100,   100,   100,   100,
+     100,   100,   100,   100,   100,   100,   100,   100,   100,   100,
+     101,   101,   101,   101,   101,   102,   102,   102,   103,   104,
+     105,   105,   106,   106,   106,   107,   107,   107,   108,   108,
+     109,   109,   109,   110,   110,   110,   111,   111,   112,   112,
+     113,   113,   114,   114,   114,   115,   115,   116,   117,   118,
+     118,   119,   120,   120,   121,   122,   123,   124,   125,   126,
+     127,   128,   129,   130,   130,   131,   131,   131,   132,   133,
+     134,   135,   136,   137,   138,   139,   139,   140,   141,   141,
+     142,   142,   143,   143,   144,   145,   145,   146,   146,   147,
+     147,   148,   149,   149,   150,   151,   152,   152,   152,   153,
+     154,   154,   154,   155,   156,   157,   157,   158,   158,   158,
+     159
 };
 
   /* YYR2[YYN] -- Number of symbols on the right hand side of rule YYN.  */
@@ -1003,22 +910,20 @@ static const yytype_uint8 yyr2[] =
 {
        0,     2,     2,     1,     2,     2,     2,     2,     2,     2,
        2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     1,     2,     1,     4,     1,
-       1,     1,     1,     1,     3,     3,     3,     3,     2,     3,
-       3,     3,     3,     3,     3,     3,     3,     3,     3,     2,
-       3,     3,     1,     1,     1,     1,     1,     1,     1,     1,
-       1,     1,     1,     0,     1,     3,     6,     4,     1,     1,
-       1,     3,     1,     3,     0,     1,     3,     0,     1,     3,
-       1,     4,     5,     4,     0,     1,     3,     1,     3,     1,
-       0,     2,     0,     2,     0,     4,     0,     1,     1,     0,
-       4,     8,     3,     5,     2,     3,     1,     3,     4,     4,
-       2,     2,     3,     2,     2,     2,     3,     4,     1,     2,
-       0,     2,     1,     7,     6,    10,     1,     1,     2,     2,
-       4,     4,     5,     1,     3,     0,     3,     0,     1,     0,
-       2,     0,     1,     0,     3,     8,     1,     3,     0,     1,
-       0,     1,    10,     1,     1,     2,     2,     1,     1,     1,
-       1,     1,     3,     3,     0,     1,     3,     3,     0,     1,
-       2,     6,     4,     1,     1,     0,     1,     2,    11
+       2,     2,     2,     1,     2,     1,     4,     1,     1,     1,
+       1,     1,     3,     3,     3,     3,     2,     3,     3,     3,
+       3,     3,     3,     3,     3,     3,     3,     2,     3,     3,
+       1,     1,     1,     1,     1,     0,     1,     3,     6,     3,
+       1,     3,     0,     1,     3,     0,     1,     3,     1,     4,
+       0,     1,     3,     1,     3,     1,     0,     2,     0,     2,
+       0,     4,     0,     1,     1,     0,     4,     8,     3,     5,
+       2,     3,     1,     3,     4,     4,     2,     2,     3,     2,
+       2,     3,     4,     1,     2,     0,     2,     1,     7,     6,
+      10,     1,     1,     2,     2,     4,     4,     4,     1,     3,
+       0,     3,     0,     2,     6,     1,     3,     0,     1,     0,
+       1,    10,     1,     1,     2,     2,     1,     1,     1,     3,
+       0,     1,     2,     6,     4,     1,     1,     0,     1,     2,
+      10
 };
 
 
@@ -1034,22 +939,22 @@ static const yytype_uint8 yyr2[] =
 
 #define YYRECOVERING()  (!!yyerrstatus)
 
-#define YYBACKUP(Token, Value)                                  \
-do                                                              \
-  if (yychar == YYEMPTY)                                        \
-    {                                                           \
-      yychar = (Token);                                         \
-      yylval = (Value);                                         \
-      YYPOPSTACK (yylen);                                       \
-      yystate = *yyssp;                                         \
-      goto yybackup;                                            \
-    }                                                           \
-  else                                                          \
-    {                                                           \
-      yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                  \
-    }                                                           \
-while (0)
+#define YYBACKUP(Token, Value)                                    \
+  do                                                              \
+    if (yychar == YYEMPTY)                                        \
+      {                                                           \
+        yychar = (Token);                                         \
+        yylval = (Value);                                         \
+        YYPOPSTACK (yylen);                                       \
+        yystate = *yyssp;                                         \
+        goto yybackup;                                            \
+      }                                                           \
+    else                                                          \
+      {                                                           \
+        yyerror (YY_("syntax error: cannot back up")); \
+        YYERROR;                                                  \
+      }                                                           \
+  while (0)
 
 /* Error token number */
 #define YYTERROR        1
@@ -1089,37 +994,39 @@ do {                                                                      \
 } while (0)
 
 
-/*----------------------------------------.
-| Print this symbol's value on YYOUTPUT.  |
-`----------------------------------------*/
+/*-----------------------------------.
+| Print this symbol's value on YYO.  |
+`-----------------------------------*/
 
 static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_value_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
 {
-  FILE *yyo = yyoutput;
-  YYUSE (yyo);
+  FILE *yyoutput = yyo;
+  YYUSE (yyoutput);
   if (!yyvaluep)
     return;
 # ifdef YYPRINT
   if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
+    YYPRINT (yyo, yytoknum[yytype], *yyvaluep);
 # endif
+  YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   YYUSE (yytype);
+  YY_IGNORE_MAYBE_UNINITIALIZED_END
 }
 
 
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
+/*---------------------------.
+| Print this symbol on YYO.  |
+`---------------------------*/
 
 static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
+yy_symbol_print (FILE *yyo, int yytype, YYSTYPE const * const yyvaluep)
 {
-  YYFPRINTF (yyoutput, "%s %s (",
+  YYFPRINTF (yyo, "%s %s (",
              yytype < YYNTOKENS ? "token" : "nterm", yytname[yytype]);
 
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
-  YYFPRINTF (yyoutput, ")");
+  yy_symbol_value_print (yyo, yytype, yyvaluep);
+  YYFPRINTF (yyo, ")");
 }
 
 /*------------------------------------------------------------------.
@@ -1153,7 +1060,7 @@ do {                                                            \
 static void
 yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
 {
-  unsigned long int yylno = yyrline[yyrule];
+  unsigned long yylno = yyrline[yyrule];
   int yynrhs = yyr2[yyrule];
   int yyi;
   YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
@@ -1164,7 +1071,7 @@ yy_reduce_print (yytype_int16 *yyssp, YYSTYPE *yyvsp, int yyrule)
       YYFPRINTF (stderr, "   $%d = ", yyi + 1);
       yy_symbol_print (stderr,
                        yystos[yyssp[yyi + 1 - yynrhs]],
-                       &(yyvsp[(yyi + 1) - (yynrhs)])
+                       &yyvsp[(yyi + 1) - (yynrhs)]
                                               );
       YYFPRINTF (stderr, "\n");
     }
@@ -1268,7 +1175,10 @@ yytnamerr (char *yyres, const char *yystr)
           case '\\':
             if (*++yyp != '\\')
               goto do_not_strip_quotes;
-            /* Fall through.  */
+            else
+              goto append;
+
+          append:
           default:
             if (yyres)
               yyres[yyn] = *yyp;
@@ -1286,7 +1196,7 @@ yytnamerr (char *yyres, const char *yystr)
   if (! yyres)
     return yystrlen (yystr);
 
-  return yystpcpy (yyres, yystr) - yyres;
+  return (YYSIZE_T) (yystpcpy (yyres, yystr) - yyres);
 }
 # endif
 
@@ -1364,10 +1274,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
                 yyarg[yycount++] = yytname[yyx];
                 {
                   YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULLPTR, yytname[yyx]);
-                  if (! (yysize <= yysize1
-                         && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+                  if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+                    yysize = yysize1;
+                  else
                     return 2;
-                  yysize = yysize1;
                 }
               }
         }
@@ -1379,6 +1289,7 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
       case N:                               \
         yyformat = S;                       \
       break
+    default: /* Avoid compiler warnings. */
       YYCASE_(0, YY_("syntax error"));
       YYCASE_(1, YY_("syntax error, unexpected %s"));
       YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
@@ -1390,9 +1301,10 @@ yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
 
   {
     YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
-    if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
+    if (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM)
+      yysize = yysize1;
+    else
       return 2;
-    yysize = yysize1;
   }
 
   if (*yymsg_alloc < yysize)
@@ -1518,23 +1430,33 @@ yyparse (void)
   yychar = YYEMPTY; /* Cause a token to be read.  */
   goto yysetstate;
 
+
 /*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
+| yynewstate -- push a new state, which is found in yystate.  |
 `------------------------------------------------------------*/
- yynewstate:
+yynewstate:
   /* In all cases, when you get here, the value and location stacks
      have just been pushed.  So pushing a state here evens the stacks.  */
   yyssp++;
 
- yysetstate:
-  *yyssp = yystate;
+
+/*--------------------------------------------------------------------.
+| yynewstate -- set current state (the top of the stack) to yystate.  |
+`--------------------------------------------------------------------*/
+yysetstate:
+  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+  YY_ASSERT (0 <= yystate && yystate < YYNSTATES);
+  *yyssp = (yytype_int16) yystate;
 
   if (yyss + yystacksize - 1 <= yyssp)
+#if !defined yyoverflow && !defined YYSTACK_RELOCATE
+    goto yyexhaustedlab;
+#else
     {
       /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
+      YYSIZE_T yysize = (YYSIZE_T) (yyssp - yyss + 1);
 
-#ifdef yyoverflow
+# if defined yyoverflow
       {
         /* Give user a chance to reallocate the stack.  Use copies of
            these so that the &'s don't force the real ones into
@@ -1550,14 +1472,10 @@ yyparse (void)
                     &yyss1, yysize * sizeof (*yyssp),
                     &yyvs1, yysize * sizeof (*yyvsp),
                     &yystacksize);
-
         yyss = yyss1;
         yyvs = yyvs1;
       }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
+# else /* defined YYSTACK_RELOCATE */
       /* Extend the stack our own way.  */
       if (YYMAXDEPTH <= yystacksize)
         goto yyexhaustedlab;
@@ -1573,35 +1491,33 @@ yyparse (void)
           goto yyexhaustedlab;
         YYSTACK_RELOCATE (yyss_alloc, yyss);
         YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-#  undef YYSTACK_RELOCATE
+# undef YYSTACK_RELOCATE
         if (yyss1 != yyssa)
           YYSTACK_FREE (yyss1);
       }
 # endif
-#endif /* no yyoverflow */
 
       yyssp = yyss + yysize - 1;
       yyvsp = yyvs + yysize - 1;
 
       YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                  (unsigned long int) yystacksize));
+                  (unsigned long) yystacksize));
 
       if (yyss + yystacksize - 1 <= yyssp)
         YYABORT;
     }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
+#endif /* !defined yyoverflow && !defined YYSTACK_RELOCATE */
 
   if (yystate == YYFINAL)
     YYACCEPT;
 
   goto yybackup;
 
+
 /*-----------.
 | yybackup.  |
 `-----------*/
 yybackup:
-
   /* Do appropriate processing given the current state.  Read a
      lookahead token if we need one and don't already have one.  */
 
@@ -1659,7 +1575,6 @@ yybackup:
   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   *++yyvsp = yylval;
   YY_IGNORE_MAYBE_UNINITIALIZED_END
-
   goto yynewstate;
 
 
@@ -1674,7 +1589,7 @@ yydefault:
 
 
 /*-----------------------------.
-| yyreduce -- Do a reduction.  |
+| yyreduce -- do a reduction.  |
 `-----------------------------*/
 yyreduce:
   /* yyn is the number of a rule to reduce with.  */
@@ -1694,953 +1609,779 @@ yyreduce:
   YY_REDUCE_PRINT (yyn);
   switch (yyn)
     {
-        case 25:
-#line 188 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1701 "pars0grm.cc" /* yacc.c:1646  */
+  case 23:
+#line 166 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1616 "pars0grm.cc"
+    break;
+
+  case 24:
+#line 168 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-1], yyvsp[0]); }
+#line 1622 "pars0grm.cc"
+    break;
+
+  case 25:
+#line 172 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1628 "pars0grm.cc"
     break;
 
   case 26:
-#line 190 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 1707 "pars0grm.cc" /* yacc.c:1646  */
+#line 174 "pars0grm.y"
+    { yyval = pars_func(yyvsp[-3], yyvsp[-1]); }
+#line 1634 "pars0grm.cc"
     break;
 
   case 27:
-#line 194 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1713 "pars0grm.cc" /* yacc.c:1646  */
+#line 175 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1640 "pars0grm.cc"
     break;
 
   case 28:
-#line 196 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_func((yyvsp[-3]), (yyvsp[-1])); }
-#line 1719 "pars0grm.cc" /* yacc.c:1646  */
+#line 176 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1646 "pars0grm.cc"
     break;
 
   case 29:
-#line 197 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1725 "pars0grm.cc" /* yacc.c:1646  */
+#line 177 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1652 "pars0grm.cc"
     break;
 
   case 30:
-#line 198 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1731 "pars0grm.cc" /* yacc.c:1646  */
+#line 178 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1658 "pars0grm.cc"
     break;
 
   case 31:
-#line 199 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1737 "pars0grm.cc" /* yacc.c:1646  */
+#line 179 "pars0grm.y"
+    { yyval = yyvsp[0];}
+#line 1664 "pars0grm.cc"
     break;
 
   case 32:
-#line 200 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1743 "pars0grm.cc" /* yacc.c:1646  */
+#line 180 "pars0grm.y"
+    { yyval = pars_op('+', yyvsp[-2], yyvsp[0]); }
+#line 1670 "pars0grm.cc"
     break;
 
   case 33:
-#line 201 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]);}
-#line 1749 "pars0grm.cc" /* yacc.c:1646  */
+#line 181 "pars0grm.y"
+    { yyval = pars_op('-', yyvsp[-2], yyvsp[0]); }
+#line 1676 "pars0grm.cc"
     break;
 
   case 34:
-#line 202 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('+', (yyvsp[-2]), (yyvsp[0])); }
-#line 1755 "pars0grm.cc" /* yacc.c:1646  */
+#line 182 "pars0grm.y"
+    { yyval = pars_op('*', yyvsp[-2], yyvsp[0]); }
+#line 1682 "pars0grm.cc"
     break;
 
   case 35:
-#line 203 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('-', (yyvsp[-2]), (yyvsp[0])); }
-#line 1761 "pars0grm.cc" /* yacc.c:1646  */
+#line 183 "pars0grm.y"
+    { yyval = pars_op('/', yyvsp[-2], yyvsp[0]); }
+#line 1688 "pars0grm.cc"
     break;
 
   case 36:
-#line 204 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('*', (yyvsp[-2]), (yyvsp[0])); }
-#line 1767 "pars0grm.cc" /* yacc.c:1646  */
+#line 184 "pars0grm.y"
+    { yyval = pars_op('-', yyvsp[0], NULL); }
+#line 1694 "pars0grm.cc"
     break;
 
   case 37:
-#line 205 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('/', (yyvsp[-2]), (yyvsp[0])); }
-#line 1773 "pars0grm.cc" /* yacc.c:1646  */
+#line 185 "pars0grm.y"
+    { yyval = yyvsp[-1]; }
+#line 1700 "pars0grm.cc"
     break;
 
   case 38:
-#line 206 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('-', (yyvsp[0]), NULL); }
-#line 1779 "pars0grm.cc" /* yacc.c:1646  */
+#line 186 "pars0grm.y"
+    { yyval = pars_op('=', yyvsp[-2], yyvsp[0]); }
+#line 1706 "pars0grm.cc"
     break;
 
   case 39:
-#line 207 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[-1]); }
-#line 1785 "pars0grm.cc" /* yacc.c:1646  */
+#line 188 "pars0grm.y"
+    { yyval = pars_op(PARS_LIKE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1712 "pars0grm.cc"
     break;
 
   case 40:
-#line 208 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('=', (yyvsp[-2]), (yyvsp[0])); }
-#line 1791 "pars0grm.cc" /* yacc.c:1646  */
+#line 189 "pars0grm.y"
+    { yyval = pars_op('<', yyvsp[-2], yyvsp[0]); }
+#line 1718 "pars0grm.cc"
     break;
 
   case 41:
-#line 210 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_LIKE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1797 "pars0grm.cc" /* yacc.c:1646  */
+#line 190 "pars0grm.y"
+    { yyval = pars_op('>', yyvsp[-2], yyvsp[0]); }
+#line 1724 "pars0grm.cc"
     break;
 
   case 42:
-#line 211 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('<', (yyvsp[-2]), (yyvsp[0])); }
-#line 1803 "pars0grm.cc" /* yacc.c:1646  */
+#line 191 "pars0grm.y"
+    { yyval = pars_op(PARS_GE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1730 "pars0grm.cc"
     break;
 
   case 43:
-#line 212 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op('>', (yyvsp[-2]), (yyvsp[0])); }
-#line 1809 "pars0grm.cc" /* yacc.c:1646  */
+#line 192 "pars0grm.y"
+    { yyval = pars_op(PARS_LE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1736 "pars0grm.cc"
     break;
 
   case 44:
-#line 213 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_GE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1815 "pars0grm.cc" /* yacc.c:1646  */
+#line 193 "pars0grm.y"
+    { yyval = pars_op(PARS_NE_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1742 "pars0grm.cc"
     break;
 
   case 45:
-#line 214 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_LE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1821 "pars0grm.cc" /* yacc.c:1646  */
+#line 194 "pars0grm.y"
+    { yyval = pars_op(PARS_AND_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1748 "pars0grm.cc"
     break;
 
   case 46:
-#line 215 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_NE_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1827 "pars0grm.cc" /* yacc.c:1646  */
+#line 195 "pars0grm.y"
+    { yyval = pars_op(PARS_OR_TOKEN, yyvsp[-2], yyvsp[0]); }
+#line 1754 "pars0grm.cc"
     break;
 
   case 47:
-#line 216 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_AND_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1833 "pars0grm.cc" /* yacc.c:1646  */
+#line 196 "pars0grm.y"
+    { yyval = pars_op(PARS_NOT_TOKEN, yyvsp[0], NULL); }
+#line 1760 "pars0grm.cc"
     break;
 
   case 48:
-#line 217 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_OR_TOKEN, (yyvsp[-2]), (yyvsp[0])); }
-#line 1839 "pars0grm.cc" /* yacc.c:1646  */
+#line 198 "pars0grm.y"
+    { yyval = pars_op(PARS_NOTFOUND_TOKEN, yyvsp[-2], NULL); }
+#line 1766 "pars0grm.cc"
     break;
 
   case 49:
-#line 218 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_NOT_TOKEN, (yyvsp[0]), NULL); }
-#line 1845 "pars0grm.cc" /* yacc.c:1646  */
+#line 200 "pars0grm.y"
+    { yyval = pars_op(PARS_NOTFOUND_TOKEN, yyvsp[-2], NULL); }
+#line 1772 "pars0grm.cc"
     break;
 
   case 50:
-#line 220 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1851 "pars0grm.cc" /* yacc.c:1646  */
+#line 204 "pars0grm.y"
+    { yyval = &pars_to_binary_token; }
+#line 1778 "pars0grm.cc"
     break;
 
   case 51:
-#line 222 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_op(PARS_NOTFOUND_TOKEN, (yyvsp[-2]), NULL); }
-#line 1857 "pars0grm.cc" /* yacc.c:1646  */
+#line 205 "pars0grm.y"
+    { yyval = &pars_substr_token; }
+#line 1784 "pars0grm.cc"
     break;
 
   case 52:
-#line 226 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_to_char_token; }
-#line 1863 "pars0grm.cc" /* yacc.c:1646  */
+#line 206 "pars0grm.y"
+    { yyval = &pars_concat_token; }
+#line 1790 "pars0grm.cc"
     break;
 
   case 53:
-#line 227 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_to_number_token; }
-#line 1869 "pars0grm.cc" /* yacc.c:1646  */
+#line 207 "pars0grm.y"
+    { yyval = &pars_instr_token; }
+#line 1796 "pars0grm.cc"
     break;
 
   case 54:
-#line 228 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_to_binary_token; }
-#line 1875 "pars0grm.cc" /* yacc.c:1646  */
+#line 208 "pars0grm.y"
+    { yyval = &pars_length_token; }
+#line 1802 "pars0grm.cc"
     break;
 
-  case 55:
-#line 230 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_binary_to_number_token; }
-#line 1881 "pars0grm.cc" /* yacc.c:1646  */
+  case 58:
+#line 219 "pars0grm.y"
+    { yyval = pars_stored_procedure_call(
+					static_cast(yyvsp[-4])); }
+#line 1809 "pars0grm.cc"
     break;
 
-  case 56:
-#line 231 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_substr_token; }
-#line 1887 "pars0grm.cc" /* yacc.c:1646  */
+  case 59:
+#line 224 "pars0grm.y"
+    { yyval = yyvsp[-2]; }
+#line 1815 "pars0grm.cc"
     break;
 
-  case 57:
-#line 232 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_concat_token; }
-#line 1893 "pars0grm.cc" /* yacc.c:1646  */
+  case 60:
+#line 228 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1821 "pars0grm.cc"
     break;
 
-  case 58:
-#line 233 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_instr_token; }
-#line 1899 "pars0grm.cc" /* yacc.c:1646  */
+  case 61:
+#line 230 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1827 "pars0grm.cc"
     break;
 
-  case 59:
-#line 234 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_length_token; }
-#line 1905 "pars0grm.cc" /* yacc.c:1646  */
+  case 62:
+#line 234 "pars0grm.y"
+    { yyval = NULL; }
+#line 1833 "pars0grm.cc"
     break;
 
-  case 60:
-#line 235 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_sysdate_token; }
-#line 1911 "pars0grm.cc" /* yacc.c:1646  */
+  case 63:
+#line 235 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1839 "pars0grm.cc"
     break;
 
-  case 61:
-#line 236 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_rnd_token; }
-#line 1917 "pars0grm.cc" /* yacc.c:1646  */
+  case 64:
+#line 237 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1845 "pars0grm.cc"
     break;
 
-  case 62:
-#line 237 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_rnd_str_token; }
-#line 1923 "pars0grm.cc" /* yacc.c:1646  */
+  case 65:
+#line 241 "pars0grm.y"
+    { yyval = NULL; }
+#line 1851 "pars0grm.cc"
     break;
 
   case 66:
-#line 248 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_stored_procedure_call(
-					static_cast((yyvsp[-4]))); }
-#line 1930 "pars0grm.cc" /* yacc.c:1646  */
+#line 242 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]);}
+#line 1857 "pars0grm.cc"
     break;
 
   case 67:
-#line 254 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_procedure_call((yyvsp[-3]), (yyvsp[-1])); }
-#line 1936 "pars0grm.cc" /* yacc.c:1646  */
+#line 243 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1863 "pars0grm.cc"
     break;
 
   case 68:
-#line 258 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_replstr_token; }
-#line 1942 "pars0grm.cc" /* yacc.c:1646  */
+#line 247 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 1869 "pars0grm.cc"
     break;
 
   case 69:
-#line 259 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_printf_token; }
-#line 1948 "pars0grm.cc" /* yacc.c:1646  */
+#line 249 "pars0grm.y"
+    { yyval = pars_func(&pars_count_token,
+					  que_node_list_add_last(NULL,
+					    sym_tab_add_int_lit(
+						pars_sym_tab_global, 1))); }
+#line 1878 "pars0grm.cc"
     break;
 
   case 70:
-#line 260 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_assert_token; }
-#line 1954 "pars0grm.cc" /* yacc.c:1646  */
+#line 256 "pars0grm.y"
+    { yyval = NULL; }
+#line 1884 "pars0grm.cc"
     break;
 
   case 71:
-#line 264 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[-2]); }
-#line 1960 "pars0grm.cc" /* yacc.c:1646  */
+#line 257 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 1890 "pars0grm.cc"
     break;
 
   case 72:
-#line 268 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1966 "pars0grm.cc" /* yacc.c:1646  */
+#line 259 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 1896 "pars0grm.cc"
     break;
 
   case 73:
-#line 270 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 1972 "pars0grm.cc" /* yacc.c:1646  */
+#line 263 "pars0grm.y"
+    { yyval = pars_select_list(&pars_star_denoter,
+								NULL); }
+#line 1903 "pars0grm.cc"
     break;
 
   case 74:
-#line 274 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 1978 "pars0grm.cc" /* yacc.c:1646  */
+#line 266 "pars0grm.y"
+    { yyval = pars_select_list(
+					yyvsp[-2], static_cast(yyvsp[0])); }
+#line 1910 "pars0grm.cc"
     break;
 
   case 75:
-#line 275 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 1984 "pars0grm.cc" /* yacc.c:1646  */
+#line 268 "pars0grm.y"
+    { yyval = pars_select_list(yyvsp[0], NULL); }
+#line 1916 "pars0grm.cc"
     break;
 
   case 76:
-#line 277 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 1990 "pars0grm.cc" /* yacc.c:1646  */
+#line 272 "pars0grm.y"
+    { yyval = NULL; }
+#line 1922 "pars0grm.cc"
     break;
 
   case 77:
-#line 281 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 1996 "pars0grm.cc" /* yacc.c:1646  */
+#line 273 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 1928 "pars0grm.cc"
     break;
 
   case 78:
-#line 282 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0]));}
-#line 2002 "pars0grm.cc" /* yacc.c:1646  */
+#line 277 "pars0grm.y"
+    { yyval = NULL; }
+#line 1934 "pars0grm.cc"
     break;
 
   case 79:
-#line 283 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2008 "pars0grm.cc" /* yacc.c:1646  */
+#line 279 "pars0grm.y"
+    { yyval = &pars_update_token; }
+#line 1940 "pars0grm.cc"
     break;
 
   case 80:
-#line 287 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2014 "pars0grm.cc" /* yacc.c:1646  */
+#line 283 "pars0grm.y"
+    { yyval = NULL; }
+#line 1946 "pars0grm.cc"
     break;
 
   case 81:
-#line 289 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_func(&pars_count_token,
-				          que_node_list_add_last(NULL,
-					    sym_tab_add_int_lit(
-						pars_sym_tab_global, 1))); }
-#line 2023 "pars0grm.cc" /* yacc.c:1646  */
+#line 285 "pars0grm.y"
+    { yyval = &pars_share_token; }
+#line 1952 "pars0grm.cc"
     break;
 
   case 82:
-#line 294 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_func(&pars_count_token,
-					    que_node_list_add_last(NULL,
-						pars_func(&pars_distinct_token,
-						     que_node_list_add_last(
-								NULL, (yyvsp[-1]))))); }
-#line 2033 "pars0grm.cc" /* yacc.c:1646  */
+#line 289 "pars0grm.y"
+    { yyval = &pars_asc_token; }
+#line 1958 "pars0grm.cc"
     break;
 
   case 83:
-#line 300 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_func(&pars_sum_token,
-						que_node_list_add_last(NULL,
-									(yyvsp[-1]))); }
-#line 2041 "pars0grm.cc" /* yacc.c:1646  */
+#line 290 "pars0grm.y"
+    { yyval = &pars_asc_token; }
+#line 1964 "pars0grm.cc"
     break;
 
   case 84:
-#line 306 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2047 "pars0grm.cc" /* yacc.c:1646  */
+#line 291 "pars0grm.y"
+    { yyval = &pars_desc_token; }
+#line 1970 "pars0grm.cc"
     break;
 
   case 85:
-#line 307 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2053 "pars0grm.cc" /* yacc.c:1646  */
+#line 295 "pars0grm.y"
+    { yyval = NULL; }
+#line 1976 "pars0grm.cc"
     break;
 
   case 86:
-#line 309 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2059 "pars0grm.cc" /* yacc.c:1646  */
+#line 297 "pars0grm.y"
+    { yyval = pars_order_by(
+					static_cast(yyvsp[-1]),
+					static_cast(yyvsp[0])); }
+#line 1984 "pars0grm.cc"
     break;
 
   case 87:
-#line 313 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_select_list(&pars_star_denoter,
-								NULL); }
-#line 2066 "pars0grm.cc" /* yacc.c:1646  */
+#line 308 "pars0grm.y"
+    { yyval = pars_select_statement(
+					static_cast(yyvsp[-6]),
+					static_cast(yyvsp[-4]),
+					static_cast(yyvsp[-3]),
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[-1]),
+					static_cast(yyvsp[0])); }
+#line 1996 "pars0grm.cc"
     break;
 
   case 88:
-#line 316 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_select_list(
-					(yyvsp[-2]), static_cast((yyvsp[0]))); }
-#line 2073 "pars0grm.cc" /* yacc.c:1646  */
+#line 319 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2002 "pars0grm.cc"
     break;
 
   case 89:
-#line 318 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_select_list((yyvsp[0]), NULL); }
-#line 2079 "pars0grm.cc" /* yacc.c:1646  */
+#line 324 "pars0grm.y"
+    { yyval = pars_insert_statement(
+					static_cast(yyvsp[-4]), yyvsp[-1], NULL); }
+#line 2009 "pars0grm.cc"
     break;
 
   case 90:
-#line 322 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2085 "pars0grm.cc" /* yacc.c:1646  */
+#line 327 "pars0grm.y"
+    { yyval = pars_insert_statement(
+					static_cast(yyvsp[-1]),
+					NULL,
+					static_cast(yyvsp[0])); }
+#line 2018 "pars0grm.cc"
     break;
 
   case 91:
-#line 323 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2091 "pars0grm.cc" /* yacc.c:1646  */
+#line 334 "pars0grm.y"
+    { yyval = pars_column_assignment(
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[0])); }
+#line 2026 "pars0grm.cc"
     break;
 
   case 92:
-#line 327 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2097 "pars0grm.cc" /* yacc.c:1646  */
+#line 340 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2032 "pars0grm.cc"
     break;
 
   case 93:
-#line 329 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_update_token; }
-#line 2103 "pars0grm.cc" /* yacc.c:1646  */
+#line 342 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2038 "pars0grm.cc"
     break;
 
   case 94:
-#line 333 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2109 "pars0grm.cc" /* yacc.c:1646  */
+#line 348 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2044 "pars0grm.cc"
     break;
 
   case 95:
-#line 335 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_share_token; }
-#line 2115 "pars0grm.cc" /* yacc.c:1646  */
+#line 354 "pars0grm.y"
+    { yyval = pars_update_statement_start(
+					FALSE,
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[0])); }
+#line 2053 "pars0grm.cc"
     break;
 
   case 96:
-#line 339 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_asc_token; }
-#line 2121 "pars0grm.cc" /* yacc.c:1646  */
+#line 362 "pars0grm.y"
+    { yyval = pars_update_statement(
+					static_cast(yyvsp[-1]),
+					NULL,
+					static_cast(yyvsp[0])); }
+#line 2062 "pars0grm.cc"
     break;
 
   case 97:
-#line 340 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_asc_token; }
-#line 2127 "pars0grm.cc" /* yacc.c:1646  */
+#line 370 "pars0grm.y"
+    { yyval = pars_update_statement(
+					static_cast(yyvsp[-1]),
+					static_cast(yyvsp[0]),
+					NULL); }
+#line 2071 "pars0grm.cc"
     break;
 
   case 98:
-#line 341 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_desc_token; }
-#line 2133 "pars0grm.cc" /* yacc.c:1646  */
+#line 378 "pars0grm.y"
+    { yyval = pars_update_statement_start(
+					TRUE,
+					static_cast(yyvsp[0]), NULL); }
+#line 2079 "pars0grm.cc"
     break;
 
   case 99:
-#line 345 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2139 "pars0grm.cc" /* yacc.c:1646  */
+#line 385 "pars0grm.y"
+    { yyval = pars_update_statement(
+					static_cast(yyvsp[-1]),
+					NULL,
+					static_cast(yyvsp[0])); }
+#line 2088 "pars0grm.cc"
     break;
 
   case 100:
-#line 347 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_order_by(
-					static_cast((yyvsp[-1])),
-					static_cast((yyvsp[0]))); }
-#line 2147 "pars0grm.cc" /* yacc.c:1646  */
+#line 393 "pars0grm.y"
+    { yyval = pars_update_statement(
+					static_cast(yyvsp[-1]),
+					static_cast(yyvsp[0]),
+					NULL); }
+#line 2097 "pars0grm.cc"
     break;
 
   case 101:
-#line 358 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_select_statement(
-					static_cast((yyvsp[-6])),
-					static_cast((yyvsp[-4])),
-					static_cast((yyvsp[-3])),
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[-1])),
-					static_cast((yyvsp[0]))); }
-#line 2159 "pars0grm.cc" /* yacc.c:1646  */
+#line 401 "pars0grm.y"
+    { yyval = pars_assignment_statement(
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[0])); }
+#line 2105 "pars0grm.cc"
     break;
 
   case 102:
-#line 369 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2165 "pars0grm.cc" /* yacc.c:1646  */
+#line 409 "pars0grm.y"
+    { yyval = pars_elsif_element(yyvsp[-2], yyvsp[0]); }
+#line 2111 "pars0grm.cc"
     break;
 
   case 103:
-#line 374 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_insert_statement(
-					static_cast((yyvsp[-4])), (yyvsp[-1]), NULL); }
-#line 2172 "pars0grm.cc" /* yacc.c:1646  */
+#line 413 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2117 "pars0grm.cc"
     break;
 
   case 104:
-#line 377 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_insert_statement(
-					static_cast((yyvsp[-1])),
-					NULL,
-					static_cast((yyvsp[0]))); }
-#line 2181 "pars0grm.cc" /* yacc.c:1646  */
+#line 415 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-1], yyvsp[0]); }
+#line 2123 "pars0grm.cc"
     break;
 
   case 105:
-#line 384 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_column_assignment(
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[0]))); }
-#line 2189 "pars0grm.cc" /* yacc.c:1646  */
+#line 419 "pars0grm.y"
+    { yyval = NULL; }
+#line 2129 "pars0grm.cc"
     break;
 
   case 106:
-#line 390 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2195 "pars0grm.cc" /* yacc.c:1646  */
+#line 421 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2135 "pars0grm.cc"
     break;
 
   case 107:
-#line 392 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2201 "pars0grm.cc" /* yacc.c:1646  */
+#line 422 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2141 "pars0grm.cc"
     break;
 
   case 108:
-#line 398 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2207 "pars0grm.cc" /* yacc.c:1646  */
+#line 429 "pars0grm.y"
+    { yyval = pars_if_statement(yyvsp[-5], yyvsp[-3], yyvsp[-2]); }
+#line 2147 "pars0grm.cc"
     break;
 
   case 109:
-#line 404 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement_start(
-					FALSE,
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[0]))); }
-#line 2216 "pars0grm.cc" /* yacc.c:1646  */
+#line 435 "pars0grm.y"
+    { yyval = pars_while_statement(yyvsp[-4], yyvsp[-2]); }
+#line 2153 "pars0grm.cc"
     break;
 
   case 110:
-#line 412 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement(
-					static_cast((yyvsp[-1])),
-					NULL,
-					static_cast((yyvsp[0]))); }
-#line 2225 "pars0grm.cc" /* yacc.c:1646  */
+#line 443 "pars0grm.y"
+    { yyval = pars_for_statement(
+					static_cast(yyvsp[-8]),
+					yyvsp[-6], yyvsp[-4], yyvsp[-2]); }
+#line 2161 "pars0grm.cc"
     break;
 
   case 111:
-#line 420 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement(
-					static_cast((yyvsp[-1])),
-					static_cast((yyvsp[0])),
-					NULL); }
-#line 2234 "pars0grm.cc" /* yacc.c:1646  */
+#line 449 "pars0grm.y"
+    { yyval = pars_exit_statement(); }
+#line 2167 "pars0grm.cc"
     break;
 
   case 112:
-#line 428 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement_start(
-					TRUE,
-					static_cast((yyvsp[0])), NULL); }
-#line 2242 "pars0grm.cc" /* yacc.c:1646  */
+#line 453 "pars0grm.y"
+    { yyval = pars_return_statement(); }
+#line 2173 "pars0grm.cc"
     break;
 
   case 113:
-#line 435 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement(
-					static_cast((yyvsp[-1])),
-					NULL,
-					static_cast((yyvsp[0]))); }
-#line 2251 "pars0grm.cc" /* yacc.c:1646  */
+#line 458 "pars0grm.y"
+    { yyval = pars_open_statement(
+						ROW_SEL_OPEN_CURSOR,
+						static_cast(yyvsp[0])); }
+#line 2181 "pars0grm.cc"
     break;
 
   case 114:
-#line 443 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_update_statement(
-					static_cast((yyvsp[-1])),
-					static_cast((yyvsp[0])),
-					NULL); }
-#line 2260 "pars0grm.cc" /* yacc.c:1646  */
+#line 465 "pars0grm.y"
+    { yyval = pars_open_statement(
+						ROW_SEL_CLOSE_CURSOR,
+						static_cast(yyvsp[0])); }
+#line 2189 "pars0grm.cc"
     break;
 
   case 115:
-#line 451 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_row_printf_statement(
-					static_cast((yyvsp[0]))); }
-#line 2267 "pars0grm.cc" /* yacc.c:1646  */
+#line 472 "pars0grm.y"
+    { yyval = pars_fetch_statement(
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[0]), NULL); }
+#line 2197 "pars0grm.cc"
     break;
 
   case 116:
-#line 457 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_assignment_statement(
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[0]))); }
-#line 2275 "pars0grm.cc" /* yacc.c:1646  */
+#line 476 "pars0grm.y"
+    { yyval = pars_fetch_statement(
+					static_cast(yyvsp[-2]),
+					NULL,
+					static_cast(yyvsp[0])); }
+#line 2206 "pars0grm.cc"
     break;
 
   case 117:
-#line 465 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_elsif_element((yyvsp[-2]), (yyvsp[0])); }
-#line 2281 "pars0grm.cc" /* yacc.c:1646  */
+#line 484 "pars0grm.y"
+    { yyval = pars_column_def(
+					static_cast(yyvsp[-3]),
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[-1]),
+					yyvsp[0]); }
+#line 2216 "pars0grm.cc"
     break;
 
   case 118:
-#line 469 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2287 "pars0grm.cc" /* yacc.c:1646  */
+#line 492 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2222 "pars0grm.cc"
     break;
 
   case 119:
-#line 471 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-1]), (yyvsp[0])); }
-#line 2293 "pars0grm.cc" /* yacc.c:1646  */
+#line 494 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2228 "pars0grm.cc"
     break;
 
   case 120:
-#line 475 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2299 "pars0grm.cc" /* yacc.c:1646  */
+#line 498 "pars0grm.y"
+    { yyval = NULL; }
+#line 2234 "pars0grm.cc"
     break;
 
   case 121:
-#line 477 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2305 "pars0grm.cc" /* yacc.c:1646  */
+#line 500 "pars0grm.y"
+    { yyval = yyvsp[-1]; }
+#line 2240 "pars0grm.cc"
     break;
 
   case 122:
-#line 478 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2311 "pars0grm.cc" /* yacc.c:1646  */
+#line 504 "pars0grm.y"
+    { yyval = NULL; }
+#line 2246 "pars0grm.cc"
     break;
 
   case 123:
-#line 485 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_if_statement((yyvsp[-5]), (yyvsp[-3]), (yyvsp[-2])); }
-#line 2317 "pars0grm.cc" /* yacc.c:1646  */
+#line 506 "pars0grm.y"
+    { yyval = &pars_int_token;
+					/* pass any non-NULL pointer */ }
+#line 2253 "pars0grm.cc"
     break;
 
   case 124:
-#line 491 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_while_statement((yyvsp[-4]), (yyvsp[-2])); }
-#line 2323 "pars0grm.cc" /* yacc.c:1646  */
+#line 513 "pars0grm.y"
+    { yyval = pars_create_table(
+					static_cast(yyvsp[-3]),
+					static_cast(yyvsp[-1])); }
+#line 2261 "pars0grm.cc"
     break;
 
   case 125:
-#line 499 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_for_statement(
-					static_cast((yyvsp[-8])),
-					(yyvsp[-6]), (yyvsp[-4]), (yyvsp[-2])); }
-#line 2331 "pars0grm.cc" /* yacc.c:1646  */
+#line 519 "pars0grm.y"
+    { yyval = que_node_list_add_last(NULL, yyvsp[0]); }
+#line 2267 "pars0grm.cc"
     break;
 
   case 126:
-#line 505 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_exit_statement(); }
-#line 2337 "pars0grm.cc" /* yacc.c:1646  */
+#line 521 "pars0grm.y"
+    { yyval = que_node_list_add_last(yyvsp[-2], yyvsp[0]); }
+#line 2273 "pars0grm.cc"
     break;
 
   case 127:
-#line 509 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_return_statement(); }
-#line 2343 "pars0grm.cc" /* yacc.c:1646  */
+#line 525 "pars0grm.y"
+    { yyval = NULL; }
+#line 2279 "pars0grm.cc"
     break;
 
   case 128:
-#line 514 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_open_statement(
-						ROW_SEL_OPEN_CURSOR,
-						static_cast((yyvsp[0]))); }
-#line 2351 "pars0grm.cc" /* yacc.c:1646  */
+#line 526 "pars0grm.y"
+    { yyval = &pars_unique_token; }
+#line 2285 "pars0grm.cc"
     break;
 
   case 129:
-#line 521 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_open_statement(
-						ROW_SEL_CLOSE_CURSOR,
-						static_cast((yyvsp[0]))); }
-#line 2359 "pars0grm.cc" /* yacc.c:1646  */
+#line 530 "pars0grm.y"
+    { yyval = NULL; }
+#line 2291 "pars0grm.cc"
     break;
 
   case 130:
-#line 528 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_fetch_statement(
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[0])), NULL); }
-#line 2367 "pars0grm.cc" /* yacc.c:1646  */
+#line 531 "pars0grm.y"
+    { yyval = &pars_clustered_token; }
+#line 2297 "pars0grm.cc"
     break;
 
   case 131:
-#line 532 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_fetch_statement(
-					static_cast((yyvsp[-2])),
-					NULL,
-					static_cast((yyvsp[0]))); }
-#line 2376 "pars0grm.cc" /* yacc.c:1646  */
+#line 540 "pars0grm.y"
+    { yyval = pars_create_index(
+					static_cast(yyvsp[-8]),
+					static_cast(yyvsp[-7]),
+					static_cast(yyvsp[-5]),
+					static_cast(yyvsp[-3]),
+					static_cast(yyvsp[-1])); }
+#line 2308 "pars0grm.cc"
     break;
 
   case 132:
-#line 540 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_column_def(
-					static_cast((yyvsp[-4])),
-					static_cast((yyvsp[-3])),
-					static_cast((yyvsp[-2])),
-					(yyvsp[-1]), (yyvsp[0])); }
-#line 2386 "pars0grm.cc" /* yacc.c:1646  */
+#line 549 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2314 "pars0grm.cc"
     break;
 
   case 133:
-#line 548 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2392 "pars0grm.cc" /* yacc.c:1646  */
+#line 550 "pars0grm.y"
+    { yyval = yyvsp[0]; }
+#line 2320 "pars0grm.cc"
     break;
 
   case 134:
-#line 550 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2398 "pars0grm.cc" /* yacc.c:1646  */
+#line 555 "pars0grm.y"
+    { yyval = pars_commit_statement(); }
+#line 2326 "pars0grm.cc"
     break;
 
   case 135:
-#line 554 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2404 "pars0grm.cc" /* yacc.c:1646  */
+#line 560 "pars0grm.y"
+    { yyval = pars_rollback_statement(); }
+#line 2332 "pars0grm.cc"
     break;
 
   case 136:
-#line 556 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[-1]); }
-#line 2410 "pars0grm.cc" /* yacc.c:1646  */
+#line 564 "pars0grm.y"
+    { yyval = &pars_int_token; }
+#line 2338 "pars0grm.cc"
     break;
 
   case 137:
-#line 560 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2416 "pars0grm.cc" /* yacc.c:1646  */
+#line 565 "pars0grm.y"
+    { yyval = &pars_bigint_token; }
+#line 2344 "pars0grm.cc"
     break;
 
   case 138:
-#line 562 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_int_token;
-					/* pass any non-NULL pointer */ }
-#line 2423 "pars0grm.cc" /* yacc.c:1646  */
+#line 566 "pars0grm.y"
+    { yyval = &pars_char_token; }
+#line 2350 "pars0grm.cc"
     break;
 
   case 139:
-#line 567 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2429 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 140:
-#line 569 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_int_token;
-					/* pass any non-NULL pointer */ }
-#line 2436 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 141:
-#line 574 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2442 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 142:
-#line 575 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_int_token;
-					/* pass any non-NULL pointer */ }
-#line 2449 "pars0grm.cc" /* yacc.c:1646  */
+#line 571 "pars0grm.y"
+    { yyval = pars_variable_declaration(
+					static_cast(yyvsp[-2]),
+					static_cast(yyvsp[-1])); }
+#line 2358 "pars0grm.cc"
     break;
 
   case 143:
-#line 580 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2455 "pars0grm.cc" /* yacc.c:1646  */
+#line 585 "pars0grm.y"
+    { yyval = pars_cursor_declaration(
+					static_cast(yyvsp[-3]),
+					static_cast(yyvsp[-1])); }
+#line 2366 "pars0grm.cc"
     break;
 
   case 144:
-#line 582 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2461 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 145:
-#line 589 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_create_table(
-					static_cast((yyvsp[-5])),
-					static_cast((yyvsp[-3])),
-					static_cast((yyvsp[-1])),
-					static_cast((yyvsp[0]))); }
-#line 2471 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 146:
-#line 597 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2477 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 147:
-#line 599 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2483 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 148:
-#line 603 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2489 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 149:
-#line 604 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_unique_token; }
-#line 2495 "pars0grm.cc" /* yacc.c:1646  */
+#line 592 "pars0grm.y"
+    { yyval = pars_function_declaration(
+					static_cast(yyvsp[-1])); }
+#line 2373 "pars0grm.cc"
     break;
 
   case 150:
-#line 608 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2501 "pars0grm.cc" /* yacc.c:1646  */
+#line 614 "pars0grm.y"
+    { yyval = pars_procedure_definition(
+					static_cast(yyvsp[-8]), yyvsp[-1]); }
+#line 2380 "pars0grm.cc"
     break;
 
-  case 151:
-#line 609 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_clustered_token; }
-#line 2507 "pars0grm.cc" /* yacc.c:1646  */
-    break;
 
-  case 152:
-#line 618 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_create_index(
-					static_cast((yyvsp[-8])),
-					static_cast((yyvsp[-7])),
-					static_cast((yyvsp[-5])),
-					static_cast((yyvsp[-3])),
-					static_cast((yyvsp[-1]))); }
-#line 2518 "pars0grm.cc" /* yacc.c:1646  */
-    break;
+#line 2384 "pars0grm.cc"
 
-  case 153:
-#line 627 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2524 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 154:
-#line 628 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = (yyvsp[0]); }
-#line 2530 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 155:
-#line 633 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_commit_statement(); }
-#line 2536 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 156:
-#line 638 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_rollback_statement(); }
-#line 2542 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 157:
-#line 642 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_int_token; }
-#line 2548 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 158:
-#line 643 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_bigint_token; }
-#line 2554 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 159:
-#line 644 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_char_token; }
-#line 2560 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 160:
-#line 645 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_binary_token; }
-#line 2566 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 161:
-#line 646 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = &pars_blob_token; }
-#line 2572 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 162:
-#line 651 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_parameter_declaration(
-					static_cast((yyvsp[-2])),
-					PARS_INPUT,
-					static_cast((yyvsp[0]))); }
-#line 2581 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 163:
-#line 656 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_parameter_declaration(
-					static_cast((yyvsp[-2])),
-					PARS_OUTPUT,
-					static_cast((yyvsp[0]))); }
-#line 2590 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 164:
-#line 663 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = NULL; }
-#line 2596 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 165:
-#line 664 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last(NULL, (yyvsp[0])); }
-#line 2602 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 166:
-#line 666 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = que_node_list_add_last((yyvsp[-2]), (yyvsp[0])); }
-#line 2608 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 167:
-#line 671 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_variable_declaration(
-					static_cast((yyvsp[-2])),
-					static_cast((yyvsp[-1]))); }
-#line 2616 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 171:
-#line 685 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_cursor_declaration(
-					static_cast((yyvsp[-3])),
-					static_cast((yyvsp[-1]))); }
-#line 2624 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 172:
-#line 692 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_function_declaration(
-					static_cast((yyvsp[-1]))); }
-#line 2631 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-  case 178:
-#line 714 "pars0grm.y" /* yacc.c:1646  */
-    { (yyval) = pars_procedure_definition(
-					static_cast((yyvsp[-9])),
-					static_cast((yyvsp[-7])),
-					(yyvsp[-1])); }
-#line 2640 "pars0grm.cc" /* yacc.c:1646  */
-    break;
-
-
-#line 2644 "pars0grm.cc" /* yacc.c:1646  */
       default: break;
     }
   /* User semantic actions sometimes alter yychar, and that requires
@@ -2665,14 +2406,13 @@ yyreduce:
   /* Now 'shift' the result of the reduction.  Determine what state
      that goes to, based on the state we popped back to and the rule
      number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
+  {
+    const int yylhs = yyr1[yyn] - YYNTOKENS;
+    const int yyi = yypgoto[yylhs] + *yyssp;
+    yystate = (0 <= yyi && yyi <= YYLAST && yycheck[yyi] == *yyssp
+               ? yytable[yyi]
+               : yydefgoto[yylhs]);
+  }
 
   goto yynewstate;
 
@@ -2755,12 +2495,10 @@ yyerrlab:
 | yyerrorlab -- error raised explicitly by YYERROR.  |
 `---------------------------------------------------*/
 yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
+  /* Pacify compilers when the user code never invokes YYERROR and the
+     label yyerrorlab therefore never appears in user code.  */
+  if (0)
+    YYERROR;
 
   /* Do not reclaim the symbols of the rule whose action triggered
      this YYERROR.  */
@@ -2822,6 +2560,7 @@ yyacceptlab:
   yyresult = 0;
   goto yyreturn;
 
+
 /*-----------------------------------.
 | yyabortlab -- YYABORT comes here.  |
 `-----------------------------------*/
@@ -2829,6 +2568,7 @@ yyabortlab:
   yyresult = 1;
   goto yyreturn;
 
+
 #if !defined yyoverflow || YYERROR_VERBOSE
 /*-------------------------------------------------.
 | yyexhaustedlab -- memory exhaustion comes here.  |
@@ -2839,6 +2579,10 @@ yyexhaustedlab:
   /* Fall through.  */
 #endif
 
+
+/*-----------------------------------------------------.
+| yyreturn -- parsing is finished, return the result.  |
+`-----------------------------------------------------*/
 yyreturn:
   if (yychar != YYEMPTY)
     {
@@ -2868,5 +2612,5 @@ yyreturn:
 #endif
   return yyresult;
 }
-#line 720 "pars0grm.y" /* yacc.c:1906  */
+#line 618 "pars0grm.y"
 
diff --git a/storage/innobase/pars/pars0grm.y b/storage/innobase/pars/pars0grm.y
index 27638e06a66..625ed41bbd4 100644
--- a/storage/innobase/pars/pars0grm.y
+++ b/storage/innobase/pars/pars0grm.y
@@ -1,7 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1997, 2014, 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
@@ -58,11 +58,7 @@ yylex(void);
 %token PARS_NE_TOKEN
 %token PARS_PROCEDURE_TOKEN
 %token PARS_IN_TOKEN
-%token PARS_OUT_TOKEN
-%token PARS_BINARY_TOKEN
-%token PARS_BLOB_TOKEN
 %token PARS_INT_TOKEN
-%token PARS_FLOAT_TOKEN
 %token PARS_CHAR_TOKEN
 %token PARS_IS_TOKEN
 %token PARS_BEGIN_TOKEN
@@ -75,14 +71,11 @@ yylex(void);
 %token PARS_WHILE_TOKEN
 %token PARS_RETURN_TOKEN
 %token PARS_SELECT_TOKEN
-%token PARS_SUM_TOKEN
 %token PARS_COUNT_TOKEN
-%token PARS_DISTINCT_TOKEN
 %token PARS_FROM_TOKEN
 %token PARS_WHERE_TOKEN
 %token PARS_FOR_TOKEN
 %token PARS_DDOT_TOKEN
-%token PARS_READ_TOKEN
 %token PARS_ORDER_TOKEN
 %token PARS_BY_TOKEN
 %token PARS_ASC_TOKEN
@@ -109,25 +102,14 @@ yylex(void);
 %token PARS_FETCH_TOKEN
 %token PARS_CLOSE_TOKEN
 %token PARS_NOTFOUND_TOKEN
-%token PARS_TO_CHAR_TOKEN
-%token PARS_TO_NUMBER_TOKEN
 %token PARS_TO_BINARY_TOKEN
-%token PARS_BINARY_TO_NUMBER_TOKEN
 %token PARS_SUBSTR_TOKEN
-%token PARS_REPLSTR_TOKEN
 %token PARS_CONCAT_TOKEN
 %token PARS_INSTR_TOKEN
 %token PARS_LENGTH_TOKEN
-%token PARS_SYSDATE_TOKEN
-%token PARS_PRINTF_TOKEN
-%token PARS_ASSERT_TOKEN
-%token PARS_RND_TOKEN
-%token PARS_RND_STR_TOKEN
-%token PARS_ROW_PRINTF_TOKEN
 %token PARS_COMMIT_TOKEN
 %token PARS_ROLLBACK_TOKEN
 %token PARS_WORK_TOKEN
-%token PARS_UNSIGNED_TOKEN
 %token PARS_EXIT_TOKEN
 %token PARS_FUNCTION_TOKEN
 %token PARS_LOCK_TOKEN
@@ -139,8 +121,6 @@ yylex(void);
 %token PARS_LIKE_TOKEN_SUFFIX
 %token PARS_LIKE_TOKEN_SUBSTR
 %token PARS_TABLE_NAME_TOKEN
-%token PARS_COMPACT_TOKEN
-%token PARS_BLOCK_SIZE_TOKEN
 %token PARS_BIGINT_TOKEN
 
 %left PARS_AND_TOKEN PARS_OR_TOKEN
@@ -161,7 +141,6 @@ top_statement:
 
 statement:
 	stored_procedure_call
-	| predefined_procedure_call ';'
 	| while_statement ';'
 	| for_statement ';'
 	| exit_statement ';'
@@ -170,7 +149,6 @@ statement:
 	| assignment_statement ';'
 	| select_statement ';'
 	| insert_statement ';'
-	| row_printf_statement ';'
 	| delete_statement_searched ';'
 	| delete_statement_positioned ';'
 	| update_statement_searched ';'
@@ -223,18 +201,11 @@ exp:
 ;
 
 function_name:
-	PARS_TO_CHAR_TOKEN	{ $$ = &pars_to_char_token; }
-	| PARS_TO_NUMBER_TOKEN	{ $$ = &pars_to_number_token; }
-	| PARS_TO_BINARY_TOKEN	{ $$ = &pars_to_binary_token; }
-	| PARS_BINARY_TO_NUMBER_TOKEN
-				{ $$ = &pars_binary_to_number_token; }
+	PARS_TO_BINARY_TOKEN	{ $$ = &pars_to_binary_token; }
 	| PARS_SUBSTR_TOKEN	{ $$ = &pars_substr_token; }
 	| PARS_CONCAT_TOKEN	{ $$ = &pars_concat_token; }
 	| PARS_INSTR_TOKEN	{ $$ = &pars_instr_token; }
 	| PARS_LENGTH_TOKEN	{ $$ = &pars_length_token; }
-	| PARS_SYSDATE_TOKEN	{ $$ = &pars_sysdate_token; }
-	| PARS_RND_TOKEN	{ $$ = &pars_rnd_token; }
-	| PARS_RND_STR_TOKEN	{ $$ = &pars_rnd_str_token; }
 ;
 
 question_mark_list:
@@ -249,17 +220,6 @@ stored_procedure_call:
 					static_cast($2)); }
 ;
 
-predefined_procedure_call:
-	predefined_procedure_name '(' exp_list ')'
-				{ $$ = pars_procedure_call($1, $3); }
-;
-
-predefined_procedure_name:
-	PARS_REPLSTR_TOKEN	{ $$ = &pars_replstr_token; }
-	| PARS_PRINTF_TOKEN	{ $$ = &pars_printf_token; }
-	| PARS_ASSERT_TOKEN	{ $$ = &pars_assert_token; }
-;
-
 user_function_call:
 	PARS_ID_TOKEN '(' ')'	{ $$ = $1; }
 ;
@@ -287,19 +247,9 @@ select_item:
 	exp			{ $$ = $1; }
 	| PARS_COUNT_TOKEN '(' '*' ')'
 				{ $$ = pars_func(&pars_count_token,
-				          que_node_list_add_last(NULL,
+					  que_node_list_add_last(NULL,
 					    sym_tab_add_int_lit(
 						pars_sym_tab_global, 1))); }
-	| PARS_COUNT_TOKEN '(' PARS_DISTINCT_TOKEN PARS_ID_TOKEN ')'
-				{ $$ = pars_func(&pars_count_token,
-					    que_node_list_add_last(NULL,
-						pars_func(&pars_distinct_token,
-						     que_node_list_add_last(
-								NULL, $4)))); }
-	| PARS_SUM_TOKEN '(' exp ')'
-				{ $$ = pars_func(&pars_sum_token,
-						que_node_list_add_last(NULL,
-									$3)); }
 ;
 
 select_item_list:
@@ -446,12 +396,6 @@ delete_statement_positioned:
 					NULL); }
 ;
 
-row_printf_statement:
-	PARS_ROW_PRINTF_TOKEN select_statement
-				{ $$ = pars_row_printf_statement(
-					static_cast($2)); }
-;
-
 assignment_statement:
 	PARS_ID_TOKEN PARS_ASSIGN_TOKEN exp
 				{ $$ = pars_assignment_statement(
@@ -536,12 +480,12 @@ fetch_statement:
 ;
 
 column_def:
-	PARS_ID_TOKEN type_name	opt_column_len opt_unsigned opt_not_null
+	PARS_ID_TOKEN type_name	opt_column_len opt_not_null
 				{ $$ = pars_column_def(
 					static_cast($1),
 					static_cast($2),
 					static_cast($3),
-					$4, $5); }
+					$4); }
 ;
 
 column_def_list:
@@ -556,13 +500,6 @@ opt_column_len:
 				{ $$ = $2; }
 ;
 
-opt_unsigned:
-	/* Nothing */		{ $$ = NULL; }
-	| PARS_UNSIGNED_TOKEN
-				{ $$ = &pars_int_token;
-					/* pass any non-NULL pointer */ }
-;
-
 opt_not_null:
 	/* Nothing */		{ $$ = NULL; }
 	| PARS_NOT_TOKEN PARS_NULL_LIT
@@ -570,27 +507,12 @@ opt_not_null:
 					/* pass any non-NULL pointer */ }
 ;
 
-compact:
-	/* Nothing */		{ $$ = NULL; }
-	| PARS_COMPACT_TOKEN	{ $$ = &pars_int_token;
-					/* pass any non-NULL pointer */ }
-;
-
-block_size:
-	/* Nothing */		{ $$ = NULL; }
-	| PARS_BLOCK_SIZE_TOKEN	'=' PARS_INT_LIT
-			{ $$ = $3; }
-;
-
 create_table:
 	PARS_CREATE_TOKEN PARS_TABLE_TOKEN
 	table_name '(' column_def_list ')'
-	compact block_size
 				{ $$ = pars_create_table(
 					static_cast($3),
-					static_cast($5),
-					static_cast($7),
-					static_cast($8)); }
+					static_cast($5)); }
 ;
 
 column_list:
@@ -642,28 +564,6 @@ type_name:
 	PARS_INT_TOKEN		{ $$ = &pars_int_token; }
 	| PARS_BIGINT_TOKEN	{ $$ = &pars_bigint_token; }
 	| PARS_CHAR_TOKEN	{ $$ = &pars_char_token; }
-	| PARS_BINARY_TOKEN	{ $$ = &pars_binary_token; }
-	| PARS_BLOB_TOKEN	{ $$ = &pars_blob_token; }
-;
-
-parameter_declaration:
-	PARS_ID_TOKEN PARS_IN_TOKEN type_name
-				{ $$ = pars_parameter_declaration(
-					static_cast($1),
-					PARS_INPUT,
-					static_cast($3)); }
-	| PARS_ID_TOKEN PARS_OUT_TOKEN type_name
-				{ $$ = pars_parameter_declaration(
-					static_cast($1),
-					PARS_OUTPUT,
-					static_cast($3)); }
-;
-
-parameter_declaration_list:
-	/* Nothing */		{ $$ = NULL; }
-	| parameter_declaration	{ $$ = que_node_list_add_last(NULL, $1); }
-	| parameter_declaration_list ',' parameter_declaration
-				{ $$ = que_node_list_add_last($1, $3); }
 ;
 
 variable_declaration:
@@ -705,16 +605,14 @@ declaration_list:
 ;
 
 procedure_definition:
-	PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' parameter_declaration_list ')'
+	PARS_PROCEDURE_TOKEN PARS_ID_TOKEN '(' ')'
 	PARS_IS_TOKEN
 	variable_declaration_list
 	declaration_list
 	PARS_BEGIN_TOKEN
 	statement_list
 	PARS_END_TOKEN		{ $$ = pars_procedure_definition(
-					static_cast($2),
-					static_cast($4),
-					$10); }
+					static_cast($2), $9); }
 ;
 
 %%
diff --git a/storage/innobase/pars/pars0lex.l b/storage/innobase/pars/pars0lex.l
index 2d0e56f400d..8b2df6b7940 100644
--- a/storage/innobase/pars/pars0lex.l
+++ b/storage/innobase/pars/pars0lex.l
@@ -249,30 +249,10 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_IN_TOKEN);
 }
 
-"OUT"		{
-			return(PARS_OUT_TOKEN);
-}
-
-"BINARY"	{
-			return(PARS_BINARY_TOKEN);
-}
-
-"BLOB"		{
-			return(PARS_BLOB_TOKEN);
-}
-
 "INT"		{
 			return(PARS_INT_TOKEN);
 }
 
-"INTEGER"	{
-			return(PARS_INT_TOKEN);
-}
-
-"FLOAT"		{
-			return(PARS_FLOAT_TOKEN);
-}
-
 "CHAR"		{
 			return(PARS_CHAR_TOKEN);
 }
@@ -321,18 +301,10 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_SELECT_TOKEN);
 }
 
-"SUM"		{
-			return(PARS_SUM_TOKEN);
-}
-
 "COUNT"		{
 			return(PARS_COUNT_TOKEN);
 }
 
-"DISTINCT"	{
-			return(PARS_DISTINCT_TOKEN);
-}
-
 "FROM"		{
 			return(PARS_FROM_TOKEN);
 }
@@ -345,10 +317,6 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_FOR_TOKEN);
 }
 
-"READ"		{
-			return(PARS_READ_TOKEN);
-}
-
 "ORDER"		{
 			return(PARS_ORDER_TOKEN);
 }
@@ -405,14 +373,6 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_TABLE_TOKEN);
 }
 
-"COMPACT"	{
-			return(PARS_COMPACT_TOKEN);
-}
-
-"BLOCK_SIZE"	{
-			return(PARS_BLOCK_SIZE_TOKEN);
-}
-
 "INDEX"		{
 			return(PARS_INDEX_TOKEN);
 }
@@ -453,30 +413,14 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_NOTFOUND_TOKEN);
 }
 
-"TO_CHAR"	{
-			return(PARS_TO_CHAR_TOKEN);
-}
-
-"TO_NUMBER"	{
-			return(PARS_TO_NUMBER_TOKEN);
-}
-
 "TO_BINARY"	{
 			return(PARS_TO_BINARY_TOKEN);
 }
 
-"BINARY_TO_NUMBER" {
-			return(PARS_BINARY_TO_NUMBER_TOKEN);
-}
-
 "SUBSTR"	{
 			return(PARS_SUBSTR_TOKEN);
 }
 
-"REPLSTR"	{
-			return(PARS_REPLSTR_TOKEN);
-}
-
 "CONCAT"	{
 			return(PARS_CONCAT_TOKEN);
 }
@@ -489,30 +433,6 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_LENGTH_TOKEN);
 }
 
-"SYSDATE"	{
-			return(PARS_SYSDATE_TOKEN);
-}
-
-"PRINTF"	{
-			return(PARS_PRINTF_TOKEN);
-}
-
-"ASSERT"	{
-			return(PARS_ASSERT_TOKEN);
-}
-
-"RND"		{
-			return(PARS_RND_TOKEN);
-}
-
-"RND_STR"	{
-			return(PARS_RND_STR_TOKEN);
-}
-
-"ROW_PRINTF"	{
-			return(PARS_ROW_PRINTF_TOKEN);
-}
-
 "COMMIT"	{
 			return(PARS_COMMIT_TOKEN);
 }
@@ -525,10 +445,6 @@ In the state 'id', only two actions are possible (defined below). */
 			return(PARS_WORK_TOKEN);
 }
 
-"UNSIGNED"	{
-			return(PARS_UNSIGNED_TOKEN);
-}
-
 "EXIT"		{
 			return(PARS_EXIT_TOKEN);
 }
diff --git a/storage/innobase/pars/pars0pars.cc b/storage/innobase/pars/pars0pars.cc
index 3f671adfdfc..280c4ee1815 100644
--- a/storage/innobase/pars/pars0pars.cc
+++ b/storage/innobase/pars/pars0pars.cc
@@ -50,29 +50,15 @@ sym_tab_t*	pars_sym_tab_global;
 /* Global variables used to denote certain reserved words, used in
 constructing the parsing tree */
 
-pars_res_word_t	pars_to_char_token = {PARS_TO_CHAR_TOKEN};
-pars_res_word_t	pars_to_number_token = {PARS_TO_NUMBER_TOKEN};
 pars_res_word_t	pars_to_binary_token = {PARS_TO_BINARY_TOKEN};
-pars_res_word_t	pars_binary_to_number_token = {PARS_BINARY_TO_NUMBER_TOKEN};
 pars_res_word_t	pars_substr_token = {PARS_SUBSTR_TOKEN};
-pars_res_word_t	pars_replstr_token = {PARS_REPLSTR_TOKEN};
 pars_res_word_t	pars_concat_token = {PARS_CONCAT_TOKEN};
 pars_res_word_t	pars_instr_token = {PARS_INSTR_TOKEN};
 pars_res_word_t	pars_length_token = {PARS_LENGTH_TOKEN};
-pars_res_word_t	pars_sysdate_token = {PARS_SYSDATE_TOKEN};
-pars_res_word_t	pars_printf_token = {PARS_PRINTF_TOKEN};
-pars_res_word_t	pars_assert_token = {PARS_ASSERT_TOKEN};
-pars_res_word_t	pars_rnd_token = {PARS_RND_TOKEN};
-pars_res_word_t	pars_rnd_str_token = {PARS_RND_STR_TOKEN};
 pars_res_word_t	pars_count_token = {PARS_COUNT_TOKEN};
-pars_res_word_t	pars_sum_token = {PARS_SUM_TOKEN};
-pars_res_word_t	pars_distinct_token = {PARS_DISTINCT_TOKEN};
-pars_res_word_t	pars_binary_token = {PARS_BINARY_TOKEN};
-pars_res_word_t	pars_blob_token = {PARS_BLOB_TOKEN};
 pars_res_word_t	pars_int_token = {PARS_INT_TOKEN};
 pars_res_word_t	pars_bigint_token = {PARS_BIGINT_TOKEN};
 pars_res_word_t	pars_char_token = {PARS_CHAR_TOKEN};
-pars_res_word_t	pars_float_token = {PARS_FLOAT_TOKEN};
 pars_res_word_t	pars_update_token = {PARS_UPDATE_TOKEN};
 pars_res_word_t	pars_asc_token = {PARS_ASC_TOKEN};
 pars_res_word_t	pars_desc_token = {PARS_DESC_TOKEN};
@@ -195,24 +181,15 @@ pars_func_get_class(
 	case PARS_AND_TOKEN: case PARS_OR_TOKEN: case PARS_NOT_TOKEN:
 		return(PARS_FUNC_LOGICAL);
 
-	case PARS_COUNT_TOKEN: case PARS_SUM_TOKEN:
+	case PARS_COUNT_TOKEN:
 		return(PARS_FUNC_AGGREGATE);
 
-	case PARS_TO_CHAR_TOKEN:
-	case PARS_TO_NUMBER_TOKEN:
 	case PARS_TO_BINARY_TOKEN:
-	case PARS_BINARY_TO_NUMBER_TOKEN:
 	case PARS_SUBSTR_TOKEN:
 	case PARS_CONCAT_TOKEN:
 	case PARS_LENGTH_TOKEN:
 	case PARS_INSTR_TOKEN:
-	case PARS_SYSDATE_TOKEN:
 	case PARS_NOTFOUND_TOKEN:
-	case PARS_PRINTF_TOKEN:
-	case PARS_ASSERT_TOKEN:
-	case PARS_RND_TOKEN:
-	case PARS_RND_STR_TOKEN:
-	case PARS_REPLSTR_TOKEN:
 		return(PARS_FUNC_PREDEFINED);
 
 	default:
@@ -499,7 +476,6 @@ pars_resolve_func_data_type(
 	arg = node->args;
 
 	switch (node->func) {
-	case PARS_SUM_TOKEN:
 	case '+': case '-': case '*': case '/':
 		/* Inherit the data type from the first argument (which must
 		not be the SQL null literal whose type is DATA_ERROR) */
@@ -516,13 +492,6 @@ pars_resolve_func_data_type(
 		dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 		break;
 
-	case PARS_TO_CHAR_TOKEN:
-	case PARS_RND_STR_TOKEN:
-		ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
-		dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
-			  DATA_ENGLISH, 0);
-		break;
-
 	case PARS_TO_BINARY_TOKEN:
 		if (dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT) {
 			dtype_set(que_node_get_data_type(node), DATA_VARCHAR,
@@ -533,19 +502,12 @@ pars_resolve_func_data_type(
 		}
 		break;
 
-	case PARS_TO_NUMBER_TOKEN:
-	case PARS_BINARY_TO_NUMBER_TOKEN:
 	case PARS_LENGTH_TOKEN:
 	case PARS_INSTR_TOKEN:
 		ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
 		dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 		break;
 
-	case PARS_SYSDATE_TOKEN:
-		ut_a(arg == NULL);
-		dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
-		break;
-
 	case PARS_SUBSTR_TOKEN:
 	case PARS_CONCAT_TOKEN:
 		ut_a(pars_is_string_type(que_node_get_data_type(arg)->mtype));
@@ -566,11 +528,6 @@ pars_resolve_func_data_type(
 		dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
 		break;
 
-	case PARS_RND_TOKEN:
-		ut_a(dtype_get_mtype(que_node_get_data_type(arg)) == DATA_INT);
-		dtype_set(que_node_get_data_type(node), DATA_INT, 0, 4);
-		break;
-
 	case PARS_LIKE_TOKEN_EXACT:
 	case PARS_LIKE_TOKEN_PREFIX:
 	case PARS_LIKE_TOKEN_SUFFIX:
@@ -1355,9 +1312,7 @@ pars_set_dfield_type(
 	pars_res_word_t*	type,		/*!< in: pointer to a type
 						token */
 	ulint			len,		/*!< in: length, or 0 */
-	ibool			is_unsigned,	/*!< in: if TRUE, column is
-						UNSIGNED. */
-	ibool			is_not_null)	/*!< in: if TRUE, column is
+	bool			is_not_null)	/*!< in: whether the column is
 						NOT NULL. */
 {
 	ulint flags = 0;
@@ -1366,10 +1321,6 @@ pars_set_dfield_type(
 		flags |= DATA_NOT_NULL;
 	}
 
-	if (is_unsigned) {
-		flags |= DATA_UNSIGNED;
-	}
-
 	if (type == &pars_bigint_token) {
 		ut_a(len == 0);
 
@@ -1384,16 +1335,6 @@ pars_set_dfield_type(
 
 		dtype_set(dfield_get_type(dfield), DATA_VARCHAR,
 			  DATA_ENGLISH | flags, len);
-	} else if (type == &pars_binary_token) {
-		ut_a(len != 0);
-
-		dtype_set(dfield_get_type(dfield), DATA_FIXBINARY,
-			  DATA_BINARY_TYPE | flags, len);
-	} else if (type == &pars_blob_token) {
-		ut_a(len == 0);
-
-		dtype_set(dfield_get_type(dfield), DATA_BLOB,
-			  DATA_BINARY_TYPE | flags, 0);
 	} else {
 		ut_error;
 	}
@@ -1414,28 +1355,7 @@ pars_variable_declaration(
 
 	node->param_type = PARS_NOT_PARAM;
 
-	pars_set_dfield_type(que_node_get_val(node), type, 0, FALSE, FALSE);
-
-	return(node);
-}
-
-/*********************************************************************//**
-Parses a procedure parameter declaration.
-@return own: symbol table node of type SYM_VAR */
-sym_node_t*
-pars_parameter_declaration(
-/*=======================*/
-	sym_node_t*	node,	/*!< in: symbol table node allocated for the
-				id of the parameter */
-	ulint		param_type,
-				/*!< in: PARS_INPUT or PARS_OUTPUT */
-	pars_res_word_t* type)	/*!< in: pointer to a type token */
-{
-	ut_a((param_type == PARS_INPUT) || (param_type == PARS_OUTPUT));
-
-	pars_variable_declaration(node, type);
-
-	node->param_type = param_type;
+	pars_set_dfield_type(que_node_get_val(node), type, 0, false);
 
 	return(node);
 }
@@ -1821,8 +1741,6 @@ pars_column_def(
 	pars_res_word_t*	type,		/*!< in: data type */
 	sym_node_t*		len,		/*!< in: length of column, or
 						NULL */
-	void*			is_unsigned,	/*!< in: if not NULL, column
-						is of type UNSIGNED. */
 	void*			is_not_null)	/*!< in: if not NULL, column
 						is of type NOT NULL. */
 {
@@ -1835,7 +1753,7 @@ pars_column_def(
 	}
 
 	pars_set_dfield_type(que_node_get_val(sym_node), type, len2,
-			     is_unsigned != NULL, is_not_null != NULL);
+			     is_not_null != NULL);
 
 	return(sym_node);
 }
@@ -1848,9 +1766,7 @@ pars_create_table(
 /*==============*/
 	sym_node_t*	table_sym,	/*!< in: table name node in the symbol
 					table */
-	sym_node_t*	column_defs,	/*!< in: list of column names */
-	sym_node_t*	compact,	/* in: non-NULL if COMPACT table. */
-	sym_node_t*	block_size)	/* in: block size (can be NULL) */
+	sym_node_t*	column_defs)	/*!< in: list of column names */
 {
 	dict_table_t*	table;
 	sym_node_t*	column;
@@ -1858,57 +1774,11 @@ pars_create_table(
 	const dtype_t*	dtype;
 	ulint		n_cols;
 	ulint		flags = 0;
-	ulint		flags2 = 0;
-
-	if (compact != NULL) {
-
-		/* System tables currently only use the REDUNDANT row
-		format therefore the check for srv_file_per_table should be
-		safe for now. */
-
-		flags |= DICT_TF_COMPACT;
-
-		/* FIXME: Ideally this should be part of the SQL syntax
-		or use some other mechanism. We want to reduce dependency
-		on global variables. There is an inherent race here but
-		that has always existed around this variable. */
-		if (srv_file_per_table) {
-			flags2 |= DICT_TF2_USE_FILE_PER_TABLE;
-		}
-	}
-
-	if (block_size != NULL) {
-		ulint		size;
-		dfield_t*	dfield;
+	ulint		flags2 = DICT_TF2_FTS_AUX_HEX_NAME;
 
-		dfield = que_node_get_val(block_size);
-
-		ut_a(dfield_get_len(dfield) == 4);
-		size = mach_read_from_4(static_cast(
-			dfield_get_data(dfield)));
-
-
-		switch (size) {
-		case 0:
-			break;
-
-		case 1: case 2: case 4: case 8: case 16:
-			flags |= DICT_TF_COMPACT;
-			/* FTS-FIXME: needs the zip changes */
-			/* flags |= size << DICT_TF_COMPRESSED_SHIFT; */
-			break;
-
-		default:
-			ut_error;
-		}
-	}
-
-	/* Set the flags2 when create table or alter tables */
-	flags2 |= DICT_TF2_FTS_AUX_HEX_NAME;
 	DBUG_EXECUTE_IF("innodb_test_wrong_fts_aux_table_name",
 			flags2 &= ~DICT_TF2_FTS_AUX_HEX_NAME;);
 
-
 	n_cols = que_node_list_get_len(column_defs);
 
 	table = dict_mem_table_create(
@@ -2001,7 +1871,6 @@ pars_procedure_definition(
 /*======================*/
 	sym_node_t*	sym_node,	/*!< in: procedure id node in the symbol
 					table */
-	sym_node_t*	param_list,	/*!< in: parameter declaration list */
 	que_node_t*	stat_list)	/*!< in: statement list */
 {
 	proc_node_t*	node;
@@ -2026,7 +1895,6 @@ pars_procedure_definition(
 	sym_node->resolved = TRUE;
 
 	node->proc_id = sym_node;
-	node->param_list = param_list;
 	node->stat_list = stat_list;
 
 	pars_set_parent_in_list(stat_list, node);
-- 
cgit v1.2.1


From 425748f1b5890a4bb3c7dcadf8f81f567f9a26fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Mon, 9 Dec 2019 14:54:27 +0200
Subject: Cleanup: Replace a redundant statement with an assertion

---
 storage/innobase/sync/sync0debug.cc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index 3e65c234cd0..c4a2fd90b37 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -1580,7 +1580,7 @@ struct CreateTracker {
 	~CreateTracker()
 		UNIV_NOTHROW
 	{
-		ut_d(m_files.empty());
+		ut_ad(m_files.empty());
 
 		m_mutex.destroy();
 	}
-- 
cgit v1.2.1


From 246e2ae12b514ed3010ffcf6473abbfd9f648340 Mon Sep 17 00:00:00 2001
From: Varun Gupta 
Date: Wed, 4 Dec 2019 20:04:45 +0530
Subject: MDEV-20900: IN predicate to IN subquery conversion causes performance
 regression

Disable the IN predicate to IN subquery conversion when the types on the left and
right hand side of the IN predicate are not of comparable type.
---
 mysql-test/main/opt_tvc.result | 53 ++++++++++++++++++++++++++++++++++++---
 mysql-test/main/opt_tvc.test   | 31 +++++++++++++++++++++++
 sql/item_cmpfunc.h             |  1 +
 sql/opt_subselect.cc           |  7 +++++-
 sql/sql_tvc.cc                 | 56 +++++++++++++++++++++++++++++++++++++++++-
 5 files changed, 142 insertions(+), 6 deletions(-)

diff --git a/mysql-test/main/opt_tvc.result b/mysql-test/main/opt_tvc.result
index 5329a9f64be..a68e70e8a25 100644
--- a/mysql-test/main/opt_tvc.result
+++ b/mysql-test/main/opt_tvc.result
@@ -629,11 +629,9 @@ SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
 i
 EXPLAIN EXTENDED SELECT * FROM t1 WHERE i IN (NULL, NULL, NULL, NULL, NULL);
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
-1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	
-1	PRIMARY		ALL	NULL	NULL	NULL	NULL	5	100.00	Using where; FirstMatch(t1); Using join buffer (flat, BNL join)
-3	DERIVED	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
 Warnings:
-Note	1003	/* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join ((values (NULL),(NULL),(NULL),(NULL),(NULL)) `tvc_0`) where `test`.`t1`.`i` = `tvc_0`.`_col_1`
+Note	1003	select `test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` in (NULL,NULL,NULL,NULL,NULL)
 SET in_predicate_conversion_threshold= default;
 DROP TABLE t1;
 #
@@ -687,3 +685,50 @@ f1	f2
 1	1
 DROP TABLE t1,t2,t3;
 SET @@in_predicate_conversion_threshold= default;
+#
+# MDEV-20900: IN predicate to IN subquery conversion causes performance regression
+#
+create table t1(a int, b int);
+insert into t1 select seq-1, seq-1 from seq_1_to_10;
+set in_predicate_conversion_threshold=2;
+explain select * from t1 where t1.a IN ("1","2","3","4");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	Using where
+select * from t1 where t1.a IN ("1","2","3","4");
+a	b
+1	1
+2	2
+3	3
+4	4
+set in_predicate_conversion_threshold=0;
+explain select * from t1 where t1.a IN ("1","2","3","4");
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	Using where
+select * from t1 where t1.a IN ("1","2","3","4");
+a	b
+1	1
+2	2
+3	3
+4	4
+set in_predicate_conversion_threshold=2;
+explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	Using where
+select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
+a	b
+1	1
+2	2
+3	3
+4	4
+set in_predicate_conversion_threshold=0;
+explain select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	10	Using where
+select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
+a	b
+1	1
+2	2
+3	3
+4	4
+drop table t1;
+SET @@in_predicate_conversion_threshold= default;
diff --git a/mysql-test/main/opt_tvc.test b/mysql-test/main/opt_tvc.test
index 7319dbdc9e8..e4e8c6d7919 100644
--- a/mysql-test/main/opt_tvc.test
+++ b/mysql-test/main/opt_tvc.test
@@ -3,6 +3,7 @@
 #
 source include/have_debug.inc;
 source include/default_optimizer_switch.inc;
+source include/have_sequence.inc;
 
 create table t1 (a int, b int);
 
@@ -397,3 +398,33 @@ SELECT * FROM t3 WHERE (f1,f2) IN ((2, 2), (1, 2), (3, 5), (1, 1));
 DROP TABLE t1,t2,t3;
 
 SET @@in_predicate_conversion_threshold= default;
+
+--echo #
+--echo # MDEV-20900: IN predicate to IN subquery conversion causes performance regression
+--echo #
+
+create table t1(a int, b int);
+insert into t1 select seq-1, seq-1 from seq_1_to_10;
+
+set in_predicate_conversion_threshold=2;
+
+let $query= select * from t1 where t1.a IN ("1","2","3","4");
+eval explain $query;
+eval $query;
+
+set in_predicate_conversion_threshold=0;
+eval explain $query;
+eval $query;
+
+set in_predicate_conversion_threshold=2;
+let $query= select * from t1 where (t1.a,t1.b) in (("1","1"),(2,2),(3,3),(4,4));
+eval explain $query;
+eval $query;
+
+set in_predicate_conversion_threshold=0;
+eval explain $query;
+eval $query;
+
+drop table t1;
+SET @@in_predicate_conversion_threshold= default;
+
diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h
index 24a9991640a..29c32be1c80 100644
--- a/sql/item_cmpfunc.h
+++ b/sql/item_cmpfunc.h
@@ -2418,6 +2418,7 @@ public:
   bool to_be_transformed_into_in_subq(THD *thd);
   bool create_value_list_for_tvc(THD *thd, List< List > *values);
   Item *in_predicate_to_in_subs_transformer(THD *thd, uchar *arg);
+  uint32 max_length_of_left_expr();
 };
 
 class cmp_item_row :public cmp_item
diff --git a/sql/opt_subselect.cc b/sql/opt_subselect.cc
index a4ee27950be..50f7efd6d65 100644
--- a/sql/opt_subselect.cc
+++ b/sql/opt_subselect.cc
@@ -829,7 +829,12 @@ bool subquery_types_allow_materialization(Item_in_subselect *in_subs)
 
   in_subs->types_allow_materialization= FALSE;  // Assign default values
   in_subs->sjm_scan_allowed= FALSE;
-  
+
+  /*
+    The checks here must be kept in sync with the one in
+    Item_func_in::in_predicate_to_in_subs_transformer().
+  */
+
   bool all_are_fields= TRUE;
   uint32 total_key_length = 0;
   for (uint i= 0; i < elements; i++)
diff --git a/sql/sql_tvc.cc b/sql/sql_tvc.cc
index 816c6fe1089..b4538248e07 100644
--- a/sql/sql_tvc.cc
+++ b/sql/sql_tvc.cc
@@ -796,6 +796,38 @@ bool Item_subselect::wrap_tvc_into_select(THD *thd, st_select_lex *tvc_sl)
 }
 
 
+/*
+  @brief
+   Check whether the items are of comparable type or not
+
+  @details
+    This check are done because materialization is not performed
+    if the left expr and right expr are of the same types.
+    @see subquery_types_allow_materialization()
+
+  @retval
+   0 comparable
+   1 not comparable
+*/
+
+static bool cmp_row_types(Item* item1, Item* item2)
+{
+  uint n= item1->cols();
+  if (item2->check_cols(n))
+    return true;
+
+  for (uint i=0; i < n; i++)
+  {
+    Item *inner= item1->element_index(i);
+    Item *outer= item2->element_index(i);
+    if (!inner->type_handler()->subquery_type_allows_materialization(inner,
+                                                                     outer))
+      return true;
+  }
+  return false;
+}
+
+
 /**
   @brief
     Transform IN predicate into IN subquery
@@ -840,10 +872,22 @@ Item *Item_func_in::in_predicate_to_in_subs_transformer(THD *thd,
   /* SELECT_LEX object where the transformation is performed */
   SELECT_LEX *parent_select= lex->current_select;
   uint8 save_derived_tables= lex->derived_tables;
+
+  /*
+    Make sure that create_tmp_table will not fail due to too long keys.
+    Here the strategy would mainly use materialization, so we need to make
+    sure that the materialized table can be created.
+
+    The checks here are the same as in subquery_type_allows_materialization()
+  */
+  uint32 length= max_length_of_left_expr();
+  if (!length  || length > tmp_table_max_key_length() ||
+      args[0]->cols() > tmp_table_max_key_parts())
+    return this;
   
   for (uint i=1; i < arg_count; i++)
   {
-    if (!args[i]->const_item())
+    if (!args[i]->const_item() || cmp_row_types(args[0], args[i]))
       return this;
   }
 
@@ -948,6 +992,16 @@ err:
 }
 
 
+uint32 Item_func_in::max_length_of_left_expr()
+{
+  uint n= args[0]->cols();
+  uint32 length= 0;
+  for (uint i=0; i < n; i++)
+    length+= args[0]->element_index(i)->max_length;
+  return length;
+}
+
+
 /**
   @brief
     Check if this IN-predicate can be transformed in IN-subquery
-- 
cgit v1.2.1


From af650c76a63838047b268d8106cd229438f6db92 Mon Sep 17 00:00:00 2001
From: Oleksandr Byelkin 
Date: Sat, 7 Dec 2019 22:15:38 +0100
Subject: MDEV-18460: Server crashed in strmake / tdc_create_key /
 THD::create_tmp_table_def_key

When there is a WITH clause we postpone check for tables without
database for later stages when tables in WITH will be defined.
But we should not try to open such tables as temporary tables because
temporary tables always belong to a some database.
---
 mysql-test/r/cte_nonrecursive.result | 18 ++++++++++++++++++
 mysql-test/t/cte_nonrecursive.test   | 20 ++++++++++++++++++++
 sql/temporary_tables.cc              |  7 +++++++
 3 files changed, 45 insertions(+)

diff --git a/mysql-test/r/cte_nonrecursive.result b/mysql-test/r/cte_nonrecursive.result
index 8ad3818b453..746fcbcf051 100644
--- a/mysql-test/r/cte_nonrecursive.result
+++ b/mysql-test/r/cte_nonrecursive.result
@@ -1673,3 +1673,21 @@ with columns as (select 1 as t) select * from columns;
 t
 1
 use test;
+#
+# MDEV-18460: Server crashed in strmake / tdc_create_key /
+# THD::create_tmp_table_def_key
+#
+connect con1,localhost,root,,;
+CREATE TEMPORARY TABLE test.t (a INT);
+WITH cte AS (SELECT 1) SELECT * FROM cte;
+1
+1
+WITH t AS (SELECT 1) SELECT * FROM t;
+1
+1
+WITH cte AS (SELECT 1) SELECT * FROM t;
+ERROR 3D000: No database selected
+DROP TABLE test.t;
+connection default;
+disconnect con1;
+# End of 10.2 tests
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test
index bd8af55071a..41a5b815bc7 100644
--- a/mysql-test/t/cte_nonrecursive.test
+++ b/mysql-test/t/cte_nonrecursive.test
@@ -1182,3 +1182,23 @@ with t as (select 1 as t) select * from t;
 with columns as (select 1 as t) select * from columns;
 
 use test;
+
+--echo #
+--echo # MDEV-18460: Server crashed in strmake / tdc_create_key /
+--echo # THD::create_tmp_table_def_key
+--echo #
+
+--connect con1,localhost,root,,
+--change_user root,,
+
+CREATE TEMPORARY TABLE test.t (a INT);
+WITH cte AS (SELECT 1) SELECT * FROM cte;
+WITH t AS (SELECT 1) SELECT * FROM t;
+--error ER_NO_DB_ERROR
+WITH cte AS (SELECT 1) SELECT * FROM t;
+DROP TABLE test.t;
+
+--connection default
+--disconnect con1
+
+--echo # End of 10.2 tests
diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc
index b97e0334f0d..e2179a71625 100644
--- a/sql/temporary_tables.cc
+++ b/sql/temporary_tables.cc
@@ -338,6 +338,13 @@ bool THD::open_temporary_table(TABLE_LIST *tl)
     DBUG_RETURN(false);
   }
 
+  if (!tl->db)
+  {
+    DBUG_PRINT("info",
+               ("Table reference to a temporary table must have database set"));
+    DBUG_RETURN(false);
+  }
+
   /*
     Temporary tables are not safe for parallel replication. They were
     designed to be visible to one thread only, so have no table locking.
-- 
cgit v1.2.1


From 7c2c420b70b19cc02b5281127205e876f3919dad Mon Sep 17 00:00:00 2001
From: Elena Stepanova 
Date: Tue, 10 Dec 2019 15:43:56 +0200
Subject: List of unstable tests for 10.4.11 release

---
 mysql-test/unstable-tests | 888 +++++++++++++++++-----------------------------
 1 file changed, 322 insertions(+), 566 deletions(-)

diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests
index 44a4626766c..b738604b13a 100644
--- a/mysql-test/unstable-tests
+++ b/mysql-test/unstable-tests
@@ -23,302 +23,170 @@
 #
 ##############################################################################
 #
-# Based on 10.4 903f5fea30cb236c5980a07b7fa63450b0f8067d
+# Based on bb-10.4-release a15234bf4bf98d7833996284c033fc53a981f5d4
 
-main.alter_table                      : Modified in 10.4.8
-main.alter_table_mdev539_maria        : Include file modified in 10.4.8
-main.alter_table_mdev539_myisam       : Include file modified in 10.4.8
 main.alter_table_trans                : MDEV-12084 - timeout
-main.analyze                          : Modified in 10.4.8
-main.analyze_format_json              : Modified in 10.4.8
-main.analyze_stmt                     : Modified in 10.4.8
-main.analyze_stmt_orderby             : Modified in 10.4.8
-main.analyze_stmt_privileges2         : Modified in 10.4.8
 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.4.9
 main.auto_increment_ranges_myisam     : Include file modified in 10.4.9
 main.backup_interaction               : Modified in 10.4.9
 main.binary_to_hex                    : MDEV-20211 - Wrong result
-main.bootstrap                        : Modified in 10.3.18
 main.brackets                         : Modified in 10.4.9
-main.bug13633383                      : Modified in 10.4.8
-main.cast                             : Modified in 10.2.27
 main.compare                          : Modified in 10.4.9
-main.compound                         : Modified in 10.4.8
-main.compress                         : Include file modified in 10.4.8
-main.connect                          : MDEV-17282 - Wrong result; include file modified in 10.4.8
+main.connect                          : MDEV-17282 - Wrong result
 main.connect-abstract                 : MDEV-20162 - Could not execute 'check-testcase'
 main.connect2                         : MDEV-13885 - Server crash
-main.constraints                      : Modified in 10.4.8
 main.count_distinct2                  : MDEV-11768 - timeout
-main.create                           : Modified in 10.4.8
+main.create                           : Modified in 10.4.11
 main.create_delayed                   : MDEV-10605 - failed with timeout
 main.create_drop_event                : MDEV-16271 - Wrong result
 main.cte_nonrecursive                 : Modified in 10.4.9
-main.cte_recursive                    : Modified in 10.4.8
 main.ctype_cp932_binlog_stm           : MDEV-20534 - Wrong result
-main.ctype_create                     : Modified in 10.2.27
-main.ctype_latin1_de                  : Modified in 10.2.27
 main.ctype_many                       : Modified in 10.4.9
 main.ctype_uca                        : Include file modified in 10.4.9
 main.ctype_uca_innodb                 : Include file modified in 10.4.9
 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.4.8
 main.ctype_utf16le                    : MDEV-10675: timeout or extra warnings
 main.ctype_utf8                       : Include file modified in 10.4.9
-main.ctype_utf8mb4                    : Modified in 10.4.8
-main.ctype_utf8mb4_heap               : Include file modified in 10.4.8
-main.ctype_utf8mb4_innodb             : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison; include file modified in 10.4.8
-main.ctype_utf8mb4_myisam             : Include file modified in 10.4.8
-main.custom_aggregates_i_s            : Modified in 10.4.8
+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.4.8
 main.delayed                          : MDEV-20961 - Assertion failure
-main.derived                          : Modified in 10.4.8
-main.derived_cond_pushdown            : Modified in 10.4.8
+main.derived_cond_pushdown            : MDEV-20532 - Floating point differences
 main.derived_opt                      : MDEV-11768 - timeout
-main.derived_split_innodb             : Modified in 10.4.8
-main.derived_view                     : Modified in 10.4.8
 main.dirty_close                      : MDEV-19368 - mysqltest failed but provided no output
-main.distinct                         : MDEV-14194 - Crash; modified in 10.4.8
+main.distinct                         : MDEV-14194 - Crash
 main.drop_bad_db_type                 : MDEV-15676 - Wrong result; modified in 10.4.9
 main.drop_debug                       : Modified in 10.1.42
-main.dyncol                           : MDEV-19455 - Extra warning; modified in 10.4.8
-main.empty_user_table                 : Include file modified in 10.4.8
-main.events_1                         : Modified in 10.4.8
-main.events_2                         : MDEV-13277 - Crash; modified in 10.4.8
-main.events_bugs                      : MDEV-12892 - Crash; modified in 10.4.8
-main.events_grant                     : Modified in 10.4.8
+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.4.8
-main.explain_json                     : Modified in 10.4.8
 main.flush                            : MDEV-19368 - mysqltest failed but provided no output
-main.flush2                           : Modified in 10.2.27
-main.func_hybrid_type                 : Modified in 10.4.8
-main.func_isnull                      : Modified in 10.4.8
+main.flush_ssl                        : MDEV-21276 - Aria recovery failure
 main.func_json                        : Modified in 10.4.9
 main.func_math                        : MDEV-20966 - Wrong error code; modified in 10.4.9
 main.func_misc                        : Modified in 10.4.9
-main.func_str                         : Modified in 10.4.8
-main.function_defaults                : Modified in 10.4.8
 main.gis                              : MDEV-13411 - wrong result on P8
-main.grant                            : Configuration added in 10.4.8
-main.grant2                           : Configuration added in 10.4.8
-main.grant4                           : Configuration added in 10.4.8
-main.grant_4332                       : Include file modified in 10.4.8
-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.4.8
-main.greedy_optimizer                 : Modified in 10.4.8
-main.group_by                         : Modified in 10.4.8
-main.group_min_max                    : Modified in 10.4.8
-main.handlersocket                    : Configuration added in 10.4.8
+main.gis_notembedded                  : MDEV-21264 - Wrong result with non-default charset
 main.host_cache_size_functionality    : MDEV-10606 - sporadic failure on shutdown
-main.index_intersect                  : Modified in 10.4.8
 main.index_intersect_innodb           : MDEV-10643 - failed with timeout
 main.index_merge_innodb               : MDEV-7142 - Plan mismatch; modified in 10.4.9
 main.index_merge_myisam               : Modified in 10.4.9
-main.information_schema               : Modified in 10.4.8
-main.information_schema-big           : Modified in 10.4.8
 main.information_schema_db            : Modified in 10.4.9
-main.information_schema_parameters    : Modified in 10.4.8
-main.information_schema_routines      : Modified in 10.4.8
-main.innodb_ext_key                   : Modified in 10.4.8
-main.innodb_icp                       : MDEV-20168 - Wrong execution plans; modified in 10.4.8
+main.innodb_icp                       : MDEV-20168 - Wrong execution plans
 main.innodb_mysql_lock                : MDEV-7861 - Wrong result
-main.intersect                        : Modified in 10.4.8
-main.invisible_field_debug            : Modified in 10.4.8
 main.ipv4_and_ipv6                    : MDEV-20964 - Wrong result
 main.ipv6                             : MDEV-20964 - Wrong result
-main.join                             : Modified in 10.4.8
-main.join_cache                       : MDEV-17743 - Bad address from storage engine MyISAM; modified in 10.4.8
-main.join_nested_jcl6                 : Modified in 10.4.8
-main.join_outer                       : Modified in 10.2.27
-main.join_outer_innodb                : Modified in 10.4.8
-main.join_outer_jcl6                  : Modified in 10.4.8
-main.kill                             : Modified in 10.4.8
+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.4.8
 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.4.8
+main.log_slow                         : MDEV-13263 - Wrong result
 main.log_slow_debug                   : Modified in 10.4.9
 main.log_tables-big                   : MDEV-13408 - wrong result
 main.log_tables_upgrade               : MDEV-20962 - Wrong result
-main.long_unique                      : Modified in 10.4.8
 main.mdev-504                         : MDEV-15171 - warning
-main.mdev13607                        : Modified in 10.4.8
 main.mdev375                          : MDEV-10607 - sporadic "can't connect"
-main.merge                            : MDEV-10607 - sporadic "can't connect"; modified in 10.4.8
-main.mrr_icp_extra                    : Modified in 10.4.8
-main.multi_update                     : Modified in 10.4.8
+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.4.9
-main.myisam_explain_non_select_all    : Modified in 10.4.8
-main.myisam_icp                       : Modified in 10.4.8
-main.myisam_mrr                       : Modified in 10.4.8
-main.mysql                            : MDEV-20156 - Wrong result; modified in 10.4.8
-main.mysql_client_test                : MDEV-19369 - error: 5888, status: 23, errno: 2; MDEV-19511 - Big endian issue; modified in 10.4.8
+main.mysql                            : MDEV-20156 - Wrong result
+main.mysql_client_test                : MDEV-19369 - error: 5888, status: 23, errno: 2; MDEV-19511 - Big endian issue
 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.4.8
-main.mysql_upgrade                    : MDEV-20161 - Wrong result; MDEV-20166 - FATAL ERROR: Upgrade failed; include file modified in 10.4.8
+main.mysql_cp932                      : MDEV-21275 - Wrong result
+main.mysql_upgrade                    : MDEV-20161 - Wrong result; MDEV-20166 - FATAL ERROR: Upgrade failed
 main.mysql_upgrade-20228              : Added in 10.4.9
 main.mysql_upgrade_no_innodb          : MDEV-20537 - Wrong result
-main.mysql_upgrade_noengine           : MDEV-14355 - Wrong result; include file modified in 10.4.8
-main.mysql_upgrade_ssl                : MDEV-13492 - Unknown SSL error
+main.mysql_upgrade_noengine           : MDEV-14355 - Wrong result
 main.mysql_upgrade_view               : MDEV-20161 - Wrong result
 main.mysqladmin                       : MDEV-20535 - Wrong result
-main.mysqlcheck                       : MDEV-20164 - Wrong result; modified in 10.4.8
-main.mysqldump                        : MDEV-14800 - Stack smashing detected; modified in 10.4.8
-main.mysqldump-compat-102             : Modified in 10.4.8
-main.mysqldump-max                    : Modified in 10.2.27
-main.mysqldump-nl                     : Modified in 10.4.8
-main.mysqldump-utf8mb4                : Modified in 10.4.8
+main.mysqlcheck                       : MDEV-20164 - Wrong result
+main.mysqld_option_err                : MDEV-21236 - Wrong error
+main.mysqldump                        : MDEV-14800 - Stack smashing detected
+main.mysqldump-max                    : MDEV-21272 - Wrong result
 main.mysqlhotcopy_myisam              : MDEV-10995 - Hang on debug
 main.mysqlshow                        : MDEV-20965 - Wrong result
 main.mysqlslap                        : MDEV-11801 - timeout
 main.mysqltest                        : MDEV-13887 - Wrong result
-main.named_pipe                       : Include file modified in 10.4.8
 main.old-mode                         : MDEV-19373 - Wrong result
-main.openssl_1                        : MDEV-13492 - Unknown SSL error; modified in 10.4.8
 main.openssl_6975                     : MDEV-17184 - Failures with OpenSSL 1.1.1
-main.opt_trace                        : Modified in 10.4.8
-main.opt_tvc                          : Modified in 10.4.8
+main.order_by                         : Modified in 10.4.11
 main.order_by_innodb                  : Modified in 10.4.9
 main.order_by_optimizer_innodb        : MDEV-10683 - Wrong result
 main.parser                           : Modified in 10.4.9
 main.partition_debug_sync             : MDEV-15669 - Deadlock found when trying to get lock; modified in 10.4.9
-main.partition_example                : Configuration added in 10.4.8
 main.partition_innodb                 : MDEV-20169 - Wrong result; modified in 10.4.9
 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.4.8
-main.partition_range                  : Modified in 10.4.8
+main.partition_mrr_aria               : Added in 10.4.11
+main.partition_mrr_innodb             : Added in 10.4.11
+main.partition_mrr_myisam             : Added in 10.4.11
+main.partition_pruning                : Modified in 10.4.11
 main.partition_ucs2                   : Added in 10.4.9
 main.partition_utf8                   : Modified in 10.4.9
-main.password_expiration              : Include file modified in 10.4.8
 main.plugin                           : Include file modified in 10.4.9
-main.plugin_auth                      : MDEV-20957 - Upgrade file was not properly created; include file modified in 10.4.8
+main.plugin_auth                      : MDEV-20957 - Upgrade file was not properly created
 main.plugin_auth_qa_2                 : MDEV-20165 - Wrong result
-main.plugin_innodb                    : Configuration added in 10.4.8
-main.plugin_load                      : Configuration modified in 10.4.8
-main.plugin_load_option               : Configuration modified in 10.4.8
-main.plugin_not_embedded              : Configuration added in 10.4.8
-main.pool_of_threads                  : MDEV-18135 - SSL error: key too small; modified in 10.4.8
+main.pool_of_threads                  : MDEV-18135 - SSL error: key too small
 main.processlist                      : Modified in 10.4.9
 main.processlist_notembedded          : Added in 10.4.9
 main.ps                               : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.4.9
 main.query_cache                      : MDEV-16180 - Wrong result
-main.query_cache_debug                : MDEV-15281 - Query cache is disabled; modified in 10.4.8
-main.query_cache_notembedded          : Modified in 10.4.8
-main.query_cache_ps_no_prot           : Modified in 10.4.8
-main.range                            : Modified in 10.4.8
-main.range_interrupted-13751          : Modified in 10.4.8
-main.range_mrr_icp                    : Modified in 10.4.8
-main.range_vs_index_merge             : Modified in 10.4.8
+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.4.8
-main.rowid_filter_innodb              : MDEV-20538 - Wrong result
-main.schema                           : Modified in 10.4.8
-main.select                           : Modified in 10.4.8
+main.rowid_filter_innodb              : MDEV-20538 - Wrong result; modified in 10.4.11
+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.4.9
-main.selectivity_innodb               : Modified in 10.4.8
-main.selectivity_no_engine            : Modified in 10.4.8
-main.set_password                     : Include file modified in 10.4.8
+main.selectivity                      : Modified in 10.4.11
 main.set_statement                    : MDEV-13183 - Wrong result
 main.set_statement_notembedded        : MDEV-19414 - Wrong result
 main.shm                              : MDEV-12727 - Mismatch, ERROR 2013
-main.show_bad_definer-5553            : Modified in 10.4.8
-main.show_check                       : Modified in 10.4.8
 main.show_explain                     : MDEV-10674 - Wrong result code
 main.sp                               : MDEV-7866 - Mismatch; modified in 10.4.9
-main.sp-anchor-type                   : Modified in 10.4.8
 main.sp-code                          : Modified in 10.4.9
-main.sp-error                         : Modified in 10.4.8
-main.sp-security                      : MDEV-10607 - sporadic "can't connect"; modified in 10.4.8
-main.sp_notembedded                   : MDEV-10607 - internal error; include file modified in 10.4.8
-main.ssl                              : MDEV-17184 - Failures with OpenSSL 1.1.1; modified in 10.4.8
-main.ssl-big                          : Modified in 10.4.8
+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
 main.ssl_7937                         : MDEV-20958 - Wrong result
 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.4.8
-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.4.11
 main.ssl_timeout                      : MDEV-11244 - Crash
 main.stat_tables                      : Modified in 10.4.9
-main.stat_tables-enospc               : Modified in 10.4.8
 main.stat_tables_par                  : MDEV-13266 - Wrong result
 main.stat_tables_par_innodb           : MDEV-14155 - Wrong rounding
 main.statement-expr                   : Modified in 10.4.9
-main.statistics                       : Modified in 10.4.8
 main.status                           : MDEV-13255 - Wrong result
 main.subselect                        : MDEV-20551 - Valgrind failure; modified in 10.4.9
-main.subselect2                       : Modified in 10.4.8
-main.subselect3                       : Modified in 10.4.8
-main.subselect3_jcl6                  : Modified in 10.4.8
-main.subselect4                       : Modified in 10.4.8
-main.subselect_exists2in              : Modified in 10.4.8
-main.subselect_extra                  : Modified in 10.4.8
 main.subselect_innodb                 : MDEV-10614 - Wrong result
-main.subselect_mat_cost               : Modified in 10.4.8
-main.subselect_mat_cost_bugs          : Modified in 10.4.8
 main.subselect_notembedded            : Modified in 10.4.9
 main.subselect_sj                     : Modified in 10.4.9
-main.subselect_sj2                    : Modified in 10.4.8
-main.subselect_sj2_jcl6               : Modified in 10.3.18
-main.subselect_sj2_mat                : Modified in 10.4.8
-main.subselect_sj_jcl6                : Modified in 10.4.8
-main.subselect_sj_mat                 : Modified in 10.4.8
-main.subselect_sj_nonmerged           : Modified in 10.4.8
 main.sum_distinct-big                 : Modified in 10.4.9
-main.system_mysql_db_507              : Include file modified in 10.4.8
-main.system_mysql_db_fix50117         : Modified in 10.4.8
-main.system_time_debug                : Added in 10.4.8
-main.table_options-5867               : Configuration added in 10.4.8
 main.table_value_constr               : Modified in 10.4.9
 main.tc_heuristic_recover             : MDEV-14189 - Wrong result
-main.timezone2                        : Modified in 10.4.8
 main.tls_version                      : MDEV-20170 - Unknown SSL error
 main.tls_version1                     : MDEV-20170 - Unknown SSL error
-main.trigger                          : Modified in 10.4.8
-main.trigger-compat                   : Modified in 10.4.8
-main.trigger_notembedded              : Modified in 10.4.8
-main.truncate_badse                   : Configuration added in 10.4.8
 main.type_blob                        : MDEV-15195 - Wrong result
-main.type_date                        : Modified in 10.4.8
-main.type_datetime                    : Modified in 10.4.8
-main.type_datetime_hires              : MDEV-10687 - Timeout; modified in 10.4.8
+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.4.8
+main.type_int                         : Modified in 10.1.42
 main.type_newdecimal                  : MDEV-20532 - Floating point differences; modified in 10.4.9
 main.type_ranges                      : MDEV-20532 - Floating point differences
-main.type_temporal_innodb             : Modified in 10.4.8
-main.type_time_6065                   : Modified in 10.4.8
-main.type_time_hires                  : Modified in 10.4.8
-main.type_timestamp                   : Modified in 10.4.8
-main.type_timestamp_hires             : Modified in 10.4.8
-main.type_varchar                     : Configuration added in 10.4.8
-main.union                            : Modified in 10.4.8
-main.upgrade                          : Configuration added in 10.4.8
-main.userstat                         : MDEV-12904 - SSL errors; configuration added in 10.4.8
-main.variables                        : Modified in 10.4.8
-main.variables-notembedded            : Modified in 10.2.27
-main.view                             : Modified in 10.4.8
+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.4.8
-main.win_percentile                   : Modified in 10.4.8
 main.xa                               : MDEV-11769 - lock wait timeout
-main.xtradb_mrr                       : Modified in 10.4.8
 
 #-----------------------------------------------------------------------
 
@@ -326,7 +194,6 @@ archive.archive-big          : MDEV-20167 - Wrong error code
 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.4.8
 archive.mysqlhotcopy_archive : MDEV-10995 - Hang on debug
 
 #-----------------------------------------------------------------------
@@ -335,28 +202,23 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed
 
 #-----------------------------------------------------------------------
 
-binlog.backup                                : Added in 10.4.9
-binlog.binlog_commit_wait                    : MDEV-10150 - Mismatch
-binlog.binlog_innodb                         : Configuration added in 10.4.8
-binlog.binlog_killed                         : MDEV-12925 - Wrong result
-binlog.binlog_max_extension                  : MDEV-19762 - Crash on shutdown; modified in 10.4.8
-binlog.binlog_mixed_cache_stat               : Configuration added in 10.4.8
-binlog.binlog_mysqlbinlog2                   : Modified in 10.2.27
-binlog.binlog_mysqlbinlog_row                : Modified in 10.4.9
-binlog.binlog_mysqlbinlog_row_innodb         : MDEV-20530 - Binary files differ
-binlog.binlog_mysqlbinlog_row_myisam         : MDEV-20530 - Binary files differ
-binlog.binlog_parallel_replication_marks_row : MDEV-20959 - Wrong result
-binlog.binlog_row_cache_stat                 : Include file modified in 10.4.8
-binlog.binlog_row_drop_tmp_tbl               : Include file modified in 10.4.8
-binlog.binlog_stm_binlog                     : MDEV-20412 - Wrong result
-binlog.binlog_stm_cache_stat                 : Include file modified in 10.4.8
-binlog.binlog_stm_drop_tmp_tbl               : Include file modified in 10.4.8
-binlog.binlog_xa_recover                     : MDEV-8517 - Extra checkpoint
-binlog.flashback-largebinlog                 : MDEV-19764 - Out of memory; modified in 10.4.8
-binlog.load_data_stm_view                    : MDEV-16948 - Wrong result
-binlog.read_only                             : Added in 10.4.9
-binlog.read_only_statement                   : Added in 10.4.9
-binlog.show_concurrent_rotate                : MDEV-20215 - Wrong result
+binlog.backup                        : Added in 10.4.9
+binlog.binlog_commit_wait            : MDEV-10150 - Mismatch
+binlog.binlog_killed                 : MDEV-12925 - Wrong result
+binlog.binlog_max_extension          : MDEV-19762 - Crash on shutdown
+binlog.binlog_mysqlbinlog_row        : Modified in 10.4.9
+binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ
+binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ
+binlog.binlog_row_binlog             : MDEV-20213 - Server crash
+binlog.binlog_row_drop_tmp_tbl       : Include file modified in 10.1.42
+binlog.binlog_stm_binlog             : MDEV-20412 - Wrong result
+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
+binlog.load_data_stm_view            : MDEV-16948 - Wrong result
+binlog.read_only                     : Added in 10.4.9
+binlog.read_only_statement           : Added in 10.4.9
+binlog.show_concurrent_rotate        : MDEV-20215 - Wrong result
 
 #-----------------------------------------------------------------------
 
@@ -371,7 +233,7 @@ binlog_encryption.multisource                              : MDEV-20213 - Server
 binlog_encryption.mysqlbinlog                              : Modified in 10.4.9
 binlog_encryption.rpl_binlog_errors                        : MDEV-12742 - Crash; include file modified in 10.4.9
 binlog_encryption.rpl_checksum                             : MDEV-16951 - Wrong result
-binlog_encryption.rpl_corruption                           : MDEV-20159 - Assertion failure; MDEV-20953 - Wrong error code
+binlog_encryption.rpl_corruption                           : MDEV-20159 - Assertion failure; MDEV-20953 - Wrong error code; include file modified in 10.4.11
 binlog_encryption.rpl_gtid_basic                           : MDEV-16947 - Server failed to start
 binlog_encryption.rpl_init_slave_errors                    : MDEV-20213 - Server crash
 binlog_encryption.rpl_loadfile                             : MDEV-16645 - Timeout in include
@@ -384,19 +246,15 @@ binlog_encryption.rpl_skip_replication                     : MDEV-13571 - Unexpe
 binlog_encryption.rpl_ssl                                  : MDEV-14507 - Timeouts
 binlog_encryption.rpl_stm_relay_ign_space                  : MDEV-19375 - Test assertion failed
 binlog_encryption.rpl_sync                                 : MDEV-13830 - Assertion failure
+binlog_encryption.rpl_temporal_format_default_to_default   : MDEV-21273 - Timeout
 binlog_encryption.rpl_temporal_format_mariadb53_to_mysql56 : MDEV-20159 - Assertion failure
 binlog_encryption.rpl_typeconv                             : MDEV-14362 - Lost connection to MySQL server during query
 
 #-----------------------------------------------------------------------
 
-compat/oracle.plugin               : Include file modified in 10.4.9
-compat/oracle.ps                   : Modified in 10.4.9
-compat/oracle.sp                   : Modified in 10.4.8
-compat/oracle.sp-package           : Modified in 10.4.8
-compat/oracle.sp-package-mysqldump : Modified in 10.4.8
-compat/oracle.sp-package-security  : Modified in 10.4.8
-compat/oracle.statement-expr       : Modified in 10.4.9
-compat/oracle.type_blob            : Modified in 10.4.8
+compat/oracle.plugin         : Include file modified in 10.4.9
+compat/oracle.ps             : Modified in 10.4.9
+compat/oracle.statement-expr : Modified in 10.4.9
 
 #-----------------------------------------------------------------------
 
@@ -422,13 +280,11 @@ encryption.corrupted_during_recovery             : MDEV-20159 - Assertion failur
 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.4.8
 encryption.innochecksum                          : MDEV-13644 - Assertion failure
 encryption.innodb-bad-key-change                 : Combinations added in 10.4.9
 encryption.innodb-bad-key-change2                : MDEV-19118 - Can't connect to local MySQL server through socket; combinations added in 10.4.9
 encryption.innodb-bad-key-change3                : Combinations added in 10.4.9
 encryption.innodb-bad-key-change4                : Modified in 10.4.9
-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
@@ -444,8 +300,8 @@ 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.4.8
-encryption.innodb_encrypt_temporary_tables       : MDEV-20142 - Wrong result; combinations added in 10.4.8
+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
 encryption.innodb_encryption_discard_import      : MDEV-16116 - Wrong result
@@ -457,7 +313,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
 
 #-----------------------------------------------------------------------
 
@@ -478,42 +333,15 @@ 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.4.11
 federated.federatedx_versioning  : Modified in 10.4.9
 
 #-----------------------------------------------------------------------
 
-funcs_1.innodb_storedproc_07      : Include file modified in 10.4.8
-funcs_1.innodb_storedproc_08      : Include file modified in 10.4.8
-funcs_1.innodb_trig_03e           : Modified in 10.4.8
-funcs_1.is_basics_mixed           : Modified in 10.4.9
-funcs_1.is_columns                : Modified in 10.4.8
-funcs_1.is_columns_innodb         : Modified in 10.4.8
-funcs_1.is_columns_memory         : Modified in 10.4.8
-funcs_1.is_columns_myisam         : Modified in 10.4.8
-funcs_1.is_routines               : Include file modified in 10.4.8
-funcs_1.is_routines_embedded      : Include file modified in 10.4.8
-funcs_1.is_schemata               : Include file modified in 10.4.8
-funcs_1.is_schemata_embedded      : Include file modified in 10.4.8
-funcs_1.is_schemata_is_mysql_test : Modified in 10.4.8
-funcs_1.is_tables                 : Include file modified in 10.4.8
-funcs_1.is_tables_embedded        : Include file modified in 10.4.8
-funcs_1.is_tables_innodb          : Include file modified in 10.4.8
-funcs_1.is_tables_memory          : Include file modified in 10.4.8
-funcs_1.is_tables_myisam          : Include file modified in 10.4.8
-funcs_1.is_tables_myisam_embedded : Include file modified in 10.4.8
-funcs_1.is_triggers               : Include file modified in 10.4.8
-funcs_1.is_triggers_embedded      : Include file modified in 10.4.8
-funcs_1.memory_storedproc_07      : Include file modified in 10.4.8
-funcs_1.memory_storedproc_08      : Include file modified in 10.4.8
-funcs_1.memory_trig_03e           : Modified in 10.4.8
-funcs_1.memory_views              : MDEV-11773 - timeout
-funcs_1.myisam_storedproc_07      : Include file modified in 10.4.8
-funcs_1.myisam_storedproc_08      : Include file modified in 10.4.8
-funcs_1.myisam_trig_03e           : Modified in 10.4.8
-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.4.8
+funcs_1.is_basics_mixed         : Modified in 10.4.9
+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
 
 #-----------------------------------------------------------------------
 
@@ -522,8 +350,7 @@ funcs_2.myisam_charset : MDEV-11535 - Timeout
 
 #-----------------------------------------------------------------------
 
-funcs_2/charset.*              : MDEV-10999 - Not maintained
-funcs_2/charset.charset_master : Modified in 10.4.8
+funcs_2/charset.* : MDEV-10999 - Not maintained
 
 #-----------------------------------------------------------------------
 
@@ -536,36 +363,29 @@ 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.4.8
-gcol.gcol_select_myisam         : Include file modified in 10.4.8
-gcol.innodb_virtual_basic       : MDEV-16950 - Failing assertion; modified in 10.4.8
+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.4.9
 gcol.innodb_virtual_fk_restart  : MDEV-17466 - Assertion failure
-gcol.innodb_virtual_index       : Modified in 10.4.8
 
 #-----------------------------------------------------------------------
 
 innodb.101_compatibility                     : MDEV-13891 - Wrong result
 innodb.alter_algorithm                       : Modified in 10.4.9
-innodb.alter_copy                            : MDEV-16181 - Assertion failure; modified in 10.4.8
+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.4.8
 innodb.autoinc_persist                       : MDEV-15282 - Assertion failure
 innodb.binlog_consistent                     : MDEV-10618 - Server fails to start
 innodb.blob-crash                            : MDEV-19298 - Assertion failure
 innodb.doublewrite                           : MDEV-12905 - Server crash
-innodb.foreign-keys                          : Modified in 10.4.8
-innodb.foreign_key                           : Modified in 10.4.8
 innodb.full_crc32_import                     : Modified in 10.4.9
 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.4.9
+innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure
+innodb.ibuf_not_empty                        : MDEV-19021 - Wrong result; modified in 10.4.11
 innodb.information_schema_grants             : Added in 10.4.9
-innodb.innodb-32k-crash                      : MDEV-20194 - Extra warnings
-innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup
-innodb.innodb-alter                          : Modified in 10.4.8
+innodb.innodb-32k-crash                      : MDEV-20194 - Extra warnings; modified in 10.4.11
+innodb.innodb-64k-crash                      : MDEV-13872 - Failure and crash on startup; modified in 10.4.11
 innodb.innodb-alter-debug                    : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS
 innodb.innodb-alter-nullable                 : Modified in 10.4.9
 innodb.innodb-alter-table                    : MDEV-10619 - Testcase timeout
@@ -574,21 +394,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.4.9
 innodb.innodb-fk                             : MDEV-13832 - Assertion failure on shutdown
-innodb.innodb-fkcheck                        : Modified in 10.4.8
-innodb.innodb-get-fk                         : MDEV-13276 - Server crash; modified in 10.4.8
+innodb.innodb-get-fk                         : MDEV-13276 - Server crash
 innodb.innodb-index-online                   : MDEV-14809 - Cannot save statistics
-innodb.innodb-mdev7046                       : Modified in 10.4.8
+innodb.innodb-mdev-7513                      : Modified in 10.4.11
 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.4.8
-innodb.innodb-system-table-view              : Modified in 10.4.8
 innodb.innodb-table-online                   : MDEV-13894 - Wrong result
 innodb.innodb-virtual-columns-debug          : Modified in 10.4.9
 innodb.innodb-wl5522                         : MDEV-13644 - Assertion failure
-innodb.innodb-wl5522-debug                   : MDEV-14200 - Wrong errno; modified in 10.4.8
+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
@@ -597,18 +414,14 @@ 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.4.8
-innodb.innodb_bug84958                       : Added in 10.4.8
-innodb.innodb_bulk_create_index_debug        : Include file modified in 10.4.8
-innodb.innodb_bulk_create_index_flush        : Configuration added in 10.4.8
 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.4.9
 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.4.11
+innodb.innodb_max_recordsize_64k             : MDEV-15203 - Wrong result; modified in 10.4.11
 innodb.innodb_monitor                        : MDEV-10939 - Testcase timeout
-innodb.innodb_mysql                          : Include file modified in 10.4.8
+innodb.innodb_mysql                          : MDEV-19873 - Wrong result
 innodb.innodb_prefix_index_restart_server    : MDEV-20213 - Server crash
 innodb.innodb_simulate_comp_failures_small   : MDEV-20526 - ASAN use-after-poison
 innodb.innodb_stats                          : MDEV-10682 - wrong result
@@ -616,42 +429,42 @@ 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.4.8
-innodb.instant_alter_bugs                    : Modified in 10.4.9
-innodb.instant_alter_charset                 : Modified in 10.4.8
+innodb.instant_alter                         : Modified in 10.4.11
+innodb.instant_alter_bugs                    : Modified in 10.4.11
+innodb.instant_alter_debug                   : Modified in 10.4.11
 innodb.instant_alter_extend                  : MDEV-20963 - Binary files differ
 innodb.instant_alter_index_rename            : Modified in 10.4.9
-innodb.log_alter_table                       : Configuration added in 10.4.8
+innodb.instant_alter_limit                   : Modified in 10.4.11
 innodb.log_corruption                        : MDEV-13251 - Wrong result
 innodb.log_data_file_size                    : MDEV-14204 - Server failed to start; MDEV-20648 - Assertion failure
 innodb.log_file                              : MDEV-20159 - Assertion failure
 innodb.log_file_name                         : MDEV-14193 - Exception
 innodb.log_file_size                         : MDEV-15668 - Not found pattern
 innodb.monitor                               : MDEV-16179 - Wrong result
-innodb.page_id_innochecksum                  : Modified in 10.4.8
 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.4.8
+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.4.11
 innodb.stat_tables                           : Added in 10.4.9
 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.4.9
-innodb.trx_id_future                         : Modified in 10.4.8
+innodb.trx_id_future                         : Modified in 10.1.42
+innodb.undo_log                              : Modified in 10.4.11
 innodb.undo_truncate                         : MDEV-17340 - Server hung; MDEV-20840 - Sporadic timeout
-innodb.undo_truncate_recover                 : MDEV-17679 - Server has gone away; MDEV-19200 - Shutdown fails; modified in 10.4.8
+innodb.undo_truncate_recover                 : MDEV-17679 - Server has gone away; MDEV-19200 - Shutdown fails
 innodb.update_time                           : MDEV-14804 - Wrong result
 innodb.xa_recovery                           : MDEV-15279 - mysqld got exception
 
 #-----------------------------------------------------------------------
 
-innodb_fts.concurrent_insert           : Modified in 10.4.9
+innodb_fts.concurrent_insert           : MDEV-21223 - Server crash; modified in 10.4.9
 innodb_fts.crash_recovery              : Modified in 10.4.9
-innodb_fts.fulltext_table_evict        : Modified in 10.4.8
-innodb_fts.innodb_fts_misc             : Modified in 10.4.9
+innodb_fts.innodb_fts_misc             : Modified in 10.4.11
 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
@@ -662,51 +475,45 @@ innodb_fts.sync_ddl                    : MDEV-18654 - Assertion failure
 
 innodb_gis.alter_spatial_index   : MDEV-13745 - Server crash
 innodb_gis.innodb_gis_rtree      : MDEV-20213 - Server crash
-innodb_gis.rtree_compress2       : MDEV-16269 - Wrong result; modified in 10.4.8
+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.4.8
 
 #-----------------------------------------------------------------------
 
-innodb_zip.cmp_per_index    : MDEV-14490 - Table is marked as crashed
-innodb_zip.innochecksum     : MDEV-14486 - Server failed to shut down
-innodb_zip.innochecksum_3   : MDEV-13279 - Extra warnings
-innodb_zip.restart          : MDEV-20213 - Server crash
-innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.4.8
-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.4.11
+innodb_zip.cmp_per_index            : MDEV-14490 - Table is marked as crashed
+innodb_zip.innochecksum             : MDEV-14486 - Server failed to shut down
+innodb_zip.innochecksum_3           : MDEV-13279 - Extra warnings
+innodb_zip.prefix_index_liftedlimit : Modified in 10.4.11
+innodb_zip.restart                  : MDEV-20213 - Server crash
+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.4.8
 maria.insert_select      : MDEV-12757 - Timeout
 maria.insert_select-7314 : MDEV-16492 - Timeout
 maria.lock               : Modified in 10.4.9
 maria.maria              : MDEV-14430 - Extra warning
-maria.maria-big          : Modified in 10.4.8
-maria.maria-gis-recovery : Modified in 10.4.8
-maria.maria-no-logging   : MDEV-20196 - Crash on shutdown or server can't start; modified in 10.4.8
-maria.maria-recover      : Modified in 10.4.8
-maria.maria-recovery     : Modified in 10.4.8
-maria.maria3             : Modified in 10.4.8
-maria.partition          : Added in 10.4.8
+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.4.8
 mariabackup.data_directory              : MDEV-15270 - Error on exec
 mariabackup.encrypted_page_corruption   : Modified in 10.4.9
 mariabackup.extra_lsndir_stream         : Added in 10.4.9
 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.4.11
 mariabackup.incremental_encrypted       : MDEV-15667 - timeout
 mariabackup.incremental_rocksdb         : MDEV-20954 - Cannot access the file
 mariabackup.log_checksum_mismatch       : MDEV-16571 - Wrong result
@@ -740,7 +547,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.4.8
+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
@@ -760,23 +567,7 @@ parts.partition_debug                  : Modified in 10.4.9
 parts.partition_debug_innodb           : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.4.9
 parts.partition_debug_myisam           : Modified in 10.4.9
 parts.partition_exch_qa_10             : MDEV-11765 - wrong result
-parts.partition_exch_qa_4_innodb       : Include file modified in 10.4.8
-parts.partition_exch_qa_4_myisam       : Include file modified in 10.4.8
-parts.partition_exch_qa_8_innodb       : Include file modified in 10.4.8
-parts.partition_exch_qa_8_myisam       : Include file modified in 10.4.8
 parts.partition_innodb_status_file     : MDEV-12901 - Valgrind
-parts.partition_mgm_lc0_archive        : Include file modified in 10.4.8
-parts.partition_mgm_lc0_innodb         : Include file modified in 10.4.8
-parts.partition_mgm_lc0_memory         : Include file modified in 10.4.8
-parts.partition_mgm_lc0_myisam         : Include file modified in 10.4.8
-parts.partition_mgm_lc1_archive        : Include file modified in 10.4.8
-parts.partition_mgm_lc1_innodb         : Include file modified in 10.4.8
-parts.partition_mgm_lc1_memory         : Include file modified in 10.4.8
-parts.partition_mgm_lc1_myisam         : Include file modified in 10.4.8
-parts.partition_mgm_lc2_archive        : Include file modified in 10.4.8
-parts.partition_mgm_lc2_innodb         : Include file modified in 10.4.8
-parts.partition_mgm_lc2_memory         : Include file modified in 10.4.8
-parts.partition_mgm_lc2_myisam         : Include file modified in 10.4.8
 parts.partition_special_innodb         : MDEV-16942 - Timeout
 parts.reorganize_partition_innodb      : Added in 10.4.9
 
@@ -786,43 +577,32 @@ 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.4.8
-perfschema.hostcache_ipv6_addrinfo_again_deny   : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_bad_allow    : MDEV-13260 - Crash; configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_bad_deny     : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_good_allow   : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_good_deny    : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_noname_allow : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_addrinfo_noname_deny  : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_auth_plugin           : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_blocked               : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_max_con               : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_nameinfo_again_allow  : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_nameinfo_again_deny   : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_nameinfo_noname_allow : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_nameinfo_noname_deny  : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_passwd                : Configuration modified in 10.4.8
-perfschema.hostcache_ipv6_ssl                   : MDEV-10696 - Crash; configuration modified in 10.4.8
-perfschema.pfs_upgrade_func                     : MDEV-20957 - Upgrade file was not properly created
-perfschema.pfs_upgrade_proc                     : MDEV-20533 - Upgrade file was not properly created
-perfschema.pfs_upgrade_view                     : MDEV-20533 - Upgrade file was not properly created
-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                   : MDEV-20157 - Wrong result; include file modified in 10.4.8
-perfschema.stage_mdl_global                     : MDEV-11803 - wrong result on slow builders; configuration added in 10.4.8
-perfschema.stage_mdl_procedure                  : MDEV-11545 - Missing row; include file modified in 10.4.8
-perfschema.stage_mdl_table                      : MDEV-12638 - Wrong result; include file modified in 10.4.8
-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.4.11
+perfschema.pfs_upgrade_event                   : MDEV-20957 - Wrong result
+perfschema.pfs_upgrade_func                    : MDEV-20957 - Upgrade file was not properly created
+perfschema.pfs_upgrade_proc                    : MDEV-20533 - Upgrade file was not properly created
+perfschema.pfs_upgrade_view                    : MDEV-20533 - Upgrade file was not properly created
+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                  : MDEV-20157 - 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
 
 #-----------------------------------------------------------------------
 
@@ -830,16 +610,16 @@ perfschema_stress.* : MDEV-10996 - Not maintained
 
 #-----------------------------------------------------------------------
 
+period.delete     : Modified in 10.4.11
 period.versioning : MDEV-20159 - Assertion failure; include file modified in 10.4.9
 
 #-----------------------------------------------------------------------
 
 plugins.feedback_plugin_load     : Modified in 10.4.9
 plugins.feedback_plugin_send     : MDEV-7932, MDEV-11118 - Connection problems and such
-plugins.multiauth                : MDEV-20163 - Plugin could not be loaded; include file modified in 10.4.8
+plugins.multiauth                : MDEV-20163 - Plugin could not be loaded
 plugins.processlist              : MDEV-16574 - Wrong result
-plugins.qc_info                  : Modified in 10.4.8
-plugins.server_audit             : MDEV-14295 - Wrong result
+plugins.server_audit             : MDEV-14295 - Wrong result; modified in 10.4.11
 plugins.thread_pool_server_audit : MDEV-14295 - Wrong result
 
 #-----------------------------------------------------------------------
@@ -880,140 +660,136 @@ rocksdb_sys_vars.rocksdb_rate_limiter_bytes_per_sec_basic : MDEV-16639 - Crash
 
 #-----------------------------------------------------------------------
 
-roles.acl_statistics                          : Configuration added in 10.4.8
-roles.create_and_drop_role_invalid_user_table : Include file modified in 10.4.8
-roles.create_and_grant_role                   : MDEV-11772 - wrong result
-roles.definer                                 : Modified in 10.4.8
-roles.show_create_database-10463              : Modified in 10.4.8
-
-#-----------------------------------------------------------------------
-
-rpl.circular_serverid0                  : MDEV-19372 - ASAN heap-use-after-free
-rpl.create_or_replace2                  : MDEV-19412 - Lost connection to MySQL server
-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.4.8
-rpl.rpl_000011                          : Modified in 10.4.9
-rpl.rpl_auto_increment                  : MDEV-10417 - Fails on Mips
-rpl.rpl_auto_increment_bug45679         : MDEV-10417 - Fails on Mips
-rpl.rpl_auto_increment_update_failure   : MDEV-10625 - warnings in error log
-rpl.rpl_binlog_errors                   : MDEV-12742 - Crash
-rpl.rpl_binlog_index                    : MDEV-9501 - Failed registering on master
-rpl.rpl_cant_read_event_incident        : MDEV-20960 - Abort on shutdown
-rpl.rpl_circular_for_4_hosts            : MDEV-20536 - Server crash
-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.4.8
-rpl.rpl_ctype_latin1                    : MDEV-14813 - Wrong result on Mac
-rpl.rpl_ddl                             : MDEV-10417 - Fails on Mips
-rpl.rpl_domain_id_filter                : MDEV-20213 - Server crash
-rpl.rpl_domain_id_filter_io_crash       : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
-rpl.rpl_domain_id_filter_master_crash   : MDEV-19043 - Table marked as crashed
-rpl.rpl_domain_id_filter_restart        : MDEV-10684 - Wrong result; MDEV-19043 - Table marked as crashed
-rpl.rpl_drop_db_fail                    : MDEV-16898 - Slave fails to start
-rpl.rpl_dual_pos_advance                : MDEV-20213 - Server crash
-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.4.8
-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
-rpl.rpl_gtid_delete_domain              : MDEV-14463 - Timeout
-rpl.rpl_gtid_errorhandling              : MDEV-13261 - Crash
-rpl.rpl_gtid_mdev9033                   : MDEV-10680 - warnings
-rpl.rpl_gtid_reconnect                  : MDEV-14497 - Crash
-rpl.rpl_gtid_startpos                   : MDEV-20141 - mysqltest failed but provided no output
-rpl.rpl_gtid_stop_start                 : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings
-rpl.rpl_gtid_until                      : MDEV-10625 - warnings in error log
-rpl.rpl_ignore_grant                    : MDEV-20159 - Assertion failure
-rpl.rpl_ignore_table_update             : MDEV-20159 - Assertion failure
-rpl.rpl_innodb_bug30888                 : MDEV-10417 - Fails on Mips
-rpl.rpl_insert                          : MDEV-9329 - Fails on Ubuntu/s390x
-rpl.rpl_insert_delayed                  : MDEV-9329 - Fails on Ubuntu/s390x
-rpl.rpl_insert_id                       : MDEV-15197 - Wrong result
-rpl.rpl_insert_id_pk                    : MDEV-16567 - Assertion failure
-rpl.rpl_insert_ignore                   : MDEV-14365 - Lost connection to MySQL server during query
-rpl.rpl_invoked_features                : MDEV-10417 - Fails on Mips
-rpl.rpl_ip_mix                          : Modified in 10.4.9
-rpl.rpl_ip_mix2                         : Modified in 10.4.9
-rpl.rpl_ipv4_as_ipv6                    : MDEV-20147 - Incorrect checksum for freed object
-rpl.rpl_known_bugs_detection            : Modified in 10.2.27
-rpl.rpl_lcase_tblnames_rewrite_db       : MDEV-20213 - Server crash
-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.4.8
-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
-rpl.rpl_non_direct_stm_mixing_engines   : MDEV-14489 - Failed sync_slave_with_master
-rpl.rpl_parallel                        : MDEV-10653 - Timeouts
-rpl.rpl_parallel2                       : MDEV-17390 - Operation cannot be performed
-rpl.rpl_parallel_conflicts              : MDEV-15272 - Server crash
-rpl.rpl_parallel_ignored_errors         : Added in 10.4.9
-rpl.rpl_parallel_mdev6589               : MDEV-12979 - Assertion failure
-rpl.rpl_parallel_multilevel             : MDEV-20160 - Server crash
-rpl.rpl_parallel_multilevel2            : MDEV-14723 - Timeout
-rpl.rpl_parallel_optimistic             : MDEV-15278 - Failed to sync with master
-rpl.rpl_parallel_optimistic_nobinlog    : MDEV-15278 - Failed to sync with master
-rpl.rpl_parallel_retry                  : MDEV-11119 - Crash; MDEV-17109 - Timeout
-rpl.rpl_parallel_temptable              : MDEV-10356 - Crash; MDEV-19076 - Wrong result
-rpl.rpl_partition_innodb                : MDEV-10417 - Fails on Mips
-rpl.rpl_password_boundaries             : MDEV-11534 - Slave IO warnings
-rpl.rpl_read_only                       : MDEV-20159 - Assertion failure
-rpl.rpl_read_only2                      : Added in 10.4.9
-rpl.rpl_relayrotate                     : MDEV-20213 - Server crash
-rpl.rpl_rotate_logs                     : Modified in 10.4.9
-rpl.rpl_row_001                         : MDEV-16653 - MTR's internal check fails
-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_find_row_debug              : Modified in 10.4.9
-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.4.8
-rpl.rpl_row_until                       : MDEV-14052 - Master will not send events with checksum
-rpl.rpl_semi_sync                       : MDEV-11220 - Wrong result
-rpl.rpl_semi_sync_after_sync            : MDEV-14366 - Wrong result
-rpl.rpl_semi_sync_after_sync_row        : MDEV-14366 - Wrong result
-rpl.rpl_semi_sync_event_after_sync      : MDEV-11806 - warnings
-rpl.rpl_semi_sync_slave_reply_fail      : Added in 10.4.9
-rpl.rpl_semi_sync_uninstall_plugin      : MDEV-7140 - Assorted failures
-rpl.rpl_semi_sync_wait_no_slave         : MDEV-20159 - Assertion failure
-rpl.rpl_semi_sync_wait_point            : MDEV-11807 - timeout in wait condition
-rpl.rpl_semisync_ali_issues             : MDEV-16272 - Wrong result
-rpl.rpl_set_statement_default_master    : MDEV-13258 - Extra warning
-rpl.rpl_show_slave_hosts                : MDEV-10681 - Crash
-rpl.rpl_shutdown_wait_semisync_slaves   : MDEV-20213 - Server crash
-rpl.rpl_skip_error                      : Modified in 10.4.9
-rpl.rpl_skip_replication                : MDEV-13258 - Extra warning
-rpl.rpl_slave_grp_exec                  : MDEV-10514 - Deadlock
-rpl.rpl_slave_load_in                   : MDEV-20159 - Assertion failure
-rpl.rpl_slave_load_tmpdir_not_exist     : MDEV-14203 - Extra warning
-rpl.rpl_slow_query_log                  : MDEV-13250 - Test abort
-rpl.rpl_sp_effects                      : MDEV-13249 - Crash
-rpl.rpl_start_stop_slave                : MDEV-13567 - Sync slave timeout
-rpl.rpl_stm_mixing_engines              : MDEV-14489 - Sync slave with master failed
-rpl.rpl_stm_multi_query                 : MDEV-9501 - Failed registering on master
-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.4.8
-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
-rpl.rpl_trigger                         : MDEV-18055 - Wrong result
-rpl.rpl_truncate_3innodb                : MDEV-19454 - Syntax error
-rpl.rpl_unsafe_statements               : Modified in 10.1.42
-rpl.rpl_user_variables                  : MDEV-20522 - Wrong result
-rpl.rpl_variables                       : MDEV-20150 - Server crash
-rpl.sec_behind_master-5114              : MDEV-13878 - Wrong result
-rpl.show_status_stop_slave_race-7126    : MDEV-17438 - Timeout
+roles.create_and_grant_role : MDEV-11772 - wrong result
+
+#-----------------------------------------------------------------------
+
+rpl.circular_serverid0                : MDEV-19372 - ASAN heap-use-after-free
+rpl.create_or_replace2                : MDEV-19412 - Lost connection to MySQL server
+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.1.42
+rpl.rpl_000011                        : Modified in 10.4.9
+rpl.rpl_auto_increment                : MDEV-10417 - Fails on Mips
+rpl.rpl_auto_increment_bug45679       : MDEV-10417 - Fails on Mips
+rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log
+rpl.rpl_binlog_errors                 : MDEV-12742 - Crash
+rpl.rpl_binlog_grant                  : MDEV-21274 - Lost connection at handshake
+rpl.rpl_binlog_index                  : MDEV-9501 - Failed registering on master
+rpl.rpl_cant_read_event_incident      : MDEV-20960 - Abort on shutdown
+rpl.rpl_circular_for_4_hosts          : MDEV-20536 - Server crash
+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.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              : MDEV-20213 - Server crash
+rpl.rpl_domain_id_filter_io_crash     : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash
+rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Table marked as crashed
+rpl.rpl_domain_id_filter_restart      : MDEV-10684 - Wrong result; MDEV-19043 - Table marked as crashed
+rpl.rpl_drop_db_fail                  : MDEV-16898 - Slave fails to start
+rpl.rpl_dual_pos_advance              : MDEV-20213 - Server crash
+rpl.rpl_extra_col_master_innodb       : MDEV-16570 - Extra warning
+rpl.rpl_extra_col_master_myisam       : MDEV-14203 - Extra warning
+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
+rpl.rpl_gtid_delete_domain            : MDEV-14463 - Timeout
+rpl.rpl_gtid_errorhandling            : MDEV-13261 - Crash
+rpl.rpl_gtid_mdev9033                 : MDEV-10680 - warnings
+rpl.rpl_gtid_reconnect                : MDEV-14497 - Crash
+rpl.rpl_gtid_startpos                 : MDEV-20141 - mysqltest failed but provided no output
+rpl.rpl_gtid_stop_start               : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings
+rpl.rpl_gtid_until                    : MDEV-10625 - warnings in error log
+rpl.rpl_ignore_grant                  : MDEV-20159 - Assertion failure
+rpl.rpl_ignore_table_update           : MDEV-20159 - Assertion failure
+rpl.rpl_innodb_bug30888               : MDEV-10417 - Fails on Mips
+rpl.rpl_insert                        : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_insert_delayed                : MDEV-9329 - Fails on Ubuntu/s390x
+rpl.rpl_insert_id                     : MDEV-15197 - Wrong result
+rpl.rpl_insert_id_pk                  : MDEV-16567 - Assertion failure
+rpl.rpl_insert_ignore                 : MDEV-14365 - Lost connection to MySQL server during query
+rpl.rpl_invoked_features              : MDEV-10417 - Fails on Mips
+rpl.rpl_ip_mix                        : Modified in 10.4.9
+rpl.rpl_ip_mix2                       : Modified in 10.4.9
+rpl.rpl_ipv4_as_ipv6                  : MDEV-20147 - Incorrect checksum for freed object
+rpl.rpl_known_bugs_detection          : Modified in 10.1.42
+rpl.rpl_lcase_tblnames_rewrite_db     : MDEV-20213 - Server crash
+rpl.rpl_mariadb_slave_capability      : MDEV-11018 - Extra lines in binlog
+rpl.rpl_mdev-11092                    : Modified in 10.4.11
+rpl.rpl_mdev12179                     : MDEV-19043 - Table marked as crashed
+rpl.rpl_mdev6020                      : MDEV-15272 - Server crash
+rpl.rpl_mdev_17614                    : Added in 10.1.42
+rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait
+rpl.rpl_parallel                      : MDEV-10653 - Timeouts
+rpl.rpl_parallel2                     : MDEV-17390 - Operation cannot be performed
+rpl.rpl_parallel_conflicts            : MDEV-15272 - Server crash
+rpl.rpl_parallel_ignored_errors       : Added in 10.4.9
+rpl.rpl_parallel_mdev6589             : MDEV-12979 - Assertion failure
+rpl.rpl_parallel_multilevel           : MDEV-20160 - Server crash
+rpl.rpl_parallel_multilevel2          : MDEV-14723 - Timeout
+rpl.rpl_parallel_optimistic           : MDEV-15278 - Failed to sync with master
+rpl.rpl_parallel_optimistic_nobinlog  : MDEV-15278 - Failed to sync with master
+rpl.rpl_parallel_retry                : MDEV-11119 - Crash; MDEV-17109 - Timeout
+rpl.rpl_parallel_temptable            : MDEV-10356 - Crash; MDEV-19076 - Wrong result
+rpl.rpl_partition_innodb              : MDEV-10417 - Fails on Mips
+rpl.rpl_password_boundaries           : MDEV-11534 - Slave IO warnings
+rpl.rpl_read_only                     : MDEV-20159 - Assertion failure
+rpl.rpl_read_only2                    : Added in 10.4.9
+rpl.rpl_relayrotate                   : MDEV-20213 - Server crash
+rpl.rpl_rotate_logs                   : Modified in 10.4.9
+rpl.rpl_row_001                       : MDEV-16653 - MTR's internal check fails
+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.4.9
+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_until                     : MDEV-14052 - Master will not send events with checksum
+rpl.rpl_semi_sync                     : MDEV-11220 - Wrong result
+rpl.rpl_semi_sync_after_sync          : MDEV-14366 - Wrong result
+rpl.rpl_semi_sync_after_sync_row      : MDEV-14366 - Wrong result
+rpl.rpl_semi_sync_event_after_sync    : MDEV-11806 - warnings
+rpl.rpl_semi_sync_gtid_reconnect      : Added in 10.4.11
+rpl.rpl_semi_sync_skip_repl           : MDEV-21223 - Server crash
+rpl.rpl_semi_sync_slave_reply_fail    : Added in 10.4.9
+rpl.rpl_semi_sync_uninstall_plugin    : MDEV-7140 - Assorted failures
+rpl.rpl_semi_sync_wait_no_slave       : MDEV-20159 - Assertion failure
+rpl.rpl_semi_sync_wait_point          : MDEV-11807 - timeout in wait condition
+rpl.rpl_semisync_ali_issues           : MDEV-16272 - Wrong result
+rpl.rpl_set_null_myisam               : MDEV-20213 - Server crash
+rpl.rpl_set_statement_default_master  : MDEV-13258 - Extra warning
+rpl.rpl_show_slave_hosts              : MDEV-10681 - Crash
+rpl.rpl_shutdown_wait_semisync_slaves : MDEV-20213 - Server crash
+rpl.rpl_skip_error                    : Modified in 10.4.9
+rpl.rpl_skip_replication              : MDEV-13258 - Extra warning
+rpl.rpl_slave_grp_exec                : MDEV-10514 - Deadlock
+rpl.rpl_slave_load_in                 : MDEV-20159 - Assertion failure
+rpl.rpl_slave_load_tmpdir_not_exist   : MDEV-14203 - Extra warning
+rpl.rpl_slow_query_log                : MDEV-13250 - Test abort
+rpl.rpl_sp_effects                    : MDEV-13249 - Crash
+rpl.rpl_start_stop_slave              : MDEV-13567 - Sync slave timeout
+rpl.rpl_stm_multi_query               : MDEV-9501 - Failed registering on master
+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.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
+rpl.rpl_trigger                       : MDEV-18055 - Wrong result
+rpl.rpl_truncate_3innodb              : MDEV-19454 - Syntax error
+rpl.rpl_unsafe_statements             : Modified in 10.1.42
+rpl.rpl_user_variables                : MDEV-20522 - Wrong result
+rpl.rpl_variables                     : MDEV-20150 - Server crash
+rpl.sec_behind_master-5114            : MDEV-13878 - Wrong result
+rpl.show_status_stop_slave_race-7126  : MDEV-17438 - Timeout
 
 #-----------------------------------------------------------------------
 
@@ -1038,8 +814,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
 
 #-----------------------------------------------------------------------
 
@@ -1055,7 +832,9 @@ spider/bg.vp_fixes              : MDEV-9329 - Fails on Ubuntu/s390x
 
 #-----------------------------------------------------------------------
 
-spider/bugfix.select_by_null : Added in 10.4.9
+spider/bugfix.return_found_rows_insert : Added in 10.4.11
+spider/bugfix.return_found_rows_update : Added in 10.4.11
+spider/bugfix.select_by_null           : Added in 10.4.9
 
 #-----------------------------------------------------------------------
 
@@ -1063,8 +842,40 @@ spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained
 
 #-----------------------------------------------------------------------
 
+spider/regression/e1121.load_data_ddi0               : Added in 10.4.11
+spider/regression/e1121.load_data_ddi1               : Added in 10.4.11
+spider/regression/e1121.load_data_ignore_ddi0        : Added in 10.4.11
+spider/regression/e1121.load_data_ignore_ddi1        : Added in 10.4.11
+spider/regression/e1121.load_data_local_ddi0         : Added in 10.4.11
+spider/regression/e1121.load_data_local_ddi1         : Added in 10.4.11
+spider/regression/e1121.load_data_local_ignore_ddi0  : Added in 10.4.11
+spider/regression/e1121.load_data_local_ignore_ddi1  : Added in 10.4.11
+spider/regression/e1121.load_data_local_replace_ddi0 : Added in 10.4.11
+spider/regression/e1121.load_data_local_replace_ddi1 : Added in 10.4.11
+spider/regression/e1121.load_data_replace_ddi0       : Added in 10.4.11
+spider/regression/e1121.load_data_replace_ddi1       : Added in 10.4.11
+
+#-----------------------------------------------------------------------
+
+spider/regression/e112122.load_data_part_ddi0               : Added in 10.4.11
+spider/regression/e112122.load_data_part_ddi1               : Added in 10.4.11
+spider/regression/e112122.load_data_part_ignore_ddi0        : Added in 10.4.11
+spider/regression/e112122.load_data_part_ignore_ddi1        : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_ddi0         : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_ddi1         : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_ignore_ddi0  : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_ignore_ddi1  : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_replace_ddi0 : Added in 10.4.11
+spider/regression/e112122.load_data_part_local_replace_ddi1 : Added in 10.4.11
+spider/regression/e112122.load_data_part_replace_ddi0       : Added in 10.4.11
+spider/regression/e112122.load_data_part_replace_ddi1       : Added in 10.4.11
+
+#-----------------------------------------------------------------------
+
 sql_sequence.concurrent_create : MDEV-16635 - Server crash
 sql_sequence.other             : Modified in 10.4.9
+sql_sequence.rebuild           : Added in 10.4.11
+sql_sequence.view              : Modified in 10.4.11
 
 #-----------------------------------------------------------------------
 
@@ -1076,51 +887,17 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout
 
 #-----------------------------------------------------------------------
 
-sys_vars.aria_recover_options_basic                : Modified in 10.4.8
 sys_vars.autocommit_func2                          : MDEV-9329 - Fails on Ubuntu/s390x
-sys_vars.binlog_cache_size_basic                   : Modified in 10.4.8
-sys_vars.binlog_stmt_cache_size_basic              : Modified in 10.4.8
-sys_vars.character_set_client_basic                : Modified in 10.4.8
-sys_vars.character_set_connection_basic            : Modified in 10.4.8
-sys_vars.character_set_database_basic              : Modified in 10.4.8
-sys_vars.character_set_results_basic               : Modified in 10.4.8
-sys_vars.character_set_server_basic                : Modified in 10.4.8
-sys_vars.character_set_server_func                 : Modified in 10.4.8
-sys_vars.collation_connection_basic                : Modified in 10.4.8
-sys_vars.collation_database_basic                  : Modified in 10.4.8
-sys_vars.collation_server_basic                    : Modified in 10.4.8
 sys_vars.delayed_insert_limit_func                 : Modified in 10.4.9
-sys_vars.expire_logs_days_basic                    : Modified in 10.4.8
-sys_vars.histogram_size_basic                      : Modified in 10.2.27
 sys_vars.host_cache_size_auto                      : MDEV-20112 - Wrong result
 sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error
 sys_vars.innodb_change_buffering_debug_basic       : Modified in 10.4.9
-sys_vars.innodb_max_dirty_pages_pct_basic          : Modified in 10.4.8
-sys_vars.innodb_max_dirty_pages_pct_lwm_basic      : Modified in 10.4.8
-sys_vars.innodb_read_io_threads_basic              : Configuration added in 10.4.8
-sys_vars.innodb_write_io_threads_basic             : Configuration added in 10.4.8
 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.4.8
-sys_vars.long_query_time_basic                     : Modified in 10.4.8
-sys_vars.max_connect_errors_basic                  : Modified in 10.4.8
-sys_vars.max_connections_basic                     : Modified in 10.4.8
-sys_vars.max_heap_table_size_basic                 : Modified in 10.4.8
-sys_vars.max_seeks_for_key_func                    : Modified in 10.4.8
-sys_vars.myisam_recover_options_basic              : Configuration added in 10.4.8
-sys_vars.myisam_sort_buffer_size_basic             : Modified in 10.4.8
-sys_vars.optimizer_switch_basic                    : Modified in 10.4.8
-sys_vars.optimizer_use_condition_selectivity_basic : Modified in 10.4.8
-sys_vars.replicate_ignore_table_basic              : Modified in 10.4.8
 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.4.8
-sys_vars.sysvars_debug                             : Modified in 10.4.8
-sys_vars.sysvars_innodb                            : Modified in 10.4.8
-sys_vars.sysvars_server_embedded                   : Configuration deleted in 10.4.8
-sys_vars.sysvars_server_notembedded                : Configuration deleted in 10.4.8
+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.4.8
 sys_vars.wait_timeout_func                         : MDEV-12896 - Wrong result
 sys_vars.wsrep_provider_basic                      : MDEV-19457 - Assertion failure
 
@@ -1130,10 +907,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.4.8
-tokudb.cluster_2968-1                          : Modified in 10.4.8
-tokudb.cluster_2968-2                          : Modified in 10.4.8
-tokudb.cluster_2968-3                          : Modified in 10.4.8
 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
@@ -1151,7 +924,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.4.8
 
 #-----------------------------------------------------------------------
 
@@ -1172,14 +944,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.4.9
-tokudb_parts.partition_exch_qa_4_tokudb : Include file modified in 10.4.8
-tokudb_parts.partition_exch_qa_8_tokudb : Include file modified in 10.4.8
-tokudb_parts.partition_mgm_lc0_tokudb   : Include file modified in 10.4.8
-tokudb_parts.partition_mgm_lc10_tokudb  : Include file modified in 10.4.8
-tokudb_parts.partition_mgm_lc1_tokudb   : Include file modified in 10.4.8
-tokudb_parts.partition_mgm_lc2_tokudb   : Include file modified in 10.4.8
+tokudb_parts.partition_alter4_tokudb : MDEV-12640 - Lost connection
+tokudb_parts.partition_debug_tokudb  : Include file modified in 10.4.9
 
 #-----------------------------------------------------------------------
 
@@ -1203,20 +969,12 @@ unit.mf_iocache                 : MDEV-20952 - ASAN stack-buffer-overflow
 
 #-----------------------------------------------------------------------
 
-vcol.cross_db                : Modified in 10.4.8
 vcol.not_supported           : MDEV-10639 - Testcase timeout
-vcol.update                  : Modified in 10.4.8
 vcol.vcol_keys_innodb        : MDEV-10639 - Testcase timeout; modified in 10.4.9
 vcol.vcol_misc               : MDEV-16651 - Wrong error message
-vcol.vcol_select_innodb      : Modified in 10.4.8
-vcol.vcol_select_myisam      : Modified in 10.4.8
-vcol.vcol_sql_mode           : Added in 10.4.8
 vcol.vcol_sql_mode_datetime  : Added in 10.4.9
 vcol.vcol_sql_mode_time      : Added in 10.4.9
 vcol.vcol_sql_mode_timestamp : Added in 10.4.9
-vcol.vcol_sql_mode_upgrade   : Added in 10.4.8
-vcol.vcol_trigger_sp_innodb  : Include file modified in 10.4.8
-vcol.vcol_trigger_sp_myisam  : Include file modified in 10.4.8
 
 #-----------------------------------------------------------------------
 
@@ -1224,31 +982,29 @@ versioning.alter            : Modified in 10.4.9
 versioning.auto_increment   : Include file modified in 10.4.9
 versioning.commit_id        : Include file modified in 10.4.9
 versioning.create           : Modified in 10.4.9
-versioning.cte              : Modified in 10.4.8
-versioning.delete           : Modified in 10.4.9
-versioning.derived          : Modified in 10.4.8
+versioning.delete           : Modified in 10.4.11
+versioning.delete_history   : Modified in 10.4.9
 versioning.engines          : Combinations added in 10.4.9
 versioning.foreign          : Modified in 10.4.9
 versioning.insert           : Include file modified in 10.4.9
 versioning.key_type         : Combinations added in 10.4.9
 versioning.online           : Modified in 10.4.9
-versioning.partition        : Modified in 10.4.9
+versioning.partition        : Modified in 10.4.11
 versioning.partition_innodb : Modified in 10.4.9
 versioning.replace          : Modified in 10.4.9
-versioning.select           : Include file modified in 10.4.9
+versioning.select           : Modified in 10.4.11
 versioning.select2          : Include file modified in 10.4.9
-versioning.truncate         : Modified in 10.4.9
 versioning.trx_id           : Modified in 10.4.9
-versioning.update           : MDEV-20955 - Wrong result code; modified in 10.4.9
+versioning.update           : MDEV-20955 - Wrong result code; modified in 10.4.11
 versioning.update-big       : Modified in 10.4.9
-versioning.view             : Modified in 10.4.9
+versioning.view             : Modified in 10.4.11
 
 #-----------------------------------------------------------------------
 
 wsrep.foreign_key                      : MDEV-14725 - WSREP has not yet prepared node
 wsrep.mdev_6832                        : MDEV-14195 - Check testcase failed; modified in 10.4.9
-wsrep.mysql_tzinfo_to_sql_symlink_skip : Added in 10.4.8
-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 added in 10.4.11
 wsrep.variables                        : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock; modified in 10.4.9
 
 #-----------------------------------------------------------------------
-- 
cgit v1.2.1


From 4c0854f2211a034683afd3a2c1e4f8d020c6785a Mon Sep 17 00:00:00 2001
From: Eugene Kosov 
Date: Thu, 5 Dec 2019 14:51:55 +0700
Subject: MDEV-21223 innodb_fts.sync_ddl fails in buildbot, server crashed in
 que_thr_step

FreeState(): replace pointer to freed memory with NULL. This actually fixes a crash
which is use-after-free as reported by ASAN

DbugParse(): unconditionally lock mutex because we're touching shared init_settings.keywords
---
 dbug/dbug.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/dbug/dbug.c b/dbug/dbug.c
index cde6363c86a..e7bf69a14e5 100644
--- a/dbug/dbug.c
+++ b/dbug/dbug.c
@@ -511,9 +511,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);
+      LockMutex(cs);
       stack->keywords= ListCopy(init_settings.keywords);
-      UnlockIfInitSettings(cs);
+      UnlockMutex(cs);
       stack->processes= ListCopy(init_settings.processes);
     }
     else
@@ -1617,7 +1617,10 @@ static void FreeState(CODE_STATE *cs, int free_state)
   struct settings *state= cs->stack;
   LockIfInitSettings(cs);
   if (!is_shared(state, keywords))
+  {
     FreeList(state->keywords);
+    state->keywords= NULL;
+  }
   UnlockIfInitSettings(cs);
   if (!is_shared(state, functions))
     FreeList(state->functions);
-- 
cgit v1.2.1


From 51fc8ab73e3ee9712d1128fefc9831dcf891a3b5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Mon, 9 Dec 2019 12:17:12 +0200
Subject: MDEV-21256: Reduce the use of ut_rnd_gen_next_ulint()

ut_rnd_set_seed(): Unused function; remove.

ut_rnd_gen(): Renamed from page_cur_lcg_prng().

ut_rnd_current: The internal state of ut_rnd_gen().

page_cur_open_on_rnd_user_rec(): Replace linear search with
page_rec_get_nth().
---
 storage/innobase/gis/gis0geo.cc    | 23 +---------------
 storage/innobase/include/ut0rnd.h  | 54 ++++++++++++++++++--------------------
 storage/innobase/include/ut0rnd.ic | 13 +--------
 storage/innobase/page/page0cur.cc  | 50 +++++------------------------------
 storage/innobase/ut/ut0rnd.cc      |  4 +++
 5 files changed, 39 insertions(+), 105 deletions(-)

diff --git a/storage/innobase/gis/gis0geo.cc b/storage/innobase/gis/gis0geo.cc
index fb55945549e..3a727185632 100644
--- a/storage/innobase/gis/gis0geo.cc
+++ b/storage/innobase/gis/gis0geo.cc
@@ -444,26 +444,6 @@ pick_seeds(
 	}
 }
 
-/*********************************************************//**
-Generates a random iboolean value.
-@return the random value */
-static
-ibool
-ut_rnd_gen_ibool(void)
-/*=================*/
-{
-	ulint    x;
-
-	x = ut_rnd_gen_ulint();
-
-	if (((x >> 20) + (x >> 15)) & 1) {
-
-		return(TRUE);
-	}
-
-	return(FALSE);
-}
-
 /*************************************************************//**
 Select next node and group where to add. */
 static
@@ -500,8 +480,7 @@ pick_next(
 			/* Introduce some randomness if the record
 			is identical */
 			if (diff == 0) {
-				diff = static_cast(
-					ut_rnd_gen_ibool());
+				diff = static_cast(ut_rnd_gen() & 1);
 			}
 
 			*n_group = 1 + (diff > 0);
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index b6d4d4abbd2..56b4a6159c1 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -1,6 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -27,37 +28,34 @@ Created 1/20/1994 Heikki Tuuri
 #define ut0rnd_h
 
 #include "ut0byte.h"
+#include 
 
 #ifndef UNIV_INNOCHECKSUM
-/** The 'character code' for end of field or string (used
-in folding records */
-#define UT_END_OF_FIELD		257
+/** Seed value of ut_rnd_gen() */
+extern uint64_t ut_rnd_current;
+
+/** @return a pseudo-random 64-bit number */
+inline uint64_t ut_rnd_gen()
+{
+	/*
+	This is a linear congruential pseudo random number generator.
+	The formula and the constants
+	being used are:
+	X[n+1] = (a * X[n] + c) mod m
+	where:
+	X[0] = my_interval_timer()
+	a = 1103515245 (3^5 * 5 * 7 * 129749)
+	c = 12345 (3 * 5 * 823)
+	m = 18446744073709551616 (1<<64), implicit */
+
+	if (UNIV_UNLIKELY(!ut_rnd_current)) {
+		ut_rnd_current = my_interval_timer();
+	}
+
+	ut_rnd_current = 1103515245 * ut_rnd_current + 12345;
+	return ut_rnd_current;
+}
 
-/********************************************************//**
-This is used to set the random number seed. */
-UNIV_INLINE
-void
-ut_rnd_set_seed(
-/*============*/
-	ulint	 seed);		 /*!< in: seed */
-/********************************************************//**
-The following function generates a series of 'random' ulint integers.
-@return the next 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_next_ulint(
-/*==================*/
-	ulint	rnd);	/*!< in: the previous random number value */
-/*********************************************************//**
-The following function generates 'random' ulint integers which
-enumerate the value space (let there be N of them) of ulint integers
-in a pseudo-random fashion. Note that the same integer is repeated
-always after N calls to the generator.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_ulint(void);
-/*==================*/
 /********************************************************//**
 Generates a random integer from a given interval.
 @return the 'random' number */
diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
index 0003c42baad..8b7ea5fe1e4 100644
--- a/storage/innobase/include/ut0rnd.ic
+++ b/storage/innobase/include/ut0rnd.ic
@@ -1,7 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1994, 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
@@ -42,17 +42,6 @@ Created 5/30/1994 Heikki Tuuri
 /** Seed value of ut_rnd_gen_ulint() */
 extern	ulint	 ut_rnd_ulint_counter;
 
-/********************************************************//**
-This is used to set the random number seed. */
-UNIV_INLINE
-void
-ut_rnd_set_seed(
-/*============*/
-	ulint	 seed)		 /*!< in: seed */
-{
-	ut_rnd_ulint_counter = seed;
-}
-
 /********************************************************//**
 The following function generates a series of 'random' ulint integers.
 @return the next 'random' number */
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index b4ec3e6dcdf..a5a8c6c3d1e 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -35,38 +35,6 @@ Created 10/4/1994 Heikki Tuuri
 
 #include 
 
-/*******************************************************************//**
-This is a linear congruential generator PRNG. Returns a pseudo random
-number between 0 and 2^64-1 inclusive. The formula and the constants
-being used are:
-X[n+1] = (a * X[n] + c) mod m
-where:
-X[0] = my_interval_timer()
-a = 1103515245 (3^5 * 5 * 7 * 129749)
-c = 12345 (3 * 5 * 823)
-m = 18446744073709551616 (2^64)
-
-@return number between 0 and 2^64-1 */
-static
-ib_uint64_t
-page_cur_lcg_prng(void)
-/*===================*/
-{
-#define LCG_a	1103515245
-#define LCG_c	12345
-	static uint64_t	lcg_current;
-
-	if (!lcg_current) {
-		lcg_current = my_interval_timer();
-	}
-
-	/* no need to "% 2^64" explicitly because lcg_current is
-	64 bit and this will be done anyway */
-	lcg_current = LCG_a * lcg_current + LCG_c;
-
-	return(lcg_current);
-}
-
 #ifdef BTR_CUR_HASH_ADAPT
 # ifdef UNIV_SEARCH_PERF_STAT
 static ulint	page_cur_short_succ;
@@ -814,8 +782,7 @@ page_cur_open_on_rnd_user_rec(
 	buf_block_t*	block,	/*!< in: page */
 	page_cur_t*	cursor)	/*!< out: page cursor */
 {
-	ulint	rnd;
-	ulint	n_recs = page_get_n_recs(buf_block_get_frame(block));
+	const ulint	n_recs = page_get_n_recs(block->frame);
 
 	page_cur_set_before_first(block, cursor);
 
@@ -824,11 +791,9 @@ page_cur_open_on_rnd_user_rec(
 		return;
 	}
 
-	rnd = (ulint) (page_cur_lcg_prng() % n_recs);
-
-	do {
-		page_cur_move_to_next(cursor);
-	} while (rnd--);
+	cursor->rec = page_rec_get_nth(block->frame,
+				       static_cast
+				       (ut_rnd_gen() % n_recs) + 1);
 }
 
 /** Write a redo log record of inserting a record into an index page.
@@ -2426,18 +2391,17 @@ page_cur_delete_rec(
 #ifdef UNIV_COMPILE_TEST_FUNCS
 
 /*******************************************************************//**
-Print the first n numbers, generated by page_cur_lcg_prng() to make sure
+Print the first n numbers, generated by ut_rnd_gen() to make sure
 (visually) that it works properly. */
 void
-test_page_cur_lcg_prng(
-/*===================*/
+test_ut_rnd_gen(
 	int	n)	/*!< in: print first n numbers */
 {
 	int			i;
 	unsigned long long	rnd;
 
 	for (i = 0; i < n; i++) {
-		rnd = page_cur_lcg_prng();
+		rnd = ut_rnd_gen();
 		printf("%llu\t%%2=%llu %%3=%llu %%5=%llu %%7=%llu %%11=%llu\n",
 		       rnd,
 		       rnd % 2,
diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc
index 3c1e51536a1..dcf43b9d7e1 100644
--- a/storage/innobase/ut/ut0rnd.cc
+++ b/storage/innobase/ut/ut0rnd.cc
@@ -1,6 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1994, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -25,6 +26,9 @@ Created 5/11/1994 Heikki Tuuri
 
 #include "ut0rnd.h"
 
+/** Seed value of ut_rnd_gen() */
+uint64_t ut_rnd_current;
+
 /** These random numbers are used in ut_find_prime */
 /*@{*/
 #define	UT_RANDOM_1	1.0412321
-- 
cgit v1.2.1


From d146e3dcfe3d4500eced3e097212b485659ec741 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 10 Dec 2019 11:14:57 +0200
Subject: MDEV-21256: Simplify ut_rnd_interval()

ut_rnd_interval(): Remove the first parameter, which was mostly
passed as 0. Implement as a simple wrapper around ut_rnd_gen().
Trivially return 0 if the size of the interval is smaller than 2.

ut_rnd_ulint_counter, ut_rnd_gen_next_ulint(), ut_rnd_gen_ulint(): Remove.
---
 storage/innobase/dict/dict0stats.cc |  2 +-
 storage/innobase/include/ib0mutex.h |  6 +--
 storage/innobase/include/ut0rnd.h   | 14 +++----
 storage/innobase/include/ut0rnd.ic  | 81 -------------------------------------
 storage/innobase/page/page0cur.cc   |  3 +-
 storage/innobase/sync/sync0rw.cc    | 10 ++---
 storage/innobase/ut/ut0rnd.cc       |  3 --
 7 files changed, 14 insertions(+), 105 deletions(-)

diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index f49fb87e4ea..c9e3929cf1d 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1747,7 +1747,7 @@ dict_stats_analyze_index_for_n_prefix(
 		ut_rnd_interval() to work with too big numbers since
 		ib_uint64_t could be bigger than ulint */
 		const ulint	rnd = ut_rnd_interval(
-			0, static_cast(right - left));
+			static_cast(right - left));
 
 		const ib_uint64_t	dive_below_idx
 			= boundaries->at(static_cast(left + rnd));
diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h
index e7f5ca2b44f..6c04563b97a 100644
--- a/storage/innobase/include/ib0mutex.h
+++ b/storage/innobase/include/ib0mutex.h
@@ -225,7 +225,7 @@ struct TTASFutexMutex {
 				return;
 			}
 
-			ut_delay(ut_rnd_interval(0, max_delay));
+			ut_delay(ut_rnd_interval(max_delay));
 		}
 
 		for (n_waits= 0;; n_waits++) {
@@ -362,7 +362,7 @@ struct TTASMutex {
 		uint32_t n_spins = 0;
 
 		while (!try_lock()) {
-			ut_delay(ut_rnd_interval(0, max_delay));
+			ut_delay(ut_rnd_interval(max_delay));
 			if (++n_spins == max_spins) {
 				os_thread_yield();
 				max_spins+= step;
@@ -516,7 +516,7 @@ struct TTASEventMutex {
 					sync_array_wait_event(sync_arr, cell);
 				}
 			} else {
-				ut_delay(ut_rnd_interval(0, max_delay));
+				ut_delay(ut_rnd_interval(max_delay));
 			}
 		}
 
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index 56b4a6159c1..fcab293b3b0 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -56,15 +56,11 @@ inline uint64_t ut_rnd_gen()
 	return ut_rnd_current;
 }
 
-/********************************************************//**
-Generates a random integer from a given interval.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_interval(
-/*============*/
-	ulint	low,	/*!< in: low limit; can generate also this value */
-	ulint	high);	/*!< in: high limit; can generate also this value */
+/** @return a random number between 0 and n-1, inclusive */
+inline ulint ut_rnd_interval(ulint n)
+{
+  return n > 1 ? static_cast(ut_rnd_gen() % n) : 0;
+}
 
 /*******************************************************//**
 The following function generates a hash value for a ulint integer
diff --git a/storage/innobase/include/ut0rnd.ic b/storage/innobase/include/ut0rnd.ic
index 8b7ea5fe1e4..c0105160a42 100644
--- a/storage/innobase/include/ut0rnd.ic
+++ b/storage/innobase/include/ut0rnd.ic
@@ -29,87 +29,6 @@ Created 5/30/1994 Heikki Tuuri
 
 #ifndef UNIV_INNOCHECKSUM
 
-#define UT_RND1			151117737
-#define UT_RND2			119785373
-#define UT_RND3			 85689495
-#define UT_RND4			 76595339
-#define UT_SUM_RND2		 98781234
-#define UT_SUM_RND3		126792457
-#define UT_SUM_RND4		 63498502
-#define UT_XOR_RND1		187678878
-#define UT_XOR_RND2		143537923
-
-/** Seed value of ut_rnd_gen_ulint() */
-extern	ulint	 ut_rnd_ulint_counter;
-
-/********************************************************//**
-The following function generates a series of 'random' ulint integers.
-@return the next 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_next_ulint(
-/*==================*/
-	ulint	rnd)	/*!< in: the previous random number value */
-{
-	ulint	n_bits;
-
-	n_bits = 8 * sizeof(ulint);
-
-	rnd = UT_RND2 * rnd + UT_SUM_RND3;
-	rnd = UT_XOR_RND1 ^ rnd;
-	rnd = (rnd << 20) + (rnd >> (n_bits - 20));
-	rnd = UT_RND3 * rnd + UT_SUM_RND4;
-	rnd = UT_XOR_RND2 ^ rnd;
-	rnd = (rnd << 20) + (rnd >> (n_bits - 20));
-	rnd = UT_RND1 * rnd + UT_SUM_RND2;
-
-	return(rnd);
-}
-
-/********************************************************//**
-The following function generates 'random' ulint integers which
-enumerate the value space of ulint integers in a pseudo random
-fashion. Note that the same integer is repeated always after
-2 to power 32 calls to the generator (if ulint is 32-bit).
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_gen_ulint(void)
-/*==================*/
-{
-	ulint	rnd;
-
-	ut_rnd_ulint_counter = UT_RND1 * ut_rnd_ulint_counter + UT_RND2;
-
-	rnd = ut_rnd_gen_next_ulint(ut_rnd_ulint_counter);
-
-	return(rnd);
-}
-
-/********************************************************//**
-Generates a random integer from a given interval.
-@return the 'random' number */
-UNIV_INLINE
-ulint
-ut_rnd_interval(
-/*============*/
-	ulint	low,	/*!< in: low limit; can generate also this value */
-	ulint	high)	/*!< in: high limit; can generate also this value */
-{
-	ulint	rnd;
-
-	ut_ad(high >= low);
-
-	if (low == high) {
-
-		return(low);
-	}
-
-	rnd = ut_rnd_gen_ulint();
-
-	return(low + (rnd % (high - low)));
-}
-
 /*******************************************************//**
 The following function generates a hash value for a ulint integer
 to a hash table of size table_size, which should be a prime
diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc
index a5a8c6c3d1e..21a725f845d 100644
--- a/storage/innobase/page/page0cur.cc
+++ b/storage/innobase/page/page0cur.cc
@@ -792,8 +792,7 @@ page_cur_open_on_rnd_user_rec(
 	}
 
 	cursor->rec = page_rec_get_nth(block->frame,
-				       static_cast
-				       (ut_rnd_gen() % n_recs) + 1);
+				       ut_rnd_interval(n_recs) + 1);
 }
 
 /** Write a redo log record of inserting a record into an index page.
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index 96108ab0bf1..c9b8a1e58a5 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -299,7 +299,7 @@ lock_loop:
 	HMT_low();
 	while (i < srv_n_spin_wait_rounds && lock->lock_word <= 0) {
 		if (srv_spin_wait_delay) {
-			ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
+			ut_delay(ut_rnd_interval(srv_spin_wait_delay));
 		}
 
 		i++;
@@ -425,7 +425,7 @@ rw_lock_x_lock_wait_func(
 
 		HMT_low();
 		if (srv_spin_wait_delay) {
-			ut_delay(ut_rnd_interval(0, srv_spin_wait_delay));
+			ut_delay(ut_rnd_interval(srv_spin_wait_delay));
 		}
 
 		if (i < srv_n_spin_wait_rounds) {
@@ -684,8 +684,7 @@ lock_loop:
 		       && lock->lock_word <= X_LOCK_HALF_DECR) {
 
 			if (srv_spin_wait_delay) {
-				ut_delay(ut_rnd_interval(
-						0, srv_spin_wait_delay));
+				ut_delay(ut_rnd_interval(srv_spin_wait_delay));
 			}
 
 			i++;
@@ -790,8 +789,7 @@ lock_loop:
 		       && lock->lock_word <= X_LOCK_HALF_DECR) {
 
 			if (srv_spin_wait_delay) {
-				ut_delay(ut_rnd_interval(
-						0, srv_spin_wait_delay));
+				ut_delay(ut_rnd_interval(srv_spin_wait_delay));
 			}
 
 			i++;
diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc
index dcf43b9d7e1..856cb82e645 100644
--- a/storage/innobase/ut/ut0rnd.cc
+++ b/storage/innobase/ut/ut0rnd.cc
@@ -36,9 +36,6 @@ uint64_t ut_rnd_current;
 #define UT_RANDOM_3	1.0132677
 /*@}*/
 
-/** Seed value of ut_rnd_gen_ulint(). */
-ulint	ut_rnd_ulint_counter = 65654363;
-
 /***********************************************************//**
 Looks for a prime number slightly greater than the given argument.
 The prime is chosen so that it is not near any power of 2.
-- 
cgit v1.2.1


From b1f2d3a8c8d9bd10e088111ca966b3f7be35df35 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 10 Dec 2019 11:20:26 +0200
Subject: MDEV-21256: Replace the 64-bit LCG with a 32-bit Galois LFSR

We should not need anywhere near 32 bits of entropy, so we might
just limit ourselves to a 32-bit random number generator.

Also, it might be cheaper to use exclusive-or, bit shifting and
conditional jumps, instead of multiplication and addition.

We use relaxed atomic operations on the global random number generator
state in order in an attempt to silence any warnings about race conditions.
There is an obvious race condition between the load and store in
ut_rnd_gen(), but we do not think that it matters much that the
state of the random number generator could 'stutter'.

This change seems makes the 'uncompress_ops' nondeterministic
in innodb_zip.cmp_per_index after the restart. It looks like
there is an inherent race condition in the test, because the
table could be opened for InnoDB statistics recalculation
already before innodb_cmp_per_index_enabled was set. We might
end up having uncompress_ops anywhere between 0 and 9, or perhaps
even more. Let us remove that part of the test.
---
 mysql-test/suite/innodb_zip/r/cmp_per_index.result | 31 +-------------
 mysql-test/suite/innodb_zip/t/cmp_per_index.test   | 26 +-----------
 storage/innobase/include/ut0rnd.h                  | 49 +++++++++++++---------
 storage/innobase/ut/ut0rnd.cc                      |  2 +-
 4 files changed, 34 insertions(+), 74 deletions(-)

diff --git a/mysql-test/suite/innodb_zip/r/cmp_per_index.result b/mysql-test/suite/innodb_zip/r/cmp_per_index.result
index cdb81e7be8a..b4e34040630 100644
--- a/mysql-test/suite/innodb_zip/r/cmp_per_index.result
+++ b/mysql-test/suite/innodb_zip/r/cmp_per_index.result
@@ -1,3 +1,4 @@
+SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
 SET GLOBAL innodb_cmp_per_index_enabled=ON;
 SELECT * FROM information_schema.innodb_cmp_per_index;
 CREATE TABLE t (
@@ -70,33 +71,5 @@ index_name	PRIMARY
 compress_ops	65
 compress_ops_ok	65
 uncompress_ops	0
-SHOW CREATE TABLE t;
-Table	t
-Create Table	CREATE TABLE `t` (
-  `a` int(11) NOT NULL,
-  `b` varchar(512) DEFAULT NULL,
-  `c` varchar(16) DEFAULT NULL,
-  PRIMARY KEY (`a`),
-  KEY `b` (`b`)
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 KEY_BLOCK_SIZE=2
-SET GLOBAL innodb_cmp_per_index_enabled=ON;
-SELECT COUNT(*) FROM t IGNORE INDEX(b);
-COUNT(*)	128
-SELECT
-database_name,
-table_name,
-index_name,
-compress_ops,
-compress_ops_ok,
-CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
-ELSE uncompress_ops END as uncompress_ops
-FROM information_schema.innodb_cmp_per_index
-ORDER BY 1, 2, 3;
-database_name	test
-table_name	t
-index_name	PRIMARY
-compress_ops	0
-compress_ops_ok	0
-uncompress_ops	4
 DROP TABLE t;
-SET GLOBAL innodb_cmp_per_index_enabled=default;
+SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
diff --git a/mysql-test/suite/innodb_zip/t/cmp_per_index.test b/mysql-test/suite/innodb_zip/t/cmp_per_index.test
index 8d66277a1bd..74ed17b1213 100644
--- a/mysql-test/suite/innodb_zip/t/cmp_per_index.test
+++ b/mysql-test/suite/innodb_zip/t/cmp_per_index.test
@@ -21,6 +21,7 @@ if (`SELECT @@innodb_log_compressed_pages = 0`)
 
 -- vertical_results
 
+SET @save_enabled= @@GLOBAL.innodb_cmp_per_index_enabled;
 SET GLOBAL innodb_cmp_per_index_enabled=ON;
 
 # reset any leftover stats from previous tests
@@ -92,29 +93,6 @@ ELSE compress_ops_ok END as compress_ops_ok,
 uncompress_ops
 FROM information_schema.innodb_cmp_per_index
 ORDER BY 1, 2, 3;
-
-# restart mysqld and see that uncompress ops also gets increased when
-# selecting from the table again
-
--- source include/restart_mysqld.inc
-
-SHOW CREATE TABLE t;
-
-SET GLOBAL innodb_cmp_per_index_enabled=ON;
-
-SELECT COUNT(*) FROM t IGNORE INDEX(b);
-
-SELECT
-database_name,
-table_name,
-index_name,
-compress_ops,
-compress_ops_ok,
-CASE WHEN uncompress_ops=6 and @@innodb_compression_level IN (4,8,9) THEN 9
-ELSE uncompress_ops END as uncompress_ops
-FROM information_schema.innodb_cmp_per_index
-ORDER BY 1, 2, 3;
-
 DROP TABLE t;
 
-SET GLOBAL innodb_cmp_per_index_enabled=default;
+SET GLOBAL innodb_cmp_per_index_enabled=@save_enabled;
diff --git a/storage/innobase/include/ut0rnd.h b/storage/innobase/include/ut0rnd.h
index fcab293b3b0..9af8687bfd0 100644
--- a/storage/innobase/include/ut0rnd.h
+++ b/storage/innobase/include/ut0rnd.h
@@ -32,28 +32,37 @@ Created 1/20/1994 Heikki Tuuri
 
 #ifndef UNIV_INNOCHECKSUM
 /** Seed value of ut_rnd_gen() */
-extern uint64_t ut_rnd_current;
+extern int32 ut_rnd_current;
 
-/** @return a pseudo-random 64-bit number */
-inline uint64_t ut_rnd_gen()
+/** @return a pseudo-random 32-bit number */
+inline uint32_t ut_rnd_gen()
 {
-	/*
-	This is a linear congruential pseudo random number generator.
-	The formula and the constants
-	being used are:
-	X[n+1] = (a * X[n] + c) mod m
-	where:
-	X[0] = my_interval_timer()
-	a = 1103515245 (3^5 * 5 * 7 * 129749)
-	c = 12345 (3 * 5 * 823)
-	m = 18446744073709551616 (1<<64), implicit */
-
-	if (UNIV_UNLIKELY(!ut_rnd_current)) {
-		ut_rnd_current = my_interval_timer();
-	}
-
-	ut_rnd_current = 1103515245 * ut_rnd_current + 12345;
-	return ut_rnd_current;
+  /* This is a Galois linear-feedback shift register.
+  https://en.wikipedia.org/wiki/Linear-feedback_shift_register#Galois_LFSRs
+  The generating primitive Galois Field polynomial is the Castagnoli
+  polynomial that was made popular by CRC-32C:
+  x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+
+  x^19+x^18+x^14+x^13+x^11+x^10+x^9+x^8+x^6+1 */
+  const uint32_t crc32c= 0x1edc6f41;
+
+  uint32_t rnd= my_atomic_load32_explicit(&ut_rnd_current,
+                                          MY_MEMORY_ORDER_RELAXED);
+
+  if (UNIV_UNLIKELY(rnd == 0))
+  {
+    rnd= static_cast(my_interval_timer());
+    if (!rnd) rnd= 1;
+  }
+  else
+  {
+    bool lsb= rnd & 1;
+    rnd>>= 1;
+    if (lsb)
+      rnd^= crc32c;
+  }
+
+  my_atomic_store32_explicit(&ut_rnd_current, rnd, MY_MEMORY_ORDER_RELAXED);
+  return rnd;
 }
 
 /** @return a random number between 0 and n-1, inclusive */
diff --git a/storage/innobase/ut/ut0rnd.cc b/storage/innobase/ut/ut0rnd.cc
index 856cb82e645..8265121ef2e 100644
--- a/storage/innobase/ut/ut0rnd.cc
+++ b/storage/innobase/ut/ut0rnd.cc
@@ -27,7 +27,7 @@ Created 5/11/1994 Heikki Tuuri
 #include "ut0rnd.h"
 
 /** Seed value of ut_rnd_gen() */
-uint64_t ut_rnd_current;
+int32 ut_rnd_current;
 
 /** These random numbers are used in ut_find_prime */
 /*@{*/
-- 
cgit v1.2.1


From 41e6a154ece1c7d49becac0ccaa72f507686d298 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 10 Dec 2019 11:23:46 +0200
Subject: MDEV-14482 - Cache line contention on ut_rnd_interval()

InnoDB RNG maintains global state, causing otherwise unnecessary bus
traffic. Even worse, this is cross-mutex traffic. That is, different
mutexes suffer from contention.

Fixed delay of 4 was verified to give best throughput by OLTP update
index and read-write benchmarks on Intel Broadwell (2/20/40) and
ARM (1/46/46).

This is a backport of ce0479006523bc72ed6abb703bd1f87ff256fd8a from
MariaDB Server 10.3.
---
 .../sys_vars/r/innodb_spin_wait_delay_basic.result | 16 +++++++--------
 mysql-test/suite/sys_vars/r/sysvars_innodb.result  |  4 ++--
 storage/innobase/handler/ha_innodb.cc              |  4 ++--
 storage/innobase/include/ib0mutex.h                |  6 +++---
 storage/innobase/sync/sync0rw.cc                   | 23 +++++-----------------
 5 files changed, 20 insertions(+), 33 deletions(-)

diff --git a/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result b/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
index 88516a854fe..b76ba4933f2 100644
--- a/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_spin_wait_delay_basic.result
@@ -1,28 +1,28 @@
 SET @start_global_value = @@global.innodb_spin_wait_delay;
 SELECT @start_global_value;
 @start_global_value
-6
+4
 Valid values are zero or above
 select @@global.innodb_spin_wait_delay >=0;
 @@global.innodb_spin_wait_delay >=0
 1
 select @@global.innodb_spin_wait_delay;
 @@global.innodb_spin_wait_delay
-6
+4
 select @@session.innodb_spin_wait_delay;
 ERROR HY000: Variable 'innodb_spin_wait_delay' is a GLOBAL variable
 show global variables like 'innodb_spin_wait_delay';
 Variable_name	Value
-innodb_spin_wait_delay	6
+innodb_spin_wait_delay	4
 show session variables like 'innodb_spin_wait_delay';
 Variable_name	Value
-innodb_spin_wait_delay	6
+innodb_spin_wait_delay	4
 select * from information_schema.global_variables where variable_name='innodb_spin_wait_delay';
 VARIABLE_NAME	VARIABLE_VALUE
-INNODB_SPIN_WAIT_DELAY	6
+INNODB_SPIN_WAIT_DELAY	4
 select * from information_schema.session_variables where variable_name='innodb_spin_wait_delay';
 VARIABLE_NAME	VARIABLE_VALUE
-INNODB_SPIN_WAIT_DELAY	6
+INNODB_SPIN_WAIT_DELAY	4
 set global innodb_spin_wait_delay=10;
 select @@global.innodb_spin_wait_delay;
 @@global.innodb_spin_wait_delay
@@ -38,7 +38,7 @@ ERROR HY000: Variable 'innodb_spin_wait_delay' is a GLOBAL variable and should b
 set global innodb_spin_wait_delay=DEFAULT;
 select @@global.innodb_spin_wait_delay;
 @@global.innodb_spin_wait_delay
-6
+4
 set global innodb_spin_wait_delay=0;
 select @@global.innodb_spin_wait_delay;
 @@global.innodb_spin_wait_delay
@@ -111,4 +111,4 @@ INNODB_SPIN_WAIT_DELAY	0
 SET @@global.innodb_spin_wait_delay = @start_global_value;
 SELECT @@global.innodb_spin_wait_delay;
 @@global.innodb_spin_wait_delay
-6
+4
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb.result b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
index 65d47347a15..4be85752cc7 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_innodb.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb.result
@@ -2228,10 +2228,10 @@ READ_ONLY	YES
 COMMAND_LINE_ARGUMENT	REQUIRED
 VARIABLE_NAME	INNODB_SPIN_WAIT_DELAY
 SESSION_VALUE	NULL
-DEFAULT_VALUE	6
+DEFAULT_VALUE	4
 VARIABLE_SCOPE	GLOBAL
 VARIABLE_TYPE	INT UNSIGNED
-VARIABLE_COMMENT	Maximum delay between polling for a spin lock (6 by default)
+VARIABLE_COMMENT	Maximum delay between polling for a spin lock (4 by default)
 NUMERIC_MIN_VALUE	0
 NUMERIC_MAX_VALUE	6000
 NUMERIC_BLOCK_SIZE	0
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 7e61a38320a..1e1583804eb 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -20716,8 +20716,8 @@ static MYSQL_SYSVAR_ULONG(sync_spin_loops, srv_n_spin_wait_rounds,
 
 static MYSQL_SYSVAR_UINT(spin_wait_delay, srv_spin_wait_delay,
   PLUGIN_VAR_OPCMDARG,
-  "Maximum delay between polling for a spin lock (6 by default)",
-  NULL, NULL, 6, 0, 6000, 0);
+  "Maximum delay between polling for a spin lock (4 by default)",
+  NULL, NULL, 4, 0, 6000, 0);
 
 static MYSQL_SYSVAR_ULONG(thread_concurrency, srv_thread_concurrency,
   PLUGIN_VAR_RQCMDARG,
diff --git a/storage/innobase/include/ib0mutex.h b/storage/innobase/include/ib0mutex.h
index 6c04563b97a..a7289777e00 100644
--- a/storage/innobase/include/ib0mutex.h
+++ b/storage/innobase/include/ib0mutex.h
@@ -225,7 +225,7 @@ struct TTASFutexMutex {
 				return;
 			}
 
-			ut_delay(ut_rnd_interval(max_delay));
+			ut_delay(max_delay);
 		}
 
 		for (n_waits= 0;; n_waits++) {
@@ -362,7 +362,7 @@ struct TTASMutex {
 		uint32_t n_spins = 0;
 
 		while (!try_lock()) {
-			ut_delay(ut_rnd_interval(max_delay));
+			ut_delay(max_delay);
 			if (++n_spins == max_spins) {
 				os_thread_yield();
 				max_spins+= step;
@@ -516,7 +516,7 @@ struct TTASEventMutex {
 					sync_array_wait_event(sync_arr, cell);
 				}
 			} else {
-				ut_delay(ut_rnd_interval(max_delay));
+				ut_delay(max_delay);
 			}
 		}
 
diff --git a/storage/innobase/sync/sync0rw.cc b/storage/innobase/sync/sync0rw.cc
index c9b8a1e58a5..df710a53cf6 100644
--- a/storage/innobase/sync/sync0rw.cc
+++ b/storage/innobase/sync/sync0rw.cc
@@ -298,10 +298,7 @@ lock_loop:
 	/* Spin waiting for the writer field to become free */
 	HMT_low();
 	while (i < srv_n_spin_wait_rounds && lock->lock_word <= 0) {
-		if (srv_spin_wait_delay) {
-			ut_delay(ut_rnd_interval(srv_spin_wait_delay));
-		}
-
+		ut_delay(srv_spin_wait_delay);
 		i++;
 	}
 
@@ -420,13 +417,9 @@ rw_lock_x_lock_wait_func(
 
 	ut_ad(lock->lock_word <= threshold);
 
+	HMT_low();
 	while (lock->lock_word < threshold) {
-
-
-		HMT_low();
-		if (srv_spin_wait_delay) {
-			ut_delay(ut_rnd_interval(srv_spin_wait_delay));
-		}
+		ut_delay(srv_spin_wait_delay);
 
 		if (i < srv_n_spin_wait_rounds) {
 			i++;
@@ -683,10 +676,7 @@ lock_loop:
 		while (i < srv_n_spin_wait_rounds
 		       && lock->lock_word <= X_LOCK_HALF_DECR) {
 
-			if (srv_spin_wait_delay) {
-				ut_delay(ut_rnd_interval(srv_spin_wait_delay));
-			}
-
+			ut_delay(srv_spin_wait_delay);
 			i++;
 		}
 
@@ -788,10 +778,7 @@ lock_loop:
 		while (i < srv_n_spin_wait_rounds
 		       && lock->lock_word <= X_LOCK_HALF_DECR) {
 
-			if (srv_spin_wait_delay) {
-				ut_delay(ut_rnd_interval(srv_spin_wait_delay));
-			}
-
+			ut_delay(srv_spin_wait_delay);
 			i++;
 		}
 
-- 
cgit v1.2.1


From f2d3b2eede50117d7f5be8a5f8daf4cfa566974b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= 
Date: Tue, 10 Dec 2019 16:56:52 +0200
Subject: Cleanup test sys_vars.innodb_buffer_pool_size_basic

When using huge pages, the innodb_buffer_pool_size cannot necessarily
be restored. Simplify things by restarting the server.
---
 .../suite/sys_vars/r/innodb_buffer_pool_size_basic.result   |  2 --
 .../suite/sys_vars/t/innodb_buffer_pool_size_basic.test     | 13 ++-----------
 2 files changed, 2 insertions(+), 13 deletions(-)

diff --git a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
index e6210165436..e50890a341c 100644
--- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_size_basic.result
@@ -50,5 +50,3 @@ COUNT(@@GLOBAL.innodb_buffer_pool_size)
 1 Expected
 SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
 ERROR 42S22: Unknown column 'innodb_buffer_pool_size' in 'field list'
-Expected error 'Readonly variable'
-SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
diff --git a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
index c5b4c118da2..4dd4a3aba0a 100644
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_size_basic.test
@@ -27,7 +27,6 @@
 --disable_query_log
 if (`select (version() like '%debug%') > 0`)
 {
-    set @old_innodb_disable_resize = @@innodb_disable_resize_buffer_pool_debug;
     set global innodb_disable_resize_buffer_pool_debug = OFF;
 }
 --enable_query_log
@@ -116,15 +115,7 @@ SELECT COUNT(@@GLOBAL.innodb_buffer_pool_size);
 
 --Error ER_BAD_FIELD_ERROR
 SELECT innodb_buffer_pool_size = @@SESSION.innodb_buffer_pool_size;
---echo Expected error 'Readonly variable'
 
 
-SET @@GLOBAL.innodb_buffer_pool_size = @start_buffer_pool_size;
---source include/wait_condition.inc
-
---disable_query_log
-if (`select (version() like '%debug%') > 0`)
-{
-    set global innodb_disable_resize_buffer_pool_debug = @old_innodb_disable_resize;
-}
---enable_query_log
+# Restore the original buffer pool size.
+--source include/restart_mysqld.inc
-- 
cgit v1.2.1


From 280f1c2605c7140af28145dc63e4a3a6177573bf Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Wed, 11 Dec 2019 11:13:32 +0100
Subject: MDEV-11345 Compile english error messages into mysqld executable.

---
 sql/derror.cc | 75 +++++++++++++++++++++++++++++++++++++++++------------------
 1 file changed, 53 insertions(+), 22 deletions(-)

diff --git a/sql/derror.cc b/sql/derror.cc
index f5e63772d54..318800ea262 100644
--- a/sql/derror.cc
+++ b/sql/derror.cc
@@ -69,6 +69,9 @@ bool init_errmessage(void)
 {
   const char **errmsgs;
   bool error= FALSE;
+  const char *lang= my_default_lc_messages->errmsgs->language;
+  my_bool use_english;
+
   DBUG_ENTER("init_errmessage");
 
   free_error_messages();
@@ -77,35 +80,63 @@ bool init_errmessage(void)
 
   error_message_charset_info= system_charset_info;
 
-  /* Read messages from file. */
-  if (read_texts(ERRMSG_FILE, my_default_lc_messages->errmsgs->language,
-                 &original_error_messages))
+  use_english= !strcmp(lang, "english");
+  if (!use_english)
   {
-    /*
-      No error messages.  Create a temporary empty error message so
-      that we don't get a crash if some code wrongly tries to access
-      a non existing error message.
-    */
+    /* Read messages from file. */
+    use_english= !read_texts(ERRMSG_FILE,lang, &original_error_messages);
+    error= TRUE;
+  }
+
+  if (use_english)
+  {
+    static const struct
+    {
+      const char* name;
+      uint id;
+      const char* fmt;
+    }
+    english_msgs[]=
+    {
+      #include 
+    };
+
+    memset(errors_per_range, 0, sizeof(errors_per_range));
+    /* Calculate nr of messages per range. */
+    for (size_t i= 0; i < array_elements(english_msgs); i++)
+    {
+      uint id= english_msgs[i].id;
+
+      // We rely on the fact the array is sorted by id.
+      DBUG_ASSERT(i == 0 || english_msgs[i-1].id < id);
+
+      errors_per_range[id/ERRORS_PER_RANGE-1]= id%ERRORS_PER_RANGE + 1;
+    }
+
+    size_t all_errors= 0;
+    for (size_t i= 0; i < MAX_ERROR_RANGES; i++)
+      all_errors+= errors_per_range[i];
+
     if (!(original_error_messages= (const char***)
-          my_malloc(MAX_ERROR_RANGES * sizeof(char**) +
-                    (ERRORS_PER_RANGE * sizeof(char*)),
-                     MYF(0))))
+          my_malloc((all_errors + MAX_ERROR_RANGES)* sizeof(void*),
+                     MYF(MY_ZEROFILL))))
       DBUG_RETURN(TRUE);
-    errmsgs= (const char**) (original_error_messages + MAX_ERROR_RANGES);
 
-    for (uint i=0 ; i < MAX_ERROR_RANGES ; i++)
+    errmsgs= (const char**)(original_error_messages + MAX_ERROR_RANGES);
+
+    original_error_messages[0]= errmsgs;
+    for (uint i= 1; i < MAX_ERROR_RANGES; i++)
     {
-      original_error_messages[i]= errmsgs;
-      errors_per_range[i]= ERRORS_PER_RANGE;
+      original_error_messages[i]=
+        original_error_messages[i-1] + errors_per_range[i-1];
     }
-    errors_per_range[2]= 0;                     // MYSYS error messages
-
-    for (const char **ptr= errmsgs;
-         ptr < errmsgs + ERRORS_PER_RANGE ;
-         ptr++)
-      *ptr= "";
 
-    error= TRUE;
+    for (uint i= 0; i < array_elements(english_msgs); i++)
+    {
+      uint id= english_msgs[i].id;
+      original_error_messages[id/ERRORS_PER_RANGE-1][id%ERRORS_PER_RANGE]=
+         english_msgs[i].fmt;
+    }
   }
 
   /* Register messages for use with my_error(). */
-- 
cgit v1.2.1


From 72a5a4f1d51aca36a8c87b845a7a8fb615a6ca74 Mon Sep 17 00:00:00 2001
From: Daniele Sciascia 
Date: Wed, 11 Dec 2019 13:08:06 +0100
Subject: MDEV-20780 Fixes for failures on galera_sr_ddl_master (#1425)

Test galera_sr_ddl_master would sometimes fail due to leftover
streaming replication fragments. Rollbacker thread would attempt to
open streaming_log table to remove the fragments, but would fail in
check_stack_overrun(). Ultimately the check_stack_overrun() failure
was caused by rollbacker missing to switch the victim's THD thread
stack to rollbacker's thread stack.

Also in this patch:
- Remove duplicate functionality in rollbacker helper functions,
  and extract rollbacker fragment removal into function
  wsrep_remove_streaming_fragments()
- Reuse open_for_write() in wsrep_schema::remove_fragments
- Partially revert changes to galera_sr_ddl_master test from
  commit 44a11a7c085f4f5a4042100df0828d54d596103d. Removed unnecessary
  wait condition and isolation level setting
---
 mysql-test/suite/galera_sr/disabled.def            |   1 -
 .../suite/galera_sr/r/galera_sr_ddl_master.result  |   2 -
 .../suite/galera_sr/t/galera_sr_ddl_master.test    |   7 --
 sql/wsrep_schema.cc                                |  20 +---
 sql/wsrep_server_service.cc                        |  29 +++---
 sql/wsrep_server_service.h                         |  10 ++
 sql/wsrep_thd.cc                                   | 111 +++++++--------------
 7 files changed, 62 insertions(+), 118 deletions(-)

diff --git a/mysql-test/suite/galera_sr/disabled.def b/mysql-test/suite/galera_sr/disabled.def
index 44354706143..ab22c746cd0 100644
--- a/mysql-test/suite/galera_sr/disabled.def
+++ b/mysql-test/suite/galera_sr/disabled.def
@@ -1,4 +1,3 @@
 galera_sr_table_contents : missing file
 GCF-437 : test relies on InnoDB redo log size limitation
-galera_sr_ddl_master : MDEV-20780 Galera test failure on galera_sr.galera_sr_ddl_master
 GCF-1043A : MDEV-21170 Galera test failure on galera_sr.GCF-1043A
diff --git a/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result
index 93f94222862..5858a9c6eb8 100644
--- a/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result
+++ b/mysql-test/suite/galera_sr/r/galera_sr_ddl_master.result
@@ -48,8 +48,6 @@ SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
 expect_0
 0
 connection node_2;
-SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-set global wsrep_sync_wait=15;
 SELECT COUNT(*) as expect_6 FROM t1;
 expect_6
 6
diff --git a/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test
index bf1105e908d..3c42cb2a0a2 100644
--- a/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test
+++ b/mysql-test/suite/galera_sr/t/galera_sr_ddl_master.test
@@ -59,15 +59,8 @@ SELECT * FROM t1;
 SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
 
 --connection node_2
-SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
-set global wsrep_sync_wait=15;
---let $wait_condition = SELECT COUNT(*) = 6 FROM t1;
---source include/wait_condition.inc
 SELECT COUNT(*) as expect_6 FROM t1;
 SELECT * FROM t1;
---let $wait_condition = SELECT COUNT(*) = 0 FROM mysql.wsrep_streaming_log;
---source include/wait_condition.inc
-
 SELECT COUNT(*) as expect_0 FROM mysql.wsrep_streaming_log;
 
 DROP TABLE t1;
diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc
index 066ea124fb7..619a535f916 100644
--- a/sql/wsrep_schema.cc
+++ b/sql/wsrep_schema.cc
@@ -1049,37 +1049,23 @@ int Wsrep_schema::remove_fragments(THD* thd,
   Wsrep_schema_impl::wsrep_off  wsrep_off(thd);
   Wsrep_schema_impl::binlog_off binlog_off(thd);
 
-  /*
-    Open SR table for write.
-    Adopted from Rpl_info_table_access::open_table()
-  */
-  uint flags= (MYSQL_OPEN_IGNORE_GLOBAL_READ_LOCK |
-               MYSQL_LOCK_IGNORE_GLOBAL_READ_ONLY |
-               MYSQL_OPEN_IGNORE_FLUSH |
-               MYSQL_LOCK_IGNORE_TIMEOUT);
   Query_tables_list query_tables_list_backup;
   Open_tables_backup open_tables_backup;
   thd->lex->reset_n_backup_query_tables_list(&query_tables_list_backup);
   thd->reset_n_backup_open_tables_state(&open_tables_backup);
-  TABLE_LIST tables;
-  LEX_CSTRING schema_str= { wsrep_schema_str.c_str(), wsrep_schema_str.length() };
-  LEX_CSTRING table_str= { sr_table_str.c_str(), sr_table_str.length() };
-  tables.init_one_table(&schema_str,
-                        &table_str, 0, TL_WRITE);
 
-  if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags))
+  TABLE* frag_table= 0;
+  if (Wsrep_schema_impl::open_for_write(thd, sr_table_str.c_str(), &frag_table))
   {
-    WSREP_DEBUG("Failed to open SR table for access");
     ret= 1;
   }
   else
   {
-    tables.table->use_all_columns();
     for (std::vector::const_iterator i= fragments.begin();
          i != fragments.end(); ++i)
     {
       if (remove_fragment(thd,
-                          tables.table,
+                          frag_table,
                           server_id,
                           transaction_id, *i))
       {
diff --git a/sql/wsrep_server_service.cc b/sql/wsrep_server_service.cc
index bfb85e3d0ab..aa288e67420 100644
--- a/sql/wsrep_server_service.cc
+++ b/sql/wsrep_server_service.cc
@@ -42,15 +42,13 @@ static void init_service_thd(THD* thd, char* thread_stack)
   thd->reset_for_next_command(true);
 }
 
-wsrep::storage_service* Wsrep_server_service::storage_service(
-  wsrep::client_service& client_service)
+Wsrep_storage_service*
+wsrep_create_storage_service(THD* orig_THD, const char* ctx)
 {
-  Wsrep_client_service& cs=
-    static_cast(client_service);
-  THD* thd= new THD(next_thread_id(), true);
-  init_service_thd(thd, cs.m_thd->thread_stack);
-  WSREP_DEBUG("Created storage service with thread id %llu",
-              thd->thread_id);
+  THD* thd= new THD(true, true);
+  init_service_thd(thd, orig_THD->thread_stack);
+  WSREP_DEBUG("Created storage service in %s context with thread id %llu",
+              ctx, thd->thread_id);
   /* Use variables from the current thd attached to client_service.
      This is because we need to be able to BF abort storage access
      operations. */
@@ -58,17 +56,20 @@ wsrep::storage_service* Wsrep_server_service::storage_service(
   return new Wsrep_storage_service(thd);
 }
 
+wsrep::storage_service* Wsrep_server_service::storage_service(
+  wsrep::client_service& client_service)
+{
+  Wsrep_client_service& cs=
+    static_cast(client_service);
+  return wsrep_create_storage_service(cs.m_thd, "local");
+}
+
 wsrep::storage_service* Wsrep_server_service::storage_service(
   wsrep::high_priority_service& high_priority_service)
 {
   Wsrep_high_priority_service& hps=
     static_cast(high_priority_service);
-  THD* thd= new THD(next_thread_id(), true);
-  init_service_thd(thd, hps.m_thd->thread_stack);
-  WSREP_DEBUG("Created high priority storage service with thread id %llu",
-              thd->thread_id);
-  wsrep_assign_from_threadvars(thd);
-  return new Wsrep_storage_service(thd);
+  return wsrep_create_storage_service(hps.m_thd, "high priority");
 }
 
 void Wsrep_server_service::release_storage_service(
diff --git a/sql/wsrep_server_service.h b/sql/wsrep_server_service.h
index 6336fe2c473..4017c9b2d58 100644
--- a/sql/wsrep_server_service.h
+++ b/sql/wsrep_server_service.h
@@ -87,4 +87,14 @@ class Wsrep_applier_service;
 Wsrep_applier_service*
 wsrep_create_streaming_applier(THD *orig_thd, const char *ctx);
 
+/**
+   Helper method to create new storage service.
+
+   @param orig_thd Original thd context to copy operation context from.
+   @param ctx Context string for debug logging.
+*/
+class Wsrep_storage_service;
+Wsrep_storage_service*
+wsrep_create_storage_service(THD *orig_thd, const char *ctx);
+
 #endif /* WSREP_SERVER_SERVICE */
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 8b535b41a43..7f1818def73 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -136,99 +136,60 @@ void wsrep_create_appliers(long threads)
   }
 }
 
-static void wsrep_rollback_streaming_aborted_by_toi(THD *thd)
+static void wsrep_remove_streaming_fragments(THD* thd, const char* ctx)
 {
-  WSREP_INFO("wsrep_rollback_streaming_aborted_by_toi");
-  /* Set thd->event_scheduler.data temporarily to NULL to avoid
-     callbacks to threadpool wait_begin() during rollback. */
-  auto saved_esd= thd->event_scheduler.data;
-  thd->event_scheduler.data= 0;
-  if (thd->wsrep_cs().mode() == wsrep::client_state::m_high_priority)
-  {
-    DBUG_ASSERT(!saved_esd);
-    DBUG_ASSERT(thd->wsrep_applier_service);
-    thd->wsrep_applier_service->rollback(wsrep::ws_handle(),
-                                         wsrep::ws_meta());
-    thd->wsrep_applier_service->after_apply();
-    /* Will free THD */
-    Wsrep_server_state::instance().server_service().
-      release_high_priority_service(thd->wsrep_applier_service);
-  }
-  else
-  {
-    mysql_mutex_lock(&thd->LOCK_thd_data);
-    /* prepare THD for rollback processing */
-    thd->reset_for_next_command(true);
-    thd->lex->sql_command= SQLCOM_ROLLBACK;
-    mysql_mutex_unlock(&thd->LOCK_thd_data);
-    /* Perform a client rollback, restore globals and signal
-       the victim only when all the resources have been
-       released */
-    thd->wsrep_cs().client_service().bf_rollback();
-    wsrep_reset_threadvars(thd);
-    /* Assign saved event_scheduler.data back before letting
-       client to continue. */
-    thd->event_scheduler.data= saved_esd;
-    thd->wsrep_cs().sync_rollback_complete();
-  }
+  wsrep::transaction_id transaction_id(thd->wsrep_trx().id());
+  Wsrep_storage_service* storage_service= wsrep_create_storage_service(thd, ctx);
+  storage_service->store_globals();
+  storage_service->adopt_transaction(thd->wsrep_trx());
+  storage_service->remove_fragments();
+  storage_service->commit(wsrep::ws_handle(transaction_id, 0),
+                          wsrep::ws_meta());
+  Wsrep_server_state::instance().server_service()
+    .release_storage_service(storage_service);
+  wsrep_store_threadvars(thd);
 }
 
-static void wsrep_rollback_high_priority(THD *thd)
+static void wsrep_rollback_high_priority(THD *thd, THD *rollbacker)
 {
-  WSREP_INFO("rollbacker aborting SR thd: (%lld %llu)",
-             thd->thread_id, (long long)thd->real_id);
+  WSREP_DEBUG("Rollbacker aborting SR applier thd (%llu %lu)",
+              thd->thread_id, thd->real_id);
+  char* orig_thread_stack= thd->thread_stack;
+  thd->thread_stack= rollbacker->thread_stack;
   DBUG_ASSERT(thd->wsrep_cs().mode() == Wsrep_client_state::m_high_priority);
   /* Must be streaming and must have been removed from the
      server state streaming appliers map. */
   DBUG_ASSERT(thd->wsrep_trx().is_streaming());
   DBUG_ASSERT(!Wsrep_server_state::instance().find_streaming_applier(
-    thd->wsrep_trx().server_id(),
-    thd->wsrep_trx().id()));
+                thd->wsrep_trx().server_id(),
+                thd->wsrep_trx().id()));
   DBUG_ASSERT(thd->wsrep_applier_service);
 
   /* Fragment removal should happen before rollback to make
      the transaction non-observable in SR table after the rollback
      completes. For correctness the order does not matter here,
      but currently it is mandated by checks in some MTR tests. */
-  wsrep::transaction_id transaction_id(thd->wsrep_trx().id());
-  Wsrep_storage_service* storage_service=
-    static_cast(
-          Wsrep_server_state::instance().server_service().storage_service(
-            *thd->wsrep_applier_service));
-  storage_service->store_globals();
-  storage_service->adopt_transaction(thd->wsrep_trx());
-  storage_service->remove_fragments();
-  storage_service->commit(wsrep::ws_handle(transaction_id, 0),
-                          wsrep::ws_meta());
-  Wsrep_server_state::instance().server_service().release_storage_service(storage_service);
-  wsrep_store_threadvars(thd);
+  wsrep_remove_streaming_fragments(thd, "high priority");
   thd->wsrep_applier_service->rollback(wsrep::ws_handle(),
                                        wsrep::ws_meta());
   thd->wsrep_applier_service->after_apply();
+  thd->thread_stack= orig_thread_stack;
+  WSREP_DEBUG("rollbacker aborted thd: (%llu %lu)",
+              thd->thread_id, thd->real_id);
   /* Will free THD */
   Wsrep_server_state::instance().server_service()
     .release_high_priority_service(thd->wsrep_applier_service);
 }
 
-static void wsrep_rollback_local(THD *thd)
+static void wsrep_rollback_local(THD *thd, THD *rollbacker)
 {
-  WSREP_INFO("Wsrep_rollback_local");
+  WSREP_DEBUG("Rollbacker aborting local thd (%llu %lu)",
+              thd->thread_id, thd->real_id);
+  char* orig_thread_stack= thd->thread_stack;
+  thd->thread_stack= rollbacker->thread_stack;
   if (thd->wsrep_trx().is_streaming())
   {
-    wsrep::transaction_id transaction_id(thd->wsrep_trx().id());
-    Wsrep_storage_service* storage_service=
-      static_cast(
-            Wsrep_server_state::instance().server_service().
-            storage_service(thd->wsrep_cs().client_service()));
-
-    storage_service->store_globals();
-    storage_service->adopt_transaction(thd->wsrep_trx());
-    storage_service->remove_fragments();
-    storage_service->commit(wsrep::ws_handle(transaction_id, 0),
-                            wsrep::ws_meta());
-    Wsrep_server_state::instance().server_service().
-      release_storage_service(storage_service);
-    wsrep_store_threadvars(thd);
+    wsrep_remove_streaming_fragments(thd, "local");
   }
   /* Set thd->event_scheduler.data temporarily to NULL to avoid
      callbacks to threadpool wait_begin() during rollback. */
@@ -247,9 +208,10 @@ static void wsrep_rollback_local(THD *thd)
   /* Assign saved event_scheduler.data back before letting
      client to continue. */
   thd->event_scheduler.data= saved_esd;
+  thd->thread_stack= orig_thread_stack;
   thd->wsrep_cs().sync_rollback_complete();
-  WSREP_DEBUG("rollbacker aborted thd: (%llu %llu)",
-              thd->thread_id, (long long)thd->real_id);
+  WSREP_DEBUG("rollbacker aborted thd: (%llu %lu)",
+              thd->thread_id, thd->real_id);
 }
 
 static void wsrep_rollback_process(THD *rollbacker,
@@ -286,18 +248,13 @@ static void wsrep_rollback_process(THD *rollbacker,
 
     /* Rollback methods below may free thd pointer. Do not try
        to access it after method returns. */
-    if (thd->wsrep_trx().is_streaming() &&
-        thd->wsrep_trx().bf_aborted_in_total_order())
-    {
-      wsrep_rollback_streaming_aborted_by_toi(thd);
-    }
-    else if (wsrep_thd_is_applying(thd))
+    if (wsrep_thd_is_applying(thd))
     {
-      wsrep_rollback_high_priority(thd);
+      wsrep_rollback_high_priority(thd, rollbacker);
     }
     else
     {
-      wsrep_rollback_local(thd);
+      wsrep_rollback_local(thd, rollbacker);
     }
     wsrep_store_threadvars(rollbacker);
     thd_proc_info(rollbacker, "wsrep aborter idle");
-- 
cgit v1.2.1


From 202a62deb0206b181ad6a7edd4fce7206c7e3381 Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Wed, 11 Dec 2019 11:22:03 +0100
Subject: MDEV-11345 Compile english error messages into mysqld executable.

Simplify loading messages into mariabackup. Do the same as server does
We're forcing english, so there is no attempt to load errmsg.sys
---
 extra/mariabackup/xtrabackup.cc | 38 ++++++--------------------------------
 1 file changed, 6 insertions(+), 32 deletions(-)

diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index ec53554e2d8..2ccd59ff13b 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -102,6 +102,7 @@ Street, Fifth Floor, Boston, MA 02110-1335 USA
 #include 
 #include 
 #include 
+#include 
 
 int sys_var_init();
 
@@ -5914,41 +5915,12 @@ extern void init_signals(void);
 
 #include 
 
-/* Messages . Avoid loading errmsg.sys file */
+
 void setup_error_messages()
 {
-  static const char *my_msgs[ERRORS_PER_RANGE];
-  static const char **all_msgs[] = { my_msgs, my_msgs, my_msgs, my_msgs };
   my_default_lc_messages = &my_locale_en_US;
-  my_default_lc_messages->errmsgs->errmsgs = all_msgs;
-
-  /* Populate the necessary error messages */
-  struct {
-    int id;
-    const char *fmt;
-  }
-  xb_msgs[] =
-  {
-  { ER_DATABASE_NAME,"Database" },
-  { ER_TABLE_NAME,"Table"},
-  { ER_PARTITION_NAME, "Partition" },
-  { ER_SUBPARTITION_NAME, "Subpartition" },
-  { ER_TEMPORARY_NAME, "Temporary"},
-  { ER_RENAMED_NAME, "Renamed"},
-  { ER_CANT_FIND_DL_ENTRY, "Can't find symbol '%-.128s' in library"},
-  { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
-  { ER_OUTOFMEMORY, "Out of memory; restart server and try again (needed %d bytes)" },
-  { ER_CANT_OPEN_LIBRARY, "Can't open shared library '%-.192s' (errno: %d, %-.128s)" },
-  { ER_UDF_NO_PATHS, "No paths allowed for shared library" },
-  { ER_CANT_INITIALIZE_UDF,"Can't initialize function '%-.192s'; %-.80s"},
-  { ER_PLUGIN_IS_NOT_LOADED,"Plugin '%-.192s' is not loaded" }
-  };
-
-  for (int i = 0; i < (int)array_elements(all_msgs); i++)
-    all_msgs[0][i] = "Unknown error";
-
-  for (int i = 0; i < (int)array_elements(xb_msgs); i++)
-    all_msgs[0][xb_msgs[i].id - ER_ERROR_FIRST] = xb_msgs[i].fmt;
+	if (init_errmessage())
+	  die("could not initialize error messages");
 }
 
 void
@@ -6220,6 +6192,8 @@ int main(int argc, char **argv)
 		(void) pthread_key_delete(THR_THD);
 
 	logger.cleanup_base();
+	cleanup_errmsgs();
+	free_error_messages();
 	mysql_mutex_destroy(&LOCK_error_log);
 
 	if (status == EXIT_SUCCESS) {
-- 
cgit v1.2.1


From 546644f1ccac8300e07b9cbc918acd7f1bd51752 Mon Sep 17 00:00:00 2001
From: Daniel Bartholomew 
Date: Wed, 11 Dec 2019 13:00:49 -0500
Subject: bump the VERSION

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

diff --git a/VERSION b/VERSION
index 49469df82da..bfa49d4ca46 100644
--- a/VERSION
+++ b/VERSION
@@ -1,3 +1,3 @@
 MYSQL_VERSION_MAJOR=10
 MYSQL_VERSION_MINOR=2
-MYSQL_VERSION_PATCH=30
+MYSQL_VERSION_PATCH=31
-- 
cgit v1.2.1


From ce47e66516ec1319dacaa3880d21622af6e00ad7 Mon Sep 17 00:00:00 2001
From: Daniel Bartholomew 
Date: Wed, 11 Dec 2019 13:03:16 -0500
Subject: bump the VERSION

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

diff --git a/VERSION b/VERSION
index 5ac3a902883..93876fce48e 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=10
 MYSQL_VERSION_MINOR=3
-MYSQL_VERSION_PATCH=21
+MYSQL_VERSION_PATCH=22
 SERVER_MATURITY=stable
-- 
cgit v1.2.1


From 3b401a69f74a4a900a2d776d8e6b5733609df617 Mon Sep 17 00:00:00 2001
From: Daniel Bartholomew 
Date: Wed, 11 Dec 2019 13:05:46 -0500
Subject: bump the VERSION

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

diff --git a/VERSION b/VERSION
index 5d77fe71692..bdeaa025260 100644
--- a/VERSION
+++ b/VERSION
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=10
 MYSQL_VERSION_MINOR=4
-MYSQL_VERSION_PATCH=11
+MYSQL_VERSION_PATCH=12
 SERVER_MATURITY=stable
-- 
cgit v1.2.1


From 808036a61d13d4392b6e0d9e7e9eca87a0c20495 Mon Sep 17 00:00:00 2001
From: Varun Gupta 
Date: Thu, 12 Dec 2019 03:45:34 +0530
Subject: MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data

The issue here is window function makes the passed string object
to point to an area in a temporary table's record buffer.
Then, the temporary table is freed, together with its record buffer.
Then, Item_cache_str attempts to read this value.

The fix is to call value_buff.copy(). This will make the value_buff to store
its string in a buffer that it owns, which will not disappear unexpectedly.
---
 mysql-test/r/win.result |  9 +++++++++
 mysql-test/t/win.test   | 10 ++++++++++
 sql/item.cc             |  2 ++
 3 files changed, 21 insertions(+)

diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result
index 13d452f3ef2..805fd2ed3d7 100644
--- a/mysql-test/r/win.result
+++ b/mysql-test/r/win.result
@@ -3634,5 +3634,14 @@ rank() over (partition by 'abc' order by 'xyz')
 1
 drop table t1;
 #
+# MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
+#
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
+x
+foo
+drop table t1;
+#
 # End of 10.2 tests
 #
diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test
index a4d42ce2b91..0f79834567b 100644
--- a/mysql-test/t/win.test
+++ b/mysql-test/t/win.test
@@ -2341,6 +2341,16 @@ select rank() over (partition by 'abc' order by 'xyz') from t1;
 select rank() over (partition by 'abc' order by 'xyz') from t1;
 drop table t1;
 
+--echo #
+--echo # MDEV-19380: ASAN heap-use-after-free in Protocol::net_store_data
+--echo #
+
+CREATE TABLE t1 (i int);
+INSERT INTO t1 VALUES (1),(2),(3);
+
+SELECT (SELECT MIN('foo') OVER() FROM t1 LIMIT 1) as x;
+drop table t1;
+
 --echo #
 --echo # End of 10.2 tests
 --echo #
diff --git a/sql/item.cc b/sql/item.cc
index 333d71ddf70..10087ef1974 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -10044,6 +10044,8 @@ bool Item_cache_str::cache_value()
     value_buff.copy(*value);
     value= &value_buff;
   }
+  else
+    value_buff.copy();
   return TRUE;
 }
 
-- 
cgit v1.2.1


From beec9c0e19284a0e50d3629f4cb2486007b0333b Mon Sep 17 00:00:00 2001
From: Vlad Lesin 
Date: Wed, 2 Oct 2019 21:11:59 +0300
Subject: MDEV-21255: Deadlock of parallel slave and mariabackup (with failed
 log copy thread)

mariabackup hangs waiting until innodb redo log thread read log till certain
LSN, and it waits under FTWRL. If there is redo log read error in the thread,
it is finished, and main thread knows nothing about it, what leads to hanging.
As it hangs under FTWRL, slave threads on server side can be blocked due
to MDL lock conflict.

The fix is to finish mariabackup with error message on innodb redo log read
failure.
---
 extra/mariabackup/xtrabackup.cc                      |  4 +++-
 .../suite/mariabackup/innodb_redo_log_overwrite.opt  |  1 +
 .../mariabackup/innodb_redo_log_overwrite.result     |  2 ++
 .../suite/mariabackup/innodb_redo_log_overwrite.test | 20 ++++++++++++++++++++
 4 files changed, 26 insertions(+), 1 deletion(-)
 create mode 100644 mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
 create mode 100644 mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
 create mode 100644 mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test

diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 2ccd59ff13b..e497ba5a972 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -2759,7 +2759,7 @@ static bool xtrabackup_copy_logfile(bool last = false)
 		log_mutex_exit();
 
 		if (!start_lsn) {
-			msg(recv_sys->found_corrupt_log
+			die(recv_sys->found_corrupt_log
 			    ? "xtrabackup_copy_logfile() failed: corrupt log."
 			    : "xtrabackup_copy_logfile() failed.");
 			return true;
@@ -4281,6 +4281,8 @@ fail_before_log_copying_thread_start:
 	if (xtrabackup_copy_logfile())
 		goto fail_before_log_copying_thread_start;
 
+	DBUG_MARIABACKUP_EVENT("before_innodb_log_copy_thread_started",0);
+
 	log_copying_stop = os_event_create(0);
 	os_thread_create(log_copying_thread, NULL, &log_copying_thread_id);
 
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
new file mode 100644
index 00000000000..7111d384b40
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.opt
@@ -0,0 +1 @@
+--loose-innodb-log-file-size=1048576 --loose-innodb-log-files-in-group=2
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
new file mode 100644
index 00000000000..29abe038afe
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.result
@@ -0,0 +1,2 @@
+CREATE TABLE t(i INT) ENGINE=INNODB;
+DROP TABLE t;
diff --git a/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test
new file mode 100644
index 00000000000..22165ff29be
--- /dev/null
+++ b/mysql-test/suite/mariabackup/innodb_redo_log_overwrite.test
@@ -0,0 +1,20 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+--source include/have_sequence.inc
+
+CREATE TABLE t(i INT) ENGINE=INNODB;
+
+--let $targetdir=$MYSQLTEST_VARDIR/tmp/backup
+
+# Generate enough redo log records to make at least one loop in log group
+--let before_innodb_log_copy_thread_started=INSERT INTO test.t SELECT * from test.seq_1_to_102400
+
+--disable_result_log
+# mariabackup must exit with error instead of hanging
+--error 1
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,mariabackup_events;
+--enable_result_log
+
+DROP TABLE t;
+--rmdir $targetdir
+
-- 
cgit v1.2.1


From 71e47f34f810f5b980a0d359bdbeed8dbe731f03 Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Wed, 27 Nov 2019 18:07:12 +0100
Subject: git ignore generated stuff

---
 .gitignore | 32 ++++++++++++++++++++++++++++++++
 1 file changed, 32 insertions(+)

diff --git a/.gitignore b/.gitignore
index 94795946e64..631922339d8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -9,6 +9,7 @@
 *.ninja
 .ninja_*
 .gdb_history
+.vs/
 errmsg.sys
 typescript
 _CPack_Packages
@@ -137,6 +138,10 @@ scripts/maria_add_gis_sp.sql
 scripts/maria_add_gis_sp_bootstrap.sql
 scripts/galera_new_cluster
 scripts/galera_recovery
+scripts/mysql_convert_table_format.pl
+scripts/mysqld_multi.pl
+scripts/mysqldumpslow.pl
+scripts/mysqlhotcopy.pl
 sql-bench/bench-count-distinct
 sql-bench/bench-init.pl
 sql-bench/compare-results
@@ -161,6 +166,30 @@ sql-bench/test-select
 sql-bench/test-table-elimination
 sql-bench/test-transactions
 sql-bench/test-wisconsin
+sql-bench/bench-count-distinct.pl
+sql-bench/compare-results.pl
+sql-bench/copy-db.pl
+sql-bench/crash-me.pl
+sql-bench/graph-compare-results.pl
+sql-bench/innotest1.pl
+sql-bench/innotest1a.pl
+sql-bench/innotest1b.pl
+sql-bench/innotest2.pl
+sql-bench/innotest2a.pl
+sql-bench/innotest2b.pl
+sql-bench/run-all-tests.pl
+sql-bench/server-cfg.pl
+sql-bench/test-ATIS.pl
+sql-bench/test-alter-table.pl
+sql-bench/test-big-tables.pl
+sql-bench/test-connect.pl
+sql-bench/test-create.pl
+sql-bench/test-insert.pl
+sql-bench/test-select.pl
+sql-bench/test-table-elimination.pl
+sql-bench/test-transactions.pl
+sql-bench/test-wisconsin.pl
+sql/make_mysqld_lib.cmake
 sql/lex_token.h
 sql/gen_lex_token
 sql/gen_lex_hash
@@ -589,3 +618,6 @@ sql/mariadb-tzinfo-to-sql
 sql/mariadbd
 storage/rocksdb/mariadb-ldb
 tests/mariadb-client-test
+versioninfo_dll.rc
+versioninfo_exe.rc
+win/packaging/ca/symlinks.cc
-- 
cgit v1.2.1


From 3304004a576c5a19f21664eda88d00c91c793f03 Mon Sep 17 00:00:00 2001
From: Vladislav Vaintroub 
Date: Thu, 12 Dec 2019 11:49:57 +0100
Subject: MDEV-21260 Innodb/Wjndows do not report error when trying open
 volumes on UNC paths

fil_node_t::find_metadata() tries to find out whether file
is on an SSD, and the disk sector size.
On Windows, it opens the corresponding volume for finding this data.

This does not go well, if datadir is on network path/UNC. The volume name
is invalid, CreateFile() function fails, and a cryptic (from the end user
perspective) error is reported. Like this

[ERROR] InnoDB: File \\.\\\workpc\work: 'CreateFile()' returned OS error 203.

The fix is not to report error if open volume failed, and the path was not
on fixed disk, i.e not on HDD or SSD. This is not a fatal error, there is
a fallback anyway.
---
 storage/innobase/os/os0file.cc | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 1eb3c4f202d..95c31523325 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -7676,9 +7676,14 @@ void fil_node_t::find_metadata(os_file_t file
 		on_ssd = win32_is_ssd(volume_handle);
 		CloseHandle(volume_handle);
 	} else {
-		if (GetLastError() != ERROR_ACCESS_DENIED) {
-			os_file_handle_error_no_exit(volume,
-				"CreateFile()", FALSE);
+		/*
+		Report error, unless it is expected, e.g
+		missing permissions, or error when trying to
+		open volume for UNC share.
+		*/
+		if (GetLastError() != ERROR_ACCESS_DENIED
+		    && GetDriveType(volume) == DRIVE_FIXED) {
+			    os_file_handle_error_no_exit(volume, "CreateFile()", FALSE);
 		}
 	}
 
-- 
cgit v1.2.1


From e0f9540bcc6ab1618b6fd475f02e019401c4c295 Mon Sep 17 00:00:00 2001
From: Alexander Barkov 
Date: Wed, 11 Dec 2019 15:09:17 +0400
Subject: MDEV-20667 Server crash on pop_cursor

When backpatching a forward GOTO label, the old code erroneously
used CURSOR/HANDLER difference between context frames "c" and "a" to tune
a cpop/hpop command. So the cpop/hpop command later tried to pop
all cursors/handlers declared between "a" and "c", but those between
"b" and "c" were not cpushed/hpoped yet during the execution of "GOTO x".

Fixing the code to use the difference between frames "b" and "a" only.

BEGIN     -- a
 ...
GOTO x;   -- b
 ...
<>     -- c
 ...
END       -- d
---
 .../suite/compat/oracle/r/sp-goto-debug.result     | 236 +++++++++++++++++++++
 mysql-test/suite/compat/oracle/r/sp-goto.result    |  79 +++++++
 .../suite/compat/oracle/t/sp-goto-debug.test       | 178 ++++++++++++++++
 mysql-test/suite/compat/oracle/t/sp-goto.test      |  98 ++++++++-
 sql/sp_head.cc                                     |   6 +-
 5 files changed, 594 insertions(+), 3 deletions(-)
 create mode 100644 mysql-test/suite/compat/oracle/r/sp-goto-debug.result
 create mode 100644 mysql-test/suite/compat/oracle/t/sp-goto-debug.test

diff --git a/mysql-test/suite/compat/oracle/r/sp-goto-debug.result b/mysql-test/suite/compat/oracle/r/sp-goto-debug.result
new file mode 100644
index 00000000000..3660bfa2d84
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/r/sp-goto-debug.result
@@ -0,0 +1,236 @@
+SET sql_mode=ORACLE;
+#
+# MDEV-20667 Server crash on pop_cursor
+#
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+IF 1=1 THEN
+GOTO iac_err;
+END IF;
+<< iac_err >>
+RETURN;
+END//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 5(5) 1 = 2
+1	cpush cur1@0
+2	jump 3
+3	cpop 1
+4	jump 7
+5	jump_if_not 7(7) 1 = 1
+6	jump 7
+7	preturn
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+IF 1=1 THEN
+GOTO iac_err;
+END IF;
+<< iac_err >>
+RETURN ;
+END//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 5(5) 1 = 2
+1	cpush cur1@0
+2	jump 3
+3	cpop 1
+4	jump 7
+5	jump_if_not 7(7) 1 = 1
+6	jump 7
+7	preturn
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+GOTO iac_err;
+<< iac_err >>
+RETURN ;
+END//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 5(5) 1 = 2
+1	cpush cur1@0
+2	jump 3
+3	cpop 1
+4	jump 5
+5	preturn
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=1 THEN
+DECLARE
+CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
+BEGIN
+SELECT 'cur2';
+IF 1=1 THEN
+DECLARE
+CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
+BEGIN
+SELECT 'cur3';
+IF 1=1 THEN
+DECLARE
+CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
+BEGIN
+SELECT 'cur4';
+GOTO ret;
+END;
+END IF;
+GOTO ret;
+END;
+END IF;
+GOTO ret;
+END;
+END IF;
+<>
+RETURN;
+END;
+//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 15(15) 1 = 1
+1	cpush cur2@0
+2	stmt 0 "SELECT 'cur2'"
+3	jump_if_not 13(13) 1 = 1
+4	cpush cur3@1
+5	stmt 0 "SELECT 'cur3'"
+6	jump_if_not 11(11) 1 = 1
+7	cpush cur4@2
+8	stmt 0 "SELECT 'cur4'"
+9	cpop 3
+10	jump 15
+11	cpop 2
+12	jump 15
+13	cpop 1
+14	jump 15
+15	preturn
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1(lab VARCHAR(32)) IS
+BEGIN
+IF 1=1 THEN
+DECLARE
+CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
+BEGIN
+IF 1=1 THEN
+DECLARE
+CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
+BEGIN
+IF 1=1 THEN
+DECLARE
+CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
+BEGIN
+IF lab = 'cur4' THEN
+SELECT 'goto from cur4' AS comment;
+GOTO ret;
+END IF;
+END;
+END IF;
+IF lab = 'cur3' THEN
+SELECT 'goto from cur3' AS comment;
+GOTO ret;
+END IF;
+END;
+END IF;
+IF lab = 'cur2' THEN
+SELECT 'goto from cur2' AS comment;
+GOTO ret;
+END IF;
+END;
+END IF;
+<>
+RETURN;
+END;
+//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 21(21) 1 = 1
+1	cpush cur2@0
+2	jump_if_not 16(16) 1 = 1
+3	cpush cur3@1
+4	jump_if_not 11(11) 1 = 1
+5	cpush cur4@2
+6	jump_if_not 10(10) lab@0 = 'cur4'
+7	stmt 0 "SELECT 'goto from cur4' AS comment"
+8	cpop 3
+9	jump 21
+10	cpop 1
+11	jump_if_not 15(15) lab@0 = 'cur3'
+12	stmt 0 "SELECT 'goto from cur3' AS comment"
+13	cpop 2
+14	jump 21
+15	cpop 1
+16	jump_if_not 20(20) lab@0 = 'cur2'
+17	stmt 0 "SELECT 'goto from cur2' AS comment"
+18	cpop 1
+19	jump 21
+20	cpop 1
+21	preturn
+CALL p1('');
+CALL p1('cur2');
+comment
+goto from cur2
+CALL p1('cur3');
+comment
+goto from cur3
+CALL p1('cur4');
+comment
+goto from cur4
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS 
+BEGIN 
+IF 1=2 THEN 
+BEGIN 
+DECLARE
+CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
+BEGIN
+GOTO iac_err;
+END; 
+END; 
+END IF; 
+IF 1=1 THEN
+GOTO iac_err;
+END IF; 
+<>
+RETURN; 
+END//
+SHOW PROCEDURE CODE p1;
+Pos	Instruction
+0	jump_if_not 9(9) 1 = 2
+1	hpush_jump 4 0 CONTINUE
+2	stmt 31 "SET @x2 = 1"
+3	hreturn 0
+4	hpop 1
+5	jump 11
+6	jump 11
+7	hpop 1
+8	jump 9
+9	jump_if_not 11(11) 1 = 1
+10	jump 11
+11	preturn
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/r/sp-goto.result b/mysql-test/suite/compat/oracle/r/sp-goto.result
index 259be7a34e6..badda507ee4 100644
--- a/mysql-test/suite/compat/oracle/r/sp-goto.result
+++ b/mysql-test/suite/compat/oracle/r/sp-goto.result
@@ -832,3 +832,82 @@ a
 15
 DROP TRIGGER trg1;
 DROP TABLE t1;
+#
+# MDEV-20667 Server crash on pop_cursor
+#
+CREATE TABLE t1 (a VARCHAR(6));
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+IF 1=1 THEN
+GOTO iac_err;
+END IF;
+<< iac_err >>
+RETURN;
+END//
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+IF 1=1 THEN
+GOTO iac_err;
+END IF;
+<< iac_err >>
+RETURN ;
+END//
+CALL p1;
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS
+BEGIN
+IF 1=2 THEN
+BEGIN
+DECLARE
+CURSOR cur1 IS SELECT a FROM t1 ;
+BEGIN
+GOTO iac_err;
+END;
+END;
+END IF;
+GOTO iac_err;
+<< iac_err >>
+RETURN ;
+END//
+CALL p1;
+DROP PROCEDURE p1;
+CREATE PROCEDURE p1() IS 
+BEGIN 
+IF 1=2 THEN 
+BEGIN 
+DECLARE
+CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
+BEGIN
+GOTO iac_err;
+END; 
+END; 
+END IF; 
+IF 1=1 THEN
+GOTO iac_err;
+END IF; 
+<>
+RETURN; 
+END//
+CALL p1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/t/sp-goto-debug.test b/mysql-test/suite/compat/oracle/t/sp-goto-debug.test
new file mode 100644
index 00000000000..0ded370b17a
--- /dev/null
+++ b/mysql-test/suite/compat/oracle/t/sp-goto-debug.test
@@ -0,0 +1,178 @@
+-- source include/have_debug.inc
+
+SET sql_mode=ORACLE;
+
+--echo #
+--echo # MDEV-20667 Server crash on pop_cursor
+--echo #
+
+DELIMITER  //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF;
+<< iac_err >>
+  RETURN;
+END//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF;
+<< iac_err >>
+  RETURN ;
+END//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  GOTO iac_err;
+<< iac_err >>
+  RETURN ;
+END//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=1 THEN
+    DECLARE
+      CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
+    BEGIN
+      SELECT 'cur2';
+      IF 1=1 THEN
+        DECLARE
+          CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
+        BEGIN
+          SELECT 'cur3';
+          IF 1=1 THEN
+            DECLARE
+              CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
+            BEGIN
+              SELECT 'cur4';
+              GOTO ret;
+            END;
+          END IF;
+          GOTO ret;
+        END;
+      END IF;
+      GOTO ret;
+    END;
+  END IF;
+<>
+  RETURN;
+END;
+//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1(lab VARCHAR(32)) IS
+BEGIN
+  IF 1=1 THEN
+    DECLARE
+      CURSOR cur2 IS SELECT 'cur2' FROM DUAL;
+    BEGIN
+      IF 1=1 THEN
+        DECLARE
+          CURSOR cur3 IS SELECT 'cur3' FROM DUAL;
+        BEGIN
+          IF 1=1 THEN
+            DECLARE
+              CURSOR cur4 IS SELECT 'cur4' FROM DUAL;
+            BEGIN
+              IF lab = 'cur4' THEN
+                SELECT 'goto from cur4' AS comment;
+                GOTO ret;
+              END IF;
+            END;
+          END IF;
+          IF lab = 'cur3' THEN
+            SELECT 'goto from cur3' AS comment;
+            GOTO ret;
+          END IF;
+        END;
+      END IF;
+      IF lab = 'cur2' THEN
+        SELECT 'goto from cur2' AS comment;
+        GOTO ret;
+      END IF;
+    END;
+  END IF;
+<>
+  RETURN;
+END;
+//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+CALL p1('');
+CALL p1('cur2');
+CALL p1('cur3');
+CALL p1('cur4');
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS 
+BEGIN 
+  IF 1=2 THEN 
+    BEGIN 
+      DECLARE
+        CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
+      BEGIN
+        GOTO iac_err;
+      END; 
+    END; 
+  END IF; 
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF; 
+<>
+  RETURN; 
+END//
+DELIMITER ;//
+SHOW PROCEDURE CODE p1;
+DROP PROCEDURE p1;
diff --git a/mysql-test/suite/compat/oracle/t/sp-goto.test b/mysql-test/suite/compat/oracle/t/sp-goto.test
index df7f1132666..9c15d10b3de 100644
--- a/mysql-test/suite/compat/oracle/t/sp-goto.test
+++ b/mysql-test/suite/compat/oracle/t/sp-goto.test
@@ -869,4 +869,100 @@ insert into t1 values (1);
 insert into t1 values (null);
 SELECT * FROM t1;
 DROP TRIGGER trg1;
-DROP TABLE t1;
\ No newline at end of file
+DROP TABLE t1;
+
+
+--echo #
+--echo # MDEV-20667 Server crash on pop_cursor
+--echo #
+
+CREATE TABLE t1 (a VARCHAR(6));
+DELIMITER  //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF;
+<< iac_err >>
+  RETURN;
+END//
+DELIMITER ;//
+CALL p1();
+DROP PROCEDURE p1;
+DROP TABLE t1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF;
+<< iac_err >>
+  RETURN ;
+END//
+DELIMITER ;//
+CALL p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS
+BEGIN
+  IF 1=2 THEN
+    BEGIN
+      DECLARE
+        CURSOR cur1 IS SELECT a FROM t1 ;
+      BEGIN
+        GOTO iac_err;
+      END;
+    END;
+  END IF;
+  GOTO iac_err;
+<< iac_err >>
+  RETURN ;
+END//
+DELIMITER ;//
+CALL p1;
+DROP PROCEDURE p1;
+
+
+DELIMITER //;
+CREATE PROCEDURE p1() IS 
+BEGIN 
+  IF 1=2 THEN 
+    BEGIN 
+      DECLARE
+        CONTINUE HANDLER FOR SQLSTATE '23000' SET @x2 = 1;
+      BEGIN
+        GOTO iac_err;
+      END; 
+    END; 
+  END IF; 
+  IF 1=1 THEN
+    GOTO iac_err;
+  END IF; 
+<>
+  RETURN; 
+END//
+DELIMITER ;//
+CALL p1;
+DROP PROCEDURE p1;
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index ab7faf51849..360713fc452 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -2571,7 +2571,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
       }
       if (bp->instr_type == CPOP)
       {
-        uint n= lab->ctx->diff_cursors(lab_begin_block->ctx, true);
+        uint n= bp->instr->m_ctx->diff_cursors(lab_begin_block->ctx, true);
         if (n == 0)
         {
           // Remove cpop instr
@@ -2588,7 +2588,7 @@ sp_head::backpatch_goto(THD *thd, sp_label *lab,sp_label *lab_begin_block)
       }
       if (bp->instr_type == HPOP)
       {
-        uint n= lab->ctx->diff_handlers(lab_begin_block->ctx, true);
+        uint n= bp->instr->m_ctx->diff_handlers(lab_begin_block->ctx, true);
         if (n == 0)
         {
           // Remove hpop instr
@@ -3082,6 +3082,8 @@ void sp_head::optimize()
   sp_instr *i;
   uint src, dst;
 
+  DBUG_EXECUTE_IF("sp_head_optimize_disable", return; );
+
   opt_mark();
 
   bp.empty();
-- 
cgit v1.2.1


From 014e1258309da2475b8ae36d445261f87422adaf Mon Sep 17 00:00:00 2001
From: Eugene Kosov 
Date: Thu, 12 Dec 2019 00:38:28 +0700
Subject: optimize crash recovery

recv_dblwr_t::list is used for appending to the beginning and iterating
through its elements. std::deque fits better for that purpose because
it does less allocations than std::forward_list and provides better memory
locality.
---
 storage/innobase/include/log0recv.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 5a687b5df08..85a4388b8a7 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -33,7 +33,7 @@ Created 9/20/1997 Heikki Tuuri
 #include "log0log.h"
 #include "mtr0types.h"
 
-#include 
+#include 
 
 /** Is recv_writer_thread active? */
 extern bool	recv_writer_thread_active;
@@ -173,7 +173,7 @@ struct recv_dblwr_t {
 	@retval NULL if no page was found */
 	const byte* find_page(ulint space_id, ulint page_no);
 
-	typedef std::forward_list > list;
+	typedef std::deque > list;
 
 	/** Recovered doublewrite buffer page frames */
 	list	pages;
-- 
cgit v1.2.1


From f0aa073f2bf3d8d85b3d028df89cdb4cdfc4002d Mon Sep 17 00:00:00 2001
From: Eugene Kosov 
Date: Mon, 4 Nov 2019 22:30:12 +0300
Subject: MDEV-20950 Reduce size of record offsets

offset_t: this is a type which represents one record offset.
It's unsigned short int.

a lot of functions: replace ulint with offset_t

btr_pcur_restore_position_func(),
page_validate(),
row_ins_scan_sec_index_for_duplicate(),
row_upd_clust_rec_by_insert_inherit_func(),
row_vers_impl_x_locked_low(),
trx_undo_prev_version_build():
  allocate record offsets on the stack instead of waiting for rec_get_offsets()
  to allocate it from mem_heap_t. So, reducing  memory allocations.

RECORD_OFFSET, INDEX_OFFSET:
  now it's less convenient to store pointers in offset_t*
  array. One pointer occupies now several offset_t. And those constant are start
  indexes into array to places where to store pointer values

REC_OFFS_HEADER_SIZE: adjusted for the new reality

REC_OFFS_NORMAL_SIZE:
  increase size from 100 to 300 which means less heap allocations.
  And sizeof(offset_t[REC_OFFS_NORMAL_SIZE]) now is 600 bytes which
  is smaller than previous 800 bytes.

REC_OFFS_SEC_INDEX_SIZE: adjusted for the new reality

rem0rec.h, rem0rec.ic, rem0rec.cc:
  various arguments, return values and local variables types were changed to
  fix numerous integer conversions issues.

enum field_type_t:
  offset types concept was introduces which replaces old offset flags stuff.
  Like in earlier version, 2 upper bits are used to store offset type.
  And this enum represents those types.

REC_OFFS_SQL_NULL, REC_OFFS_MASK: removed

get_type(), set_type(), get_value(), combine():
  these are convenience functions to work with offsets and it's types

rec_offs_base()[0]:
  still uses an old scheme with flags REC_OFFS_COMPACT and REC_OFFS_EXTERNAL

rec_offs_base()[i]:
  these have type offset_t now. Two upper bits contains type.
---
 storage/innobase/btr/btr0btr.cc           |  54 ++++++------
 storage/innobase/btr/btr0bulk.cc          |  14 +--
 storage/innobase/btr/btr0cur.cc           |  86 +++++++++----------
 storage/innobase/btr/btr0defragment.cc    |   4 +-
 storage/innobase/btr/btr0pcur.cc          |  17 ++--
 storage/innobase/btr/btr0scrub.cc         |   2 +-
 storage/innobase/btr/btr0sea.cc           |  22 ++---
 storage/innobase/dict/dict0stats.cc       |  55 ++++++------
 storage/innobase/fts/fts0fts.cc           |  12 +--
 storage/innobase/gis/gis0rtree.cc         |  54 ++++++------
 storage/innobase/gis/gis0sea.cc           |  32 +++----
 storage/innobase/handler/handler0alter.cc |   2 +-
 storage/innobase/ibuf/ibuf0ibuf.cc        |  10 +--
 storage/innobase/include/btr0btr.h        |   7 +-
 storage/innobase/include/btr0btr.ic       |   2 +-
 storage/innobase/include/btr0bulk.h       |   5 +-
 storage/innobase/include/btr0cur.h        |  25 +++---
 storage/innobase/include/dict0mem.h       |   4 -
 storage/innobase/include/gis0rtree.h      |  21 ++---
 storage/innobase/include/gis0rtree.ic     |   2 +-
 storage/innobase/include/handler0alter.h  |   4 +-
 storage/innobase/include/lock0lock.h      |  12 +--
 storage/innobase/include/lock0priv.h      |   3 +-
 storage/innobase/include/lock0priv.ic     |   2 +-
 storage/innobase/include/page0cur.h       |  15 ++--
 storage/innobase/include/page0cur.ic      |   4 +-
 storage/innobase/include/page0page.h      |   7 +-
 storage/innobase/include/page0page.ic     |   2 +-
 storage/innobase/include/page0types.h     |   3 +-
 storage/innobase/include/page0zip.h       |   9 +-
 storage/innobase/include/rem0cmp.h        |  24 +++---
 storage/innobase/include/rem0cmp.ic       |   4 +-
 storage/innobase/include/rem0rec.h        | 137 ++++++++++++++++++++----------
 storage/innobase/include/rem0rec.ic       | 108 ++++++++++-------------
 storage/innobase/include/rem0types.h      |   4 +
 storage/innobase/include/row0ftsort.h     |   3 +-
 storage/innobase/include/row0log.h        |   8 +-
 storage/innobase/include/row0merge.h      |   2 +-
 storage/innobase/include/row0row.h        |  18 ++--
 storage/innobase/include/row0row.ic       |   8 +-
 storage/innobase/include/row0upd.h        |  13 +--
 storage/innobase/include/row0upd.ic       |   2 +-
 storage/innobase/include/row0vers.h       |   6 +-
 storage/innobase/include/trx0rec.h        |   4 +-
 storage/innobase/lock/lock0lock.cc        |  38 ++++-----
 storage/innobase/page/page0cur.cc         |  50 +++++------
 storage/innobase/page/page0page.cc        |  42 ++++-----
 storage/innobase/page/page0zip.cc         |  38 ++++-----
 storage/innobase/rem/rem0cmp.cc           |  24 +++---
 storage/innobase/rem/rem0rec.cc           | 120 +++++++++++++-------------
 storage/innobase/row/row0ftsort.cc        |  18 ++--
 storage/innobase/row/row0import.cc        |  30 +++----
 storage/innobase/row/row0ins.cc           |  40 ++++-----
 storage/innobase/row/row0log.cc           |  48 +++++------
 storage/innobase/row/row0merge.cc         |  45 +++++-----
 storage/innobase/row/row0mysql.cc         |  10 +--
 storage/innobase/row/row0purge.cc         |   6 +-
 storage/innobase/row/row0row.cc           |  28 +++---
 storage/innobase/row/row0sel.cc           |  66 +++++++-------
 storage/innobase/row/row0uins.cc          |   2 +-
 storage/innobase/row/row0umod.cc          |   8 +-
 storage/innobase/row/row0undo.cc          |   4 +-
 storage/innobase/row/row0upd.cc           |  43 +++++-----
 storage/innobase/row/row0vers.cc          |  29 ++++---
 storage/innobase/trx/trx0i_s.cc           |   6 +-
 storage/innobase/trx/trx0rec.cc           |  10 ++-
 66 files changed, 792 insertions(+), 745 deletions(-)

diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index bb0b5c82f06..0a8ffe23cbb 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -777,7 +777,7 @@ btr_node_ptr_set_child_page_no(
 	rec_t*		rec,	/*!< in: node pointer record */
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page whose uncompressed
 				part will be updated, or NULL */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		page_no,/*!< in: child node address */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
@@ -812,7 +812,7 @@ btr_node_ptr_get_child(
 /*===================*/
 	const rec_t*	node_ptr,/*!< in: node pointer */
 	dict_index_t*	index,	/*!< in: index */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
 	ut_ad(rec_offs_validate(node_ptr, index, offsets));
@@ -830,10 +830,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
 an sx-latch on the tree.
 @return rec_get_offsets() of the node pointer record */
 static
-ulint*
+offset_t*
 btr_page_get_father_node_ptr_func(
 /*==============================*/
-	ulint*		offsets,/*!< in: work area for the return value */
+	offset_t*	offsets,/*!< in: work area for the return value */
 	mem_heap_t*	heap,	/*!< in: memory heap to use */
 	btr_cur_t*	cursor,	/*!< in: cursor pointing to user record,
 				out: cursor on node pointer record,
@@ -937,10 +937,10 @@ Returns the upper level node pointer to a page. It is assumed that mtr holds
 an x-latch on the tree.
 @return rec_get_offsets() of the node pointer record */
 static
-ulint*
+offset_t*
 btr_page_get_father_block(
 /*======================*/
-	ulint*		offsets,/*!< in: work area for the return value */
+	offset_t*	offsets,/*!< in: work area for the return value */
 	mem_heap_t*	heap,	/*!< in: memory heap to use */
 	dict_index_t*	index,	/*!< in: b-tree index */
 	buf_block_t*	block,	/*!< in: child page in the index */
@@ -1814,7 +1814,7 @@ btr_root_raise_and_insert(
 				on the root page; when the function returns,
 				the cursor is positioned on the predecessor
 				of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
@@ -2125,7 +2125,7 @@ btr_page_get_split_rec(
 	rec_t*		next_rec;
 	ulint		n;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	page = btr_cur_get_page(cursor);
 
@@ -2231,7 +2231,7 @@ btr_page_insert_fits(
 	const rec_t*	split_rec,/*!< in: suggestion for first record
 				on upper half-page, or NULL if
 				tuple to be inserted should be first */
-	ulint**		offsets,/*!< in: rec_get_offsets(
+	offset_t**	offsets,/*!< in: rec_get_offsets(
 				split_rec, cursor->index); out: garbage */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
@@ -2331,8 +2331,8 @@ btr_insert_on_non_leaf_level_func(
 	dberr_t		err;
 	rec_t*		rec;
 	mem_heap_t*	heap = NULL;
-	ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*          offsets         = offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets         = offsets_;
 	rec_offs_init(offsets_);
 	rtr_info_t	rtr_info;
 
@@ -2441,7 +2441,7 @@ btr_attach_half_pages(
 	if (direction == FSP_DOWN) {
 
 		btr_cur_t	cursor;
-		ulint*		offsets;
+		offset_t*	offsets;
 
 		lower_page = buf_block_get_frame(new_block);
 		lower_page_no = new_block->page.id.page_no();
@@ -2564,7 +2564,7 @@ btr_page_tuple_smaller(
 /*===================*/
 	btr_cur_t*	cursor,	/*!< in: b-tree cursor */
 	const dtuple_t*	tuple,	/*!< in: tuple to consider */
-	ulint**		offsets,/*!< in/out: temporary storage */
+	offset_t**	offsets,/*!< in/out: temporary storage */
 	ulint		n_uniq,	/*!< in: number of unique fields
 				in the index page records */
 	mem_heap_t**	heap)	/*!< in/out: heap for offsets */
@@ -2604,7 +2604,7 @@ rec_t*
 btr_insert_into_right_sibling(
 	ulint		flags,
 	btr_cur_t*	cursor,
-	ulint**		offsets,
+	offset_t**	offsets,
 	mem_heap_t*	heap,
 	const dtuple_t*	tuple,
 	ulint		n_ext,
@@ -2741,7 +2741,7 @@ btr_page_split_and_insert(
 	btr_cur_t*	cursor,	/*!< in: cursor at which to insert; when the
 				function returns, the cursor is positioned
 				on the predecessor of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
@@ -3302,7 +3302,7 @@ btr_lift_page_up(
 
 	{
 		btr_cur_t	cursor;
-		ulint*		offsets	= NULL;
+		offset_t*	offsets	= NULL;
 		mem_heap_t*	heap	= mem_heap_create(
 			sizeof(*offsets)
 			* (REC_OFFS_HEADER_SIZE + 1 + 1 + index->n_fields));
@@ -3487,7 +3487,7 @@ btr_compress(
 	page_t*		page;
 	btr_cur_t	father_cursor;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 	ulint		nth_rec = 0; /* remove bogus warning */
 	bool		mbr_changed = false;
 #ifdef UNIV_DEBUG
@@ -3631,7 +3631,7 @@ retry:
 	if (is_left) {
 		btr_cur_t	cursor2;
 		rtr_mbr_t	new_mbr;
-		ulint*		offsets2 = NULL;
+		offset_t*	offsets2 = NULL;
 
 		/* For rtree, we need to update father's mbr. */
 		if (dict_index_is_spatial(index)) {
@@ -3829,7 +3829,7 @@ retry:
 
 		/* For rtree, we need to update father's mbr. */
 		if (dict_index_is_spatial(index)) {
-			ulint*	offsets2;
+			offset_t* offsets2;
 			ulint	rec_info;
 
 			offsets2 = rec_get_offsets(
@@ -4276,7 +4276,7 @@ btr_print_recursive(
 	ulint		width,	/*!< in: print this many entries from start
 				and end */
 	mem_heap_t**	heap,	/*!< in/out: heap for rec_get_offsets() */
-	ulint**		offsets,/*!< in/out: buffer for rec_get_offsets() */
+	offset_t**	offsets,/*!< in/out: buffer for rec_get_offsets() */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
 	const page_t*	page	= buf_block_get_frame(block);
@@ -4340,8 +4340,8 @@ btr_print_index(
 	mtr_t		mtr;
 	buf_block_t*	root;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets	= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets	= offsets_;
 	rec_offs_init(offsets_);
 
 	fputs("--------------------------\n"
@@ -4375,7 +4375,7 @@ btr_check_node_ptr(
 {
 	mem_heap_t*	heap;
 	dtuple_t*	tuple;
-	ulint*		offsets;
+	offset_t*	offsets;
 	btr_cur_t	cursor;
 	page_t*		page = buf_block_get_frame(block);
 
@@ -4457,8 +4457,8 @@ btr_index_rec_validate(
 	ulint		i;
 	const page_t*	page;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets	= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets	= offsets_;
 	rec_offs_init(offsets_);
 
 	page = page_align(rec);
@@ -4691,8 +4691,8 @@ btr_validate_level(
 	bool		ret	= true;
 	mtr_t		mtr;
 	mem_heap_t*	heap	= mem_heap_create(256);
-	ulint*		offsets	= NULL;
-	ulint*		offsets2= NULL;
+	offset_t*	offsets	= NULL;
+	offset_t*	offsets2= NULL;
 #ifdef UNIV_ZIP_DEBUG
 	page_zip_des_t*	page_zip;
 #endif /* UNIV_ZIP_DEBUG */
diff --git a/storage/innobase/btr/btr0bulk.cc b/storage/innobase/btr/btr0bulk.cc
index 262709bc679..de45bd4ca6c 100644
--- a/storage/innobase/btr/btr0bulk.cc
+++ b/storage/innobase/btr/btr0bulk.cc
@@ -178,7 +178,7 @@ PageBulk::init()
 void
 PageBulk::insert(
 	const rec_t*		rec,
-	ulint*			offsets)
+	offset_t*		offsets)
 {
 	ulint		rec_size;
 
@@ -190,7 +190,7 @@ PageBulk::insert(
 	/* Check whether records are in order. */
 	if (!page_rec_is_infimum(m_cur_rec)) {
 		rec_t*	old_rec = m_cur_rec;
-		ulint*	old_offsets = rec_get_offsets(
+		offset_t* old_offsets = rec_get_offsets(
 			old_rec, m_index, NULL,	page_rec_is_leaf(old_rec),
 			ULINT_UNDEFINED, &m_heap);
 
@@ -402,7 +402,7 @@ rec_t*
 PageBulk::getSplitRec()
 {
 	rec_t*		rec;
-	ulint*		offsets;
+	offset_t*	offsets;
 	ulint		total_used_size;
 	ulint		total_recs_size;
 	ulint		n_recs;
@@ -448,7 +448,7 @@ PageBulk::copyIn(
 {
 
 	rec_t*		rec = split_rec;
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 
 	ut_ad(m_rec_no == 0);
 	ut_ad(page_rec_is_user_rec(rec));
@@ -494,7 +494,7 @@ PageBulk::copyOut(
 	ut_ad(n > 0);
 
 	/* Set last record's next in page */
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 	rec = page_rec_get_prev(split_rec);
 	offsets = rec_get_offsets(rec, m_index, offsets,
 				  page_rec_is_leaf(split_rec),
@@ -604,7 +604,7 @@ the blob data is logged first, then the record is logged in bulk mode.
 dberr_t
 PageBulk::storeExt(
 	const big_rec_t*	big_rec,
-	ulint*			offsets)
+	offset_t*		offsets)
 {
 	/* Note: not all fileds are initialized in btr_pcur. */
 	btr_pcur_t	btr_pcur;
@@ -864,7 +864,7 @@ BtrBulk::insert(
 	ulint		rec_size = rec_get_converted_size(m_index, tuple, n_ext);
 	big_rec_t*	big_rec = NULL;
 	rec_t*		rec = NULL;
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 
 	if (page_bulk->needExt(tuple, rec_size)) {
 		/* The record is so big that we have to store some fields
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index 51552dcc513..06094eb65b3 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -162,7 +162,7 @@ btr_cur_unmark_extern_fields(
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	mtr_t*		mtr);	/*!< in: mtr, or NULL if not logged */
 /*******************************************************************//**
 Adds path information to the cursor for the current page, for which
@@ -187,7 +187,7 @@ btr_rec_free_updated_extern_fields(
 	rec_t*		rec,	/*!< in: record */
 	page_zip_des_t*	page_zip,/*!< in: compressed page whose uncompressed
 				part will be updated, or NULL */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	const upd_t*	update,	/*!< in: update vector */
 	bool		rollback,/*!< in: performing rollback? */
 	mtr_t*		mtr);	/*!< in: mini-transaction handle which contains
@@ -201,7 +201,7 @@ btr_rec_free_externally_stored_fields(
 	dict_index_t*	index,	/*!< in: index of the data, the index
 				tree MUST be X-latched */
 	rec_t*		rec,	/*!< in: record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	page_zip_des_t*	page_zip,/*!< in: compressed page whose uncompressed
 				part will be updated, or NULL */
 	bool		rollback,/*!< in: performing rollback? */
@@ -923,10 +923,10 @@ btr_cur_search_to_nth_level(
 	btr_search_t*	info;
 #endif /* BTR_CUR_ADAPT */
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
-	ulint		offsets2_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets2	= offsets2_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
+	offset_t	offsets2_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets2	= offsets2_;
 	rec_offs_init(offsets_);
 	rec_offs_init(offsets2_);
 	/* Currently, PAGE_CUR_LE is the only search mode used for searches
@@ -2178,8 +2178,8 @@ btr_cur_open_at_index_side_func(
 	ulint		n_blocks = 0;
 	ulint		n_releases = 0;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	dberr_t		err = DB_SUCCESS;
 
 	rec_offs_init(offsets_);
@@ -2548,8 +2548,8 @@ btr_cur_open_at_rnd_pos_func(
 	ulint		n_blocks = 0;
 	ulint		n_releases = 0;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(!dict_index_is_spatial(index));
@@ -2839,7 +2839,7 @@ btr_cur_insert_if_possible(
 				cursor stays valid */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert; the size info need not
 				have been stored to tuple */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
 	mtr_t*		mtr)	/*!< in/out: mini-transaction */
@@ -3005,7 +3005,7 @@ btr_cur_optimistic_insert(
 				specified */
 	btr_cur_t*	cursor,	/*!< in: cursor on page after which to insert;
 				cursor stays valid */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap */
 	dtuple_t*	entry,	/*!< in/out: entry to insert */
 	rec_t**		rec,	/*!< out: pointer to inserted record if
@@ -3294,7 +3294,7 @@ btr_cur_pessimistic_insert(
 				insertion will certainly succeed */
 	btr_cur_t*	cursor,	/*!< in: cursor after which to insert;
 				cursor stays valid */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap
 				that can be emptied */
 	dtuple_t*	entry,	/*!< in/out: entry to insert */
@@ -3460,7 +3460,7 @@ btr_cur_upd_lock_and_undo(
 /*======================*/
 	ulint		flags,	/*!< in: undo logging and locking flags */
 	btr_cur_t*	cursor,	/*!< in: cursor on record to update */
-	const ulint*	offsets,/*!< in: rec_get_offsets() on cursor */
+	const offset_t*	offsets,/*!< in: rec_get_offsets() on cursor */
 	const upd_t*	update,	/*!< in: update vector */
 	ulint		cmpl_info,/*!< in: compiler info on secondary index
 				updates */
@@ -3591,7 +3591,7 @@ btr_cur_parse_update_in_place(
 	roll_ptr_t	roll_ptr;
 	ulint		rec_offset;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	if (end_ptr < ptr + 1) {
 
@@ -3676,7 +3676,7 @@ btr_cur_update_alloc_zip_func(
 	page_cur_t*	cursor,	/*!< in/out: B-tree page cursor */
 	dict_index_t*	index,	/*!< in: the index corresponding to cursor */
 #ifdef UNIV_DEBUG
-	ulint*		offsets,/*!< in/out: offsets of the cursor record */
+	offset_t*	offsets,/*!< in/out: offsets of the cursor record */
 #endif /* UNIV_DEBUG */
 	ulint		length,	/*!< in: size needed */
 	bool		create,	/*!< in: true=delete-and-insert,
@@ -3757,7 +3757,7 @@ btr_cur_update_in_place(
 	btr_cur_t*	cursor,	/*!< in: cursor on the record to update;
 				cursor stays valid and positioned on the
 				same record */
-	ulint*		offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+	offset_t*	offsets,/*!< in/out: offsets on cursor->page_cur.rec */
 	const upd_t*	update,	/*!< in: update vector */
 	ulint		cmpl_info,/*!< in: compiler info on secondary index
 				updates */
@@ -3922,7 +3922,7 @@ btr_cur_optimistic_update(
 	btr_cur_t*	cursor,	/*!< in: cursor on the record to update;
 				cursor stays valid and positioned on the
 				same record */
-	ulint**		offsets,/*!< out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< out: offsets on cursor->page_cur.rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to NULL or memory heap */
 	const upd_t*	update,	/*!< in: update vector; this must also
 				contain trx id and roll ptr fields */
@@ -4240,7 +4240,7 @@ btr_cur_pessimistic_update(
 	btr_cur_t*	cursor,	/*!< in/out: cursor on the record to update;
 				cursor may become invalid if *big_rec == NULL
 				|| !(flags & BTR_KEEP_POS_FLAG) */
-	ulint**		offsets,/*!< out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< out: offsets on cursor->page_cur.rec */
 	mem_heap_t**	offsets_heap,
 				/*!< in/out: pointer to memory heap
 				that can be emptied */
@@ -4762,7 +4762,7 @@ btr_cur_parse_del_mark_set_clust_rec(
 		clustered index fields. */
 		ut_ad(pos <= MAX_REF_PARTS);
 
-		ulint offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
+		offset_t offsets[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
 		rec_offs_init(offsets);
 		mem_heap_t*	heap	= NULL;
 
@@ -4805,7 +4805,7 @@ btr_cur_del_mark_set_clust_rec(
 	buf_block_t*	block,	/*!< in/out: buffer block of the record */
 	rec_t*		rec,	/*!< in/out: record */
 	dict_index_t*	index,	/*!< in: clustered index of the record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec) */
 	que_thr_t*	thr,	/*!< in: query thread */
 	const dtuple_t*	entry,	/*!< in: dtuple for the deleting record, also
 				contains the virtual cols if there are any */
@@ -5092,8 +5092,8 @@ btr_cur_optimistic_delete_func(
 	buf_block_t*	block;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	ibool		no_compress_needed;
 	rec_offs_init(offsets_);
 
@@ -5213,7 +5213,7 @@ btr_cur_pessimistic_delete(
 	bool		success;
 	ibool		ret		= FALSE;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 #ifdef UNIV_DEBUG
 	bool		parent_latched	= false;
 #endif /* UNIV_DEBUG */
@@ -5312,7 +5312,7 @@ btr_cur_pessimistic_delete(
 			rtr_mbr_t	father_mbr;
 			rec_t*		father_rec;
 			btr_cur_t	father_cursor;
-			ulint*		offsets;
+			offset_t*	offsets;
 			bool		upd_ret;
 			ulint		len;
 
@@ -6073,7 +6073,7 @@ btr_record_not_null_field_in_rec(
 	ulint		n_unique,	/*!< in: dict_index_get_n_unique(index),
 					number of columns uniquely determine
 					an index entry */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index),
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index),
 					its size could be for all fields or
 					that of "n_unique" */
 	ib_uint64_t*	n_not_null)	/*!< in/out: array to record number of
@@ -6127,8 +6127,8 @@ btr_estimate_number_of_different_key_vals(
 	uintmax_t	add_on;
 	mtr_t		mtr;
 	mem_heap_t*	heap		= NULL;
-	ulint*		offsets_rec	= NULL;
-	ulint*		offsets_next_rec = NULL;
+	offset_t*	offsets_rec	= NULL;
+	offset_t*	offsets_next_rec = NULL;
 
 	/* For spatial index, there is no such stats can be
 	fetched. */
@@ -6316,7 +6316,7 @@ btr_estimate_number_of_different_key_vals(
 			and assign the old offsets_rec buffer to
 			offsets_next_rec. */
 			{
-				ulint*	offsets_tmp = offsets_rec;
+				offset_t* offsets_tmp = offsets_rec;
 				offsets_rec = offsets_next_rec;
 				offsets_next_rec = offsets_tmp;
 			}
@@ -6401,7 +6401,7 @@ static
 ulint
 btr_rec_get_field_ref_offs(
 /*=======================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: index of the external field */
 {
 	ulint	field_ref_offs;
@@ -6430,7 +6430,7 @@ btr_rec_get_field_ref_offs(
 ulint
 btr_rec_get_externally_stored_len(
 	const rec_t*	rec,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	ulint	n_fields;
 	ulint	total_extern_len = 0;
@@ -6469,7 +6469,7 @@ btr_cur_set_ownership_of_extern_field(
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: clustered index record */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		i,	/*!< in: field number */
 	ibool		val,	/*!< in: value to set */
 	mtr_t*		mtr)	/*!< in: mtr, or NULL if not logged */
@@ -6519,7 +6519,7 @@ btr_cur_disown_inherited_fields(
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	const upd_t*	update,	/*!< in: update vector */
 	mtr_t*		mtr)	/*!< in/out: mini-transaction */
 {
@@ -6550,7 +6550,7 @@ btr_cur_unmark_extern_fields(
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	mtr_t*		mtr)	/*!< in: mtr, or NULL if not logged */
 {
 	ulint	n;
@@ -6724,7 +6724,7 @@ struct btr_blob_log_check_t {
 	/** Mini transaction holding the latches for m_pcur */
 	mtr_t*		m_mtr;
 	/** rec_get_offsets(rec, index); offset of clust_rec */
-	const ulint*	m_offsets;
+	const offset_t*	m_offsets;
 	/** The block containing clustered record */
 	buf_block_t**	m_block;
 	/** The clustered record pointer */
@@ -6744,7 +6744,7 @@ struct btr_blob_log_check_t {
 	btr_blob_log_check_t(
 		btr_pcur_t*	pcur,
 		mtr_t*		mtr,
-		const ulint*	offsets,
+		const offset_t*	offsets,
 		buf_block_t**	block,
 		rec_t**		rec,
 		enum blob_op	op)
@@ -6818,7 +6818,7 @@ struct btr_blob_log_check_t {
 		*m_rec		= btr_pcur_get_rec(m_pcur);
 
 		ut_d(rec_offs_make_valid(
-			*m_rec, index, const_cast(m_offsets)));
+			*m_rec, index, const_cast(m_offsets)));
 
 		ut_ad(m_mtr->memo_contains_page_flagged(
 		      *m_rec,
@@ -6849,7 +6849,7 @@ btr_store_big_rec_extern_fields(
 	btr_pcur_t*	pcur,		/*!< in/out: a persistent cursor. if
 					btr_mtr is restarted, then this can
 					be repositioned. */
-	ulint*		offsets,	/*!< in/out: rec_get_offsets() on
+	offset_t*	offsets,	/*!< in/out: rec_get_offsets() on
 					pcur. the "external storage" flags
 					in offsets will correctly correspond
 					to rec when this function returns */
@@ -7361,7 +7361,7 @@ btr_free_externally_stored_field(
 	byte*		field_ref,	/*!< in/out: field reference */
 	const rec_t*	rec,		/*!< in: record containing field_ref, for
 					page_zip_write_blob_ptr(), or NULL */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index),
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index),
 					or NULL */
 	page_zip_des_t*	page_zip,	/*!< in: compressed page corresponding
 					to rec, or NULL if rec == NULL */
@@ -7534,7 +7534,7 @@ btr_rec_free_externally_stored_fields(
 	dict_index_t*	index,	/*!< in: index of the data, the index
 				tree MUST be X-latched */
 	rec_t*		rec,	/*!< in/out: record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	page_zip_des_t*	page_zip,/*!< in: compressed page whose uncompressed
 				part will be updated, or NULL */
 	bool		rollback,/*!< in: performing rollback? */
@@ -7575,7 +7575,7 @@ btr_rec_free_updated_extern_fields(
 	rec_t*		rec,	/*!< in/out: record */
 	page_zip_des_t*	page_zip,/*!< in: compressed page whose uncompressed
 				part will be updated, or NULL */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	const upd_t*	update,	/*!< in: update vector */
 	bool		rollback,/*!< in: performing rollback? */
 	mtr_t*		mtr)	/*!< in: mini-transaction handle which contains
@@ -7973,7 +7973,7 @@ protected by a lock or a page latch
 byte*
 btr_rec_copy_externally_stored_field(
 	const rec_t*		rec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	const page_size_t&	page_size,
 	ulint			no,
 	ulint*			len,
diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc
index 4646b3252a7..545989fa867 100644
--- a/storage/innobase/btr/btr0defragment.cc
+++ b/storage/innobase/btr/btr0defragment.cc
@@ -338,8 +338,8 @@ btr_defragment_calc_n_recs_for_size(
 {
 	page_t* page = buf_block_get_frame(block);
 	ulint n_recs = 0;
-	ulint offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint* offsets = offsets_;
+	offset_t offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t* offsets = offsets_;
 	rec_offs_init(offsets_);
 	mem_heap_t* heap = NULL;
 	ulint size = 0;
diff --git a/storage/innobase/btr/btr0pcur.cc b/storage/innobase/btr/btr0pcur.cc
index cb5e18457f2..25a39e9646b 100644
--- a/storage/innobase/btr/btr0pcur.cc
+++ b/storage/innobase/btr/btr0pcur.cc
@@ -293,16 +293,21 @@ btr_pcur_restore_position_func(
 			if (cursor->rel_pos == BTR_PCUR_ON) {
 #ifdef UNIV_DEBUG
 				const rec_t*	rec;
-				const ulint*	offsets1;
-				const ulint*	offsets2;
+				offset_t	offsets1_[REC_OFFS_NORMAL_SIZE];
+				offset_t	offsets2_[REC_OFFS_NORMAL_SIZE];
+				offset_t*	offsets1 = offsets1_;
+				offset_t*	offsets2 = offsets2_;
 				rec = btr_pcur_get_rec(cursor);
 
+				rec_offs_init(offsets1_);
+				rec_offs_init(offsets2_);
+
 				heap = mem_heap_create(256);
 				offsets1 = rec_get_offsets(
-					cursor->old_rec, index, NULL, true,
+					cursor->old_rec, index, offsets1, true,
 					cursor->old_n_fields, &heap);
 				offsets2 = rec_get_offsets(
-					rec, index, NULL, true,
+					rec, index, offsets2, true,
 					cursor->old_n_fields, &heap);
 
 				ut_ad(!cmp_rec_rec(cursor->old_rec,
@@ -357,11 +362,13 @@ btr_pcur_restore_position_func(
 	ut_ad(cursor->rel_pos == BTR_PCUR_ON
 	      || cursor->rel_pos == BTR_PCUR_BEFORE
 	      || cursor->rel_pos == BTR_PCUR_AFTER);
+	offset_t offsets[REC_OFFS_NORMAL_SIZE];
+	rec_offs_init(offsets);
 	if (cursor->rel_pos == BTR_PCUR_ON
 	    && btr_pcur_is_on_user_rec(cursor)
 	    && !cmp_dtuple_rec(tuple, btr_pcur_get_rec(cursor),
 			       rec_get_offsets(btr_pcur_get_rec(cursor),
-					       index, NULL, true,
+					       index, offsets, true,
 					       ULINT_UNDEFINED, &heap))) {
 
 		/* We have to store the NEW value for the modify clock,
diff --git a/storage/innobase/btr/btr0scrub.cc b/storage/innobase/btr/btr0scrub.cc
index 955a5bc0800..6170ab5188b 100644
--- a/storage/innobase/btr/btr0scrub.cc
+++ b/storage/innobase/btr/btr0scrub.cc
@@ -481,7 +481,7 @@ btr_pessimistic_scrub(
 	/* arguments to btr_page_split_and_insert */
 	mem_heap_t* heap = NULL;
 	dtuple_t* entry = NULL;
-	ulint* offsets = NULL;
+	offset_t* offsets = NULL;
 	ulint n_ext = 0;
 	ulint flags = BTR_MODIFY_TREE;
 
diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc
index 725190e7fee..713540ecf81 100644
--- a/storage/innobase/btr/btr0sea.cc
+++ b/storage/innobase/btr/btr0sea.cc
@@ -629,7 +629,7 @@ btr_search_update_hash_ref(
 	    && (block->curr_n_bytes == info->n_bytes)
 	    && (block->curr_left_side == info->left_side)) {
 		mem_heap_t*	heap		= NULL;
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+		offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
 		rec_offs_init(offsets_);
 
 		rec = btr_cur_get_rec(cursor);
@@ -740,8 +740,8 @@ btr_search_check_guess(
 	ulint		match;
 	int		cmp;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	ibool		success		= FALSE;
 	rec_offs_init(offsets_);
 
@@ -1116,7 +1116,7 @@ btr_search_drop_page_hash_index(buf_block_t* block)
 	ulint			i;
 	mem_heap_t*		heap;
 	const dict_index_t*	index;
-	ulint*			offsets;
+	offset_t*		offsets;
 	rw_lock_t*		latch;
 	btr_search_t*		info;
 
@@ -1370,8 +1370,8 @@ btr_search_build_page_hash_index(
 	rec_t**		recs;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 
 #ifdef MYSQL_INDEX_DISABLE_AHI
 	if (index->disable_ahi) return;
@@ -1619,7 +1619,7 @@ btr_search_update_hash_on_delete(btr_cur_t* cursor)
 	const rec_t*	rec;
 	ulint		fold;
 	dict_index_t*	index;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
 	mem_heap_t*	heap		= NULL;
 	rec_offs_init(offsets_);
 
@@ -1768,8 +1768,8 @@ btr_search_update_hash_on_insert(btr_cur_t* cursor)
 	ibool		left_side;
 	ibool		locked		= FALSE;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(page_is_leaf(btr_cur_get_page(cursor)));
@@ -1930,8 +1930,8 @@ btr_search_hash_table_validate(ulint hash_table_id)
 	ulint		i;
 	ulint		cell_count;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 
 	if (!btr_search_enabled) {
 		return(TRUE);
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index c9e3929cf1d..f3cd26f5527 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -1018,8 +1018,8 @@ dict_stats_analyze_index_level(
 	bool		prev_rec_is_copied;
 	byte*		prev_rec_buf = NULL;
 	ulint		prev_rec_buf_size = 0;
-	ulint*		rec_offsets;
-	ulint*		prev_rec_offsets;
+	offset_t*	rec_offsets;
+	offset_t*	prev_rec_offsets;
 	ulint		i;
 
 	DEBUG_PRINTF("    %s(table=%s, index=%s, level=" ULINTPF ")\n",
@@ -1040,9 +1040,9 @@ dict_stats_analyze_index_level(
 	i = (REC_OFFS_HEADER_SIZE + 1 + 1) + index->n_fields;
 
 	heap = mem_heap_create((2 * sizeof *rec_offsets) * i);
-	rec_offsets = static_cast(
+	rec_offsets = static_cast(
 		mem_heap_alloc(heap, i * sizeof *rec_offsets));
-	prev_rec_offsets = static_cast(
+	prev_rec_offsets = static_cast(
 		mem_heap_alloc(heap, i * sizeof *prev_rec_offsets));
 	rec_offs_set_n_alloc(rec_offsets, i);
 	rec_offs_set_n_alloc(prev_rec_offsets, i);
@@ -1328,11 +1328,11 @@ to the number of externally stored pages which were encountered
 @return offsets1 or offsets2 (the offsets of *out_rec),
 or NULL if the page is empty and does not contain user records. */
 UNIV_INLINE
-ulint*
+offset_t*
 dict_stats_scan_page(
 	const rec_t**		out_rec,
-	ulint*			offsets1,
-	ulint*			offsets2,
+	offset_t*		offsets1,
+	offset_t*		offsets2,
 	const dict_index_t*	index,
 	const page_t*		page,
 	ulint			n_prefix,
@@ -1340,8 +1340,8 @@ dict_stats_scan_page(
 	ib_uint64_t*		n_diff,
 	ib_uint64_t*		n_external_pages)
 {
-	ulint*		offsets_rec		= offsets1;
-	ulint*		offsets_next_rec	= offsets2;
+	offset_t*	offsets_rec		= offsets1;
+	offset_t*	offsets_next_rec	= offsets2;
 	const rec_t*	rec;
 	const rec_t*	next_rec;
 	/* A dummy heap, to be passed to rec_get_offsets().
@@ -1407,23 +1407,16 @@ dict_stats_scan_page(
 		}
 
 		rec = next_rec;
-		{
-			/* Assign offsets_rec = offsets_next_rec
-			so that offsets_rec matches with rec which
-			was just assigned rec = next_rec above.
-			Also need to point offsets_next_rec to the
-			place where offsets_rec was pointing before
-			because we have just 2 placeholders where
-			data is actually stored:
-			offsets1 and offsets2 and we
-			are using them in circular fashion
-			(offsets[_next]_rec are just pointers to
-			those placeholders). */
-			ulint*	offsets_tmp;
-			offsets_tmp = offsets_rec;
-			offsets_rec = offsets_next_rec;
-			offsets_next_rec = offsets_tmp;
-		}
+		/* Assign offsets_rec = offsets_next_rec so that
+		offsets_rec matches with rec which was just assigned
+		rec = next_rec above.  Also need to point
+		offsets_next_rec to the place where offsets_rec was
+		pointing before because we have just 2 placeholders
+		where data is actually stored: offsets1 and offsets2
+		and we are using them in circular fashion
+		(offsets[_next]_rec are just pointers to those
+		placeholders). */
+		std::swap(offsets_rec, offsets_next_rec);
 
 		if (should_count_external_pages) {
 			*n_external_pages += btr_rec_get_externally_stored_len(
@@ -1462,9 +1455,9 @@ dict_stats_analyze_index_below_cur(
 	const page_t*	page;
 	mem_heap_t*	heap;
 	const rec_t*	rec;
-	ulint*		offsets1;
-	ulint*		offsets2;
-	ulint*		offsets_rec;
+	offset_t*	offsets1;
+	offset_t*	offsets2;
+	offset_t*	offsets_rec;
 	ulint		size;
 	mtr_t		mtr;
 
@@ -1482,10 +1475,10 @@ dict_stats_analyze_index_below_cur(
 
 	heap = mem_heap_create(size * (sizeof *offsets1 + sizeof *offsets2));
 
-	offsets1 = static_cast(mem_heap_alloc(
+	offsets1 = static_cast(mem_heap_alloc(
 			heap, size * sizeof *offsets1));
 
-	offsets2 = static_cast(mem_heap_alloc(
+	offsets2 = static_cast(mem_heap_alloc(
 			heap, size * sizeof *offsets2));
 
 	rec_offs_set_n_alloc(offsets1, size);
diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc
index 458f4277988..330424e4ab7 100644
--- a/storage/innobase/fts/fts0fts.cc
+++ b/storage/innobase/fts/fts0fts.cc
@@ -3229,7 +3229,7 @@ fts_fetch_doc_from_rec(
 	dict_index_t*	clust_index,	/*!< in: cluster index */
 	btr_pcur_t*	pcur,		/*!< in: cursor whose position
 					has been stored */
-	ulint*		offsets,	/*!< in: offsets */
+	offset_t*	offsets,	/*!< in: offsets */
 	fts_doc_t*	doc)		/*!< out: fts doc to hold parsed
 					documents */
 {
@@ -3511,7 +3511,7 @@ fts_add_doc_by_id(
 		btr_pcur_t*	doc_pcur;
 		const rec_t*	clust_rec;
 		btr_pcur_t	clust_pcur;
-		ulint*		offsets = NULL;
+		offset_t*	offsets = NULL;
 		ulint		num_idx = ib_vector_size(cache->get_docs);
 
 		rec = btr_pcur_get_rec(&pcur);
@@ -3700,8 +3700,8 @@ fts_get_max_doc_id(
 
 	if (!page_is_empty(btr_pcur_get_page(&pcur))) {
 		const rec_t*    rec = NULL;
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-		ulint*		offsets = offsets_;
+		offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+		offset_t*	offsets = offsets_;
 		mem_heap_t*	heap = NULL;
 		ulint		len;
 		const void*	data;
@@ -5208,8 +5208,8 @@ fts_get_doc_id_from_rec(
 	const byte*	data;
 	ulint		col_no;
 	doc_id_t	doc_id = 0;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets = offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets = offsets_;
 	mem_heap_t*	my_heap = heap;
 
 	ut_a(table->fts->doc_col != ULINT_UNDEFINED);
diff --git a/storage/innobase/gis/gis0rtree.cc b/storage/innobase/gis/gis0rtree.cc
index ce1749820c3..8e602d127cf 100644
--- a/storage/innobase/gis/gis0rtree.cc
+++ b/storage/innobase/gis/gis0rtree.cc
@@ -50,7 +50,7 @@ rtr_page_split_initialize_nodes(
 	btr_cur_t*	cursor,	/*!< in: cursor at which to insert; when the
 				function returns, the cursor is positioned
 				on the predecessor of the inserted record */
-	ulint**		offsets,/*!< in: offsets on inserted record */
+	offset_t**	offsets,/*!< in: offsets on inserted record */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	double**	buf_pos)/*!< in/out: current buffer position */
 {
@@ -193,7 +193,7 @@ rtr_update_mbr_field_in_place(
 /*==========================*/
 	dict_index_t*	index,		/*!< in: spatial index. */
 	rec_t*		rec,		/*!< in/out: rec to be modified.*/
-	ulint*		offsets,	/*!< in/out: offsets on rec. */
+	offset_t*	offsets,	/*!< in/out: offsets on rec. */
 	rtr_mbr_t*	mbr,		/*!< in: the new mbr. */
 	mtr_t*		mtr)		/*!< in: mtr */
 {
@@ -267,7 +267,7 @@ bool
 rtr_update_mbr_field(
 /*=================*/
 	btr_cur_t*	cursor,		/*!< in/out: cursor pointed to rec.*/
-	ulint*		offsets,	/*!< in/out: offsets on rec. */
+	offset_t*	offsets,	/*!< in/out: offsets on rec. */
 	btr_cur_t*	cursor2,	/*!< in/out: cursor pointed to rec
 					that should be deleted.
 					this cursor is for btr_compress to
@@ -297,7 +297,7 @@ rtr_update_mbr_field(
 	bool		ins_suc = true;
 	ulint		cur2_pos = 0;
 	ulint		del_page_no = 0;
-	ulint*		offsets2;
+	offset_t*	offsets2;
 
 	rec = btr_cur_get_rec(cursor);
 	page = page_align(rec);
@@ -384,7 +384,7 @@ rtr_update_mbr_field(
 		}
 
 		if (cursor2) {
-			ulint* offsets2;
+			offset_t* offsets2;
 
 			if (page_zip) {
 				cursor2->page_cur.rec
@@ -406,7 +406,7 @@ rtr_update_mbr_field(
 
 		page_cur_t		page_cur;
 		rec_t*			insert_rec;
-		ulint*			insert_offsets = NULL;
+		offset_t*		insert_offsets = NULL;
 		ulint			old_pos;
 		rec_t*			old_rec;
 
@@ -438,7 +438,7 @@ update_mbr:
 		/* When there're not only 1 rec in the page, we do delete/insert
 		to avoid page split. */
 		rec_t*			insert_rec;
-		ulint*			insert_offsets = NULL;
+		offset_t*		insert_offsets = NULL;
 		rec_t*			next_rec;
 
 		/* Delete the rec which cursor point to. */
@@ -639,7 +639,7 @@ rtr_adjust_upper_level(
 	page_zip_des_t*	new_page_zip;
 	dict_index_t*	index = sea_cur->index;
 	btr_cur_t	cursor;
-	ulint*		offsets;
+	offset_t*	offsets;
 	mem_heap_t*	heap;
 	ulint		level;
 	dtuple_t*	node_ptr_upper;
@@ -809,8 +809,8 @@ rtr_split_page_move_rec_list(
 	page_cur_t		new_page_cursor;
 	page_t*			page;
 	page_t*			new_page;
-	ulint			offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*			offsets		= offsets_;
+	offset_t		offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*		offsets		= offsets_;
 	page_zip_des_t*		new_page_zip
 		= buf_block_get_page_zip(new_block);
 	rec_t*			rec;
@@ -970,7 +970,7 @@ rtr_page_split_and_insert(
 	btr_cur_t*	cursor,	/*!< in/out: cursor at which to insert; when the
 				function returns, the cursor is positioned
 				on the predecessor of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
@@ -1322,7 +1322,7 @@ rtr_ins_enlarge_mbr(
 	mem_heap_t*		heap;
 	dict_index_t*		index = btr_cur->index;
 	page_cur_t*		page_cursor;
-	ulint*			offsets;
+	offset_t*		offsets;
 	node_visit_t*		node_visit;
 	btr_cur_t		cursor;
 	page_t*			page;
@@ -1406,10 +1406,10 @@ rtr_page_copy_rec_list_end_no_locks(
 	page_cur_t	page_cur;
 	page_cur_t	cur1;
 	rec_t*		cur_rec;
-	ulint		offsets_1[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets1 = offsets_1;
-	ulint		offsets_2[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets2 = offsets_2;
+	offset_t	offsets_1[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets1 = offsets_1;
+	offset_t	offsets_2[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets2 = offsets_2;
 	ulint		moved = 0;
 	bool		is_leaf = page_is_leaf(new_page);
 
@@ -1533,10 +1533,10 @@ rtr_page_copy_rec_list_start_no_locks(
 {
 	page_cur_t	cur1;
 	rec_t*		cur_rec;
-	ulint		offsets_1[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets1 = offsets_1;
-	ulint		offsets_2[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets2 = offsets_2;
+	offset_t	offsets_1[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets1 = offsets_1;
+	offset_t	offsets_2[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets2 = offsets_2;
 	page_cur_t	page_cur;
 	ulint		moved = 0;
 	bool		is_leaf = page_is_leaf(buf_block_get_frame(block));
@@ -1645,8 +1645,8 @@ rtr_merge_mbr_changed(
 /*==================*/
 	btr_cur_t*		cursor,		/*!< in/out: cursor */
 	btr_cur_t*		cursor2,	/*!< in: the other cursor */
-	ulint*			offsets,	/*!< in: rec offsets */
-	ulint*			offsets2,	/*!< in: rec offsets */
+	offset_t*		offsets,	/*!< in: rec offsets */
+	offset_t*		offsets2,	/*!< in: rec offsets */
 	rtr_mbr_t*		new_mbr,	/*!< out: MBR to update */
 	buf_block_t*		merge_block,	/*!< in: page to merge */
 	buf_block_t*		block,		/*!< in: page be merged */
@@ -1692,8 +1692,8 @@ rtr_merge_and_update_mbr(
 /*=====================*/
 	btr_cur_t*		cursor,		/*!< in/out: cursor */
 	btr_cur_t*		cursor2,	/*!< in: the other cursor */
-	ulint*			offsets,	/*!< in: rec offsets */
-	ulint*			offsets2,	/*!< in: rec offsets */
+	offset_t*		offsets,	/*!< in: rec offsets */
+	offset_t*		offsets2,	/*!< in: rec offsets */
 	page_t*			child_page,	/*!< in: the page. */
 	buf_block_t*		merge_block,	/*!< in: page to merge */
 	buf_block_t*		block,		/*!< in: page be merged */
@@ -1762,7 +1762,7 @@ rtr_check_same_block(
 
 {
 	ulint		page_no = childb->page.id.page_no();
-	ulint*		offsets;
+	offset_t*	offsets;
 	rec_t*		rec = page_rec_get_next(page_get_infimum_rec(
 				buf_block_get_frame(parentb)));
 
@@ -1793,7 +1793,7 @@ rtr_rec_cal_increase(
 				dtuple in some of the common fields, or which
 				has an equal number or more fields than
 				dtuple */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	double*		area)	/*!< out: increased area */
 {
 	const dfield_t*	dtuple_field;
@@ -1889,7 +1889,7 @@ rtr_estimate_n_rows_in_range(
 	rec_t*		rec;
 	byte*		field;
 	ulint		len;
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 	mem_heap_t*	heap;
 
 	heap = mem_heap_create(512);
diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc
index 84307659873..7ac529ed0db 100644
--- a/storage/innobase/gis/gis0sea.cc
+++ b/storage/innobase/gis/gis0sea.cc
@@ -527,7 +527,7 @@ rtr_compare_cursor_rec(
 	mem_heap_t**	heap)		/*!< in: memory heap */
 {
 	const rec_t*	rec;
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	rec = btr_cur_get_rec(cursor);
 
@@ -669,7 +669,7 @@ rtr_page_get_father(
 {
 	mem_heap_t*	heap = mem_heap_create(100);
 #ifdef UNIV_DEBUG
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	offsets = rtr_page_get_father_block(
 		NULL, heap, index, block, mtr, sea_cur, cursor);
@@ -690,9 +690,9 @@ rtr_page_get_father(
 that mtr holds an SX-latch or X-latch on the tree.
 @return	rec_get_offsets() of the node pointer record */
 static
-ulint*
+offset_t*
 rtr_page_get_father_node_ptr(
-	ulint*		offsets,/*!< in: work area for the return value */
+	offset_t*	offsets,/*!< in: work area for the return value */
 	mem_heap_t*	heap,	/*!< in: memory heap to use */
 	btr_cur_t*	sea_cur,/*!< in: search cursor */
 	btr_cur_t*	cursor,	/*!< in: cursor pointing to user record,
@@ -785,10 +785,10 @@ rtr_page_get_father_node_ptr(
 Returns the father block to a page. It is assumed that mtr holds
 an X or SX latch on the tree.
 @return rec_get_offsets() of the node pointer record */
-ulint*
+offset_t*
 rtr_page_get_father_block(
 /*======================*/
-	ulint*		offsets,/*!< in: work area for the return value */
+	offset_t*	offsets,/*!< in: work area for the return value */
 	mem_heap_t*	heap,	/*!< in: memory heap to use */
 	dict_index_t*	index,	/*!< in: b-tree index */
 	buf_block_t*	block,	/*!< in: child page in the index */
@@ -1303,8 +1303,8 @@ rtr_cur_restore_position(
 #ifdef UNIV_DEBUG
 		do {
 			const rec_t*	rec;
-			const ulint*	offsets1;
-			const ulint*	offsets2;
+			const offset_t*	offsets1;
+			const offset_t*	offsets2;
 			ulint		comp;
 
 			rec = btr_pcur_get_rec(r_cursor);
@@ -1377,8 +1377,8 @@ search_again:
 
 	if (low_match == r_cursor->old_n_fields) {
 		const rec_t*	rec;
-		const ulint*	offsets1;
-		const ulint*	offsets2;
+		const offset_t*	offsets1;
+		const offset_t*	offsets2;
 		ulint		comp;
 
 		rec = btr_pcur_get_rec(r_cursor);
@@ -1424,7 +1424,7 @@ rtr_leaf_push_match_rec(
 /*====================*/
 	const rec_t*	rec,		/*!< in: record to copy */
 	rtr_info_t*	rtr_info,	/*!< in/out: search stack */
-	ulint*		offsets,	/*!< in: offsets */
+	offset_t*	offsets,	/*!< in: offsets */
 	bool		is_comp)	/*!< in: is compact format */
 {
 	byte*		buf;
@@ -1610,7 +1610,7 @@ void
 rtr_get_mbr_from_rec(
 /*=================*/
 	const rec_t*	rec,	/*!< in: data tuple */
-	const ulint*	offsets,/*!< in: offsets array */
+	const offset_t*	offsets,/*!< in: offsets array */
 	rtr_mbr_t*	mbr)	/*!< out MBR */
 {
 	ulint		rec_f_len;
@@ -1657,8 +1657,8 @@ rtr_cur_search_with_match(
 	const page_t*	page;
 	const rec_t*	rec;
 	const rec_t*	last_rec;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	mem_heap_t*	heap = NULL;
 	int		cmp = 1;
 	double		least_inc = DBL_MAX;
@@ -1941,8 +1941,8 @@ rtr_cur_search_with_match(
 
 			test_rec = match_rec->matched_recs->back();
 #ifdef UNIV_DEBUG
-			ulint		offsets_2[REC_OFFS_NORMAL_SIZE];
-			ulint*		offsets2	= offsets_2;
+			offset_t	offsets_2[REC_OFFS_NORMAL_SIZE];
+			offset_t*	offsets2	= offsets_2;
 			rec_offs_init(offsets_2);
 
 			ut_ad(found);
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index bae93e399e9..4cc1250b719 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -1801,7 +1801,7 @@ innobase_rec_to_mysql(
 	struct TABLE*		table,	/*!< in/out: MySQL table */
 	const rec_t*		rec,	/*!< in: record */
 	const dict_index_t*	index,	/*!< in: index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(
+	const offset_t*		offsets)/*!< in: rec_get_offsets(
 					rec, index, ...) */
 {
 	uint	n_fields	= table->s->fields;
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index c5768653154..d71a37cdd0b 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -3319,7 +3319,7 @@ ibuf_insert_low(
 	dtuple_t*	ibuf_entry;
 	mem_heap_t*	offsets_heap	= NULL;
 	mem_heap_t*	heap;
-	ulint*		offsets		= NULL;
+	offset_t*	offsets		= NULL;
 	ulint		buffered;
 	lint		min_n_recs;
 	rec_t*		ins_rec;
@@ -3784,7 +3784,7 @@ ibuf_insert_to_index_page_low(
 	buf_block_t*	block,	/*!< in/out: index page where the buffered
 				entry should be placed */
 	dict_index_t*	index,	/*!< in: record descriptor */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t*	heap,	/*!< in/out: memory heap */
 	mtr_t*		mtr,	/*!< in/out: mtr */
 	page_cur_t*	page_cur)/*!< in/out: cursor positioned on the record
@@ -3864,7 +3864,7 @@ ibuf_insert_to_index_page(
 	ulint		low_match;
 	page_t*		page		= buf_block_get_frame(block);
 	rec_t*		rec;
-	ulint*		offsets;
+	offset_t*	offsets;
 	mem_heap_t*	heap;
 
 	DBUG_ENTER("ibuf_insert_to_index_page");
@@ -4121,8 +4121,8 @@ ibuf_delete(
 		/* TODO: the below should probably be a separate function,
 		it's a bastardized version of btr_cur_optimistic_delete. */
 
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-		ulint*		offsets	= offsets_;
+		offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+		offset_t*	offsets	= offsets_;
 		mem_heap_t*	heap = NULL;
 		ulint		max_ins_size = 0;
 
diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h
index ee4e522cf49..c5ae633016a 100644
--- a/storage/innobase/include/btr0btr.h
+++ b/storage/innobase/include/btr0btr.h
@@ -30,6 +30,7 @@ Created 6/2/1994 Heikki Tuuri
 
 #include "dict0dict.h"
 #include "data0data.h"
+#include "rem0types.h"
 #include "page0cur.h"
 #include "btr0types.h"
 #include "gis0type.h"
@@ -305,7 +306,7 @@ ulint
 btr_node_ptr_get_child_page_no(
 /*===========================*/
 	const rec_t*	rec,	/*!< in: node pointer record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 
 /** Create the root node for a new index tree.
@@ -392,7 +393,7 @@ btr_root_raise_and_insert(
 				on the root page; when the function returns,
 				the cursor is positioned on the predecessor
 				of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap
 				that can be emptied, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
@@ -475,7 +476,7 @@ btr_page_split_and_insert(
 	btr_cur_t*	cursor,	/*!< in: cursor at which to insert; when the
 				function returns, the cursor is positioned
 				on the predecessor of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap
 				that can be emptied, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic
index f4fcd9f4194..e5d0e805bd8 100644
--- a/storage/innobase/include/btr0btr.ic
+++ b/storage/innobase/include/btr0btr.ic
@@ -218,7 +218,7 @@ ulint
 btr_node_ptr_get_child_page_no(
 /*===========================*/
 	const rec_t*	rec,	/*!< in: node pointer record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	const byte*	field;
 	ulint		len;
diff --git a/storage/innobase/include/btr0bulk.h b/storage/innobase/include/btr0bulk.h
index a65f6901ce9..3dbc85cad6d 100644
--- a/storage/innobase/include/btr0bulk.h
+++ b/storage/innobase/include/btr0bulk.h
@@ -28,6 +28,7 @@ Created 03/11/2014 Shaohua Wang
 #define btr0bulk_h
 
 #include "dict0dict.h"
+#include "rem0types.h"
 #include "page0cur.h"
 
 #include 
@@ -103,7 +104,7 @@ public:
 	/** Insert a record in the page.
 	@param[in]	rec		record
 	@param[in]	offsets		record offsets */
-	void insert(const rec_t* rec, ulint* offsets);
+	void insert(const rec_t* rec, offset_t* offsets);
 
 	/** Mark end of insertion to the page. Scan all records to set page
 	dirs, and set page header members. */
@@ -127,7 +128,7 @@ public:
 	@param[in]	big_rec		external recrod
 	@param[in]	offsets		record offsets
 	@return	error code */
-	dberr_t storeExt(const big_rec_t* big_rec, ulint* offsets);
+	dberr_t storeExt(const big_rec_t* big_rec, offset_t* offsets);
 
 	/** Get node pointer
 	@return node pointer */
diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h
index 4d67833db70..0f2fd48004b 100644
--- a/storage/innobase/include/btr0cur.h
+++ b/storage/innobase/include/btr0cur.h
@@ -30,6 +30,7 @@ Created 10/16/1994 Heikki Tuuri
 #include "dict0dict.h"
 #include "page0cur.h"
 #include "btr0types.h"
+#include "rem0types.h"
 #include "gis0type.h"
 
 /** Mode flags for btr_cur operations; these can be ORed */
@@ -242,7 +243,7 @@ btr_cur_optimistic_insert(
 				specified */
 	btr_cur_t*	cursor,	/*!< in: cursor on page after which to insert;
 				cursor stays valid */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap */
 	dtuple_t*	entry,	/*!< in/out: entry to insert */
 	rec_t**		rec,	/*!< out: pointer to inserted record if
@@ -278,7 +279,7 @@ btr_cur_pessimistic_insert(
 				insertion will certainly succeed */
 	btr_cur_t*	cursor,	/*!< in: cursor after which to insert;
 				cursor stays valid */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap
 				that can be emptied */
 	dtuple_t*	entry,	/*!< in/out: entry to insert */
@@ -312,7 +313,7 @@ btr_cur_update_alloc_zip_func(
 	page_cur_t*	cursor,	/*!< in/out: B-tree page cursor */
 	dict_index_t*	index,	/*!< in: the index corresponding to cursor */
 #ifdef UNIV_DEBUG
-	ulint*		offsets,/*!< in/out: offsets of the cursor record */
+	offset_t*	offsets,/*!< in/out: offsets of the cursor record */
 #endif /* UNIV_DEBUG */
 	ulint		length,	/*!< in: size needed */
 	bool		create,	/*!< in: true=delete-and-insert,
@@ -339,7 +340,7 @@ btr_cur_update_in_place(
 	btr_cur_t*	cursor,	/*!< in: cursor on the record to update;
 				cursor stays valid and positioned on the
 				same record */
-	ulint*		offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+	offset_t*	offsets,/*!< in/out: offsets on cursor->page_cur.rec */
 	const upd_t*	update,	/*!< in: update vector */
 	ulint		cmpl_info,/*!< in: compiler info on secondary index
 				updates */
@@ -381,7 +382,7 @@ btr_cur_optimistic_update(
 	btr_cur_t*	cursor,	/*!< in: cursor on the record to update;
 				cursor stays valid and positioned on the
 				same record */
-	ulint**		offsets,/*!< out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< out: offsets on cursor->page_cur.rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to NULL or memory heap */
 	const upd_t*	update,	/*!< in: update vector; this must also
 				contain trx id and roll ptr fields */
@@ -408,7 +409,7 @@ btr_cur_pessimistic_update(
 	btr_cur_t*	cursor,	/*!< in/out: cursor on the record to update;
 				cursor may become invalid if *big_rec == NULL
 				|| !(flags & BTR_KEEP_POS_FLAG) */
-	ulint**		offsets,/*!< out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< out: offsets on cursor->page_cur.rec */
 	mem_heap_t**	offsets_heap,
 				/*!< in/out: pointer to memory heap
 				that can be emptied */
@@ -440,7 +441,7 @@ btr_cur_del_mark_set_clust_rec(
 	buf_block_t*	block,	/*!< in/out: buffer block of the record */
 	rec_t*		rec,	/*!< in/out: record */
 	dict_index_t*	index,	/*!< in: clustered index of the record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec) */
 	que_thr_t*	thr,	/*!< in: query thread */
 	const dtuple_t*	entry,	/*!< in: dtuple for the deleting record */
 	mtr_t*		mtr)	/*!< in/out: mini-transaction */
@@ -607,7 +608,7 @@ btr_estimate_number_of_different_key_vals(
 ulint
 btr_rec_get_externally_stored_len(
 	const rec_t*	rec,
-	const ulint*	offsets);
+	const offset_t*	offsets);
 
 /*******************************************************************//**
 Marks non-updated off-page fields as disowned by this record. The ownership
@@ -621,7 +622,7 @@ btr_cur_disown_inherited_fields(
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	const upd_t*	update,	/*!< in: update vector */
 	mtr_t*		mtr)	/*!< in/out: mini-transaction */
 	MY_ATTRIBUTE((nonnull(2,3,4,5,6)));
@@ -660,7 +661,7 @@ btr_store_big_rec_extern_fields(
 	btr_pcur_t*	pcur,		/*!< in/out: a persistent cursor. if
 					btr_mtr is restarted, then this can
 					be repositioned. */
-	ulint*		offsets,	/*!< in/out: rec_get_offsets() on
+	offset_t*	offsets,	/*!< in/out: rec_get_offsets() on
 					pcur. the "external storage" flags
 					in offsets will correctly correspond
 					to rec when this function returns */
@@ -691,7 +692,7 @@ btr_free_externally_stored_field(
 	byte*		field_ref,	/*!< in/out: field reference */
 	const rec_t*	rec,		/*!< in: record containing field_ref, for
 					page_zip_write_blob_ptr(), or NULL */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index),
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index),
 					or NULL */
 	page_zip_des_t*	page_zip,	/*!< in: compressed page corresponding
 					to rec, or NULL if rec == NULL */
@@ -748,7 +749,7 @@ protected by a lock or a page latch
 byte*
 btr_rec_copy_externally_stored_field(
 	const rec_t*		rec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	const page_size_t&	page_size,
 	ulint			no,
 	ulint*			len,
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 0f96cd4e3ba..ed4bf073061 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -821,10 +821,6 @@ a certain index.*/
 system clustered index when there is no primary key. */
 const char innobase_index_reserve_name[] = "GEN_CLUST_INDEX";
 
-/* Estimated number of offsets in records (based on columns)
-to start with. */
-#define OFFS_IN_REC_NORMAL_SIZE		100
-
 /** Data structure for an index.  Most fields will be
 initialized to 0, NULL or FALSE in dict_mem_index_create(). */
 struct dict_index_t{
diff --git a/storage/innobase/include/gis0rtree.h b/storage/innobase/include/gis0rtree.h
index e5942b71c64..ffb6beb922b 100644
--- a/storage/innobase/include/gis0rtree.h
+++ b/storage/innobase/include/gis0rtree.h
@@ -28,6 +28,7 @@ Created 2013/03/27 Jimmy Yang and Allen Lai
 #define gis0rtree_h
 
 #include "btr0cur.h"
+#include "rem0types.h"
 
 /* Whether MBR 'a' contains 'b' */
 #define	MBR_CONTAIN_CMP(a, b)					\
@@ -90,7 +91,7 @@ rtr_page_split_and_insert(
 	btr_cur_t*	cursor,	/*!< in/out: cursor at which to insert; when the
 				function returns, the cursor is positioned
 				on the predecessor of the inserted record */
-	ulint**		offsets,/*!< out: offsets on inserted record */
+	offset_t**	offsets,/*!< out: offsets on inserted record */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	const dtuple_t*	tuple,	/*!< in: tuple to insert */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
@@ -152,7 +153,7 @@ rtr_rec_cal_increase(
 				dtuple in some of the common fields, or which
 				has an equal number or more fields than
 				dtuple */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	double*		area);	/*!< out: increased area */
 
 /****************************************************************//**
@@ -276,7 +277,7 @@ void
 rtr_get_mbr_from_rec(
 /*=================*/
 	const rec_t*	rec,	/*!< in: data tuple */
-	const ulint*	offsets,/*!< in: offsets array */
+	const offset_t*	offsets,/*!< in: offsets array */
 	rtr_mbr_t*	mbr);	/*!< out MBR */
 
 /****************************************************************//**
@@ -308,10 +309,10 @@ rtr_page_get_father(
 Returns the father block to a page. It is assumed that mtr holds
 an X or SX latch on the tree.
 @return rec_get_offsets() of the node pointer record */
-ulint*
+offset_t*
 rtr_page_get_father_block(
 /*======================*/
-	ulint*		offsets,/*!< in: work area for the return value */
+	offset_t*	offsets,/*!< in: work area for the return value */
 	mem_heap_t*	heap,	/*!< in: memory heap to use */
 	dict_index_t*	index,	/*!< in: b-tree index */
 	buf_block_t*	block,	/*!< in: child page in the index */
@@ -418,8 +419,8 @@ rtr_merge_and_update_mbr(
 /*=====================*/
 	btr_cur_t*		cursor,		/*!< in/out: cursor */
 	btr_cur_t*		cursor2,	/*!< in: the other cursor */
-	ulint*			offsets,	/*!< in: rec offsets */
-	ulint*			offsets2,	/*!< in: rec offsets */
+	offset_t*		offsets,	/*!< in: rec offsets */
+	offset_t*		offsets2,	/*!< in: rec offsets */
 	page_t*			child_page,	/*!< in: the child page. */
 	buf_block_t*		merge_block,	/*!< in: page to merge */
 	buf_block_t*		block,		/*!< in: page be merged */
@@ -444,8 +445,8 @@ rtr_merge_mbr_changed(
 /*==================*/
 	btr_cur_t*	cursor,		/*!< in: cursor */
 	btr_cur_t*	cursor2,	/*!< in: the other cursor */
-	ulint*		offsets,	/*!< in: rec offsets */
-	ulint*		offsets2,	/*!< in: rec offsets */
+	offset_t*	offsets,	/*!< in: rec offsets */
+	offset_t*	offsets2,	/*!< in: rec offsets */
 	rtr_mbr_t*	new_mbr,	/*!< out: MBR to update */
 	buf_block_t*	merge_block,	/*!< in: page to merge */
 	buf_block_t*	block,		/*!< in: page be merged */
@@ -459,7 +460,7 @@ bool
 rtr_update_mbr_field(
 /*=================*/
 	btr_cur_t*	cursor,		/*!< in: cursor pointed to rec.*/
-	ulint*		offsets,	/*!< in: offsets on rec. */
+	offset_t*	offsets,	/*!< in: offsets on rec. */
 	btr_cur_t*	cursor2,	/*!< in/out: cursor pointed to rec
 					that should be deleted.
 					this cursor is for btr_compress to
diff --git a/storage/innobase/include/gis0rtree.ic b/storage/innobase/include/gis0rtree.ic
index b9ab2ea57e8..525acb7ecf0 100644
--- a/storage/innobase/include/gis0rtree.ic
+++ b/storage/innobase/include/gis0rtree.ic
@@ -40,7 +40,7 @@ rtr_page_cal_mbr(
 	rec_t*		rec;
 	byte*		field;
 	ulint		len;
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 	double		bmin, bmax;
 	double*		amin;
 	double*		amax;
diff --git a/storage/innobase/include/handler0alter.h b/storage/innobase/include/handler0alter.h
index 16616e3fc9c..2fdcedc5bb6 100644
--- a/storage/innobase/include/handler0alter.h
+++ b/storage/innobase/include/handler0alter.h
@@ -22,6 +22,8 @@ this program; if not, write to the Free Software Foundation, Inc.,
 Smart ALTER TABLE
 *******************************************************/
 
+#include "rem0types.h"
+
 /*************************************************************//**
 Copies an InnoDB record to table->record[0]. */
 void
@@ -30,7 +32,7 @@ innobase_rec_to_mysql(
 	struct TABLE*		table,	/*!< in/out: MySQL table */
 	const rec_t*		rec,	/*!< in: record */
 	const dict_index_t*	index,	/*!< in: index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(
+	const offset_t*		offsets)/*!< in: rec_get_offsets(
 					rec, index, ...) */
 	MY_ATTRIBUTE((nonnull));
 
diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h
index 8369db8b879..21760d1dca9 100644
--- a/storage/innobase/include/lock0lock.h
+++ b/storage/innobase/include/lock0lock.h
@@ -317,7 +317,7 @@ lock_clust_rec_modify_check_and_lock(
 	const rec_t*		rec,	/*!< in: record which should be
 					modified */
 	dict_index_t*		index,	/*!< in: clustered index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	que_thr_t*		thr)	/*!< in: query thread */
 	MY_ATTRIBUTE((warn_unused_result));
 /*********************************************************************//**
@@ -355,7 +355,7 @@ lock_sec_rec_read_check_and_lock(
 					be read or passed over by a
 					read cursor */
 	dict_index_t*		index,	/*!< in: secondary index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	lock_mode		mode,	/*!< in: mode of the lock which
 					the read cursor should set on
 					records: LOCK_S or LOCK_X; the
@@ -383,7 +383,7 @@ lock_clust_rec_read_check_and_lock(
 					be read or passed over by a
 					read cursor */
 	dict_index_t*		index,	/*!< in: clustered index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	lock_mode		mode,	/*!< in: mode of the lock which
 					the read cursor should set on
 					records: LOCK_S or LOCK_X; the
@@ -432,7 +432,7 @@ lock_clust_rec_cons_read_sees(
 	const rec_t*	rec,	/*!< in: user record which should be read or
 				passed over by a read cursor */
 	dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ReadView*	view);	/*!< in: consistent read view */
 /*********************************************************************//**
 Checks that a non-clustered index record is seen in a consistent read.
@@ -577,7 +577,7 @@ lock_report_trx_id_insanity(
 	trx_id_t	trx_id,		/*!< in: trx id */
 	const rec_t*	rec,		/*!< in: user record */
 	dict_index_t*	index,		/*!< in: index */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index) */
 	trx_id_t	max_trx_id);	/*!< in: trx_sys_get_max_trx_id() */
 /*********************************************************************//**
 Prints info of locks for all transactions.
@@ -803,7 +803,7 @@ lock_check_trx_id_sanity(
 	trx_id_t	trx_id,		/*!< in: trx id */
 	const rec_t*	rec,		/*!< in: user record */
 	dict_index_t*	index,		/*!< in: index */
-	const ulint*	offsets)	/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets)	/*!< in: rec_get_offsets(rec, index) */
 	MY_ATTRIBUTE((warn_unused_result));
 /*******************************************************************//**
 Check if the transaction holds any locks on the sys tables
diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h
index 9b80f593e30..5e00e1bb6f1 100644
--- a/storage/innobase/include/lock0priv.h
+++ b/storage/innobase/include/lock0priv.h
@@ -35,6 +35,7 @@ those functions in lock/ */
 #endif
 
 #include "hash0hash.h"
+#include "rem0types.h"
 #include "trx0trx.h"
 
 #ifndef UINT32_MAX
@@ -468,7 +469,7 @@ lock_clust_rec_some_has_impl(
 /*=========================*/
 	const rec_t*		rec,	/*!< in: user record */
 	const dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets)/*!< in: rec_get_offsets(rec, index) */
 	MY_ATTRIBUTE((warn_unused_result));
 
 /*********************************************************************//**
diff --git a/storage/innobase/include/lock0priv.ic b/storage/innobase/include/lock0priv.ic
index 80a63271256..7062e3f7082 100644
--- a/storage/innobase/include/lock0priv.ic
+++ b/storage/innobase/include/lock0priv.ic
@@ -59,7 +59,7 @@ lock_clust_rec_some_has_impl(
 /*=========================*/
 	const rec_t*		rec,	/*!< in: user record */
 	const dict_index_t*	index,	/*!< in: clustered index */
-	const ulint*		offsets)/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets)/*!< in: rec_get_offsets(rec, index) */
 {
 	ut_ad(dict_index_is_clust(index));
 	ut_ad(page_rec_is_user_rec(rec));
diff --git a/storage/innobase/include/page0cur.h b/storage/innobase/include/page0cur.h
index 18cc058ca6d..d91f1bd7ba7 100644
--- a/storage/innobase/include/page0cur.h
+++ b/storage/innobase/include/page0cur.h
@@ -29,6 +29,7 @@ Created 10/4/1994 Heikki Tuuri
 
 #include "buf0types.h"
 #include "page0page.h"
+#include "rem0types.h"
 #include "rem0rec.h"
 #include "data0data.h"
 #include "mtr0mtr.h"
@@ -151,7 +152,7 @@ page_cur_tuple_insert(
 	page_cur_t*	cursor,	/*!< in/out: a page cursor */
 	const dtuple_t*	tuple,	/*!< in: pointer to a data tuple */
 	dict_index_t*	index,	/*!< in: record descriptor */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
 	mtr_t*		mtr,	/*!< in: mini-transaction handle, or NULL */
@@ -178,7 +179,7 @@ page_cur_rec_insert(
 	page_cur_t*	cursor,	/*!< in/out: a page cursor */
 	const rec_t*	rec,	/*!< in: record to insert */
 	dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(rec, index) */
 	mtr_t*		mtr);	/*!< in: mini-transaction handle, or NULL */
 /***********************************************************//**
 Inserts a record next to page cursor on an uncompressed page.
@@ -192,7 +193,7 @@ page_cur_insert_rec_low(
 				which the new record is inserted */
 	dict_index_t*	index,	/*!< in: record descriptor */
 	const rec_t*	rec,	/*!< in: pointer to a physical record */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(rec, index) */
 	mtr_t*		mtr)	/*!< in: mini-transaction handle, or NULL */
 	MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
 
@@ -214,7 +215,7 @@ page_cur_insert_rec_zip(
 	page_cur_t*	cursor,	/*!< in/out: page cursor */
 	dict_index_t*	index,	/*!< in: record descriptor */
 	const rec_t*	rec,	/*!< in: pointer to a physical record */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(rec, index) */
 	mtr_t*		mtr)	/*!< in: mini-transaction handle, or NULL */
 	MY_ATTRIBUTE((nonnull(1,2,3,4), warn_unused_result));
 /*************************************************************//**
@@ -240,7 +241,7 @@ page_cur_delete_rec(
 /*================*/
 	page_cur_t*		cursor,	/*!< in/out: a page cursor */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	const ulint*		offsets,/*!< in: rec_get_offsets(
+	const offset_t*		offsets,/*!< in: rec_get_offsets(
 					cursor->rec, index) */
 	mtr_t*			mtr);	/*!< in: mini-transaction handle */
 
@@ -388,14 +389,14 @@ page_delete_rec(
 	page_cur_t*		pcur,	/*!< in/out: page cursor on record
 					to delete */
 	page_zip_des_t*		page_zip,/*!< in: compressed page descriptor */
-	const ulint*		offsets);/*!< in: offsets for record */
+	const offset_t*		offsets);/*!< in: offsets for record */
 
 /** Index page cursor */
 
 struct page_cur_t{
 	const dict_index_t*	index;
 	rec_t*		rec;	/*!< pointer to a record on page */
-	ulint*		offsets;
+	offset_t*	offsets;
 	buf_block_t*	block;	/*!< pointer to the block containing rec */
 };
 
diff --git a/storage/innobase/include/page0cur.ic b/storage/innobase/include/page0cur.ic
index 7c5737613c4..982bda83c32 100644
--- a/storage/innobase/include/page0cur.ic
+++ b/storage/innobase/include/page0cur.ic
@@ -259,7 +259,7 @@ page_cur_tuple_insert(
 	page_cur_t*	cursor,	/*!< in/out: a page cursor */
 	const dtuple_t*	tuple,	/*!< in: pointer to a data tuple */
 	dict_index_t*	index,	/*!< in: record descriptor */
-	ulint**		offsets,/*!< out: offsets on *rec */
+	offset_t**	offsets,/*!< out: offsets on *rec */
 	mem_heap_t**	heap,	/*!< in/out: pointer to memory heap, or NULL */
 	ulint		n_ext,	/*!< in: number of externally stored columns */
 	mtr_t*		mtr,	/*!< in: mini-transaction handle, or NULL */
@@ -315,7 +315,7 @@ page_cur_rec_insert(
 	page_cur_t*	cursor,	/*!< in/out: a page cursor */
 	const rec_t*	rec,	/*!< in: record to insert */
 	dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(rec, index) */
 	mtr_t*		mtr)	/*!< in: mini-transaction handle, or NULL */
 {
 	if (buf_block_get_page_zip(cursor->block)) {
diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h
index 2e3bae2d7ff..87de16f9abf 100644
--- a/storage/innobase/include/page0page.h
+++ b/storage/innobase/include/page0page.h
@@ -32,6 +32,7 @@ Created 2/2/1994 Heikki Tuuri
 #include "buf0buf.h"
 #include "data0data.h"
 #include "dict0dict.h"
+#include "rem0types.h"
 #include "rem0rec.h"
 #endif /* !UNIV_INNOCHECKSUM*/
 #include "fsp0fsp.h"
@@ -919,7 +920,7 @@ page_mem_free(
 	rec_t*			rec,	/*!< in: pointer to the (origin of)
 					record */
 	const dict_index_t*	index,	/*!< in: index of rec */
-	const ulint*		offsets);/*!< in: array returned by
+	const offset_t*		offsets);/*!< in: array returned by
 					 rec_get_offsets() */
 /**********************************************************//**
 Create an uncompressed B-tree index page.
@@ -1140,7 +1141,7 @@ void
 page_rec_print(
 /*===========*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets);/*!< in: record descriptor */
+	const offset_t*	offsets);/*!< in: record descriptor */
 # ifdef UNIV_BTR_PRINT
 /***************************************************************//**
 This is used to print the contents of the directory for
@@ -1187,7 +1188,7 @@ ibool
 page_rec_validate(
 /*==============*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets);/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets);/*!< in: array returned by rec_get_offsets() */
 #ifdef UNIV_DEBUG
 /***************************************************************//**
 Checks that the first directory slot points to the infimum record and
diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic
index 6c12c43b237..6369932db1b 100644
--- a/storage/innobase/include/page0page.ic
+++ b/storage/innobase/include/page0page.ic
@@ -1004,7 +1004,7 @@ page_mem_free(
 	rec_t*			rec,		/*!< in: pointer to the
 						(origin of) record */
 	const dict_index_t*	index,		/*!< in: index of rec */
-	const ulint*		offsets)	/*!< in: array returned by
+	const offset_t*		offsets)	/*!< in: array returned by
 						rec_get_offsets() */
 {
 	rec_t*		free;
diff --git a/storage/innobase/include/page0types.h b/storage/innobase/include/page0types.h
index 02d0cf29ec5..4debd639fa4 100644
--- a/storage/innobase/include/page0types.h
+++ b/storage/innobase/include/page0types.h
@@ -28,6 +28,7 @@ Created 2/2/1994 Heikki Tuuri
 
 #include "dict0types.h"
 #include "mtr0types.h"
+#include "rem0types.h"
 
 #include 
 
@@ -184,7 +185,7 @@ page_zip_dir_delete(
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page */
 	byte*		rec,	/*!< in: deleted record */
 	dict_index_t*	index,	/*!< in: index of rec */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec) */
 	const byte*	free)	/*!< in: previous start of the free list */
 	MY_ATTRIBUTE((nonnull(1,2,3,4)));
 
diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h
index b4d4f0e980b..98a1422f496 100644
--- a/storage/innobase/include/page0zip.h
+++ b/storage/innobase/include/page0zip.h
@@ -47,6 +47,7 @@ Created June 2005 by Marko Makela
 #endif /* !UNIV_INNOCHECKSUM */
 
 #include "buf0types.h"
+#include "rem0types.h"
 
 #ifndef UNIV_INNOCHECKSUM
 #include "dict0types.h"
@@ -287,7 +288,7 @@ page_zip_write_rec(
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page */
 	const byte*	rec,	/*!< in: record being written */
 	dict_index_t*	index,	/*!< in: the index the record belongs to */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		create)	/*!< in: nonzero=insert, zero=update */
 	MY_ATTRIBUTE((nonnull));
 
@@ -312,7 +313,7 @@ page_zip_write_blob_ptr(
 	const byte*	rec,	/*!< in/out: record whose data is being
 				written */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		n,	/*!< in: column index */
 	mtr_t*		mtr);	/*!< in: mini-transaction handle,
 				or NULL if no logging is needed */
@@ -346,7 +347,7 @@ page_zip_write_trx_id_and_roll_ptr(
 /*===============================*/
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page */
 	byte*		rec,	/*!< in/out: record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		trx_id_col,/*!< in: column number of TRX_ID in rec */
 	trx_id_t	trx_id,	/*!< in: transaction identifier */
 	roll_ptr_t	roll_ptr)/*!< in: roll_ptr */
@@ -394,7 +395,7 @@ page_zip_dir_delete(
 	page_zip_des_t*		page_zip,	/*!< in/out: compressed page */
 	byte*			rec,		/*!< in: deleted record */
 	const dict_index_t*	index,		/*!< in: index of rec */
-	const ulint*		offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*		offsets,	/*!< in: rec_get_offsets(rec) */
 	const byte*		free)		/*!< in: previous start of
 						the free list */
 	MY_ATTRIBUTE((nonnull(1,2,3,4)));
diff --git a/storage/innobase/include/rem0cmp.h b/storage/innobase/include/rem0cmp.h
index 9582b0df393..0877c7b5b6a 100644
--- a/storage/innobase/include/rem0cmp.h
+++ b/storage/innobase/include/rem0cmp.h
@@ -89,7 +89,7 @@ cmp_dtuple_rec_with_gis(
 /*====================*/
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	page_cur_mode_t	mode)
 	MY_ATTRIBUTE((nonnull));
 
@@ -105,7 +105,7 @@ int
 cmp_dtuple_rec_with_gis_internal(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets);
+	const offset_t*	offsets);
 
 /** Compare a data tuple to a physical record.
 @param[in] dtuple data tuple
@@ -121,7 +121,7 @@ int
 cmp_dtuple_rec_with_match_low(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	ulint		n_cmp,
 	ulint*		matched_fields)
 	MY_ATTRIBUTE((nonnull));
@@ -145,7 +145,7 @@ cmp_dtuple_rec_with_match_bytes(
 	const dtuple_t*		dtuple,
 	const rec_t*		rec,
 	const dict_index_t*	index,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	ulint*			matched_fields,
 	ulint*			matched_bytes)
 	MY_ATTRIBUTE((warn_unused_result));
@@ -162,7 +162,7 @@ int
 cmp_dtuple_rec(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets);
+	const offset_t*	offsets);
 /**************************************************************//**
 Checks if a dtuple is a prefix of a record. The last field in dtuple
 is allowed to be a prefix of the corresponding field in the record.
@@ -172,7 +172,7 @@ cmp_dtuple_is_prefix_of_rec(
 /*========================*/
 	const dtuple_t*	dtuple,	/*!< in: data tuple */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets);/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets);/*!< in: array returned by rec_get_offsets() */
 /** Compare two physical records that contain the same number of columns,
 none of which are stored externally.
 @retval positive if rec1 (including non-ordering columns) is greater than rec2
@@ -183,8 +183,8 @@ cmp_rec_rec_simple(
 /*===============*/
 	const rec_t*		rec1,	/*!< in: physical record */
 	const rec_t*		rec2,	/*!< in: physical record */
-	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
-	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+	const offset_t*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+	const offset_t*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
 	const dict_index_t*	index,	/*!< in: data dictionary index */
 	struct TABLE*		table)	/*!< in: MySQL table, for reporting
 					duplicate key value if applicable,
@@ -209,8 +209,8 @@ int
 cmp_rec_rec_with_match(
 	const rec_t*		rec1,
 	const rec_t*		rec2,
-	const ulint*		offsets1,
-	const ulint*		offsets2,
+	const offset_t*		offsets1,
+	const offset_t*		offsets2,
 	const dict_index_t*	index,
 	bool			nulls_unequal,
 	ulint*			matched_fields);
@@ -231,8 +231,8 @@ int
 cmp_rec_rec(
 	const rec_t*		rec1,
 	const rec_t*		rec2,
-	const ulint*		offsets1,
-	const ulint*		offsets2,
+	const offset_t*		offsets1,
+	const offset_t*		offsets2,
 	const dict_index_t*	index,
 	ulint*			matched_fields = NULL);
 
diff --git a/storage/innobase/include/rem0cmp.ic b/storage/innobase/include/rem0cmp.ic
index 2412d22e8fa..5ac3838f244 100644
--- a/storage/innobase/include/rem0cmp.ic
+++ b/storage/innobase/include/rem0cmp.ic
@@ -68,8 +68,8 @@ int
 cmp_rec_rec(
 	const rec_t*		rec1,
 	const rec_t*		rec2,
-	const ulint*		offsets1,
-	const ulint*		offsets2,
+	const offset_t*		offsets1,
+	const offset_t*		offsets2,
 	const dict_index_t*	index,
 	ulint*			matched_fields)
 {
diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h
index c81f0479ce6..f38efc660c4 100644
--- a/storage/innobase/include/rem0rec.h
+++ b/storage/innobase/include/rem0rec.h
@@ -71,29 +71,72 @@ The status is stored in the low-order bits. */
 /* Length of a B-tree node pointer, in bytes */
 #define REC_NODE_PTR_SIZE	4
 
+#ifndef UNIV_INNOCHECKSUM
 /** SQL null flag in a 1-byte offset of ROW_FORMAT=REDUNDANT records */
-#define REC_1BYTE_SQL_NULL_MASK	0x80UL
+static const offset_t REC_1BYTE_SQL_NULL_MASK= 0x80;
 /** SQL null flag in a 2-byte offset of ROW_FORMAT=REDUNDANT records */
-#define REC_2BYTE_SQL_NULL_MASK	0x8000UL
+static const offset_t REC_2BYTE_SQL_NULL_MASK= 0x8000;
 
 /** In a 2-byte offset of ROW_FORMAT=REDUNDANT records, the second most
 significant bit denotes that the tail of a field is stored off-page. */
-#define REC_2BYTE_EXTERN_MASK	0x4000UL
+static const offset_t REC_2BYTE_EXTERN_MASK= 0x4000;
+
+static const size_t RECORD_OFFSET= 2;
+static const size_t INDEX_OFFSET=
+    RECORD_OFFSET + sizeof(rec_t *) / sizeof(offset_t);
 
-#ifdef UNIV_DEBUG
-/* Length of the rec_get_offsets() header */
-# define REC_OFFS_HEADER_SIZE	4
-#else /* UNIV_DEBUG */
 /* Length of the rec_get_offsets() header */
-# define REC_OFFS_HEADER_SIZE	2
+static const size_t REC_OFFS_HEADER_SIZE=
+#ifdef UNIV_DEBUG
+    sizeof(rec_t *) / sizeof(offset_t) +
+    sizeof(dict_index_t *) / sizeof(offset_t) +
 #endif /* UNIV_DEBUG */
+    2;
 
 /* Number of elements that should be initially allocated for the
 offsets[] array, first passed to rec_get_offsets() */
-#define REC_OFFS_NORMAL_SIZE	OFFS_IN_REC_NORMAL_SIZE
-#define REC_OFFS_SMALL_SIZE	10
+static const size_t REC_OFFS_NORMAL_SIZE= 300;
+static const size_t REC_OFFS_SMALL_SIZE= 18;
+static const size_t REC_OFFS_SEC_INDEX_SIZE=
+    /* PK max key parts */ 16 + /* sec idx max key parts */ 16 +
+    /* child page number for non-leaf pages */ 1;
+
+/* Offset consists of two parts: 2 upper bits is type and all other bits is
+value */
+
+enum field_type_t
+{
+  /** normal field */
+  STORED_IN_RECORD= 0 << 14,
+  /** this field is stored off-page */
+  STORED_OFFPAGE= 1 << 14,
+  /** just an SQL NULL */
+  SQL_NULL= 2 << 14
+};
+
+/** without 2 upper bits */
+static const offset_t DATA_MASK= 0x3fff;
+/** 2 upper bits */
+static const offset_t TYPE_MASK= ~DATA_MASK;
+inline field_type_t get_type(offset_t n)
+{
+  return static_cast(n & TYPE_MASK);
+}
+inline void set_type(offset_t &n, field_type_t type)
+{
+  n= (n & DATA_MASK) | static_cast(type);
+}
+inline offset_t get_value(offset_t n) { return n & DATA_MASK; }
+inline offset_t combine(offset_t value, field_type_t type)
+{
+  return get_value(value) | static_cast(type);
+}
+
+/** Compact flag ORed to the extra size returned by rec_offs_base()[0] */
+static const offset_t REC_OFFS_COMPACT= 1 << 15;
+/** External flag in offsets returned by rec_offs_base()[0] */
+static const offset_t REC_OFFS_EXTERNAL= 1 << 14;
 
-#ifndef UNIV_INNOCHECKSUM
 /******************************************************//**
 The following function is used to get the pointer of the next chained record
 on the same page.
@@ -398,7 +441,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
 value.
 @return offset of the start of the field, SQL null flag ORed */
 UNIV_INLINE
-ulint
+uint8_t
 rec_1_get_field_end_info(
 /*=====================*/
 	const rec_t*	rec,	/*!< in: record */
@@ -453,11 +496,11 @@ rec_get_n_extern_new(
 				(ULINT_UNDEFINED to compute all offsets)
 @param[in,out]	heap		memory heap
 @return the new offsets */
-ulint*
+offset_t*
 rec_get_offsets_func(
 	const rec_t*		rec,
 	const dict_index_t*	index,
-	ulint*			offsets,
+	offset_t*		offsets,
 #ifdef UNIV_DEBUG
 	bool			leaf,
 #endif /* UNIV_DEBUG */
@@ -494,7 +537,7 @@ rec_get_offsets_reverse(
 	const dict_index_t*	index,	/*!< in: record descriptor */
 	ulint			node_ptr,/*!< in: nonzero=node pointer,
 					0=leaf node */
-	ulint*			offsets)/*!< in/out: array consisting of
+	offset_t*		offsets)/*!< in/out: array consisting of
 					offsets[0] allocated elements */
 	MY_ATTRIBUTE((nonnull));
 #ifdef UNIV_DEBUG
@@ -507,7 +550,7 @@ rec_offs_validate(
 /*==============*/
 	const rec_t*		rec,	/*!< in: record or NULL */
 	const dict_index_t*	index,	/*!< in: record descriptor or NULL */
-	const ulint*		offsets)/*!< in: array returned by
+	const offset_t*		offsets)/*!< in: array returned by
 					rec_get_offsets() */
 	MY_ATTRIBUTE((nonnull(3), warn_unused_result));
 /************************************************************//**
@@ -519,7 +562,7 @@ rec_offs_make_valid(
 /*================*/
 	const rec_t*		rec,	/*!< in: record */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in: array returned by
+	offset_t*		offsets)/*!< in: array returned by
 					rec_get_offsets() */
 	MY_ATTRIBUTE((nonnull));
 #else
@@ -557,10 +600,10 @@ The following function is used to get an offset to the nth
 data field in a record.
 @return offset from the origin of rec */
 UNIV_INLINE
-ulint
+offset_t
 rec_get_nth_field_offs(
 /*===================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n,	/*!< in: index of the field */
 	ulint*		len)	/*!< out: length of the field; UNIV_SQL_NULL
 				if SQL null */
@@ -575,7 +618,7 @@ UNIV_INLINE
 ulint
 rec_offs_comp(
 /*==========*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /******************************************************//**
 Determine if the offsets are for a record containing
@@ -585,7 +628,7 @@ UNIV_INLINE
 ulint
 rec_offs_any_extern(
 /*================*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /******************************************************//**
 Determine if the offsets are for a record containing null BLOB pointers.
@@ -595,7 +638,7 @@ const byte*
 rec_offs_any_null_extern(
 /*=====================*/
 	const rec_t*	rec,		/*!< in: record */
-	const ulint*	offsets)	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets)	/*!< in: rec_get_offsets(rec) */
 	MY_ATTRIBUTE((warn_unused_result));
 /******************************************************//**
 Returns nonzero if the extern bit is set in nth field of rec.
@@ -604,7 +647,7 @@ UNIV_INLINE
 ulint
 rec_offs_nth_extern(
 /*================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 	MY_ATTRIBUTE((warn_unused_result));
 
@@ -613,7 +656,7 @@ rec_offs_nth_extern(
 @param[in]	n		nth field */
 void
 rec_offs_make_nth_extern(
-        ulint*		offsets,
+        offset_t*	offsets,
         const ulint     n);
 /******************************************************//**
 Returns nonzero if the SQL NULL bit is set in nth field of rec.
@@ -622,7 +665,7 @@ UNIV_INLINE
 ulint
 rec_offs_nth_sql_null(
 /*==================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 	MY_ATTRIBUTE((warn_unused_result));
 /******************************************************//**
@@ -632,7 +675,7 @@ UNIV_INLINE
 ulint
 rec_offs_nth_size(
 /*==============*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 	MY_ATTRIBUTE((warn_unused_result));
 
@@ -643,7 +686,7 @@ UNIV_INLINE
 ulint
 rec_offs_n_extern(
 /*==============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /***********************************************************//**
 This is used to modify the value of an already existing field in a record.
@@ -656,7 +699,7 @@ void
 rec_set_nth_field(
 /*==============*/
 	rec_t*		rec,	/*!< in: record */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n,	/*!< in: index number of the field */
 	const void*	data,	/*!< in: pointer to the data if not SQL null */
 	ulint		len)	/*!< in: length of the data or UNIV_SQL_NULL.
@@ -685,7 +728,7 @@ UNIV_INLINE
 ulint
 rec_offs_get_n_alloc(
 /*=================*/
-	const ulint*	offsets)/*!< in: array for rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array for rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /**********************************************************//**
 The following function sets the number of allocated elements
@@ -694,7 +737,7 @@ UNIV_INLINE
 void
 rec_offs_set_n_alloc(
 /*=================*/
-	ulint*	offsets,	/*!< out: array for rec_get_offsets(),
+	offset_t*offsets,	/*!< out: array for rec_get_offsets(),
 				must be allocated */
 	ulint	n_alloc)	/*!< in: number of elements */
 	MY_ATTRIBUTE((nonnull));
@@ -707,7 +750,7 @@ UNIV_INLINE
 ulint
 rec_offs_n_fields(
 /*==============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /**********************************************************//**
 The following function returns the data size of a physical
@@ -719,7 +762,7 @@ UNIV_INLINE
 ulint
 rec_offs_data_size(
 /*===============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /**********************************************************//**
 Returns the total size of record minus data size of record.
@@ -730,7 +773,7 @@ UNIV_INLINE
 ulint
 rec_offs_extra_size(
 /*================*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /**********************************************************//**
 Returns the total size of a physical record.
@@ -739,7 +782,7 @@ UNIV_INLINE
 ulint
 rec_offs_size(
 /*==========*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 #ifdef UNIV_DEBUG
 /**********************************************************//**
@@ -750,7 +793,7 @@ byte*
 rec_get_start(
 /*==========*/
 	const rec_t*	rec,	/*!< in: pointer to record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 /**********************************************************//**
 Returns a pointer to the end of the record.
@@ -760,7 +803,7 @@ byte*
 rec_get_end(
 /*========*/
 	const rec_t*	rec,	/*!< in: pointer to record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((warn_unused_result));
 #else /* UNIV_DEBUG */
 # define rec_get_start(rec, offsets) ((rec) - rec_offs_extra_size(offsets))
@@ -777,7 +820,7 @@ rec_t*
 rec_copy(
 	void*		buf,
 	const rec_t*	rec,
-	const ulint*	offsets);
+	const offset_t*	offsets);
 
 /** Determine the size of a data tuple prefix in a temporary file.
 @param[in]	index		clustered or secondary index
@@ -801,7 +844,7 @@ rec_init_offsets_temp(
 /*==================*/
 	const rec_t*		rec,	/*!< in: temporary file record */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in/out: array of offsets;
+	offset_t*		offsets)/*!< in/out: array of offsets;
 					in: n=rec_offs_n_fields(offsets) */
 	MY_ATTRIBUTE((nonnull));
 
@@ -843,7 +886,7 @@ UNIV_INLINE
 ulint
 rec_fold(
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	ulint		n_fields,
 	ulint		n_bytes,
 	index_id_t	tree_id)
@@ -944,7 +987,7 @@ ibool
 rec_validate(
 /*=========*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((nonnull));
 /***************************************************************//**
 Prints an old-style physical record. */
@@ -961,7 +1004,7 @@ rec_print_mbr_rec(
 /*==========*/
 	FILE*		file,	/*!< in: file where to print */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((nonnull));
 /***************************************************************//**
 Prints a physical record. */
@@ -970,7 +1013,7 @@ rec_print_new(
 /*==========*/
 	FILE*		file,	/*!< in: file where to print */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 	MY_ATTRIBUTE((nonnull));
 /***************************************************************//**
 Prints a physical record. */
@@ -992,7 +1035,7 @@ rec_print(
 	std::ostream&	o,
 	const rec_t*	rec,
 	ulint		info,
-	const ulint*	offsets);
+	const offset_t*	offsets);
 
 /** Wrapper for pretty-printing a record */
 struct rec_index_print
@@ -1019,14 +1062,14 @@ operator<<(std::ostream& o, const rec_index_print& r);
 struct rec_offsets_print
 {
 	/** Constructor */
-	rec_offsets_print(const rec_t* rec, const ulint* offsets) :
+	rec_offsets_print(const rec_t* rec, const offset_t* offsets) :
 		m_rec(rec), m_offsets(offsets)
 	{}
 
 	/** Record */
 	const rec_t*		m_rec;
 	/** Offsets to each field */
-	const ulint*		m_offsets;
+	const offset_t*		m_offsets;
 };
 
 /** Display a record.
@@ -1043,7 +1086,7 @@ public:
 	/** Construct a pretty-printed record.
 	@param rec	record with header
 	@param offsets	rec_get_offsets(rec, ...) */
-	rec_printer(const rec_t* rec, const ulint* offsets)
+	rec_printer(const rec_t* rec, const offset_t* offsets)
 		:
 		std::ostringstream ()
 	{
@@ -1056,7 +1099,7 @@ public:
 	@param rec record, possibly lacking header
 	@param info rec_get_info_bits(rec)
 	@param offsets rec_get_offsets(rec, ...) */
-	rec_printer(const rec_t* rec, ulint info, const ulint* offsets)
+	rec_printer(const rec_t* rec, ulint info, const offset_t* offsets)
 		:
 		std::ostringstream ()
 	{
diff --git a/storage/innobase/include/rem0rec.ic b/storage/innobase/include/rem0rec.ic
index 4d2c00de48f..cb62017268c 100644
--- a/storage/innobase/include/rem0rec.ic
+++ b/storage/innobase/include/rem0rec.ic
@@ -30,15 +30,6 @@ Created 5/30/1994 Heikki Tuuri
 #include "dict0boot.h"
 #include "btr0types.h"
 
-/* Compact flag ORed to the extra size returned by rec_get_offsets() */
-#define REC_OFFS_COMPACT	((ulint) 1 << 31)
-/* SQL NULL flag in offsets returned by rec_get_offsets() */
-#define REC_OFFS_SQL_NULL	((ulint) 1 << 31)
-/* External flag in offsets returned by rec_get_offsets() */
-#define REC_OFFS_EXTERNAL	((ulint) 1 << 30)
-/* Mask for offsets returned by rec_get_offsets() */
-#define REC_OFFS_MASK		(REC_OFFS_EXTERNAL - 1)
-
 /* Offsets of the bit-fields in an old-style record. NOTE! In the table the
 most significant bytes and bits are written below less significant.
 
@@ -873,7 +864,7 @@ offsets form. If the field is SQL null, the flag is ORed in the returned
 value.
 @return offset of the start of the field, SQL null flag ORed */
 UNIV_INLINE
-ulint
+uint8_t
 rec_1_get_field_end_info(
 /*=====================*/
 	const rec_t*	rec,	/*!< in: record */
@@ -931,7 +922,7 @@ UNIV_INLINE
 ulint
 rec_offs_get_n_alloc(
 /*=================*/
-	const ulint*	offsets)/*!< in: array for rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array for rec_get_offsets() */
 {
 	ulint	n_alloc;
 	ut_ad(offsets);
@@ -948,13 +939,13 @@ UNIV_INLINE
 void
 rec_offs_set_n_alloc(
 /*=================*/
-	ulint*	offsets,	/*!< out: array for rec_get_offsets(),
+	offset_t*offsets,	/*!< out: array for rec_get_offsets(),
 				must be allocated */
 	ulint	n_alloc)	/*!< in: number of elements */
 {
 	ut_ad(n_alloc > REC_OFFS_HEADER_SIZE);
 	UNIV_MEM_ALLOC(offsets, n_alloc * sizeof *offsets);
-	offsets[0] = n_alloc;
+	offsets[0] = static_cast(n_alloc);
 }
 
 /**********************************************************//**
@@ -964,7 +955,7 @@ UNIV_INLINE
 ulint
 rec_offs_n_fields(
 /*==============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	n_fields;
 	ut_ad(offsets);
@@ -985,22 +976,22 @@ rec_offs_validate(
 /*==============*/
 	const rec_t*		rec,	/*!< in: record or NULL */
 	const dict_index_t*	index,	/*!< in: record descriptor or NULL */
-	const ulint*		offsets)/*!< in: array returned by
+	const offset_t*		offsets)/*!< in: array returned by
 					rec_get_offsets() */
 {
 	ulint	i	= rec_offs_n_fields(offsets);
 	ulint	last	= ULINT_MAX;
-	ulint	comp	= *rec_offs_base(offsets) & REC_OFFS_COMPACT;
+	bool	comp	= rec_offs_base(offsets)[0] & REC_OFFS_COMPACT;
 
 	if (rec) {
-		ut_ad((ulint) rec == offsets[2]);
+		ut_ad(!memcmp(&rec, &offsets[RECORD_OFFSET], sizeof(rec)));
 		if (!comp) {
 			ut_a(rec_get_n_fields_old(rec) >= i);
 		}
 	}
 	if (index) {
 		ulint max_n_fields;
-		ut_ad((ulint) index == offsets[3]);
+		ut_ad(!memcmp(&index, &offsets[INDEX_OFFSET], sizeof(index)));
 		max_n_fields = ut_max(
 			dict_index_get_n_fields(index),
 			dict_index_get_n_unique_in_tree(index) + 1);
@@ -1025,7 +1016,7 @@ rec_offs_validate(
 		ut_a(!index->n_def || i <= max_n_fields);
 	}
 	while (i--) {
-		ulint	curr = rec_offs_base(offsets)[1 + i] & REC_OFFS_MASK;
+		offset_t curr = get_value(rec_offs_base(offsets)[1 + i]);
 		ut_a(curr <= last);
 		last = curr;
 	}
@@ -1041,15 +1032,15 @@ rec_offs_make_valid(
 /*================*/
 	const rec_t*		rec,	/*!< in: record */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in: array returned by
+	offset_t*		offsets)/*!< in: array returned by
 					rec_get_offsets() */
 {
 	ut_ad(rec);
 	ut_ad(index);
 	ut_ad(offsets);
 	ut_ad(rec_get_n_fields(rec, index) >= rec_offs_n_fields(offsets));
-	offsets[2] = (ulint) rec;
-	offsets[3] = (ulint) index;
+	memcpy(&offsets[RECORD_OFFSET], &rec, sizeof(rec));
+	memcpy(&offsets[INDEX_OFFSET], &index, sizeof(index));
 }
 #endif /* UNIV_DEBUG */
 
@@ -1058,34 +1049,26 @@ The following function is used to get an offset to the nth
 data field in a record.
 @return offset from the origin of rec */
 UNIV_INLINE
-ulint
+offset_t
 rec_get_nth_field_offs(
 /*===================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n,	/*!< in: index of the field */
 	ulint*		len)	/*!< out: length of the field; UNIV_SQL_NULL
 				if SQL null */
 {
-	ulint	offs;
-	ulint	length;
 	ut_ad(n < rec_offs_n_fields(offsets));
 
-	if (n == 0) {
-		offs = 0;
-	} else {
-		offs = rec_offs_base(offsets)[n] & REC_OFFS_MASK;
-	}
-
-	length = rec_offs_base(offsets)[1 + n];
+	offset_t offs = n == 0 ? 0 : get_value(rec_offs_base(offsets)[n]);
+	offset_t next_offs = rec_offs_base(offsets)[1 + n];
 
-	if (length & REC_OFFS_SQL_NULL) {
-		length = UNIV_SQL_NULL;
+	if (get_type(next_offs) == SQL_NULL) {
+		*len = UNIV_SQL_NULL;
 	} else {
-		length &= REC_OFFS_MASK;
-		length -= offs;
+
+		*len = get_value(next_offs) - offs;
 	}
 
-	*len = length;
 	return(offs);
 }
 
@@ -1097,7 +1080,7 @@ UNIV_INLINE
 ulint
 rec_offs_comp(
 /*==========*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
 	return(*rec_offs_base(offsets) & REC_OFFS_COMPACT);
@@ -1111,7 +1094,7 @@ UNIV_INLINE
 ulint
 rec_offs_any_extern(
 /*================*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
 	return(*rec_offs_base(offsets) & REC_OFFS_EXTERNAL);
@@ -1125,7 +1108,7 @@ const byte*
 rec_offs_any_null_extern(
 /*=====================*/
 	const rec_t*	rec,		/*!< in: record */
-	const ulint*	offsets)	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets)	/*!< in: rec_get_offsets(rec) */
 {
 	ulint	i;
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
@@ -1160,12 +1143,12 @@ UNIV_INLINE
 ulint
 rec_offs_nth_extern(
 /*================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 {
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
 	ut_ad(n < rec_offs_n_fields(offsets));
-	return(rec_offs_base(offsets)[1 + n] & REC_OFFS_EXTERNAL);
+	return get_type(rec_offs_base(offsets)[1 + n]) == STORED_OFFPAGE;
 }
 
 /******************************************************//**
@@ -1175,12 +1158,12 @@ UNIV_INLINE
 ulint
 rec_offs_nth_sql_null(
 /*==================*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 {
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
 	ut_ad(n < rec_offs_n_fields(offsets));
-	return(rec_offs_base(offsets)[1 + n] & REC_OFFS_SQL_NULL);
+	return get_type(rec_offs_base(offsets)[1 + n]) == SQL_NULL;
 }
 
 /******************************************************//**
@@ -1190,16 +1173,16 @@ UNIV_INLINE
 ulint
 rec_offs_nth_size(
 /*==============*/
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n)	/*!< in: nth field */
 {
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
 	ut_ad(n < rec_offs_n_fields(offsets));
 	if (!n) {
-		return(rec_offs_base(offsets)[1 + n] & REC_OFFS_MASK);
+		return get_value(rec_offs_base(offsets)[1 + n]);
 	}
-	return((rec_offs_base(offsets)[1 + n] - rec_offs_base(offsets)[n])
-	       & REC_OFFS_MASK);
+	return get_value((rec_offs_base(offsets)[1 + n]))
+	       - get_value(rec_offs_base(offsets)[n]);
 }
 
 /******************************************************//**
@@ -1209,7 +1192,7 @@ UNIV_INLINE
 ulint
 rec_offs_n_extern(
 /*==============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	n = 0;
 
@@ -1407,7 +1390,7 @@ void
 rec_set_nth_field(
 /*==============*/
 	rec_t*		rec,	/*!< in: record */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		n,	/*!< in: index number of the field */
 	const void*	data,	/*!< in: pointer to the data
 				if not SQL null */
@@ -1462,16 +1445,16 @@ UNIV_INLINE
 void
 rec_offs_set_n_fields(
 /*==================*/
-	ulint*	offsets,	/*!< in/out: array returned by
+	offset_t*	offsets,	/*!< in/out: array returned by
 				rec_get_offsets() */
-	ulint	n_fields)	/*!< in: number of fields */
+	ulint		n_fields)	/*!< in: number of fields */
 {
 	ut_ad(offsets);
 	ut_ad(n_fields > 0);
 	ut_ad(n_fields <= REC_MAX_N_FIELDS);
 	ut_ad(n_fields + REC_OFFS_HEADER_SIZE
 	      <= rec_offs_get_n_alloc(offsets));
-	offsets[1] = n_fields;
+	offsets[1] = static_cast(n_fields);
 }
 
 /**********************************************************//**
@@ -1484,13 +1467,12 @@ UNIV_INLINE
 ulint
 rec_offs_data_size(
 /*===============*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	size;
 
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
-	size = rec_offs_base(offsets)[rec_offs_n_fields(offsets)]
-		& REC_OFFS_MASK;
+	size = get_value(rec_offs_base(offsets)[rec_offs_n_fields(offsets)]);
 	ut_ad(size < UNIV_PAGE_SIZE);
 	return(size);
 }
@@ -1504,7 +1486,7 @@ UNIV_INLINE
 ulint
 rec_offs_extra_size(
 /*================*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	size;
 	ut_ad(rec_offs_validate(NULL, NULL, offsets));
@@ -1520,7 +1502,7 @@ UNIV_INLINE
 ulint
 rec_offs_size(
 /*==========*/
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	return(rec_offs_data_size(offsets) + rec_offs_extra_size(offsets));
 }
@@ -1534,7 +1516,7 @@ byte*
 rec_get_end(
 /*========*/
 	const rec_t*	rec,	/*!< in: pointer to record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
 	return(const_cast(rec + rec_offs_data_size(offsets)));
@@ -1548,7 +1530,7 @@ byte*
 rec_get_start(
 /*==========*/
 	const rec_t*	rec,	/*!< in: pointer to record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
 	return(const_cast(rec - rec_offs_extra_size(offsets)));
@@ -1565,7 +1547,7 @@ rec_t*
 rec_copy(
 	void*		buf,
 	const rec_t*	rec,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	ulint	extra_len;
 	ulint	data_len;
@@ -1696,7 +1678,7 @@ UNIV_INLINE
 ulint
 rec_fold(
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	ulint		n_fields,
 	ulint		n_bytes,
 	index_id_t	tree_id)
diff --git a/storage/innobase/include/rem0types.h b/storage/innobase/include/rem0types.h
index cc59bd91076..4482517fc4e 100644
--- a/storage/innobase/include/rem0types.h
+++ b/storage/innobase/include/rem0types.h
@@ -1,6 +1,7 @@
 /*****************************************************************************
 
 Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 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
@@ -29,6 +30,9 @@ Created 5/30/1994 Heikki Tuuri
 /* We define the physical record simply as an array of bytes */
 typedef byte	rec_t;
 
+/** This type represents a field offset in a rec_t* */
+typedef unsigned short int offset_t;
+
 /* Maximum values for various fields (for non-blob tuples) */
 #define REC_MAX_N_FIELDS	(1024 - 1)
 #define REC_MAX_HEAP_NO		(2 * 8192 - 1)
diff --git a/storage/innobase/include/row0ftsort.h b/storage/innobase/include/row0ftsort.h
index 1c1357e330b..73f815604d8 100644
--- a/storage/innobase/include/row0ftsort.h
+++ b/storage/innobase/include/row0ftsort.h
@@ -30,6 +30,7 @@ Created 10/13/2010 Jimmy Yang
 #include "data0data.h"
 #include "fts0fts.h"
 #include "fts0priv.h"
+#include "rem0types.h"
 #include "row0merge.h"
 #include "btr0bulk.h"
 
@@ -247,7 +248,7 @@ row_merge_fts_sel_propagate(
 	int*		sel_tree,	/*rec, index) */
 	mtr_t*			mtr)	/*!< in: mini-transaction handle
 					or NULL */
diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc
index e316c8b1568..61ebbc3d140 100644
--- a/storage/innobase/page/page0page.cc
+++ b/storage/innobase/page/page0page.cc
@@ -36,6 +36,7 @@ Created 2/2/1994 Heikki Tuuri
 #include "fut0lst.h"
 #include "btr0sea.h"
 #include "trx0sys.h"
+#include 
 
 /*			THE INDEX PAGE
 			==============
@@ -582,8 +583,8 @@ page_copy_rec_list_end_no_locks(
 	page_cur_t	cur1;
 	rec_t*		cur2;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	page_cur_position(rec, block, &cur1);
@@ -814,8 +815,8 @@ page_copy_rec_list_start(
 	rtr_rec_move_t*	rec_move	= NULL;
 	rec_t*		ret
 		= page_rec_get_prev(page_get_supremum_rec(new_page));
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	/* Here, "ret" may be pointing to a user record or the
@@ -1049,8 +1050,8 @@ page_delete_rec_list_end(
 	page_zip_des_t*	page_zip	= buf_block_get_page_zip(block);
 	page_t*		page		= page_align(rec);
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(size == ULINT_UNDEFINED || size < UNIV_PAGE_SIZE);
@@ -1250,8 +1251,8 @@ page_delete_rec_list_start(
 	mtr_t*		mtr)	/*!< in: mtr */
 {
 	page_cur_t	cur1;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	mem_heap_t*	heap		= NULL;
 
 	rec_offs_init(offsets_);
@@ -1738,7 +1739,7 @@ void
 page_rec_print(
 /*===========*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: record descriptor */
+	const offset_t*	offsets)/*!< in: record descriptor */
 {
 	ut_a(!page_rec_is_comp(rec) == !rec_offs_comp(offsets));
 	rec_print_new(stderr, rec, offsets);
@@ -1813,8 +1814,8 @@ page_print_list(
 	ulint		count;
 	ulint		n_recs;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_a((ibool)!!page_is_comp(page) == dict_table_is_comp(index->table));
@@ -1924,7 +1925,7 @@ ibool
 page_rec_validate(
 /*==============*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint		n_owned;
 	ulint		heap_no;
@@ -2420,8 +2421,13 @@ page_validate(
 	ulint			n_slots;
 	ibool			ret		= FALSE;
 	ulint			i;
-	ulint*			offsets		= NULL;
-	ulint*			old_offsets	= NULL;
+	offset_t		offsets_1[REC_OFFS_NORMAL_SIZE];
+	offset_t		offsets_2[REC_OFFS_NORMAL_SIZE];
+	offset_t*		offsets		= offsets_1;
+	offset_t*		old_offsets	= offsets_2;
+
+	rec_offs_init(offsets_1);
+	rec_offs_init(offsets_2);
 
 #ifdef UNIV_GIS_DEBUG
 	if (dict_index_is_spatial(index)) {
@@ -2644,11 +2650,7 @@ page_validate(
 		}
 
 		/* set old_offsets to offsets; recycle offsets */
-		{
-			ulint* offs = old_offsets;
-			old_offsets = offsets;
-			offsets = offs;
-		}
+		std::swap(old_offsets, offsets);
 	}
 
 	if (page_is_comp(page)) {
@@ -2813,7 +2815,7 @@ page_delete_rec(
 	page_cur_t*		pcur,	/*!< in/out: page cursor on record
 					to delete */
 	page_zip_des_t*		page_zip,/*!< in: compressed page descriptor */
-	const ulint*		offsets)/*!< in: offsets for record */
+	const offset_t*		offsets)/*!< in: offsets for record */
 {
 	bool		no_compress_needed;
 	buf_block_t*	block = pcur->block;
diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc
index d6abec57821..b466a0464f8 100644
--- a/storage/innobase/page/page0zip.cc
+++ b/storage/innobase/page/page0zip.cc
@@ -880,7 +880,7 @@ page_zip_compress_node_ptrs(
 	mem_heap_t*	heap)		/*!< in: temporary memory heap */
 {
 	int	err	= Z_OK;
-	ulint*	offsets = NULL;
+	offset_t* offsets = NULL;
 
 	do {
 		const rec_t*	rec = *recs++;
@@ -985,7 +985,7 @@ page_zip_compress_clust_ext(
 	FILE_LOGFILE
 	z_stream*	c_stream,	/*!< in/out: compressed page stream */
 	const rec_t*	rec,		/*!< in: record */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec) */
 	ulint		trx_id_col,	/*!< in: position of of DB_TRX_ID */
 	byte*		deleted,	/*!< in: dense directory entry pointing
 					to the head of the free list */
@@ -1124,7 +1124,7 @@ page_zip_compress_clust(
 	mem_heap_t*	heap)		/*!< in: temporary memory heap */
 {
 	int	err		= Z_OK;
-	ulint*	offsets		= NULL;
+	offset_t* offsets		= NULL;
 	/* BTR_EXTERN_FIELD_REF storage */
 	byte*	externs		= storage - n_dense
 		* (DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN);
@@ -1984,7 +1984,7 @@ const byte*
 page_zip_apply_log_ext(
 /*===================*/
 	rec_t*		rec,		/*!< in/out: record */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec) */
 	ulint		trx_id_col,	/*!< in: position of of DB_TRX_ID */
 	const byte*	data,		/*!< in: modification log */
 	const byte*	end)		/*!< in: end of modification log */
@@ -2085,7 +2085,7 @@ page_zip_apply_log(
 				/*!< in: heap_no and status bits for
 				the next record to uncompress */
 	dict_index_t*	index,	/*!< in: index of the page */
-	ulint*		offsets)/*!< in/out: work area for
+	offset_t*	offsets)/*!< in/out: work area for
 				rec_get_offsets_reverse() */
 {
 	const byte* const end = data + size;
@@ -2153,7 +2153,7 @@ page_zip_apply_log(
 		if (val & 1) {
 			/* Clear the data bytes of the record. */
 			mem_heap_t*	heap	= NULL;
-			ulint*		offs;
+			offset_t*	offs;
 			offs = rec_get_offsets(rec, index, offsets, is_leaf,
 					       ULINT_UNDEFINED, &heap);
 			memset(rec, 0, rec_offs_data_size(offs));
@@ -2305,7 +2305,7 @@ page_zip_decompress_node_ptrs(
 					sorted by address */
 	ulint		n_dense,	/*!< in: size of recs[] */
 	dict_index_t*	index,		/*!< in: the index of the page */
-	ulint*		offsets,	/*!< in/out: temporary offsets */
+	offset_t*	offsets,	/*!< in/out: temporary offsets */
 	mem_heap_t*	heap)		/*!< in: temporary memory heap */
 {
 	ulint		heap_status = REC_STATUS_NODE_PTR
@@ -2494,7 +2494,7 @@ page_zip_decompress_sec(
 					sorted by address */
 	ulint		n_dense,	/*!< in: size of recs[] */
 	dict_index_t*	index,		/*!< in: the index of the page */
-	ulint*		offsets)	/*!< in/out: temporary offsets */
+	offset_t*	offsets)	/*!< in/out: temporary offsets */
 {
 	ulint	heap_status	= REC_STATUS_ORDINARY
 		| PAGE_HEAP_NO_USER_LOW << REC_HEAP_NO_SHIFT;
@@ -2626,7 +2626,7 @@ page_zip_decompress_clust_ext(
 /*==========================*/
 	z_stream*	d_stream,	/*!< in/out: compressed page stream */
 	rec_t*		rec,		/*!< in/out: record */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec) */
 	ulint		trx_id_col)	/*!< in: position of of DB_TRX_ID */
 {
 	ulint	i;
@@ -2741,7 +2741,7 @@ page_zip_decompress_clust(
 	ulint		n_dense,	/*!< in: size of recs[] */
 	dict_index_t*	index,		/*!< in: the index of the page */
 	ulint		trx_id_col,	/*!< index of the trx_id column */
-	ulint*		offsets,	/*!< in/out: temporary offsets */
+	offset_t*	offsets,	/*!< in/out: temporary offsets */
 	mem_heap_t*	heap)		/*!< in: temporary memory heap */
 {
 	int		err;
@@ -3044,7 +3044,7 @@ page_zip_decompress_low(
 	ulint		n_dense;/* number of user records on the page */
 	ulint		trx_id_col = ULINT_UNDEFINED;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	ut_ad(page_zip_simple_validate(page_zip));
 	UNIV_MEM_ASSERT_W(page, UNIV_PAGE_SIZE);
@@ -3168,7 +3168,7 @@ zlib_error:
 		ulint	n = 1 + 1/* node ptr */ + REC_OFFS_HEADER_SIZE
 			+ dict_index_get_n_fields(index);
 
-		offsets = static_cast(
+		offsets = static_cast(
 			mem_heap_alloc(heap, n * sizeof(ulint)));
 
 		*offsets = n;
@@ -3395,7 +3395,7 @@ page_zip_validate_low(
 		committed.  Let us tolerate that difference when we
 		are performing a sloppy validation. */
 
-		ulint*		offsets;
+		offset_t*	offsets;
 		mem_heap_t*	heap;
 		const rec_t*	rec;
 		const rec_t*	trec;
@@ -3562,7 +3562,7 @@ page_zip_write_rec_ext(
 	const page_t*	page,		/*!< in: page containing rec */
 	const byte*	rec,		/*!< in: record being written */
 	dict_index_t*	index,		/*!< in: record descriptor */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index) */
 	ulint		create,		/*!< in: nonzero=insert, zero=update */
 	ulint		trx_id_col,	/*!< in: position of DB_TRX_ID */
 	ulint		heap_no,	/*!< in: heap number of rec */
@@ -3681,7 +3681,7 @@ page_zip_write_rec(
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page */
 	const byte*	rec,	/*!< in: record being written */
 	dict_index_t*	index,	/*!< in: the index the record belongs to */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		create)	/*!< in: nonzero=insert, zero=update */
 {
 	const page_t*	page;
@@ -3931,7 +3931,7 @@ page_zip_write_blob_ptr(
 	const byte*	rec,	/*!< in/out: record whose data is being
 				written */
 	dict_index_t*	index,	/*!< in: index of the page */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		n,	/*!< in: column index */
 	mtr_t*		mtr)	/*!< in: mini-transaction handle,
 				or NULL if no logging is needed */
@@ -4149,7 +4149,7 @@ page_zip_write_trx_id_and_roll_ptr(
 /*===============================*/
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page */
 	byte*		rec,	/*!< in/out: record */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint		trx_id_col,/*!< in: column number of TRX_ID in rec */
 	trx_id_t	trx_id,	/*!< in: transaction identifier */
 	roll_ptr_t	roll_ptr)/*!< in: roll_ptr */
@@ -4216,7 +4216,7 @@ page_zip_clear_rec(
 	page_zip_des_t*	page_zip,	/*!< in/out: compressed page */
 	byte*		rec,		/*!< in: record to clear */
 	const dict_index_t*	index,	/*!< in: index of rec */
-	const ulint*	offsets)	/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets)	/*!< in: rec_get_offsets(rec, index) */
 {
 	ulint	heap_no;
 	page_t*	page	= page_align(rec);
@@ -4422,7 +4422,7 @@ page_zip_dir_delete(
 	page_zip_des_t*		page_zip,	/*!< in/out: compressed page */
 	byte*			rec,		/*!< in: deleted record */
 	const dict_index_t*	index,		/*!< in: index of rec */
-	const ulint*		offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*		offsets,	/*!< in: rec_get_offsets(rec) */
 	const byte*		free)		/*!< in: previous start of
 						the free list */
 {
diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc
index 9449274321e..48927b02963 100644
--- a/storage/innobase/rem/rem0cmp.cc
+++ b/storage/innobase/rem/rem0cmp.cc
@@ -546,7 +546,7 @@ cmp_dtuple_rec_with_gis(
 				dtuple in some of the common fields, or which
 				has an equal number or more fields than
 				dtuple */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	page_cur_mode_t	mode)	/*!< in: compare mode */
 {
 	const dfield_t*	dtuple_field;	/* current field in logical record */
@@ -579,7 +579,7 @@ int
 cmp_dtuple_rec_with_gis_internal(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	const dfield_t*	dtuple_field;	/* current field in logical record */
 	ulint		dtuple_f_len;	/* the length of the current field
@@ -650,7 +650,7 @@ int
 cmp_dtuple_rec_with_match_low(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	ulint		n_cmp,
 	ulint*		matched_fields)
 {
@@ -779,7 +779,7 @@ cmp_dtuple_rec_with_match_bytes(
 	const dtuple_t*		dtuple,
 	const rec_t*		rec,
 	const dict_index_t*	index,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	ulint*			matched_fields,
 	ulint*			matched_bytes)
 {
@@ -942,7 +942,7 @@ int
 cmp_dtuple_rec(
 	const dtuple_t*	dtuple,
 	const rec_t*	rec,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	ulint	matched_fields	= 0;
 
@@ -960,7 +960,7 @@ cmp_dtuple_is_prefix_of_rec(
 /*========================*/
 	const dtuple_t*	dtuple,	/*!< in: data tuple */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	n_fields;
 	ulint	matched_fields	= 0;
@@ -988,8 +988,8 @@ cmp_rec_rec_simple_field(
 /*=====================*/
 	const rec_t*		rec1,	/*!< in: physical record */
 	const rec_t*		rec2,	/*!< in: physical record */
-	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
-	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+	const offset_t*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+	const offset_t*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
 	const dict_index_t*	index,	/*!< in: data dictionary index */
 	ulint			n)	/*!< in: field to compare */
 {
@@ -1019,8 +1019,8 @@ cmp_rec_rec_simple(
 /*===============*/
 	const rec_t*		rec1,	/*!< in: physical record */
 	const rec_t*		rec2,	/*!< in: physical record */
-	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
-	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
+	const offset_t*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
+	const offset_t*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
 	const dict_index_t*	index,	/*!< in: data dictionary index */
 	struct TABLE*		table)	/*!< in: MySQL table, for reporting
 					duplicate key value if applicable,
@@ -1105,8 +1105,8 @@ int
 cmp_rec_rec_with_match(
 	const rec_t*		rec1,
 	const rec_t*		rec2,
-	const ulint*		offsets1,
-	const ulint*		offsets2,
+	const offset_t*		offsets1,
+	const offset_t*		offsets2,
 	const dict_index_t*	index,
 	bool			nulls_unequal,
 	ulint*			matched_fields)
diff --git a/storage/innobase/rem/rem0rec.cc b/storage/innobase/rem/rem0rec.cc
index b0fb4e0f113..1d7f9880240 100644
--- a/storage/innobase/rem/rem0rec.cc
+++ b/storage/innobase/rem/rem0rec.cc
@@ -242,12 +242,12 @@ rec_init_offsets_comp_ordinary(
 					format for temporary files in
 					index creation */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in/out: array of offsets;
+	offset_t*		offsets)/*!< in/out: array of offsets;
 					in: n=rec_offs_n_fields(offsets) */
 {
 	ulint		i		= 0;
-	ulint		offs		= 0;
-	ulint		any_ext		= 0;
+	offset_t	offs		= 0;
+	offset_t	any_ext		= 0;
 	ulint		n_null		= index->n_nullable;
 	const byte*	nulls		= temp
 		? rec - 1
@@ -259,8 +259,8 @@ rec_init_offsets_comp_ordinary(
 	/* We cannot invoke rec_offs_make_valid() here if temp=true.
 	Similarly, rec_offs_validate() will fail in that case, because
 	it invokes rec_get_status(). */
-	offsets[2] = (ulint) rec;
-	offsets[3] = (ulint) index;
+	memcpy(&offsets[RECORD_OFFSET], &rec, sizeof(rec));
+	memcpy(&offsets[INDEX_OFFSET], &index, sizeof(index));
 #endif /* UNIV_DEBUG */
 
 	ut_ad(temp || dict_table_is_comp(index->table));
@@ -277,7 +277,7 @@ rec_init_offsets_comp_ordinary(
 			= dict_index_get_nth_field(index, i);
 		const dict_col_t*	col
 			= dict_field_get_col(field);
-		ulint			len;
+		offset_t		len;
 
 		if (!(col->prtype & DATA_NOT_NULL)) {
 			/* nullable field => read the null flag */
@@ -294,7 +294,7 @@ rec_init_offsets_comp_ordinary(
 				We do not advance offs, and we set
 				the length to zero and enable the
 				SQL NULL flag in offsets[]. */
-				len = offs | REC_OFFS_SQL_NULL;
+				len = combine(offs, SQL_NULL);
 				goto resolved;
 			}
 			null_mask <<= 1;
@@ -317,14 +317,14 @@ rec_init_offsets_comp_ordinary(
 					len <<= 8;
 					len |= *lens--;
 
-					offs += len & 0x3fff;
+					offs += get_value(len);
 					if (UNIV_UNLIKELY(len
 							  & 0x4000)) {
 						ut_ad(dict_index_is_clust
 						      (index));
 						any_ext = REC_OFFS_EXTERNAL;
-						len = offs
-							| REC_OFFS_EXTERNAL;
+						len = combine(offs,
+							      STORED_OFFPAGE);
 					} else {
 						len = offs;
 					}
@@ -341,8 +341,8 @@ resolved:
 		rec_offs_base(offsets)[i + 1] = len;
 	} while (++i < rec_offs_n_fields(offsets));
 
-	*rec_offs_base(offsets)
-		= (rec - (lens + 1)) | REC_OFFS_COMPACT | any_ext;
+	*rec_offs_base(offsets) = static_cast(rec - (lens + 1))
+				  | REC_OFFS_COMPACT | any_ext;
 }
 
 /******************************************************//**
@@ -355,21 +355,20 @@ to the extra size (if REC_OFFS_COMPACT is set, the record is in the
 new format; if REC_OFFS_EXTERNAL is set, the record contains externally
 stored columns), and rec_offs_base(offsets)[1..n_fields] will be set to
 offsets past the end of fields 0..n_fields, or to the beginning of
-fields 1..n_fields+1.  When the high-order bit of the offset at [i+1]
-is set (REC_OFFS_SQL_NULL), the field i is NULL.  When the second
-high-order bit of the offset at [i+1] is set (REC_OFFS_EXTERNAL), the
-field i is being stored externally. */
+fields 1..n_fields+1.  When the type of the offset at [i+1]
+is (SQL_NULL), the field i is NULL. When the type of the offset at [i+1]
+is (STORED_OFFPAGE), the field i is stored externally. */
 static
 void
 rec_init_offsets(
 /*=============*/
 	const rec_t*		rec,	/*!< in: physical record */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in/out: array of offsets;
+	offset_t*		offsets)/*!< in/out: array of offsets;
 					in: n=rec_offs_n_fields(offsets) */
 {
 	ulint	i	= 0;
-	ulint	offs;
+	offset_t	offs;
 
 	rec_offs_make_valid(rec, index, offsets);
 
@@ -407,7 +406,7 @@ rec_init_offsets(
 
 		/* read the lengths of fields 0..n */
 		do {
-			ulint	len;
+			offset_t len;
 			if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
 				len = offs += REC_NODE_PTR_SIZE;
 				goto resolved;
@@ -429,7 +428,7 @@ rec_init_offsets(
 					We do not advance offs, and we set
 					the length to zero and enable the
 					SQL NULL flag in offsets[]. */
-					len = offs | REC_OFFS_SQL_NULL;
+					len = combine(offs, SQL_NULL);
 					goto resolved;
 				}
 				null_mask <<= 1;
@@ -461,7 +460,7 @@ rec_init_offsets(
 						stored columns.  Thus
 						the "e" flag must be 0. */
 						ut_a(!(len & 0x4000));
-						offs += len & 0x3fff;
+						offs += get_value(len);
 						len = offs;
 
 						goto resolved;
@@ -476,8 +475,8 @@ resolved:
 			rec_offs_base(offsets)[i + 1] = len;
 		} while (++i < rec_offs_n_fields(offsets));
 
-		*rec_offs_base(offsets)
-			= (rec - (lens + 1)) | REC_OFFS_COMPACT;
+		*rec_offs_base(offsets) = static_cast(
+			(rec - (lens + 1)) | REC_OFFS_COMPACT);
 	} else {
 		/* Old-style record: determine extra size and end offsets */
 		offs = REC_N_OLD_EXTRA_BYTES;
@@ -489,23 +488,25 @@ resolved:
 				offs = rec_1_get_field_end_info(rec, i);
 				if (offs & REC_1BYTE_SQL_NULL_MASK) {
 					offs &= ~REC_1BYTE_SQL_NULL_MASK;
-					offs |= REC_OFFS_SQL_NULL;
+					set_type(offs, SQL_NULL);
 				}
 				rec_offs_base(offsets)[1 + i] = offs;
 			} while (++i < rec_offs_n_fields(offsets));
 		} else {
-			offs += 2 * rec_offs_n_fields(offsets);
+			offs += 2
+				* static_cast(
+					rec_offs_n_fields(offsets));
 			*rec_offs_base(offsets) = offs;
 			/* Determine offsets to fields */
 			do {
 				offs = rec_2_get_field_end_info(rec, i);
 				if (offs & REC_2BYTE_SQL_NULL_MASK) {
 					offs &= ~REC_2BYTE_SQL_NULL_MASK;
-					offs |= REC_OFFS_SQL_NULL;
+					set_type(offs, SQL_NULL);
 				}
 				if (offs & REC_2BYTE_EXTERN_MASK) {
 					offs &= ~REC_2BYTE_EXTERN_MASK;
-					offs |= REC_OFFS_EXTERNAL;
+					set_type(offs, STORED_OFFPAGE);
 					*rec_offs_base(offsets) |= REC_OFFS_EXTERNAL;
 				}
 				rec_offs_base(offsets)[1 + i] = offs;
@@ -524,11 +525,11 @@ resolved:
 				(ULINT_UNDEFINED to compute all offsets)
 @param[in,out]	heap		memory heap
 @return the new offsets */
-ulint*
+offset_t*
 rec_get_offsets_func(
 	const rec_t*		rec,
 	const dict_index_t*	index,
-	ulint*			offsets,
+	offset_t*		offsets,
 #ifdef UNIV_DEBUG
 	bool			leaf,
 #endif /* UNIV_DEBUG */
@@ -606,11 +607,11 @@ rec_get_offsets_func(
 	if (UNIV_UNLIKELY(!offsets)
 	    || UNIV_UNLIKELY(rec_offs_get_n_alloc(offsets) < size)) {
 		if (UNIV_UNLIKELY(!*heap)) {
-			*heap = mem_heap_create_at(size * sizeof(ulint),
+			*heap = mem_heap_create_at(size * sizeof(*offsets),
 						   file, line);
 		}
-		offsets = static_cast(
-			mem_heap_alloc(*heap, size * sizeof(ulint)));
+		offsets = static_cast(
+			mem_heap_alloc(*heap, size * sizeof(*offsets)));
 
 		rec_offs_set_n_alloc(offsets, size);
 	}
@@ -633,13 +634,13 @@ rec_get_offsets_reverse(
 	const dict_index_t*	index,	/*!< in: record descriptor */
 	ulint			node_ptr,/*!< in: nonzero=node pointer,
 					0=leaf node */
-	ulint*			offsets)/*!< in/out: array consisting of
+	offset_t*		offsets)/*!< in/out: array consisting of
 					offsets[0] allocated elements */
 {
 	ulint		n;
 	ulint		i;
-	ulint		offs;
-	ulint		any_ext;
+	offset_t	offs;
+	offset_t	any_ext = 0;
 	const byte*	nulls;
 	const byte*	lens;
 	dict_field_t*	field;
@@ -664,11 +665,10 @@ rec_get_offsets_reverse(
 	lens = nulls + UT_BITS_IN_BYTES(index->n_nullable);
 	i = offs = 0;
 	null_mask = 1;
-	any_ext = 0;
 
 	/* read the lengths of fields 0..n */
 	do {
-		ulint	len;
+		offset_t len;
 		if (UNIV_UNLIKELY(i == n_node_ptr_field)) {
 			len = offs += REC_NODE_PTR_SIZE;
 			goto resolved;
@@ -689,7 +689,7 @@ rec_get_offsets_reverse(
 				We do not advance offs, and we set
 				the length to zero and enable the
 				SQL NULL flag in offsets[]. */
-				len = offs | REC_OFFS_SQL_NULL;
+				len = combine(offs, SQL_NULL);
 				goto resolved;
 			}
 			null_mask <<= 1;
@@ -713,10 +713,11 @@ rec_get_offsets_reverse(
 					len <<= 8;
 					len |= *lens++;
 
-					offs += len & 0x3fff;
+					offs += get_value(len);
 					if (UNIV_UNLIKELY(len & 0x4000)) {
 						any_ext = REC_OFFS_EXTERNAL;
-						len = offs | REC_OFFS_EXTERNAL;
+						len = combine(offs,
+							      STORED_OFFPAGE);
 					} else {
 						len = offs;
 					}
@@ -727,15 +728,16 @@ rec_get_offsets_reverse(
 
 			len = offs += len;
 		} else {
-			len = offs += field->fixed_len;
+			len = offs += static_cast(field->fixed_len);
 		}
 resolved:
 		rec_offs_base(offsets)[i + 1] = len;
 	} while (++i < rec_offs_n_fields(offsets));
 
 	ut_ad(lens >= extra);
-	*rec_offs_base(offsets) = (lens - extra + REC_N_NEW_EXTRA_BYTES)
-		| REC_OFFS_COMPACT | any_ext;
+	*rec_offs_base(offsets)
+		= static_cast((lens - extra + REC_N_NEW_EXTRA_BYTES)
+					| REC_OFFS_COMPACT | any_ext);
 }
 
 /************************************************************//**
@@ -1397,7 +1399,7 @@ rec_init_offsets_temp(
 /*==================*/
 	const rec_t*		rec,	/*!< in: temporary file record */
 	const dict_index_t*	index,	/*!< in: record descriptor */
-	ulint*			offsets)/*!< in/out: array of offsets;
+	offset_t*		offsets)/*!< in/out: array of offsets;
 					in: n=rec_offs_n_fields(offsets) */
 {
 	rec_init_offsets_comp_ordinary(rec, true, index, offsets);
@@ -1436,8 +1438,8 @@ rec_copy_prefix_to_dtuple_func(
 	ulint			n_fields,
 	mem_heap_t*		heap)
 {
-	ulint	offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*	offsets	= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets	= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(is_leaf || n_fields
@@ -1697,7 +1699,7 @@ ibool
 rec_validate(
 /*=========*/
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint		len;
 	ulint		n_fields;
@@ -1799,7 +1801,7 @@ rec_print_comp(
 /*===========*/
 	FILE*		file,	/*!< in: file where to print */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ulint	i;
 
@@ -1919,7 +1921,7 @@ rec_print_mbr_rec(
 /*==============*/
 	FILE*		file,	/*!< in: file where to print */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
 
@@ -1986,7 +1988,7 @@ rec_print_new(
 /*==========*/
 	FILE*		file,	/*!< in: file where to print */
 	const rec_t*	rec,	/*!< in: physical record */
-	const ulint*	offsets)/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets)/*!< in: array returned by rec_get_offsets() */
 {
 	ut_ad(rec_offs_validate(rec, NULL, offsets));
 
@@ -2026,7 +2028,7 @@ rec_print(
 		return;
 	} else {
 		mem_heap_t*	heap	= NULL;
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+		offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
 		rec_offs_init(offsets_);
 
 		rec_print_new(file, rec,
@@ -2049,7 +2051,7 @@ rec_print(
 	std::ostream&	o,
 	const rec_t*	rec,
 	ulint		info,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	const ulint	comp	= rec_offs_comp(offsets);
 	const ulint	n	= rec_offs_n_fields(offsets);
@@ -2101,7 +2103,7 @@ std::ostream&
 operator<<(std::ostream& o, const rec_index_print& r)
 {
 	mem_heap_t*	heap	= NULL;
-	ulint*		offsets	= rec_get_offsets(
+	offset_t*	offsets	= rec_get_offsets(
 		r.m_rec, r.m_index, NULL, page_rec_is_leaf(r.m_rec),
 		ULINT_UNDEFINED, &heap);
 	rec_print(o, r.m_rec,
@@ -2139,9 +2141,9 @@ rec_get_trx_id(
 	const byte*	trx_id;
 	ulint		len;
 	mem_heap_t*	heap		= NULL;
-	ulint offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
+	offset_t offsets_[REC_OFFS_HEADER_SIZE + MAX_REF_PARTS + 2];
 	rec_offs_init(offsets_);
-	ulint* offsets = offsets_;
+	offset_t* offsets = offsets_;
 
 	ut_ad(trx_id_col <= MAX_REF_PARTS);
 	ut_ad(dict_index_is_clust(index));
@@ -2168,11 +2170,11 @@ rec_get_trx_id(
 @param[in]	n		nth field */
 void
 rec_offs_make_nth_extern(
-	ulint*		offsets,
+	offset_t*	offsets,
 	const ulint	n)
 {
 	ut_ad(!rec_offs_nth_sql_null(offsets, n));
-	rec_offs_base(offsets)[1 + n] |= REC_OFFS_EXTERNAL;
+	set_type(rec_offs_base(offsets)[1 +n ], STORED_OFFPAGE);
 }
 #ifdef WITH_WSREP
 # include "ha_prototypes.h"
@@ -2192,8 +2194,8 @@ wsrep_rec_get_foreign_key(
 	ulint		i;
 	uint            key_parts;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-        const ulint*    offsets;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	const offset_t* offsets;
 
 	ut_ad(index_for);
 	ut_ad(index_ref);
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index 2b751170886..68ac044416f 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -1371,7 +1371,7 @@ row_fts_sel_tree_propagate(
 	int		propogated,	/*(mem_heap_zalloc(
+		offsets[i] = static_cast(mem_heap_zalloc(
 			heap, num * sizeof *offsets[i]));
-		offsets[i][0] = num;
-		offsets[i][1] = dict_index_get_n_fields(index);
+		rec_offs_set_n_alloc(offsets[i], num);
+		rec_offs_set_n_fields(offsets[i], dict_index_get_n_fields(index));
 		block[i] = psort_info[i].merge_block[id];
 		crypt_block[i] = psort_info[i].crypt_block[id];
 		b[i] = psort_info[i].merge_block[id];
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 6d0d77c9f5b..930a8303316 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -264,7 +264,7 @@ public:
 	bool remove(
 		const dict_index_t*	index,
 		page_zip_des_t*		page_zip,
-		ulint*			offsets) UNIV_NOTHROW
+		offset_t*		offsets) UNIV_NOTHROW
 	{
 		/* We can't end up with an empty page unless it is root. */
 		if (page_get_n_recs(m_cur.block->frame) <= 1) {
@@ -845,7 +845,7 @@ private:
 	@return DB_SUCCESS or error code */
 	dberr_t	adjust_cluster_index_blob_column(
 		rec_t*		rec,
-		const ulint*	offsets,
+		const offset_t*	offsets,
 		ulint		i) UNIV_NOTHROW;
 
 	/** Adjusts the BLOB reference in the clustered index row for all
@@ -855,7 +855,7 @@ private:
 	@return DB_SUCCESS or error code */
 	dberr_t	adjust_cluster_index_blob_columns(
 		rec_t*		rec,
-		const ulint*	offsets) UNIV_NOTHROW;
+		const offset_t*	offsets) UNIV_NOTHROW;
 
 	/** In the clustered index, adjist the BLOB pointers as needed.
 	Also update the BLOB reference, write the new space id.
@@ -864,13 +864,13 @@ private:
 	@return DB_SUCCESS or error code */
 	dberr_t	adjust_cluster_index_blob_ref(
 		rec_t*		rec,
-		const ulint*	offsets) UNIV_NOTHROW;
+		const offset_t*	offsets) UNIV_NOTHROW;
 
 	/** Purge delete-marked records, only if it is possible to do
 	so without re-organising the B+tree.
 	@param offsets current row offsets.
 	@retval true if purged */
-	bool	purge(const ulint* offsets) UNIV_NOTHROW;
+	bool	purge(const offset_t* offsets) UNIV_NOTHROW;
 
 	/** Adjust the BLOB references and sys fields for the current record.
 	@param index the index being converted
@@ -880,7 +880,7 @@ private:
 	dberr_t	adjust_cluster_record(
 		const dict_index_t*	index,
 		rec_t*			rec,
-		const ulint*		offsets) UNIV_NOTHROW;
+		const offset_t*		offsets) UNIV_NOTHROW;
 
 	/** Find an index with the matching id.
 	@return row_index_t* instance or 0 */
@@ -914,10 +914,10 @@ private:
 	RecIterator		m_rec_iter;
 
 	/** Record offset */
-	ulint			m_offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t		m_offsets_[REC_OFFS_NORMAL_SIZE];
 
 	/** Pointer to m_offsets_ */
-	ulint*			m_offsets;
+	offset_t*		m_offsets;
 
 	/** Memory heap for the record offsets */
 	mem_heap_t*		m_heap;
@@ -1583,7 +1583,7 @@ inline
 dberr_t
 PageConverter::adjust_cluster_index_blob_column(
 	rec_t*		rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	ulint		i) UNIV_NOTHROW
 {
 	ulint		len;
@@ -1627,7 +1627,7 @@ inline
 dberr_t
 PageConverter::adjust_cluster_index_blob_columns(
 	rec_t*		rec,
-	const ulint*	offsets) UNIV_NOTHROW
+	const offset_t*	offsets) UNIV_NOTHROW
 {
 	ut_ad(rec_offs_any_extern(offsets));
 
@@ -1660,7 +1660,7 @@ inline
 dberr_t
 PageConverter::adjust_cluster_index_blob_ref(
 	rec_t*		rec,
-	const ulint*	offsets) UNIV_NOTHROW
+	const offset_t*	offsets) UNIV_NOTHROW
 {
 	if (rec_offs_any_extern(offsets)) {
 		dberr_t	err;
@@ -1681,7 +1681,7 @@ re-organising the B+tree.
 @return true if purge succeeded */
 inline
 bool
-PageConverter::purge(const ulint* offsets) UNIV_NOTHROW
+PageConverter::purge(const offset_t* offsets) UNIV_NOTHROW
 {
 	const dict_index_t*	index = m_index->m_srv_index;
 
@@ -1707,7 +1707,7 @@ dberr_t
 PageConverter::adjust_cluster_record(
 	const dict_index_t*	index,
 	rec_t*			rec,
-	const ulint*		offsets) UNIV_NOTHROW
+	const offset_t*		offsets) UNIV_NOTHROW
 {
 	dberr_t	err;
 
@@ -2273,8 +2273,8 @@ row_import_set_sys_max_row_id(
 		ulint		len;
 		const byte*	field;
 		mem_heap_t*	heap = NULL;
-		ulint		offsets_[1 + REC_OFFS_HEADER_SIZE];
-		ulint*		offsets;
+		offset_t	offsets_[1 + REC_OFFS_HEADER_SIZE];
+		offset_t*	offsets;
 
 		rec_offs_init(offsets_);
 
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 17c45503cc1..cb27d4f8dd3 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -223,7 +223,7 @@ row_ins_sec_index_entry_by_modify(
 				depending on whether mtr holds just a leaf
 				latch or also a tree latch */
 	btr_cur_t*	cursor,	/*!< in: B-tree cursor */
-	ulint**		offsets,/*!< in/out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< in/out: offsets on cursor->page_cur.rec */
 	mem_heap_t*	offsets_heap,
 				/*!< in/out: memory heap that can be emptied */
 	mem_heap_t*	heap,	/*!< in/out: memory heap */
@@ -318,7 +318,7 @@ row_ins_clust_index_entry_by_modify(
 	ulint		mode,	/*!< in: BTR_MODIFY_LEAF or BTR_MODIFY_TREE,
 				depending on whether mtr holds just a leaf
 				latch or also a tree latch */
-	ulint**		offsets,/*!< out: offsets on cursor->page_cur.rec */
+	offset_t**	offsets,/*!< out: offsets on cursor->page_cur.rec */
 	mem_heap_t**	offsets_heap,
 				/*!< in/out: pointer to memory heap that can
 				be emptied, or NULL */
@@ -942,9 +942,9 @@ row_ins_foreign_fill_virtual(
 {
 	THD*		thd = current_thd;
 	row_ext_t*	ext;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
 	rec_offs_init(offsets_);
-	const ulint*	offsets =
+	const offset_t*	offsets =
 		rec_get_offsets(rec, index, offsets_, true,
 				ULINT_UNDEFINED, &cascade->heap);
 	mem_heap_t*	v_heap = NULL;
@@ -1483,7 +1483,7 @@ row_ins_set_shared_rec_lock(
 	const buf_block_t*	block,	/*!< in: buffer block of rec */
 	const rec_t*		rec,	/*!< in: record */
 	dict_index_t*		index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	que_thr_t*		thr)	/*!< in: query thread */
 {
 	dberr_t	err;
@@ -1514,7 +1514,7 @@ row_ins_set_exclusive_rec_lock(
 	const buf_block_t*	block,	/*!< in: buffer block of rec */
 	const rec_t*		rec,	/*!< in: record */
 	dict_index_t*		index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	que_thr_t*		thr)	/*!< in: query thread */
 {
 	dberr_t	err;
@@ -1561,8 +1561,8 @@ row_ins_check_foreign_constraint(
 	mtr_t		mtr;
 	trx_t*		trx		= thr_get_trx(thr);
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 
 	bool		skip_gap_lock;
 
@@ -2036,7 +2036,7 @@ row_ins_dupl_error_with_rec(
 				the record! */
 	const dtuple_t*	entry,	/*!< in: entry to insert */
 	dict_index_t*	index,	/*!< in: index */
-	const ulint*	offsets)/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets)/*!< in: rec_get_offsets(rec, index) */
 {
 	ulint	matched_fields;
 	ulint	n_unique;
@@ -2095,9 +2095,11 @@ row_ins_scan_sec_index_for_duplicate(
 	btr_pcur_t	pcur;
 	dberr_t		err		= DB_SUCCESS;
 	ulint		allow_duplicates;
-	ulint*		offsets		= NULL;
+	offset_t	offsets_[REC_OFFS_SEC_INDEX_SIZE];
+	offset_t*	offsets		= offsets_;
 	DBUG_ENTER("row_ins_scan_sec_index_for_duplicate");
 
+	rec_offs_init(offsets_);
 
 	ut_ad(s_latch == rw_lock_own_flagged(
 			&index->lock, RW_LOCK_FLAG_S | RW_LOCK_FLAG_SX));
@@ -2227,7 +2229,7 @@ row_ins_duplicate_online(
 	ulint		n_uniq,	/*!< in: offset of DB_TRX_ID */
 	const dtuple_t*	entry,	/*!< in: entry that is being inserted */
 	const rec_t*	rec,	/*!< in: clustered index record */
-	ulint*		offsets)/*!< in/out: rec_get_offsets(rec) */
+	offset_t*	offsets)/*!< in/out: rec_get_offsets(rec) */
 {
 	ulint	fields	= 0;
 
@@ -2266,7 +2268,7 @@ row_ins_duplicate_error_in_clust_online(
 	ulint		n_uniq,	/*!< in: offset of DB_TRX_ID */
 	const dtuple_t*	entry,	/*!< in: entry that is being inserted */
 	const btr_cur_t*cursor,	/*!< in: cursor on insert position */
-	ulint**		offsets,/*!< in/out: rec_get_offsets(rec) */
+	offset_t**	offsets,/*!< in/out: rec_get_offsets(rec) */
 	mem_heap_t**	heap)	/*!< in/out: heap for offsets */
 {
 	dberr_t		err	= DB_SUCCESS;
@@ -2313,8 +2315,8 @@ row_ins_duplicate_error_in_clust(
 	ulint	n_unique;
 	trx_t*	trx		= thr_get_trx(thr);
 	mem_heap_t*heap		= NULL;
-	ulint	offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*	offsets		= offsets_;
+	offset_t offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t* offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(dict_index_is_clust(cursor->index));
@@ -2487,7 +2489,7 @@ dberr_t
 row_ins_index_entry_big_rec(
 	const dtuple_t*		entry,
 	const big_rec_t*	big_rec,
-	ulint*			offsets,
+	offset_t*		offsets,
 	mem_heap_t**		heap,
 	dict_index_t*		index,
 	const void*		thd __attribute__((unused)))
@@ -2562,8 +2564,8 @@ row_ins_clust_index_entry_low(
 	mtr_t		mtr;
 	ib_uint64_t	auto_inc	= 0;
 	mem_heap_t*	offsets_heap	= NULL;
-	ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*          offsets         = offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets         = offsets_;
 	rec_offs_init(offsets_);
 
 	DBUG_ENTER("row_ins_clust_index_entry_low");
@@ -2841,8 +2843,8 @@ row_ins_sec_index_entry_low(
 	dberr_t		err		= DB_SUCCESS;
 	ulint		n_unique;
 	mtr_t		mtr;
-	ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*          offsets         = offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets         = offsets_;
 	rec_offs_init(offsets_);
 	rtr_info_t	rtr_info;
 
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 6da08872a9a..6c28919555b 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -592,7 +592,7 @@ row_log_table_delete(
 				page X-latched */
 	dict_index_t*	index,	/*!< in/out: clustered index, S-latched
 				or X-latched */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec,index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec,index) */
 	const byte*	sys)	/*!< in: DB_TRX_ID,DB_ROLL_PTR that should
 				be logged, or NULL to use those in rec */
 {
@@ -835,7 +835,7 @@ row_log_table_low(
 				page X-latched */
 	dict_index_t*	index,	/*!< in/out: clustered index, S-latched
 				or X-latched */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec,index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec,index) */
 	bool		insert,	/*!< in: true if insert, false if update */
 	const dtuple_t*	old_pk)	/*!< in: old PRIMARY KEY value (if !insert
 				and a PRIMARY KEY is being created) */
@@ -948,7 +948,7 @@ row_log_table_update(
 				page X-latched */
 	dict_index_t*	index,	/*!< in/out: clustered index, S-latched
 				or X-latched */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec,index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec,index) */
 	const dtuple_t*	old_pk)	/*!< in: row_log_table_get_pk()
 				before the update */
 {
@@ -999,7 +999,7 @@ row_log_table_get_pk_col(
 	dfield_t*		dfield,
 	mem_heap_t*		heap,
 	const rec_t*		rec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	ulint			i,
 	const page_size_t&	page_size,
 	ulint			max_len)
@@ -1053,7 +1053,7 @@ row_log_table_get_pk(
 				page X-latched */
 	dict_index_t*	index,	/*!< in/out: clustered index, S-latched
 				or X-latched */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec,index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec,index) */
 	byte*		sys,	/*!< out: DB_TRX_ID,DB_ROLL_PTR for
 				row_log_table_delete(), or NULL */
 	mem_heap_t**	heap)	/*!< in/out: memory heap where allocated */
@@ -1246,7 +1246,7 @@ row_log_table_insert(
 				page X-latched */
 	dict_index_t*	index,	/*!< in/out: clustered index, S-latched
 				or X-latched */
-	const ulint*	offsets)/*!< in: rec_get_offsets(rec,index) */
+	const offset_t*	offsets)/*!< in: rec_get_offsets(rec,index) */
 {
 	row_log_table_low(rec, index, offsets, true, NULL);
 }
@@ -1337,7 +1337,7 @@ row_log_table_apply_convert_mrec(
 /*=============================*/
 	const mrec_t*		mrec,		/*!< in: merge record */
 	dict_index_t*		index,		/*!< in: index of mrec */
-	const ulint*		offsets,	/*!< in: offsets of mrec */
+	const offset_t*		offsets,	/*!< in: offsets of mrec */
 	const row_log_t*	log,		/*!< in: rebuild context */
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
 	trx_id_t		trx_id,		/*!< in: DB_TRX_ID of mrec */
@@ -1569,7 +1569,7 @@ row_log_table_apply_insert(
 /*=======================*/
 	que_thr_t*		thr,		/*!< in: query graph */
 	const mrec_t*		mrec,		/*!< in: record to insert */
-	const ulint*		offsets,	/*!< in: offsets of mrec */
+	const offset_t*		offsets,	/*!< in: offsets of mrec */
 	mem_heap_t*		offsets_heap,	/*!< in/out: memory heap
 						that can be emptied */
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
@@ -1621,7 +1621,7 @@ row_log_table_apply_delete_low(
 /*===========================*/
 	btr_pcur_t*		pcur,		/*!< in/out: B-tree cursor,
 						will be trashed */
-	const ulint*		offsets,	/*!< in: offsets on pcur */
+	const offset_t*		offsets,	/*!< in: offsets on pcur */
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
 	mtr_t*			mtr)		/*!< in/out: mini-transaction,
 						will be committed */
@@ -1714,7 +1714,7 @@ row_log_table_apply_delete(
 						DB_TRX_ID in the new
 						clustered index */
 	const mrec_t*		mrec,		/*!< in: merge record */
-	const ulint*		moffsets,	/*!< in: offsets of mrec */
+	const offset_t*		moffsets,	/*!< in: offsets of mrec */
 	mem_heap_t*		offsets_heap,	/*!< in/out: memory heap
 						that can be emptied */
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
@@ -1725,7 +1725,7 @@ row_log_table_apply_delete(
 	dtuple_t*	old_pk;
 	mtr_t		mtr;
 	btr_pcur_t	pcur;
-	ulint*		offsets;
+	offset_t*	offsets;
 
 	ut_ad(rec_offs_n_fields(moffsets)
 	      == dict_index_get_n_unique(index) + 2);
@@ -1835,7 +1835,7 @@ row_log_table_apply_update(
 						DB_TRX_ID in the new
 						clustered index */
 	const mrec_t*		mrec,		/*!< in: new value */
-	const ulint*		offsets,	/*!< in: offsets of mrec */
+	const offset_t*		offsets,	/*!< in: offsets of mrec */
 	mem_heap_t*		offsets_heap,	/*!< in/out: memory heap
 						that can be emptied */
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
@@ -1973,7 +1973,7 @@ func_exit_committed:
 	}
 
 	/* Prepare to update (or delete) the record. */
-	ulint*		cur_offsets	= rec_get_offsets(
+	offset_t*		cur_offsets	= rec_get_offsets(
 		btr_pcur_get_rec(&pcur), index, NULL, true,
 		ULINT_UNDEFINED, &offsets_heap);
 
@@ -2213,7 +2213,7 @@ row_log_table_apply_op(
 	mem_heap_t*		heap,		/*!< in/out: memory heap */
 	const mrec_t*		mrec,		/*!< in: merge record */
 	const mrec_t*		mrec_end,	/*!< in: end of buffer */
-	ulint*			offsets)	/*!< in/out: work area
+	offset_t*		offsets)	/*!< in/out: work area
 						for parsing mrec */
 {
 	row_log_t*	log	= dup->index->online_log;
@@ -2531,7 +2531,7 @@ row_log_table_apply_ops(
 	const mrec_t*	next_mrec_end;
 	mem_heap_t*	heap;
 	mem_heap_t*	offsets_heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 	bool		has_index_lock;
 	dict_index_t*	index		= const_cast(
 		dup->index);
@@ -2559,9 +2559,9 @@ row_log_table_apply_ops(
 
 	UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
 
-	offsets = static_cast(ut_malloc_nokey(i * sizeof *offsets));
-	offsets[0] = i;
-	offsets[1] = dict_index_get_n_fields(index);
+	offsets = static_cast(ut_malloc_nokey(i * sizeof *offsets));
+	rec_offs_set_n_alloc(offsets, i);
+	rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
 
 	heap = mem_heap_create(UNIV_PAGE_SIZE);
 	offsets_heap = mem_heap_create(UNIV_PAGE_SIZE);
@@ -3073,7 +3073,7 @@ row_log_apply_op_low(
 {
 	mtr_t		mtr;
 	btr_cur_t	cursor;
-	ulint*		offsets = NULL;
+	offset_t*	offsets = NULL;
 
 	ut_ad(!dict_index_is_clust(index));
 
@@ -3307,7 +3307,7 @@ row_log_apply_op(
 					in exclusive mode */
 	const mrec_t*	mrec,		/*!< in: merge record */
 	const mrec_t*	mrec_end,	/*!< in: end of buffer */
-	ulint*		offsets)	/*!< in/out: work area for
+	offset_t*	offsets)	/*!< in/out: work area for
 					rec_init_offsets_temp() */
 
 {
@@ -3426,7 +3426,7 @@ row_log_apply_ops(
 	const mrec_t*	next_mrec_end;
 	mem_heap_t*	offsets_heap;
 	mem_heap_t*	heap;
-	ulint*		offsets;
+	offset_t*	offsets;
 	bool		has_index_lock;
 	const ulint	i	= 1 + REC_OFFS_HEADER_SIZE
 		+ dict_index_get_n_fields(index);
@@ -3437,9 +3437,9 @@ row_log_apply_ops(
 	ut_ad(index->online_log);
 	UNIV_MEM_INVALID(&mrec_end, sizeof mrec_end);
 
-	offsets = static_cast(ut_malloc_nokey(i * sizeof *offsets));
-	offsets[0] = i;
-	offsets[1] = dict_index_get_n_fields(index);
+	offsets = static_cast(ut_malloc_nokey(i * sizeof *offsets));
+	rec_offs_set_n_alloc(offsets, i);
+	rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
 
 	offsets_heap = mem_heap_create(UNIV_PAGE_SIZE);
 	heap = mem_heap_create(UNIV_PAGE_SIZE);
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 1e7a6156479..071a65e101b 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -120,7 +120,7 @@ public:
 		btr_cur_t       ins_cur;
 		mtr_t           mtr;
 		rtr_info_t      rtr_info;
-		ulint*		ins_offsets = NULL;
+		offset_t*	ins_offsets = NULL;
 		dberr_t		error = DB_SUCCESS;
 		dtuple_t*	dtuple;
 		ulint		count = 0;
@@ -1046,8 +1046,8 @@ row_merge_heap_create(
 /*==================*/
 	const dict_index_t*	index,		/*!< in: record descriptor */
 	mrec_buf_t**		buf,		/*!< out: 3 buffers */
-	ulint**			offsets1,	/*!< out: offsets */
-	ulint**			offsets2)	/*!< out: offsets */
+	offset_t**		offsets1,	/*!< out: offsets */
+	offset_t**		offsets2)	/*!< out: offsets */
 {
 	ulint		i	= 1 + REC_OFFS_HEADER_SIZE
 		+ dict_index_get_n_fields(index);
@@ -1056,9 +1056,9 @@ row_merge_heap_create(
 
 	*buf = static_cast(
 		mem_heap_alloc(heap, 3 * sizeof **buf));
-	*offsets1 = static_cast(
+	*offsets1 = static_cast(
 		mem_heap_alloc(heap, i * sizeof **offsets1));
-	*offsets2 = static_cast(
+	*offsets2 = static_cast(
 		mem_heap_alloc(heap, i * sizeof **offsets2));
 
 	(*offsets1)[0] = (*offsets2)[0] = i;
@@ -1179,7 +1179,7 @@ row_merge_read_rec(
 	const mrec_t**		mrec,	/*!< out: pointer to merge record,
 					or NULL on end of list
 					(non-NULL on I/O error) */
-	ulint*			offsets,/*!< out: offsets of mrec */
+	offset_t*		offsets,/*!< out: offsets of mrec */
 	row_merge_block_t*	crypt_block, /*!< in: crypt buf or NULL */
 	ulint			space) /*!< in: space id */
 {
@@ -1190,7 +1190,7 @@ row_merge_read_rec(
 	ut_ad(b >= &block[0]);
 	ut_ad(b < &block[srv_sort_buf_size]);
 
-	ut_ad(*offsets == 1 + REC_OFFS_HEADER_SIZE
+	ut_ad(rec_offs_get_n_alloc(offsets) == 1 + REC_OFFS_HEADER_SIZE
 	      + dict_index_get_n_fields(index));
 
 	DBUG_ENTER("row_merge_read_rec");
@@ -1297,12 +1297,7 @@ err_exit:
 	memcpy(*buf, b, avail_size);
 	*mrec = *buf + extra_size;
 
-	/* We cannot invoke rec_offs_make_valid() here, because there
-	are no REC_N_NEW_EXTRA_BYTES between extra_size and data_size.
-	Similarly, rec_offs_validate() would fail, because it invokes
-	rec_get_status(). */
-	ut_d(offsets[2] = (ulint) *mrec);
-	ut_d(offsets[3] = (ulint) index);
+	rec_init_offsets_temp(*mrec, index, offsets);
 
 	if (!row_merge_read(fd, ++(*foffs), block,
 			    crypt_block,
@@ -1341,7 +1336,7 @@ row_merge_write_rec_low(
 	ulint		foffs,	/*!< in: file offset */
 #endif /* !DBUG_OFF */
 	const mrec_t*	mrec,	/*!< in: record to write */
-	const ulint*	offsets)/*!< in: offsets of mrec */
+	const offset_t*	offsets)/*!< in: offsets of mrec */
 #ifdef DBUG_OFF
 # define row_merge_write_rec_low(b, e, size, fd, foffs, mrec, offsets)	\
 	row_merge_write_rec_low(b, e, mrec, offsets)
@@ -1383,7 +1378,7 @@ row_merge_write_rec(
 	int			fd,	/*!< in: file descriptor */
 	ulint*			foffs,	/*!< in/out: file offset */
 	const mrec_t*		mrec,	/*!< in: record to write */
-	const ulint*            offsets,/*!< in: offsets of mrec */
+	const offset_t*         offsets,/*!< in: offsets of mrec */
 	row_merge_block_t*	crypt_block, /*!< in: crypt buf or NULL */
 	ulint			space)	   /*!< in: space id */
 {
@@ -1899,7 +1894,7 @@ row_merge_read_clustered_index(
 		}
 
 		const rec_t*	rec;
-		ulint*		offsets;
+		offset_t*	offsets;
 		dtuple_t*	row;
 		row_ext_t*	ext;
 		page_cur_t*	cur	= btr_pcur_get_page_cur(&pcur);
@@ -2821,8 +2816,8 @@ row_merge_blocks(
 	const mrec_t*	mrec0;	/*!< merge rec, points to block[0] or buf[0] */
 	const mrec_t*	mrec1;	/*!< merge rec, points to
 				block[srv_sort_buf_size] or buf[1] */
-	ulint*		offsets0;/* offsets of mrec0 */
-	ulint*		offsets1;/* offsets of mrec1 */
+	offset_t*	offsets0;/* offsets of mrec0 */
+	offset_t*	offsets1;/* offsets of mrec1 */
 
 	DBUG_ENTER("row_merge_blocks");
 	DBUG_LOG("ib_merge_sort",
@@ -2939,8 +2934,8 @@ row_merge_blocks_copy(
 	const byte*	b0;	/*!< pointer to block[0] */
 	byte*		b2;	/*!< pointer to block[2 * srv_sort_buf_size] */
 	const mrec_t*	mrec0;	/*!< merge rec, points to block[0] */
-	ulint*		offsets0;/* offsets of mrec0 */
-	ulint*		offsets1;/* dummy offsets */
+	offset_t*	offsets0;/* offsets of mrec0 */
+	offset_t*	offsets1;/* dummy offsets */
 
 	DBUG_ENTER("row_merge_blocks_copy");
 	DBUG_LOG("ib_merge_sort",
@@ -3279,7 +3274,7 @@ static
 void
 row_merge_copy_blobs(
 	const mrec_t*		mrec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	const page_size_t&	page_size,
 	dtuple_t*		tuple,
 	mem_heap_t*		heap)
@@ -3388,7 +3383,7 @@ row_merge_insert_index_tuples(
 	mem_heap_t*		tuple_heap;
 	dberr_t			error = DB_SUCCESS;
 	ulint			foffs = 0;
-	ulint*			offsets;
+	offset_t*		offsets;
 	mrec_buf_t*		buf;
 	ulint			n_rows = 0;
 	dtuple_t*		dtuple;
@@ -3416,10 +3411,10 @@ row_merge_insert_index_tuples(
 		ulint i	= 1 + REC_OFFS_HEADER_SIZE
 			+ dict_index_get_n_fields(index);
 		heap = mem_heap_create(sizeof *buf + i * sizeof *offsets);
-		offsets = static_cast(
+		offsets = static_cast(
 			mem_heap_alloc(heap, i * sizeof *offsets));
-		offsets[0] = i;
-		offsets[1] = dict_index_get_n_fields(index);
+		rec_offs_set_n_alloc(offsets, i);
+		rec_offs_set_n_fields(offsets, dict_index_get_n_fields(index));
 	}
 
 	if (row_buf != NULL) {
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index dabdeeec68b..f1019bd7f0d 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -2003,8 +2003,8 @@ row_unlock_for_mysql(
 						     + index->trx_id_offset);
 		} else {
 			mem_heap_t*	heap			= NULL;
-			ulint	offsets_[REC_OFFS_NORMAL_SIZE];
-			ulint*	offsets				= offsets_;
+			offset_t offsets_[REC_OFFS_NORMAL_SIZE];
+			offset_t* offsets				= offsets_;
 
 			rec_offs_init(offsets_);
 			offsets = rec_get_offsets(rec, index, offsets, true,
@@ -4653,8 +4653,8 @@ row_scan_index_for_mysql(
 	ulint		cnt;
 	mem_heap_t*	heap		= NULL;
 	ulint		n_ext;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets;
 	rec_offs_init(offsets_);
 
 	*n_rows = 0;
@@ -4786,7 +4786,7 @@ not_ok:
 
 			tmp_heap = mem_heap_create(size);
 
-			offsets = static_cast(
+			offsets = static_cast(
 				mem_heap_dup(tmp_heap, offsets, size));
 		}
 
diff --git a/storage/innobase/row/row0purge.cc b/storage/innobase/row/row0purge.cc
index 42aa6123cd6..b13bf47ce95 100644
--- a/storage/innobase/row/row0purge.cc
+++ b/storage/innobase/row/row0purge.cc
@@ -108,8 +108,8 @@ row_purge_remove_clust_if_poss_low(
 	mtr_t			mtr;
 	rec_t*			rec;
 	mem_heap_t*		heap		= NULL;
-	ulint*			offsets;
-	ulint			offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*		offsets;
+	offset_t		offsets_[REC_OFFS_NORMAL_SIZE];
 	rec_offs_init(offsets_);
 
 	ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_S)
@@ -1284,7 +1284,7 @@ purge_node_t::validate_pcur()
 
 	dict_index_t*	clust_index = pcur.btr_cur.index;
 
-	ulint*	offsets = rec_get_offsets(
+	offset_t* offsets = rec_get_offsets(
 		pcur.old_rec, clust_index, NULL, true,
 		pcur.old_n_fields, &heap);
 
diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc
index 3e65dc1d28b..c6aedbe2eb5 100644
--- a/storage/innobase/row/row0row.cc
+++ b/storage/innobase/row/row0row.cc
@@ -372,7 +372,7 @@ row_build_low(
 	ulint			type,
 	const dict_index_t*	index,
 	const rec_t*		rec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	const dict_table_t*	col_table,
 	const dtuple_t*		add_cols,
 	const dict_add_v_col_t*	add_v,
@@ -388,7 +388,7 @@ row_build_low(
 	byte*			buf;
 	ulint			j;
 	mem_heap_t*		tmp_heap	= NULL;
-	ulint			offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t		offsets_[REC_OFFS_NORMAL_SIZE];
 	rec_offs_init(offsets_);
 
 	ut_ad(index != NULL);
@@ -435,7 +435,7 @@ row_build_low(
 	}
 
 	/* Avoid a debug assertion in rec_offs_validate(). */
-	rec_offs_make_valid(copy, index, const_cast(offsets));
+	rec_offs_make_valid(copy, index, const_cast(offsets));
 
 	if (!col_table) {
 		ut_ad(!col_map);
@@ -525,7 +525,7 @@ row_build_low(
 		}
 	}
 
-	rec_offs_make_valid(rec, index, const_cast(offsets));
+	rec_offs_make_valid(rec, index, const_cast(offsets));
 
 	ut_ad(dtuple_check_typed(row));
 
@@ -578,7 +578,7 @@ row_build(
 					this record must be at least
 					s-latched and the latch held
 					as long as the row dtuple is used! */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec,index)
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec,index)
 					or NULL, in which case this function
 					will invoke rec_get_offsets() */
 	const dict_table_t*	col_table,
@@ -631,7 +631,7 @@ row_build_w_add_vcol(
 	ulint			type,
 	const dict_index_t*	index,
 	const rec_t*		rec,
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	const dict_table_t*	col_table,
 	const dtuple_t*		add_cols,
 	const dict_add_v_col_t*	add_v,
@@ -652,7 +652,7 @@ row_rec_to_index_entry_low(
 /*=======================*/
 	const rec_t*		rec,	/*!< in: record in the index */
 	const dict_index_t*	index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint*			n_ext,	/*!< out: number of externally
 					stored columns */
 	mem_heap_t*		heap)	/*!< in: memory heap from which
@@ -716,7 +716,7 @@ row_rec_to_index_entry(
 /*===================*/
 	const rec_t*		rec,	/*!< in: record in the index */
 	const dict_index_t*	index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec) */
 	ulint*			n_ext,	/*!< out: number of externally
 					stored columns */
 	mem_heap_t*		heap)	/*!< in: memory heap from which
@@ -737,10 +737,10 @@ row_rec_to_index_entry(
 
 	copy_rec = rec_copy(buf, rec, offsets);
 
-	rec_offs_make_valid(copy_rec, index, const_cast(offsets));
+	rec_offs_make_valid(copy_rec, index, const_cast(offsets));
 	entry = row_rec_to_index_entry_low(
 		copy_rec, index, offsets, n_ext, heap);
-	rec_offs_make_valid(rec, index, const_cast(offsets));
+	rec_offs_make_valid(rec, index, const_cast(offsets));
 
 	dtuple_set_info_bits(entry,
 			     rec_get_info_bits(rec, rec_offs_comp(offsets)));
@@ -782,8 +782,8 @@ row_build_row_ref(
 	ulint		clust_col_prefix_len;
 	ulint		i;
 	mem_heap_t*	tmp_heap	= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(index != NULL);
@@ -878,7 +878,7 @@ row_build_row_ref_in_tuple(
 					held as long as the row
 					reference is used! */
 	const dict_index_t*	index,	/*!< in: secondary index */
-	ulint*			offsets,/*!< in: rec_get_offsets(rec, index)
+	offset_t*		offsets,/*!< in: rec_get_offsets(rec, index)
 					or NULL */
 	trx_t*			trx)	/*!< in: transaction */
 {
@@ -891,7 +891,7 @@ row_build_row_ref_in_tuple(
 	ulint			clust_col_prefix_len;
 	ulint			i;
 	mem_heap_t*		heap		= NULL;
-	ulint			offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t		offsets_[REC_OFFS_NORMAL_SIZE];
 	rec_offs_init(offsets_);
 
 	ut_ad(!dict_index_is_clust(index));
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index dae51354196..381a1fb8bc5 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -172,10 +172,10 @@ row_sel_sec_rec_is_for_clust_rec(
 	ulint		n;
 	ulint		i;
 	mem_heap_t*	heap		= NULL;
-	ulint		clust_offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint		sec_offsets_[REC_OFFS_SMALL_SIZE];
-	ulint*		clust_offs	= clust_offsets_;
-	ulint*		sec_offs	= sec_offsets_;
+	offset_t	clust_offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t	sec_offsets_[REC_OFFS_SMALL_SIZE];
+	offset_t*	clust_offs	= clust_offsets_;
+	offset_t*	sec_offs	= sec_offsets_;
 	ibool		is_equal	= TRUE;
 	VCOL_STORAGE*	vcol_storage= 0;
 	byte*		record;
@@ -494,7 +494,7 @@ row_sel_fetch_columns(
 	dict_index_t*	index,	/*!< in: record index */
 	const rec_t*	rec,	/*!< in: record in a clustered or non-clustered
 				index; must be protected by a page latch */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	sym_node_t*	column)	/*!< in: first column in a column list, or
 				NULL */
 {
@@ -761,7 +761,7 @@ row_sel_build_prev_vers(
 	ReadView*	read_view,	/*!< in: read view */
 	dict_index_t*	index,		/*!< in: plan node for table */
 	rec_t*		rec,		/*!< in: record in a clustered index */
-	ulint**		offsets,	/*!< in/out: offsets returned by
+	offset_t**	offsets,	/*!< in/out: offsets returned by
 					rec_get_offsets(rec, plan->index) */
 	mem_heap_t**	offset_heap,	/*!< in/out: memory heap from which
 					the offsets are allocated */
@@ -796,7 +796,7 @@ row_sel_build_committed_vers_for_mysql(
 	dict_index_t*	clust_index,	/*!< in: clustered index */
 	row_prebuilt_t*	prebuilt,	/*!< in: prebuilt struct */
 	const rec_t*	rec,		/*!< in: record in a clustered index */
-	ulint**		offsets,	/*!< in/out: offsets returned by
+	offset_t**	offsets,	/*!< in/out: offsets returned by
 					rec_get_offsets(rec, clust_index) */
 	mem_heap_t**	offset_heap,	/*!< in/out: memory heap from which
 					the offsets are allocated */
@@ -910,8 +910,8 @@ row_sel_get_clust_rec(
 	rec_t*		old_vers;
 	dberr_t		err;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	*out_rec = NULL;
@@ -1070,7 +1070,7 @@ sel_set_rtr_rec_lock(
 	btr_pcur_t*		pcur,	/*!< in: cursor */
 	const rec_t*		first_rec,/*!< in: record */
 	dict_index_t*		index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint			mode,	/*!< in: lock mode */
 	ulint			type,	/*!< in: LOCK_ORDINARY, LOCK_GAP, or
 					LOC_REC_NOT_GAP */
@@ -1082,8 +1082,8 @@ sel_set_rtr_rec_lock(
 	dberr_t		err = DB_SUCCESS;
 	trx_t*		trx = thr_get_trx(thr);
 	buf_block_t*	cur_block = btr_pcur_get_block(pcur);
-	ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*          my_offsets = const_cast(offsets);
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	my_offsets = const_cast(offsets);
 	rec_t*		rec = const_cast(first_rec);
 	rtr_rec_vector*	match_rec;
 	rtr_rec_vector::iterator end;
@@ -1235,7 +1235,7 @@ sel_set_rec_lock(
 	btr_pcur_t*		pcur,	/*!< in: cursor */
 	const rec_t*		rec,	/*!< in: record */
 	dict_index_t*		index,	/*!< in: index */
-	const ulint*		offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*		offsets,/*!< in: rec_get_offsets(rec, index) */
 	ulint			mode,	/*!< in: lock mode */
 	ulint			type,	/*!< in: LOCK_ORDINARY, LOCK_GAP, or
 					LOC_REC_NOT_GAP */
@@ -1486,8 +1486,8 @@ row_sel_try_search_shortcut(
 	dict_index_t*	index;
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	ulint		ret;
 	rec_offs_init(offsets_);
 
@@ -1612,8 +1612,8 @@ row_sel(
 	to the next non-clustered record */
 	dberr_t		err;
 	mem_heap_t*	heap				= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets				= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets				= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(thr->run_node == node);
@@ -2760,7 +2760,7 @@ row_sel_store_row_id_to_prebuilt(
 	row_prebuilt_t*		prebuilt,	/*!< in/out: prebuilt */
 	const rec_t*		index_rec,	/*!< in: record */
 	const dict_index_t*	index,		/*!< in: index of the record */
-	const ulint*		offsets)	/*!< in: rec_get_offsets
+	const offset_t*		offsets)	/*!< in: rec_get_offsets
 						(index_rec, index) */
 {
 	const byte*	data;
@@ -2996,7 +2996,7 @@ row_sel_store_mysql_field_func(
 #ifdef UNIV_DEBUG
 	const dict_index_t*	index,
 #endif
-	const ulint*		offsets,
+	const offset_t*		offsets,
 	ulint			field_no,
 	const mysql_row_templ_t*templ)
 {
@@ -3152,7 +3152,7 @@ static bool row_sel_store_mysql_rec(
 	const dtuple_t*	vrow,
 	bool		rec_clust,
 	const dict_index_t* index,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	DBUG_ENTER("row_sel_store_mysql_rec");
 
@@ -3283,7 +3283,7 @@ row_sel_build_prev_vers_for_mysql(
 	dict_index_t*	clust_index,	/*!< in: clustered index */
 	row_prebuilt_t*	prebuilt,	/*!< in: prebuilt struct */
 	const rec_t*	rec,		/*!< in: record in a clustered index */
-	ulint**		offsets,	/*!< in/out: offsets returned by
+	offset_t**	offsets,	/*!< in/out: offsets returned by
 					rec_get_offsets(rec, clust_index) */
 	mem_heap_t**	offset_heap,	/*!< in/out: memory heap from which
 					the offsets are allocated */
@@ -3321,7 +3321,7 @@ public:
 
 	dberr_t operator()(row_prebuilt_t *prebuilt, dict_index_t *sec_index,
 			const rec_t *rec, que_thr_t *thr, const rec_t **out_rec,
-			ulint **offsets, mem_heap_t **offset_heap,
+			offset_t **offsets, mem_heap_t **offset_heap,
 			dtuple_t **vrow, mtr_t *mtr);
 };
 
@@ -3344,7 +3344,7 @@ Row_sel_get_clust_rec_for_mysql::operator()(
 				it, NULL if the old version did not exist
 				in the read view, i.e., it was a fresh
 				inserted version */
-	ulint**		offsets,/*!< in: offsets returned by
+	offset_t**	offsets,/*!< in: offsets returned by
 				rec_get_offsets(rec, sec_index);
 				out: offsets returned by
 				rec_get_offsets(out_rec, clust_index) */
@@ -3918,7 +3918,7 @@ row_sel_try_search_shortcut_for_mysql(
 /*==================================*/
 	const rec_t**	out_rec,/*!< out: record if found */
 	row_prebuilt_t*	prebuilt,/*!< in: prebuilt struct */
-	ulint**		offsets,/*!< in/out: for rec_get_offsets(*out_rec) */
+	offset_t**	offsets,/*!< in/out: for rec_get_offsets(*out_rec) */
 	mem_heap_t**	heap,	/*!< in/out: heap for rec_get_offsets() */
 	mtr_t*		mtr)	/*!< in: started mtr */
 {
@@ -3989,7 +3989,7 @@ row_search_idx_cond_check(
 	row_prebuilt_t*		prebuilt,	/*!< in/out: prebuilt struct
 						for the table handle */
 	const rec_t*		rec,		/*!< in: InnoDB record */
-	const ulint*		offsets)	/*!< in: rec_get_offsets() */
+	const offset_t*		offsets)	/*!< in: rec_get_offsets() */
 {
 	ICP_RESULT	result;
 	ulint		i;
@@ -4077,8 +4077,8 @@ row_sel_fill_vrow(
 	dtuple_t**		vrow,
 	mem_heap_t*		heap)
 {
-	ulint           offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets	= offsets_;
+	offset_t offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t* offsets	= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(!(*vrow));
@@ -4129,7 +4129,7 @@ rec_field_len_in_chars(
 	const dict_col_t*	col,
 	const ulint		field_no,
 	const rec_t*		rec,
-	const ulint*		offsets)
+	const offset_t*		offsets)
 {
 	const ulint cset = dtype_get_charset_coll(col->prtype);
 	const CHARSET_INFO* cs = all_charsets[cset];
@@ -4156,7 +4156,7 @@ static
 bool row_search_with_covering_prefix(
 	row_prebuilt_t*	prebuilt,
 	const rec_t*	rec,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	const dict_index_t*	index = prebuilt->index;
 	ut_ad(!dict_index_is_clust(index));
@@ -4285,8 +4285,8 @@ row_search_mvcc(
 	ibool		same_user_rec;
 	mtr_t		mtr;
 	mem_heap_t*	heap				= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets				= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets				= offsets_;
 	ibool		table_lock_waited		= FALSE;
 	byte*		next_buf			= 0;
 	bool		spatial_search			= false;
@@ -5995,8 +5995,8 @@ row_search_autoinc_read_column(
 	const byte*	data;
 	ib_uint64_t	value;
 	mem_heap_t*	heap = NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets	= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets	= offsets_;
 
 	rec_offs_init(offsets_);
 	ut_ad(page_rec_is_leaf(rec));
diff --git a/storage/innobase/row/row0uins.cc b/storage/innobase/row/row0uins.cc
index 7d0664006bb..d62e730d800 100644
--- a/storage/innobase/row/row0uins.cc
+++ b/storage/innobase/row/row0uins.cc
@@ -114,7 +114,7 @@ row_undo_ins_remove_clust_rec(
 	if (online && dict_index_is_online_ddl(index)) {
 		const rec_t*	rec	= btr_cur_get_rec(btr_cur);
 		mem_heap_t*	heap	= NULL;
-		const ulint*	offsets	= rec_get_offsets(
+		const offset_t*	offsets	= rec_get_offsets(
 			rec, index, NULL, true, ULINT_UNDEFINED, &heap);
 		row_log_table_delete(rec, index, offsets, NULL);
 		mem_heap_free(heap);
diff --git a/storage/innobase/row/row0umod.cc b/storage/innobase/row/row0umod.cc
index 3d4065cbab6..4598e8959d6 100644
--- a/storage/innobase/row/row0umod.cc
+++ b/storage/innobase/row/row0umod.cc
@@ -75,7 +75,7 @@ dberr_t
 row_undo_mod_clust_low(
 /*===================*/
 	undo_node_t*	node,	/*!< in: row undo node */
-	ulint**		offsets,/*!< out: rec_get_offsets() on the record */
+	offset_t**	offsets,/*!< out: rec_get_offsets() on the record */
 	mem_heap_t**	offsets_heap,
 				/*!< in/out: memory heap that can be emptied */
 	mem_heap_t*	heap,	/*!< in/out: memory heap */
@@ -184,7 +184,7 @@ row_undo_mod_remove_clust_low(
 	if (!trx_id_offset) {
 		mem_heap_t*	heap	= NULL;
 		ulint		trx_id_col;
-		const ulint*	offsets;
+		const offset_t*	offsets;
 		ulint		len;
 
 		trx_id_col = dict_index_get_sys_col_pos(
@@ -285,7 +285,7 @@ row_undo_mod_clust(
 
 	mem_heap_t*	heap		= mem_heap_create(1024);
 	mem_heap_t*	offsets_heap	= NULL;
-	ulint*		offsets		= NULL;
+	offset_t*	offsets		= NULL;
 	const dtuple_t*	rebuilt_old_pk;
 	byte		sys[DATA_TRX_ID_LEN + DATA_ROLL_PTR_LEN];
 
@@ -665,7 +665,7 @@ try_again:
 	switch (search_result) {
 		mem_heap_t*	heap;
 		mem_heap_t*	offsets_heap;
-		ulint*		offsets;
+		offset_t*	offsets;
 	case ROW_BUFFERED:
 	case ROW_NOT_DELETED_REF:
 		/* These are invalid outcomes, because the mode passed
diff --git a/storage/innobase/row/row0undo.cc b/storage/innobase/row/row0undo.cc
index 7a245f8279c..109bf1004ca 100644
--- a/storage/innobase/row/row0undo.cc
+++ b/storage/innobase/row/row0undo.cc
@@ -167,8 +167,8 @@ row_undo_search_clust_to_pcur(
 	row_ext_t**	ext;
 	const rec_t*	rec;
 	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets		= offsets_;
 	rec_offs_init(offsets_);
 
 	ut_ad(!node->table->skip_alter_undo);
diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc
index 0153d618ab8..367e6c8e263 100644
--- a/storage/innobase/row/row0upd.cc
+++ b/storage/innobase/row/row0upd.cc
@@ -214,7 +214,7 @@ row_upd_check_references_constraints(
 				cursor position is lost in this function! */
 	dict_table_t*	table,	/*!< in: table in question */
 	dict_index_t*	index,	/*!< in: index of the cursor */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
 	que_thr_t*	thr,	/*!< in: query thread */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
@@ -364,7 +364,7 @@ wsrep_row_upd_check_foreign_constraints(
 				cursor position is lost in this function! */
 	dict_table_t*	table,	/*!< in: table in question */
 	dict_index_t*	index,	/*!< in: index of the cursor */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(pcur.rec, index) */
 	que_thr_t*	thr,	/*!< in: query thread */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
@@ -505,7 +505,7 @@ row_upd_rec_sys_fields_in_recovery(
 /*===============================*/
 	rec_t*		rec,	/*!< in/out: record */
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page, or NULL */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	ulint		pos,	/*!< in: TRX_ID position in rec */
 	trx_id_t	trx_id,	/*!< in: transaction id */
 	roll_ptr_t	roll_ptr)/*!< in: roll ptr of the undo log record */
@@ -571,7 +571,7 @@ ibool
 row_upd_changes_field_size_or_external(
 /*===================================*/
 	dict_index_t*	index,	/*!< in: index */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	const upd_t*	update)	/*!< in: update vector */
 {
 	const upd_field_t*	upd_field;
@@ -686,7 +686,7 @@ row_upd_rec_in_place(
 /*=================*/
 	rec_t*		rec,	/*!< in/out: record where replaced */
 	dict_index_t*	index,	/*!< in: the index the record belongs to */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	const upd_t*	update,	/*!< in: update vector */
 	page_zip_des_t*	page_zip)/*!< in: compressed page with enough space
 				available, or NULL */
@@ -964,7 +964,7 @@ row_upd_build_sec_rec_difference_binary(
 /*====================================*/
 	const rec_t*	rec,	/*!< in: secondary index record */
 	dict_index_t*	index,	/*!< in: index */
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec, index) */
 	const dtuple_t*	entry,	/*!< in: entry to insert */
 	mem_heap_t*	heap)	/*!< in: memory heap from which allocated */
 {
@@ -1044,7 +1044,7 @@ row_upd_build_difference_binary(
 	dict_index_t*	index,
 	const dtuple_t*	entry,
 	const rec_t*	rec,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	bool		no_sys,
 	trx_t*		trx,
 	mem_heap_t*	heap,
@@ -1057,7 +1057,7 @@ row_upd_build_difference_binary(
 	ulint		n_diff;
 	ulint		trx_id_pos;
 	ulint		i;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
 	ulint		n_fld = dtuple_get_n_fields(entry);
 	ulint		n_v_fld = dtuple_get_n_v_fields(entry);
 	rec_offs_init(offsets_);
@@ -2070,7 +2070,7 @@ void
 row_upd_copy_columns(
 /*=================*/
 	rec_t*		rec,	/*!< in: record in a clustered index */
-	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
+	const offset_t*	offsets,/*!< in: array returned by rec_get_offsets() */
 	sym_node_t*	column)	/*!< in: first column in a column list, or
 				NULL */
 {
@@ -2219,8 +2219,8 @@ row_upd_store_row(
 	rec_t*		rec;
 	mem_heap_t*	heap		= NULL;
 	row_ext_t**	ext;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	const ulint*	offsets;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	const offset_t*	offsets;
 	rec_offs_init(offsets_);
 
 	ut_ad(node->pcur->latch_mode != BTR_NO_LATCHES);
@@ -2459,7 +2459,7 @@ row_upd_sec_index_entry(
 			    && wsrep_must_process_fk(node, trx)
 			    && !wsrep_thd_is_BF(trx->mysql_thd, FALSE)) {
 
-				ulint*	offsets = rec_get_offsets(
+				offset_t* offsets = rec_get_offsets(
 					rec, index, NULL, true,
 					ULINT_UNDEFINED, &heap);
 
@@ -2504,7 +2504,7 @@ row_upd_sec_index_entry(
 
 		if (referenced) {
 
-			ulint*	offsets;
+			offset_t* offsets;
 
 			offsets = rec_get_offsets(
 				rec, index, NULL, true, ULINT_UNDEFINED,
@@ -2586,7 +2586,7 @@ row_upd_clust_rec_by_insert_inherit_func(
 /*=====================================*/
 	const rec_t*	rec,	/*!< in: old record, or NULL */
 #ifdef UNIV_DEBUG
-	const ulint*	offsets,/*!< in: rec_get_offsets(rec), or NULL */
+	const offset_t*	offsets,/*!< in: rec_get_offsets(rec), or NULL */
 #endif /* UNIV_DEBUG */
 	dtuple_t*	entry,	/*!< in/out: updated entry to be
 				inserted into the clustered index */
@@ -2687,10 +2687,13 @@ row_upd_clust_rec_by_insert(
 	dtuple_t*	entry;
 	dberr_t		err;
 	rec_t*		rec;
-	ulint*		offsets			= NULL;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets			= offsets_;
 
 	ut_ad(dict_index_is_clust(index));
 
+	rec_offs_init(offsets_);
+
 	trx = thr_get_trx(thr);
 	table = node->table;
 	pcur = node->pcur;
@@ -2718,7 +2721,7 @@ row_upd_clust_rec_by_insert(
 		we update the primary key.  Delete-mark the old record
 		in the clustered index and prepare to insert a new entry. */
 		rec = btr_cur_get_rec(btr_cur);
-		offsets = rec_get_offsets(rec, index, NULL, true,
+		offsets = rec_get_offsets(rec, index, offsets, true,
 					  ULINT_UNDEFINED, &heap);
 		ut_ad(page_rec_is_user_rec(rec));
 
@@ -2825,7 +2828,7 @@ row_upd_clust_rec(
 	ulint		flags,  /*!< in: undo logging and locking flags */
 	upd_node_t*	node,	/*!< in: row update node */
 	dict_index_t*	index,	/*!< in: clustered index */
-	ulint*		offsets,/*!< in: rec_get_offsets() on node->pcur */
+	offset_t*	offsets,/*!< in: rec_get_offsets() on node->pcur */
 	mem_heap_t**	offsets_heap,
 				/*!< in/out: memory heap, can be emptied */
 	que_thr_t*	thr,	/*!< in: query thread */
@@ -2956,7 +2959,7 @@ row_upd_del_mark_clust_rec(
 /*=======================*/
 	upd_node_t*	node,	/*!< in: row update node */
 	dict_index_t*	index,	/*!< in: clustered index */
-	ulint*		offsets,/*!< in/out: rec_get_offsets() for the
+	offset_t*	offsets,/*!< in/out: rec_get_offsets() for the
 				record under the cursor */
 	que_thr_t*	thr,	/*!< in: query thread */
 	ibool		referenced,
@@ -3051,8 +3054,8 @@ row_upd_clust_step(
 	mtr_t		mtr;
 	rec_t*		rec;
 	mem_heap_t*	heap	= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets;
+	offset_t	offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	offsets;
 	ibool		referenced;
 	trx_t*		trx = thr_get_trx(thr);
 
diff --git a/storage/innobase/row/row0vers.cc b/storage/innobase/row/row0vers.cc
index f2a574b8331..c977a58c340 100644
--- a/storage/innobase/row/row0vers.cc
+++ b/storage/innobase/row/row0vers.cc
@@ -86,24 +86,27 @@ row_vers_impl_x_locked_low(
 	dict_index_t*	clust_index,
 	const rec_t*	rec,
 	dict_index_t*	index,
-	const ulint*	offsets,
+	const offset_t*	offsets,
 	mtr_t*		mtr)
 {
 	rec_t*		prev_version = NULL;
-	ulint*		clust_offsets;
+	offset_t	clust_offsets_[REC_OFFS_NORMAL_SIZE];
+	offset_t*	clust_offsets = clust_offsets_;
 	mem_heap_t*	heap;
 	dtuple_t*	ientry = NULL;
 	mem_heap_t*	v_heap = NULL;
 	dtuple_t*	cur_vrow = NULL;
 
+	rec_offs_init(clust_offsets_);
+
 	DBUG_ENTER("row_vers_impl_x_locked_low");
 
 	ut_ad(rec_offs_validate(rec, index, offsets));
 
 	heap = mem_heap_create(1024);
 
-	clust_offsets = rec_get_offsets(
-		clust_rec, clust_index, NULL, true, ULINT_UNDEFINED, &heap);
+	clust_offsets = rec_get_offsets(clust_rec, clust_index, clust_offsets,
+					true, ULINT_UNDEFINED, &heap);
 
 	const trx_id_t trx_id = row_get_rec_trx_id(
 		clust_rec, clust_index, clust_offsets);
@@ -186,7 +189,7 @@ row_vers_impl_x_locked_low(
 		ut_ad(committed || prev_version
 		      || !rec_get_deleted_flag(version, comp));
 
-		/* Free version and clust_offsets. */
+		/* Free version. */
 		mem_heap_free(old_heap);
 
 		if (committed) {
@@ -221,7 +224,7 @@ not_locked:
 		}
 
 		clust_offsets = rec_get_offsets(
-			prev_version, clust_index, NULL, true,
+			prev_version, clust_index, clust_offsets, true,
 			ULINT_UNDEFINED, &heap);
 
 		vers_del = rec_get_deleted_flag(prev_version, comp);
@@ -368,7 +371,7 @@ trx_t*
 row_vers_impl_x_locked(
 	const rec_t*	rec,
 	dict_index_t*	index,
-	const ulint*	offsets)
+	const offset_t*	offsets)
 {
 	mtr_t		mtr;
 	trx_t*		trx;
@@ -522,7 +525,7 @@ row_vers_build_cur_vrow_low(
 	bool			in_purge,
 	const rec_t*		rec,
 	dict_index_t*		clust_index,
-	ulint*			clust_offsets,
+	offset_t*		clust_offsets,
 	dict_index_t*		index,
 	roll_ptr_t		roll_ptr,
 	trx_id_t		trx_id,
@@ -638,7 +641,7 @@ row_vers_vc_matches_cluster(
 	const rec_t*	rec,
 	const dtuple_t* icentry,
 	dict_index_t*	clust_index,
-	ulint*		clust_offsets,
+	offset_t*	clust_offsets,
 	dict_index_t*	index,
 	const dtuple_t* ientry,
 	roll_ptr_t	roll_ptr,
@@ -814,7 +817,7 @@ row_vers_build_cur_vrow(
 	bool			in_purge,
 	const rec_t*		rec,
 	dict_index_t*		clust_index,
-	ulint**			clust_offsets,
+	offset_t**		clust_offsets,
 	dict_index_t*		index,
 	const dtuple_t*		ientry,
 	roll_ptr_t		roll_ptr,
@@ -899,7 +902,7 @@ row_vers_old_has_index_entry(
 	const rec_t*	version;
 	rec_t*		prev_version;
 	dict_index_t*	clust_index;
-	ulint*		clust_offsets;
+	offset_t*	clust_offsets;
 	mem_heap_t*	heap;
 	mem_heap_t*	heap2;
 	dtuple_t*	row;
@@ -1157,7 +1160,7 @@ row_vers_build_for_consistent_read(
 				of this records */
 	mtr_t*		mtr,	/*!< in: mtr holding the latch on rec */
 	dict_index_t*	index,	/*!< in: the clustered index */
-	ulint**		offsets,/*!< in/out: offsets returned by
+	offset_t**	offsets,/*!< in/out: offsets returned by
 				rec_get_offsets(rec, index) */
 	ReadView*	view,	/*!< in: the consistent read view */
 	mem_heap_t**	offset_heap,/*!< in/out: memory heap from which
@@ -1272,7 +1275,7 @@ row_vers_build_for_semi_consistent_read(
 				of this records */
 	mtr_t*		mtr,	/*!< in: mtr holding the latch on rec */
 	dict_index_t*	index,	/*!< in: the clustered index */
-	ulint**		offsets,/*!< in/out: offsets returned by
+	offset_t**	offsets,/*!< in/out: offsets returned by
 				rec_get_offsets(rec, index) */
 	mem_heap_t**	offset_heap,/*!< in/out: memory heap from which
 				the offsets are allocated */
diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc
index 6dba53dee6b..540194f1dc2 100644
--- a/storage/innobase/trx/trx0i_s.cc
+++ b/storage/innobase/trx/trx0i_s.cc
@@ -599,7 +599,7 @@ put_nth_field(
 	ulint			n,	/*!< in: number of field */
 	const dict_index_t*	index,	/*!< in: index */
 	const rec_t*		rec,	/*!< in: record */
-	const ulint*		offsets)/*!< in: record offsets, returned
+	const offset_t*		offsets)/*!< in: record offsets, returned
 					by rec_get_offsets() */
 {
 	const byte*	data;
@@ -680,8 +680,8 @@ fill_lock_data(
 	const dict_index_t*	index;
 	ulint			n_fields;
 	mem_heap_t*		heap;
-	ulint			offsets_onstack[REC_OFFS_NORMAL_SIZE];
-	ulint*			offsets;
+	offset_t		offsets_onstack[REC_OFFS_NORMAL_SIZE];
+	offset_t*		offsets;
 	char			buf[TRX_I_S_LOCK_DATA_MAX_LEN];
 	ulint			buf_used;
 	ulint			i;
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index e23f29fa735..b4ac685a267 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -848,7 +848,7 @@ trx_undo_page_report_modify(
 					delete marking is done */
 	const rec_t*	rec,		/*!< in: clustered index record which
 					has NOT yet been modified */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec, index) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec, index) */
 	const upd_t*	update,		/*!< in: update vector which tells the
 					columns to be updated; in the case of
 					a delete, this should be set to NULL */
@@ -2017,7 +2017,7 @@ trx_undo_report_row_operation(
 	const rec_t*	rec,		/*!< in: case of an update or delete
 					marking, the record in the clustered
 					index; NULL if insert */
-	const ulint*	offsets,	/*!< in: rec_get_offsets(rec) */
+	const offset_t*	offsets,	/*!< in: rec_get_offsets(rec) */
 	roll_ptr_t*	roll_ptr)	/*!< out: DB_ROLL_PTR to the
 					undo log record */
 {
@@ -2292,7 +2292,7 @@ trx_undo_prev_version_build(
 				index_rec page and purge_view */
 	const rec_t*	rec,	/*!< in: version of a clustered index record */
 	dict_index_t*	index,	/*!< in: clustered index */
-	ulint*		offsets,/*!< in/out: rec_get_offsets(rec, index) */
+	offset_t*	offsets,/*!< in/out: rec_get_offsets(rec, index) */
 	mem_heap_t*	heap,	/*!< in: memory heap from which the memory
 				needed is allocated */
 	rec_t**		old_vers,/*!< out, own: previous version, or NULL if
@@ -2476,8 +2476,10 @@ trx_undo_prev_version_build(
 	}
 
 #if defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
+	offset_t offsets_dbg[REC_OFFS_NORMAL_SIZE];
+	rec_offs_init(offsets_dbg);
 	ut_a(!rec_offs_any_null_extern(
-		*old_vers, rec_get_offsets(*old_vers, index, NULL, true,
+		*old_vers, rec_get_offsets(*old_vers, index, offsets_dbg, true,
 					   ULINT_UNDEFINED, &heap)));
 #endif // defined UNIV_DEBUG || defined UNIV_BLOB_LIGHT_DEBUG
 
-- 
cgit v1.2.1