From 048f814e7b8ee8f32c55ef07372d8867b0c53fb9 Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Sat, 1 Dec 2018 16:56:55 +0100 Subject: [PATCH 01/72] - Make PlugSubAlloc to be exportable Suppress unused parameter from PlugSubSet modified: storage/connect/global.h modified: storage/connect/plugutil.cpp modified: storage/connect/jsonudf.cpp modified: storage/connect/tabjson.cpp modified: storage/connect/user_connect.cc - Fix a bug making column catalog XML tables fail modified: storage/connect/tabxml.cpp - Comment out wrong message modified: storage/connect/ha_connect.cc - Update error message when sorting an ODBC table fails modified: storage/connect/tabodbc.cpp - Add error message when gettting an address from an OEM fails. modified: storage/connect/reldef.cpp - Make some modifications useful for OEM module writting Export discovery functions for CSV, JDBC and XML Remove unuseful include from tabjson.h Move TDBXML::data_charset function from header file to source modified: storage/connect/tabfmt.h modified: storage/connect/tabjson.h modified: storage/connect/tabxml.cpp modified: storage/connect/tabxml.h - Update test result modified: storage/connect/mysql-test/connect/r/jdbc_oracle.result --- storage/connect/global.h | 6 +- storage/connect/ha_connect.cc | 2 +- storage/connect/jsonudf.cpp | 12 +- .../mysql-test/connect/r/jdbc_oracle.result | 18 +- storage/connect/plugutil.cpp | 28 +- storage/connect/reldef.cpp | 11 +- storage/connect/tabfmt.h | 2 +- storage/connect/tabjson.cpp | 10 +- storage/connect/tabjson.h | 6 +- storage/connect/tabodbc.cpp | 305 +++++++++--------- storage/connect/tabxml.cpp | 13 +- storage/connect/tabxml.h | 5 +- storage/connect/user_connect.cc | 4 +- 13 files changed, 225 insertions(+), 197 deletions(-) diff --git a/storage/connect/global.h b/storage/connect/global.h index 36e8a311124..dc1e149745f 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -219,11 +219,11 @@ DllExport LPCSTR PlugSetPath(LPSTR to, LPCSTR prefix, LPCSTR name, LPCSTR dir); DllExport BOOL PlugIsAbsolutePath(LPCSTR path); DllExport bool AllocSarea(PGLOBAL, uint); DllExport void FreeSarea(PGLOBAL); -DllExport BOOL PlugSubSet(PGLOBAL, void *, uint); +DllExport BOOL PlugSubSet(void *, uint); +DllExport void *PlugSubAlloc(PGLOBAL, void *, size_t); DllExport char *PlugDup(PGLOBAL g, const char *str); DllExport void *MakePtr(void *, OFFSET); DllExport void htrc(char const *fmt, ...); -//DllExport int GetTraceValue(void); DllExport uint GetTraceValue(void); #if defined(__cplusplus) @@ -233,6 +233,6 @@ DllExport uint GetTraceValue(void); /***********************************************************************/ /* Non exported routine declarations. */ /***********************************************************************/ -void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw +//void *PlugSubAlloc(PGLOBAL, void *, size_t); // Does throw /*-------------------------- End of Global.H --------------------------*/ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index c9d8d34bd86..26b7036e5ac 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -4191,7 +4191,7 @@ int ha_connect::rnd_pos(uchar *buf, uchar *pos) rc= rnd_next(buf); } else { PGLOBAL g = GetPlug((table) ? table->in_use : NULL, xp); - strcpy(g->Message, "Not supported by this table type"); +// strcpy(g->Message, "Not supported by this table type"); my_message(ER_ILLEGAL_HA, g->Message, MYF(0)); rc= HA_ERR_INTERNAL_ERROR; } // endif SetRecpos diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 26455d572b6..d5a3a840173 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -3055,7 +3055,7 @@ my_bool json_array_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) PGLOBAL g = (PGLOBAL)initid->ptr; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR); g->N = (int)n; return false; @@ -3098,7 +3098,7 @@ void json_array_grp_clear(UDF_INIT *initid, char*, char*) { PGLOBAL g = (PGLOBAL)initid->ptr; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JAR); g->N = GetJsonGroupSize(); } // end of json_array_grp_clear @@ -3132,7 +3132,7 @@ my_bool json_object_grp_init(UDF_INIT *initid, UDF_ARGS *args, char *message) PGLOBAL g = (PGLOBAL)initid->ptr; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB); g->N = (int)n; return false; @@ -3169,7 +3169,7 @@ void json_object_grp_clear(UDF_INIT *initid, char*, char*) { PGLOBAL g = (PGLOBAL)initid->ptr; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Activityp = (PACTIVITY)JsonNew(g, TYPE_JOB); g->N = GetJsonGroupSize(); } // end of json_object_grp_clear @@ -4418,7 +4418,7 @@ char *json_file(UDF_INIT *initid, UDF_ARGS *args, char *result, } else if (initid->const_item) g->N = 1; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); fn = MakePSZ(g, args, 0); if (args->arg_count > 1) { @@ -5662,7 +5662,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, if (bsp && !bsp->Changed) goto fin; - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Xchk = NULL; fn = MakePSZ(g, args, 0); pretty = (args->arg_count > 2 && args->args[2]) ? (int)*(longlong*)args->args[2] : 3; diff --git a/storage/connect/mysql-test/connect/r/jdbc_oracle.result b/storage/connect/mysql-test/connect/r/jdbc_oracle.result index 2e36891a037..ec314c5f072 100644 --- a/storage/connect/mysql-test/connect/r/jdbc_oracle.result +++ b/storage/connect/mysql-test/connect/r/jdbc_oracle.result @@ -8,12 +8,19 @@ SELECT * FROM t2 WHERE command = 'drop table employee'; command number message drop table employee 0 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist +Warnings: +Warning 1105 Execute: java.sql.SQLSyntaxErrorException: ORA-00942: table or view does not exist + SELECT * FROM t2 WHERE command = 'create table employee (id int not null, name varchar(32), title char(16), salary number(8,2))'; command number message create table employee (id int not null, name varchar(32), title char(16), salary number(8,2)) 0 Affected rows +Warnings: +Warning 1105 Affected rows SELECT * FROM t2 WHERE command = "insert into employee values(4567,'Johnson', 'Engineer', 12560.50)"; command number message insert into employee values(4567,'Johnson', 'Engineer', 12560.50) 1 Affected rows +Warnings: +Warning 1105 Affected rows CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=JDBC CATFUNC=tables CONNECTION='jdbc:oracle:thin:@localhost:1521:xe' OPTION_LIST='User=system,Password=manager'; @@ -27,8 +34,8 @@ OPTION_LIST='User=system,Password=manager'; SELECT * FROM t1; Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks NULL SYSTEM EMPLOYEE ID 3 NUMBER 38 0 0 10 0 NULL -NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 0 10 1 NULL -NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 0 10 1 NULL +NULL SYSTEM EMPLOYEE NAME 12 VARCHAR2 32 0 NULL 10 1 NULL +NULL SYSTEM EMPLOYEE TITLE 1 CHAR 16 0 NULL 10 1 NULL NULL SYSTEM EMPLOYEE SALARY 3 NUMBER 8 0 2 10 1 NULL DROP TABLE t1; CREATE SERVER 'oracle' FOREIGN DATA WRAPPER 'oracle.jdbc.driver.OracleDriver' OPTIONS ( @@ -52,7 +59,7 @@ Note 1105 EMPLOYEE: 1 affected rows SELECT * FROM t1; ID NAME TITLE SALARY 4567 Trump Engineer 12560.50 -6214 Clinton Retired 0.00 +6214 Clinton Retired NULL DELETE FROM t1 WHERE id = 6214; Warnings: Note 1105 EMPLOYEE: 1 affected rows @@ -63,8 +70,7 @@ DROP TABLE t1; SELECT * FROM t2 WHERE command = 'drop table employee'; command number message drop table employee 0 Affected rows +Warnings: +Warning 1105 Affected rows DROP TABLE t2; DROP SERVER 'oracle'; -SET GLOBAL connect_jvm_path=NULL; -SET GLOBAL connect_class_path=NULL; -SET GLOBAL time_zone = SYSTEM; diff --git a/storage/connect/plugutil.cpp b/storage/connect/plugutil.cpp index 887527e38ab..048f00be75f 100644 --- a/storage/connect/plugutil.cpp +++ b/storage/connect/plugutil.cpp @@ -514,27 +514,31 @@ void FreeSarea(PGLOBAL g) /* Here there should be some verification done such as validity of */ /* the address and size not larger than memory size. */ /***********************************************************************/ -BOOL PlugSubSet(PGLOBAL g __attribute__((unused)), void *memp, uint size) +BOOL PlugSubSet(void *memp, uint size) { PPOOLHEADER pph = (PPOOLHEADER)memp; pph->To_Free = (OFFSET)sizeof(POOLHEADER); pph->FreeBlk = size - pph->To_Free; - return FALSE; } /* end of PlugSubSet */ +/***********************************************************************/ +/* Use it to export a function that do throwing. */ +/***********************************************************************/ +void *DoThrow(int n) +{ + throw n; +} /* end of DoThrow */ + /***********************************************************************/ /* Program for sub-allocating one item in a storage area. */ -/* Note: SubAlloc routines of OS/2 are no more used to increase the */ -/* code portability and avoid problems when a grammar compiled under */ -/* one version of OS/2 is used under another version. */ -/* The simple way things are done here is also based on the fact */ -/* that no freeing of suballocated blocks is permitted in Plug. */ +/* The simple way things are done here is based on the fact */ +/* that no freeing of suballocated blocks is permitted in CONNECT. */ /***********************************************************************/ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) - { - PPOOLHEADER pph; /* Points on area header. */ +{ + PPOOLHEADER pph; /* Points on area header. */ if (!memp) /*******************************************************************/ @@ -559,8 +563,8 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) if (trace(1)) htrc("PlugSubAlloc: %s\n", g->Message); - throw 1234; - } /* endif size OS32 code */ + DoThrow(1234); + } /* endif size OS32 code */ /*********************************************************************/ /* Do the suballocation the simplest way. */ @@ -574,7 +578,7 @@ void *PlugSubAlloc(PGLOBAL g, void *memp, size_t size) memp, pph->To_Free, pph->FreeBlk); return (memp); - } /* end of PlugSubAlloc */ +} /* end of PlugSubAlloc */ /***********************************************************************/ /* Program for sub-allocating and copying a string in a storage area. */ diff --git a/storage/connect/reldef.cpp b/storage/connect/reldef.cpp index e4f169575f8..30d8063d1a6 100644 --- a/storage/connect/reldef.cpp +++ b/storage/connect/reldef.cpp @@ -522,8 +522,15 @@ PTABDEF OEMDEF::GetXdef(PGLOBAL g) // Get the function returning an instance of the external DEF class if (!(getdef = (XGETDEF)GetProcAddress((HINSTANCE)Hdll, getname))) { - sprintf(g->Message, MSG(PROCADD_ERROR), GetLastError(), getname); - FreeLibrary((HMODULE)Hdll); + char buf[256]; + DWORD rc = GetLastError(); + + sprintf(g->Message, MSG(PROCADD_ERROR), rc, getname); + 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 getdef #else // !__WIN__ diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index 396bba568ff..10f0757c60b 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -13,7 +13,7 @@ typedef class TDBFMT *PTDBFMT; /***********************************************************************/ /* Functions used externally. */ /***********************************************************************/ -PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info); +DllExport PQRYRES CSVColumns(PGLOBAL g, PCSZ dp, PTOS topt, bool info); /***********************************************************************/ /* CSV table. */ diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index 9e4f5ab987d..d20e793ff88 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -299,7 +299,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt) memset(G, 0, sizeof(GLOBAL)); G->Sarea_Size = tdp->Lrecl * 10; G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size); - PlugSubSet(G, G->Sarea, G->Sarea_Size); + PlugSubSet(G->Sarea, G->Sarea_Size); G->jump_level = 0; tjnp->SetG(G); @@ -670,7 +670,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) memset(G, 0, sizeof(GLOBAL)); G->Sarea_Size = Lrecl * 10; G->Sarea = PlugSubAlloc(g, NULL, G->Sarea_Size); - PlugSubSet(G, G->Sarea, G->Sarea_Size); + PlugSubSet(G->Sarea, G->Sarea_Size); G->jump_level = 0; ((TDBJSN*)tdbp)->G = G; } else { @@ -963,7 +963,7 @@ int TDBJSN::ReadDB(PGLOBAL g) return rc; // Recover the memory used for parsing - PlugSubSet(G, G->Sarea, G->Sarea_Size); + PlugSubSet(G->Sarea, G->Sarea_Size); if ((Row = ParseJson(G, To_Line, strlen(To_Line), &Pretty, &Comma))) { Row = FindRow(g); @@ -1079,13 +1079,13 @@ int TDBJSN::MakeTopTree(PGLOBAL g, PJSON jsp) } // end of PrepareWriting /***********************************************************************/ -/* WriteDB: Data Base write routine for DOS access method. */ +/* WriteDB: Data Base write routine for JSON access method. */ /***********************************************************************/ int TDBJSN::WriteDB(PGLOBAL g) { int rc = TDBDOS::WriteDB(g); - PlugSubSet(G, G->Sarea, G->Sarea_Size); + PlugSubSet(G->Sarea, G->Sarea_Size); Row->Clear(); return rc; } // end of WriteDB diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index 2ff72905e86..fcbfe4ed1ec 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -1,11 +1,11 @@ /*************** tabjson H Declares Source Code File (.H) **************/ /* Name: tabjson.h Version 1.3 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2014 - 2018 */ /* */ /* This file contains the JSON classes declares. */ /***********************************************************************/ -#include "osutil.h" +//#include "osutil.h" // Unuseful and bad for OEM #include "block.h" #include "colblk.h" #include "json.h" @@ -16,7 +16,7 @@ typedef class JSONDEF *PJDEF; typedef class TDBJSON *PJTDB; typedef class JSONCOL *PJCOL; class TDBJSN; -PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info); +DllExport PQRYRES JSONColumns(PGLOBAL, PCSZ, PCSZ, PTOS, bool); /***********************************************************************/ /* The JSON tree node. Can be an Object or an Array. */ diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index fddfb0c0420..0fa117c3d2f 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -5,7 +5,7 @@ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2000-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2000-2018 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -95,23 +95,23 @@ bool ExactInfo(void); /* Constructor. */ /***********************************************************************/ ODBCDEF::ODBCDEF(void) - { +{ Connect = NULL; Catver = 0; UseCnc = false; - } // end of ODBCDEF constructor +} // end of ODBCDEF constructor /***********************************************************************/ /* DefineAM: define specific AM block values from XDB file. */ /***********************************************************************/ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) - { +{ Desc = Connect = GetStringCatInfo(g, "Connect", NULL); if (!Connect && !Catfunc) { sprintf(g->Message, "Missing connection for ODBC table %s", Name); return true; - } // endif Connect + } // endif Connect if (EXTDEF::DefineAM(g, am, poff)) return true; @@ -123,13 +123,13 @@ bool ODBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) Qto= GetIntCatInfo("QueryTimeout", DEFAULT_QUERY_TIMEOUT); UseCnc = GetBoolCatInfo("UseDSN", false); return false; - } // end of DefineAM +} // end of DefineAM /***********************************************************************/ /* GetTable: makes a new Table Description Block. */ /***********************************************************************/ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m) - { +{ PTDB tdbp = NULL; /*********************************************************************/ @@ -158,10 +158,10 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m) tdbp = new(g) TDBMUL(tdbp); else if (Multiple == 2) strcpy(g->Message, MSG(NO_ODBC_MUL)); - } // endswitch Catfunc + } // endswitch Catfunc return tdbp; - } // end of GetTable +} // end of GetTable /* -------------------------- Class TDBODBC -------------------------- */ @@ -169,7 +169,7 @@ PTDB ODBCDEF::GetTable(PGLOBAL g, MODE m) /* Implementation of the TDBODBC class. */ /***********************************************************************/ TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp) - { +{ Ocp = NULL; Cnp = NULL; @@ -191,19 +191,19 @@ TDBODBC::TDBODBC(PODEF tdp) : TDBEXT(tdp) Ops.UseCnc = false; } // endif tdp - } // end of TDBODBC standard constructor +} // end of TDBODBC standard constructor TDBODBC::TDBODBC(PTDBODBC tdbp) : TDBEXT(tdbp) - { +{ Ocp = tdbp->Ocp; // is that right ? Cnp = tdbp->Cnp; Connect = tdbp->Connect; Ops = tdbp->Ops; - } // end of TDBODBC copy constructor +} // end of TDBODBC copy constructor // Method PTDB TDBODBC::Clone(PTABS t) - { +{ PTDB tp; PODBCCOL cp1, cp2; PGLOBAL g = t->G; // Is this really useful ??? @@ -213,18 +213,18 @@ PTDB TDBODBC::Clone(PTABS t) for (cp1 = (PODBCCOL)Columns; cp1; cp1 = (PODBCCOL)cp1->GetNext()) { cp2 = new(g) ODBCCOL(cp1, tp); // Make a copy NewPointer(t, cp1, cp2); - } // endfor cp1 + } // endfor cp1 return tp; - } // end of CopyOne +} // end of CopyOne /***********************************************************************/ /* Allocate ODBC column description block. */ /***********************************************************************/ PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) - { +{ return new(g) ODBCCOL(cdp, this, cprec, n); - } // end of MakeCol +} // end of MakeCol /***********************************************************************/ /* Extract the filename from connect string and return it. */ @@ -232,7 +232,7 @@ PCOL TDBODBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) /* with a place holder to be used by SetFile. */ /***********************************************************************/ PCSZ TDBODBC::GetFile(PGLOBAL g) - { +{ if (Connect) { char *p1, *p2; int i; @@ -263,18 +263,18 @@ PCSZ TDBODBC::GetFile(PGLOBAL g) memcpy(MulConn, Connect, p1 - Connect); MulConn[p1 - Connect] = '\0'; strcat(strcat(MulConn, "%s"), (p2) ? p2 : ";"); - } // endif p1 + } // endif p1 - } // endif Connect + } // endif Connect return (DBQ) ? DBQ : (PSZ)"???"; - } // end of GetFile +} // end of GetFile /***********************************************************************/ /* Set DBQ and get the new file name into the connect string. */ /***********************************************************************/ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn) - { +{ if (MulConn) { int n = strlen(MulConn) + strlen(fn) - 1; @@ -283,20 +283,20 @@ void TDBODBC::SetFile(PGLOBAL g, PCSZ fn) // of having to reallocate it is reduced. BufSize = n + 6; Connect = (char*)PlugSubAlloc(g, NULL, BufSize); - } // endif n + } // endif n // Make the complete connect string sprintf(Connect, MulConn, fn); - } // endif MultConn + } // endif MultConn DBQ = PlugDup(g, fn); - } // end of SetFile +} // end of SetFile /***********************************************************************/ /* MakeInsert: make the Insert statement used with ODBC connection. */ /***********************************************************************/ bool TDBODBC::MakeInsert(PGLOBAL g) - { +{ PCSZ schmp = NULL; char *catp = NULL, buf[NAM_LEN * 3]; int len = 0; @@ -377,7 +377,7 @@ bool TDBODBC::MakeInsert(PGLOBAL g) } else Query->Append(buf); - } // endfor colp + } // endfor colp Query->Append(") VALUES ("); @@ -390,32 +390,32 @@ bool TDBODBC::MakeInsert(PGLOBAL g) Query->RepLast(')'); return oom; - } // end of MakeInsert +} // end of MakeInsert /***********************************************************************/ /* ODBC Bind Parameter function. */ /***********************************************************************/ bool TDBODBC::BindParameters(PGLOBAL g) - { - PODBCCOL colp; +{ + PODBCCOL colp; - for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) { - colp->AllocateBuffers(g, 0); + for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) { + colp->AllocateBuffers(g, 0); - if (Ocp->BindParam(colp)) - return true; + if (Ocp->BindParam(colp)) + return true; - } // endfor colp + } // endfor colp - return false; - } // end of BindParameters + return false; +} // end of BindParameters #if 0 /***********************************************************************/ /* MakeUpdate: make the SQL statement to send to ODBC connection. */ /***********************************************************************/ char *TDBODBC::MakeUpdate(PGLOBAL g) - { +{ char *qc, *stmt = NULL, cmd[8], tab[96], end[1024]; stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64); @@ -440,60 +440,60 @@ char *TDBODBC::MakeUpdate(PGLOBAL g) strcat(stmt, end); return stmt; - } // end of MakeUpdate +} // end of MakeUpdate /***********************************************************************/ /* MakeDelete: make the SQL statement to send to ODBC connection. */ /***********************************************************************/ char *TDBODBC::MakeDelete(PGLOBAL g) - { - char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512]; +{ + char *qc, *stmt = NULL, cmd[8], from[8], tab[96], end[512]; - stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64); - memset(end, 0, sizeof(end)); + stmt = (char*)PlugSubAlloc(g, NULL, strlen(Qrystr) + 64); + memset(end, 0, sizeof(end)); - if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 || - sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2) - qc = Ocp->GetQuoteChar(); - else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2) - qc = (Quoted) ? Quote : ""; - else { - strcpy(g->Message, "Cannot use this DELETE command"); - return NULL; - } // endif sscanf + if (sscanf(Qrystr, "%s %s `%[^`]`%511c", cmd, from, tab, end) > 2 || + sscanf(Qrystr, "%s %s \"%[^\"]\"%511c", cmd, from, tab, end) > 2) + qc = Ocp->GetQuoteChar(); + else if (sscanf(Qrystr, "%s %s %s%511c", cmd, from, tab, end) > 2) + qc = (Quoted) ? Quote : ""; + else { + strcpy(g->Message, "Cannot use this DELETE command"); + return NULL; + } // endif sscanf - assert(!stricmp(cmd, "delete") && !stricmp(from, "from")); - strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc); + assert(!stricmp(cmd, "delete") && !stricmp(from, "from")); + strcat(strcat(strcat(strcpy(stmt, "DELETE FROM "), qc), TableName), qc); - if (*end) { - for (int i = 0; end[i]; i++) - if (end[i] == '`') - end[i] = *qc; + if (*end) { + for (int i = 0; end[i]; i++) + if (end[i] == '`') + end[i] = *qc; - strcat(stmt, end); - } // endif end + strcat(stmt, end); + } // endif end - return stmt; - } // end of MakeDelete + return stmt; +} // end of MakeDelete #endif // 0 /***********************************************************************/ /* ResetSize: call by TDBMUL when calculating size estimate. */ /***********************************************************************/ void TDBODBC::ResetSize(void) - { +{ MaxSize = -1; if (Ocp && Ocp->IsOpen()) Ocp->Close(); - } // end of ResetSize +} // end of ResetSize /***********************************************************************/ /* ODBC Cardinality: returns table size in number of rows. */ /***********************************************************************/ int TDBODBC::Cardinality(PGLOBAL g) - { +{ if (!g) return (Mode == MODE_ANY && !Srcdef) ? 1 : 0; @@ -526,7 +526,7 @@ int TDBODBC::Cardinality(PGLOBAL g) Cardinal = 10; // To make MySQL happy return Cardinal; - } // end of Cardinality +} // end of Cardinality /***********************************************************************/ /* ODBC Access Method opening routine. */ @@ -535,7 +535,7 @@ int TDBODBC::Cardinality(PGLOBAL g) /* join block of next table if it exists or else are discarted. */ /***********************************************************************/ bool TDBODBC::OpenDB(PGLOBAL g) - { +{ bool rc = true; if (trace(1)) @@ -571,7 +571,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) Fpos = 0; Curpos = 1; return false; - } // endif use + } // endif use /*********************************************************************/ /* Open an ODBC connection for this table. */ @@ -593,7 +593,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) Use = USE_OPEN; // Do it now in case we are recursively called /*********************************************************************/ - /* Make the command and allocate whatever is used for getting results. */ + /* Make the command and allocate whatever is used for getting results*/ /*********************************************************************/ if (Mode == MODE_READ || Mode == MODE_READX) { if (Memory > 1 && !Srcdef) { @@ -624,7 +624,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) } else return true; - } // endif Memory + } // endif Memory if (!(rc = MakeSQL(g, false))) { for (PODBCCOL colp = (PODBCCOL)Columns; colp; @@ -635,7 +635,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) rc = (Mode == MODE_READ) ? ((Rows = Ocp->ExecDirectSQL(Query->GetStr(), (PODBCCOL)Columns)) < 0) : false; - } // endif rc + } // endif rc } else if (Mode == MODE_INSERT) { if (!(rc = MakeInsert(g))) { @@ -645,7 +645,7 @@ bool TDBODBC::OpenDB(PGLOBAL g) } else rc = BindParameters(g); - } // endif rc + } // endif rc } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) { rc = false; // wait for CheckCond before calling MakeCommand(g); @@ -655,30 +655,30 @@ bool TDBODBC::OpenDB(PGLOBAL g) if (rc) { Ocp->Close(); return true; - } // endif rc + } // endif rc /*********************************************************************/ /* Reset statistics values. */ /*********************************************************************/ num_read = num_there = num_eq[0] = num_eq[1] = 0; return false; - } // end of OpenDB +} // end of OpenDB #if 0 /***********************************************************************/ /* GetRecpos: return the position of last read record. */ /***********************************************************************/ int TDBODBC::GetRecpos(void) - { +{ return Fpos; - } // end of GetRecpos +} // end of GetRecpos #endif // 0 /***********************************************************************/ /* SetRecpos: set the position of next read record. */ /***********************************************************************/ bool TDBODBC::SetRecpos(PGLOBAL g, int recpos) - { +{ if (Ocp->m_Full) { Fpos = 0; CurNum = recpos - 1; @@ -696,14 +696,15 @@ bool TDBODBC::SetRecpos(PGLOBAL g, int recpos) } // endif recpos } else { - strcpy(g->Message, "This action requires a scrollable cursor"); + strcpy(g->Message, + "This action requires Memory setting or a scrollable cursor"); return true; } // endif's // Indicate the table position was externally set Placed = true; return false; - } // end of SetRecpos +} // end of SetRecpos /***********************************************************************/ /* Data Base indexed read routine for ODBC access method. */ @@ -721,7 +722,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) Rows = Ocp->ExecDirectSQL((char*)Query->GetStr(), (PODBCCOL)Columns); Mode = MODE_READ; return (Rows < 0); - } // endif key + } // endif key return false; } else { @@ -737,7 +738,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) if ((To_CondFil = hc->CheckCond(g, To_CondFil, Cond))) PlugSubAlloc(g, NULL, strlen(To_CondFil->Body) + 1); - } // endif active_index + } // endif active_index if (To_CondFil) if (Query->Append(" AND ") || Query->Append(To_CondFil->Body)) { @@ -762,7 +763,7 @@ bool TDBODBC::ReadKey(PGLOBAL g, OPVAL op, const key_range *kr) /* VRDNDOS: Data Base read routine for odbc access method. */ /***********************************************************************/ int TDBODBC::ReadDB(PGLOBAL g) - { +{ int rc; if (trace(2)) @@ -784,7 +785,7 @@ int TDBODBC::ReadDB(PGLOBAL g) } else return RC_FX; // Error - } // endif Mode + } // endif Mode /*********************************************************************/ /* Now start the reading process. */ @@ -813,7 +814,7 @@ int TDBODBC::ReadDB(PGLOBAL g) Qrp->Nblin++; Fpos++; // Used for memory and pos - } // endif rc + } // endif rc } // endif Placed @@ -821,13 +822,13 @@ int TDBODBC::ReadDB(PGLOBAL g) htrc(" Read: Rbuf=%d rc=%d\n", Rbuf, rc); return rc; - } // end of ReadDB +} // end of ReadDB /***********************************************************************/ /* Data Base Insert write routine for ODBC access method. */ /***********************************************************************/ int TDBODBC::WriteDB(PGLOBAL g) - { +{ int n = Ocp->ExecuteSQL(); if (n < 0) { @@ -837,13 +838,13 @@ int TDBODBC::WriteDB(PGLOBAL g) AftRows += n; return RC_OK; - } // end of WriteDB +} // end of WriteDB /***********************************************************************/ /* Data Base delete line routine for ODBC access method. */ /***********************************************************************/ int TDBODBC::DeleteDB(PGLOBAL g, int irc) - { +{ if (irc == RC_FX) { if (!Query && MakeCommand(g)) return RC_FX; @@ -863,13 +864,13 @@ int TDBODBC::DeleteDB(PGLOBAL g, int irc) } else return RC_OK; // Ignore - } // end of DeleteDB +} // end of DeleteDB /***********************************************************************/ /* Data Base close routine for ODBC access method. */ /***********************************************************************/ void TDBODBC::CloseDB(PGLOBAL g) - { +{ if (Ocp) Ocp->Close(); @@ -877,7 +878,7 @@ void TDBODBC::CloseDB(PGLOBAL g) if (trace(1)) htrc("ODBC CloseDB: closing %s\n", Name); - } // end of CloseDB +} // end of CloseDB /* --------------------------- ODBCCOL ------------------------------- */ @@ -886,33 +887,33 @@ void TDBODBC::CloseDB(PGLOBAL g) /***********************************************************************/ ODBCCOL::ODBCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am) : EXTCOL(cdp, tdbp, cprec, i, am) - { +{ // Set additional ODBC access method information for column. Slen = 0; StrLen = &Slen; Sqlbuf = NULL; - } // end of ODBCCOL constructor +} // end of ODBCCOL constructor /***********************************************************************/ /* ODBCCOL private constructor. */ /***********************************************************************/ ODBCCOL::ODBCCOL(void) : EXTCOL() - { +{ Slen = 0; StrLen = &Slen; Sqlbuf = NULL; - } // end of ODBCCOL constructor +} // end of ODBCCOL constructor /***********************************************************************/ /* ODBCCOL constructor used for copying columns. */ /* tdbp is the pointer to the new table descriptor. */ /***********************************************************************/ ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp) - { +{ Slen = col1->Slen; StrLen = col1->StrLen; Sqlbuf = col1->Sqlbuf; - } // end of ODBCCOL copy constructor +} // end of ODBCCOL copy constructor /***********************************************************************/ /* ReadColumn: when SQLFetch is used there is nothing to do as the */ @@ -920,7 +921,7 @@ ODBCCOL::ODBCCOL(ODBCCOL *col1, PTDB tdbp) : EXTCOL(col1, tdbp) /* when calculating MaxSize (Bufp is NULL even when Rows is not). */ /***********************************************************************/ void ODBCCOL::ReadColumn(PGLOBAL g) - { +{ PTDBODBC tdbp = (PTDBODBC)To_Tdb; int i = tdbp->Fpos - 1, n = tdbp->CurNum; @@ -953,7 +954,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g) else Value->SetValue_pvblk(Blkp, n); - } // endif Bufp + } // endif Bufp if (Buf_Type == TYPE_DATE) { struct tm dbtime; @@ -980,7 +981,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g) htrc("ODBC Column %s: rows=%d buf=%p type=%d value=%s\n", Name, tdbp->Rows, Bufp, Buf_Type, Value->GetCharString(buf)); - } // endif trace + } // endif trace put: if (tdbp->Memory != 2) @@ -997,7 +998,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g) } else Crp->Kdata->SetValue(Value, i); - } // end of ReadColumn +} // end of ReadColumn /***********************************************************************/ /* AllocateBuffers: allocate the extended buffer for SQLExtendedFetch */ @@ -1005,7 +1006,7 @@ void ODBCCOL::ReadColumn(PGLOBAL g) /* for the ending null character. */ /***********************************************************************/ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows) - { +{ if (Buf_Type == TYPE_DATE) Sqlbuf = (TIMESTAMP_STRUCT*)PlugSubAlloc(g, NULL, sizeof(TIMESTAMP_STRUCT)); @@ -1019,31 +1020,31 @@ void ODBCCOL::AllocateBuffers(PGLOBAL g, int rows) Blkp = AllocValBlock(g, NULL, Buf_Type, rows, GetBuflen(), GetScale(), true, false, false); Bufp = Blkp->GetValPointer(); - } // endelse + } // endelse if (rows > 1) StrLen = (SQLLEN *)PlugSubAlloc(g, NULL, rows * sizeof(SQLLEN)); - } // end of AllocateBuffers +} // end of AllocateBuffers /***********************************************************************/ /* Returns the buffer to use for Fetch or Extended Fetch. */ /***********************************************************************/ void *ODBCCOL::GetBuffer(DWORD rows) - { +{ if (rows && To_Tdb) { assert(rows == (DWORD)((TDBODBC*)To_Tdb)->Rows); return Bufp; } else return (Buf_Type == TYPE_DATE) ? Sqlbuf : Value->GetTo_Val(); - } // end of GetBuffer +} // end of GetBuffer /***********************************************************************/ /* Returns the buffer length to use for Fetch or Extended Fetch. */ /***********************************************************************/ SWORD ODBCCOL::GetBuflen(void) - { +{ SWORD flen; switch (Buf_Type) { @@ -1059,13 +1060,13 @@ SWORD ODBCCOL::GetBuflen(void) } // endswitch Buf_Type return flen; - } // end of GetBuflen +} // end of GetBuflen /***********************************************************************/ /* WriteColumn: make sure the bind buffer is updated. */ /***********************************************************************/ void ODBCCOL::WriteColumn(PGLOBAL g) - { +{ /*********************************************************************/ /* Do convert the column value if necessary. */ /*********************************************************************/ @@ -1095,7 +1096,7 @@ void ODBCCOL::WriteColumn(PGLOBAL g) *StrLen = (Value->IsNull()) ? SQL_NULL_DATA : (IsTypeChar(Buf_Type)) ? SQL_NTS : 0; - } // end of WriteColumn +} // end of WriteColumn /* -------------------------- Class TDBXDBC -------------------------- */ @@ -1119,7 +1120,7 @@ TDBXDBC::TDBXDBC(PTDBXDBC tdbp) : TDBODBC(tdbp) } // end of TDBXDBC copy constructor PTDB TDBXDBC::Clone(PTABS t) - { +{ PTDB tp; PXSRCCOL cp1, cp2; PGLOBAL g = t->G; // Is this really useful ??? @@ -1129,29 +1130,29 @@ PTDB TDBXDBC::Clone(PTABS t) for (cp1 = (PXSRCCOL)Columns; cp1; cp1 = (PXSRCCOL)cp1->GetNext()) { cp2 = new(g) XSRCCOL(cp1, tp); // Make a copy NewPointer(t, cp1, cp2); - } // endfor cp1 + } // endfor cp1 return tp; - } // end of CopyOne +} // end of CopyOne /***********************************************************************/ /* Allocate XSRC column description block. */ /***********************************************************************/ PCOL TDBXDBC::MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n) - { +{ PXSRCCOL colp = new(g) XSRCCOL(cdp, this, cprec, n); if (!colp->Flag) Cmdcol = colp->GetName(); return colp; - } // end of MakeCol +} // end of MakeCol /***********************************************************************/ /* MakeCMD: make the SQL statement to send to ODBC connection. */ /***********************************************************************/ PCMD TDBXDBC::MakeCMD(PGLOBAL g) - { +{ PCMD xcmd = NULL; if (To_CondFil) { @@ -1171,14 +1172,14 @@ PCMD TDBXDBC::MakeCMD(PGLOBAL g) xcmd = new(g) CMD(g, Srcdef); return xcmd; - } // end of MakeCMD +} // end of MakeCMD #if 0 /***********************************************************************/ /* ODBC Bind Parameter function. */ /***********************************************************************/ bool TDBXDBC::BindParameters(PGLOBAL g) - { +{ PODBCCOL colp; for (colp = (PODBCCOL)Columns; colp; colp = (PODBCCOL)colp->Next) { @@ -1190,19 +1191,19 @@ bool TDBXDBC::BindParameters(PGLOBAL g) } // endfor colp return false; - } // end of BindParameters +} // end of BindParameters #endif // 0 /***********************************************************************/ /* XDBC GetMaxSize: returns table size (not always one row). */ /***********************************************************************/ int TDBXDBC::GetMaxSize(PGLOBAL g) - { +{ if (MaxSize < 0) MaxSize = 10; // Just a guess return MaxSize; - } // end of GetMaxSize +} // end of GetMaxSize /***********************************************************************/ /* ODBC Access Method opening routine. */ @@ -1211,7 +1212,7 @@ int TDBXDBC::GetMaxSize(PGLOBAL g) /* join block of next table if it exists or else are discarted. */ /***********************************************************************/ bool TDBXDBC::OpenDB(PGLOBAL g) - { +{ bool rc = false; if (trace(1)) @@ -1221,7 +1222,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g) if (Use == USE_OPEN) { strcpy(g->Message, "Multiple execution is not allowed"); return true; - } // endif use + } // endif use /*********************************************************************/ /* Open an ODBC connection for this table. */ @@ -1243,7 +1244,7 @@ bool TDBXDBC::OpenDB(PGLOBAL g) if (Mode != MODE_READ && Mode != MODE_READX) { strcpy(g->Message, "No INSERT/DELETE/UPDATE of XDBC tables"); return true; - } // endif Mode + } // endif Mode /*********************************************************************/ /* Get the command to execute. */ @@ -1256,13 +1257,13 @@ bool TDBXDBC::OpenDB(PGLOBAL g) Rows = 1; return false; - } // end of OpenDB +} // end of OpenDB /***********************************************************************/ /* ReadDB: Data Base read routine for xdbc access method. */ /***********************************************************************/ int TDBXDBC::ReadDB(PGLOBAL g) - { +{ if (Cmdlist) { if (!Query) Query = new(g)STRING(g, 0, Cmdlist->Cmd); @@ -1280,25 +1281,25 @@ int TDBXDBC::ReadDB(PGLOBAL g) return RC_EF; } // endif Cmdlist - } // end of ReadDB +} // end of ReadDB /***********************************************************************/ -/* Data Base delete line routine for ODBC access method. */ +/* Data Base write line routine for XDBC access method. */ /***********************************************************************/ int TDBXDBC::WriteDB(PGLOBAL g) - { +{ strcpy(g->Message, "Execsrc tables are read only"); return RC_FX; - } // end of DeleteDB +} // end of DeleteDB /***********************************************************************/ -/* Data Base delete line routine for ODBC access method. */ +/* Data Base delete line routine for XDBC access method. */ /***********************************************************************/ int TDBXDBC::DeleteDB(PGLOBAL g, int irc) - { +{ strcpy(g->Message, MSG(NO_ODBC_DELETE)); return RC_FX; - } // end of DeleteDB +} // end of DeleteDB /* --------------------------- XSRCCOL ------------------------------- */ @@ -1307,25 +1308,25 @@ int TDBXDBC::DeleteDB(PGLOBAL g, int irc) /***********************************************************************/ XSRCCOL::XSRCCOL(PCOLDEF cdp, PTDB tdbp, PCOL cprec, int i, PCSZ am) : ODBCCOL(cdp, tdbp, cprec, i, am) - { +{ // Set additional ODBC access method information for column. Flag = cdp->GetOffset(); - } // end of XSRCCOL constructor +} // end of XSRCCOL constructor /***********************************************************************/ /* XSRCCOL constructor used for copying columns. */ /* tdbp is the pointer to the new table descriptor. */ /***********************************************************************/ XSRCCOL::XSRCCOL(XSRCCOL *col1, PTDB tdbp) : ODBCCOL(col1, tdbp) - { +{ Flag = col1->Flag; - } // end of XSRCCOL copy constructor +} // end of XSRCCOL copy constructor /***********************************************************************/ /* ReadColumn: set column value according to Flag. */ /***********************************************************************/ void XSRCCOL::ReadColumn(PGLOBAL g) - { +{ PTDBXDBC tdbp = (PTDBXDBC)To_Tdb; switch (Flag) { @@ -1335,15 +1336,15 @@ void XSRCCOL::ReadColumn(PGLOBAL g) default: Value->SetValue_psz("Invalid Flag"); break; } // endswitch Flag - } // end of ReadColumn +} // end of ReadColumn /***********************************************************************/ /* WriteColumn: Should never be called. */ /***********************************************************************/ void XSRCCOL::WriteColumn(PGLOBAL g) - { +{ // Should never be called - } // end of WriteColumn +} // end of WriteColumn /* ---------------------------TDBDRV class --------------------------- */ @@ -1351,9 +1352,9 @@ void XSRCCOL::WriteColumn(PGLOBAL g) /* GetResult: Get the list of ODBC drivers. */ /***********************************************************************/ PQRYRES TDBDRV::GetResult(PGLOBAL g) - { +{ return ODBCDrivers(g, Maxres, false); - } // end of GetResult +} // end of GetResult /* ---------------------------TDBSRC class --------------------------- */ @@ -1361,9 +1362,9 @@ PQRYRES TDBDRV::GetResult(PGLOBAL g) /* GetResult: Get the list of ODBC data sources. */ /***********************************************************************/ PQRYRES TDBSRC::GetResult(PGLOBAL g) - { +{ return ODBCDataSources(g, Maxres, false); - } // end of GetResult +} // end of GetResult /* ---------------------------TDBOTB class --------------------------- */ @@ -1371,7 +1372,7 @@ PQRYRES TDBSRC::GetResult(PGLOBAL g) /* TDBOTB class constructor. */ /***********************************************************************/ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp) - { +{ Dsn = tdp->GetConnect(); Schema = tdp->GetTabschema(); Tab = tdp->GetTabname(); @@ -1381,15 +1382,15 @@ TDBOTB::TDBOTB(PODEF tdp) : TDBDRV(tdp) Ops.Cto = tdp->Cto; Ops.Qto = tdp->Qto; Ops.UseCnc = tdp->UseCnc; - } // end of TDBOTB constructor +} // end of TDBOTB constructor /***********************************************************************/ /* GetResult: Get the list of ODBC tables. */ /***********************************************************************/ PQRYRES TDBOTB::GetResult(PGLOBAL g) - { +{ return ODBCTables(g, Dsn, Schema, Tab, Tabtyp, Maxres, false, &Ops); - } // end of GetResult +} // end of GetResult /* ---------------------------TDBOCL class --------------------------- */ @@ -1405,8 +1406,8 @@ TDBOCL::TDBOCL(PODEF tdp) : TDBOTB(tdp) /* GetResult: Get the list of ODBC table columns. */ /***********************************************************************/ PQRYRES TDBOCL::GetResult(PGLOBAL g) - { +{ return ODBCColumns(g, Dsn, Schema, Tab, Colpat, Maxres, false, &Ops); - } // end of GetResult +} // end of GetResult /* ------------------------ End of Tabodbc --------------------------- */ diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp index c96e0844497..fa4854bb618 100644 --- a/storage/connect/tabxml.cpp +++ b/storage/connect/tabxml.cpp @@ -681,6 +681,14 @@ PTDB TDBXML::Clone(PTABS t) return tp; } // end of Clone +/***********************************************************************/ +/* Must not be in tabxml.h because of OEM tables */ +/***********************************************************************/ +const CHARSET_INFO *TDBXML::data_charset() +{ + return &my_charset_utf8_general_ci; +} // end of data_charset + /***********************************************************************/ /* Allocate XML column description block. */ /***********************************************************************/ @@ -2209,8 +2217,9 @@ void XPOSCOL::WriteColumn(PGLOBAL g) TDBXCT::TDBXCT(PXMLDEF tdp) : TDBCAT(tdp) { Topt = tdp->GetTopt(); - Db = (char*)tdp->GetDB(); - Tabn = tdp->Tabname; + //Db = (char*)tdp->GetDB(); + Db = (char*)tdp->Schema; + Tabn = tdp->Tabname; } // end of TDBXCT constructor /***********************************************************************/ diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h index f55b7d98de7..102767e965a 100644 --- a/storage/connect/tabxml.h +++ b/storage/connect/tabxml.h @@ -9,6 +9,8 @@ typedef class XMLDEF *PXMLDEF; typedef class TDBXML *PTDBXML; typedef class XMLCOL *PXMLCOL; +DllExport PQRYRES XMLColumns(PGLOBAL, char *, char *, PTOS, bool); + /* --------------------------- XML classes --------------------------- */ /***********************************************************************/ @@ -100,8 +102,7 @@ class DllExport TDBXML : public TDBASE { virtual int DeleteDB(PGLOBAL g, int irc); virtual void CloseDB(PGLOBAL g); virtual int CheckWrite(PGLOBAL g) {Checked = true; return 0;} - virtual const CHARSET_INFO *data_charset() - {return &my_charset_utf8_general_ci;} + virtual const CHARSET_INFO *data_charset(); protected: // Members diff --git a/storage/connect/user_connect.cc b/storage/connect/user_connect.cc index e2d3b664aeb..a2a8faf9b38 100644 --- a/storage/connect/user_connect.cc +++ b/storage/connect/user_connect.cc @@ -107,7 +107,7 @@ bool user_connect::user_init() g= PlugInit(NULL, worksize); // Check whether the initialization is complete - if (!g || !g->Sarea || PlugSubSet(g, g->Sarea, g->Sarea_Size) + if (!g || !g->Sarea || PlugSubSet(g->Sarea, g->Sarea_Size) || !(dup= PlgMakeUser(g))) { if (g) printf("%s\n", g->Message); @@ -172,7 +172,7 @@ bool user_connect::CheckCleanup(bool force) } // endif worksize - PlugSubSet(g, g->Sarea, g->Sarea_Size); + PlugSubSet(g->Sarea, g->Sarea_Size); g->Xchk = NULL; g->Createas = 0; g->Alchecked = 0; From 0735423e196e35f4fb5ca5b4bdc16bcbd4af37fe Mon Sep 17 00:00:00 2001 From: Olivier Bertrand Date: Tue, 4 Dec 2018 23:30:16 +0100 Subject: [PATCH 02/72] Fix wrong version number --- storage/connect/ha_connect.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 26b7036e5ac..9b40253b090 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -7307,7 +7307,7 @@ maria_declare_plugin(connect) PLUGIN_LICENSE_GPL, connect_init_func, /* Plugin Init */ connect_done_func, /* Plugin Deinit */ - 0x0107, /* version number (1.05) */ + 0x0106, /* version number (1.06) */ NULL, /* status variables */ connect_system_variables, /* system variables */ "1.06.0008", /* string version */ From 15eaeace394320d96b6bf193f9e049f9358d2b07 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Wed, 12 Dec 2018 19:58:20 +0400 Subject: [PATCH 03/72] MDEV-16987 - ALTER DATABASE possible in read-only mode Forbid ALTER DATABASE under read_only. --- mysql-test/r/read_only.result | 11 +++++++++++ mysql-test/t/read_only.test | 13 +++++++++++++ sql/sql_parse.cc | 1 + 3 files changed, 25 insertions(+) diff --git a/mysql-test/r/read_only.result b/mysql-test/r/read_only.result index 2d0f9d730fd..4afddab6851 100644 --- a/mysql-test/r/read_only.result +++ b/mysql-test/r/read_only.result @@ -162,3 +162,14 @@ delete from mysql.columns_priv where User like 'mysqltest_%'; flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; +# +# MDEV-16987 - ALTER DATABASE possible in read-only mode +# +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +ALTER DATABASE test1 CHARACTER SET utf8; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; diff --git a/mysql-test/t/read_only.test b/mysql-test/t/read_only.test index eb9bea803c2..dd9d6430172 100644 --- a/mysql-test/t/read_only.test +++ b/mysql-test/t/read_only.test @@ -310,3 +310,16 @@ set global read_only= @start_read_only; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc +--echo # +--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode +--echo # +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +change_user user1; +--error ER_OPTION_PREVENTS_STATEMENT +ALTER DATABASE test1 CHARACTER SET utf8; +change_user root; +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 9f8a625325f..95243ead2fe 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -831,6 +831,7 @@ static bool deny_updates_if_read_only_option(THD *thd, TABLE_LIST *all_tables) DBUG_RETURN(FALSE); if (lex->sql_command == SQLCOM_CREATE_DB || + lex->sql_command == SQLCOM_ALTER_DB || lex->sql_command == SQLCOM_DROP_DB) DBUG_RETURN(TRUE); From 1a7158b88a117f6543e1318a7abdc490cdfd5e67 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 13 Dec 2018 19:51:40 +0100 Subject: [PATCH 04/72] remove unsed variable --- sql/opt_range.cc | 4 ---- 1 file changed, 4 deletions(-) diff --git a/sql/opt_range.cc b/sql/opt_range.cc index 005ae92a665..b1f8366d83b 100644 --- a/sql/opt_range.cc +++ b/sql/opt_range.cc @@ -3322,10 +3322,6 @@ bool create_key_parts_for_pseudo_indexes(RANGE_OPT_PARAM *param, { Field **field_ptr; TABLE *table= param->table; - partition_info *part_info= NULL; - #ifdef WITH_PARTITION_STORAGE_ENGINE - part_info= table->part_info; - #endif uint parts= 0; for (field_ptr= table->field; *field_ptr; field_ptr++) From d1f399408d245dd8b971ba331eaaedf488e083b6 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Sun, 16 Dec 2018 21:50:49 +0200 Subject: [PATCH 05/72] MDEV-6453: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init(bool) with InnoDB, joins, AND/OR conditions The inited parameter handler is not initialised when we do a quick_select after a table scan. --- mysql-test/r/range_innodb.result | 18 ++++++++++++++++++ mysql-test/t/range_innodb.test | 17 +++++++++++++++++ sql/sql_select.cc | 4 ++++ 3 files changed, 39 insertions(+) diff --git a/mysql-test/r/range_innodb.result b/mysql-test/r/range_innodb.result index 794e6c7b3cc..8bb1c833a56 100644 --- a/mysql-test/r/range_innodb.result +++ b/mysql-test/r/range_innodb.result @@ -37,3 +37,21 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL NULL NULL NULL NULL 10 1 SIMPLE t2 range a,b b 5 NULL 201 Using where; Using join buffer (flat, BNL join) drop table t0,t1,t2; +CREATE TABLE t1 ( +pk INT PRIMARY KEY, f1 INT, f2 CHAR(1), f3 CHAR(1), +KEY(f1), KEY(f2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES +(1,4,'v',NULL),(2,6,'v',NULL),(3,7,'c',NULL),(4,1,'e',NULL),(5,0,'x',NULL), +(6,7,'i',NULL),(7,7,'e',NULL),(8,1,'p',NULL),(9,7,'s',NULL),(10,1,'j',NULL), +(11,5,'z',NULL),(12,2,'c',NULL),(13,0,'a',NULL),(14,1,'q',NULL),(15,8,'y',NULL), +(16,1,'m',NULL),(17,1,'r',NULL),(18,9,'v',NULL),(19,1,'n',NULL); +CREATE TABLE t2 (f4 INT, f5 CHAR(1)) ENGINE=InnoDB; +INSERT INTO t2 VALUES (4,'q'),(NULL,'j'); +SELECT * FROM t1 AS t1_1, t1 AS t1_2, t2 +WHERE f5 = t1_2.f2 AND ( t1_1.f1 = 103 AND t1_1.f2 = 'o' OR t1_1.pk < f4 ); +pk f1 f2 f3 pk f1 f2 f3 f4 f5 +1 4 v NULL 14 1 q NULL 4 q +2 6 v NULL 14 1 q NULL 4 q +3 7 c NULL 14 1 q NULL 4 q +drop table t1,t2; diff --git a/mysql-test/t/range_innodb.test b/mysql-test/t/range_innodb.test index f76794814ef..605006587cc 100644 --- a/mysql-test/t/range_innodb.test +++ b/mysql-test/t/range_innodb.test @@ -45,3 +45,20 @@ explain select * from t0 left join t2 on t2.a select->quick; tab->select->quick=0; + + if (tab->table->file->inited != handler::NONE) + tab->table->file->ha_index_or_rnd_end(); + return tab->select->test_quick_select(tab->join->thd, tab->keys, (table_map) 0, HA_POS_ERROR, 0, FALSE); From cadb6ac770d818d1ed14aa1c2b84647619900935 Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Thu, 6 Dec 2018 14:36:57 +0100 Subject: [PATCH 06/72] DEV-17835: Remove wsrep-sst-method=xtrabackup The use of the xtrabackup and xtrabackup-v2 methods for SST has been declared obsolete since version 10.2, now it cannot be used because of the different redo log format. Accordingly, we need to remove the xtrabackup-related scripts and dynamically replace the call to xtrabackup[-v2] to the mariabackup (with a corresponding warning in the log) when the server performs SST. https://jira.mariadb.org/browse/MDEV-17835 --- .gitignore | 2 - Docs/README-wsrep | 16 +- .../r/galera_autoinc_sst_mariabackup.result | 2 + .../r/galera_ist_innodb_flush_logs.result | 204 +++ .../t/galera_autoinc_sst_mariabackup.cnf | 1 - .../t/galera_autoinc_sst_mariabackup.test | 8 + .../galera/t/galera_ist_innodb_flush_logs.cnf | 13 + .../t/galera_ist_innodb_flush_logs.test | 13 + ...era_ist_mariabackup_innodb_flush_logs.test | 1 + .../sys_vars/r/wsrep_sst_method_basic.result | 4 + .../sys_vars/t/wsrep_sst_method_basic.test | 5 + scripts/CMakeLists.txt | 2 - scripts/wsrep_sst_xtrabackup-v2.sh | 1260 ----------------- scripts/wsrep_sst_xtrabackup.sh | 692 --------- sql/wsrep_sst.cc | 21 +- sql/wsrep_sst.h | 3 + 16 files changed, 276 insertions(+), 1971 deletions(-) create mode 100644 mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result create mode 100644 mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf create mode 100644 mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test delete mode 100644 scripts/wsrep_sst_xtrabackup-v2.sh delete mode 100644 scripts/wsrep_sst_xtrabackup.sh diff --git a/.gitignore b/.gitignore index 3f28c0fb66b..859551d62a0 100644 --- a/.gitignore +++ b/.gitignore @@ -128,8 +128,6 @@ scripts/wsrep_sst_mysqldump scripts/wsrep_sst_rsync scripts/wsrep_sst_rsync_wan scripts/wsrep_sst_mariabackup -scripts/wsrep_sst_xtrabackup -scripts/wsrep_sst_xtrabackup-v2 scripts/maria_add_gis_sp.sql scripts/maria_add_gis_sp_bootstrap.sql scripts/galera_new_cluster diff --git a/Docs/README-wsrep b/Docs/README-wsrep index 6bb329e9396..02642e80efb 100644 --- a/Docs/README-wsrep +++ b/Docs/README-wsrep @@ -137,7 +137,7 @@ Additional packages to consider (if not yet installed): * galera (multi-master replication provider, https://launchpad.net/galera) * MySQL-client-community (for connecting to server and mysqldump-based SST) * rsync (for rsync-based SST) - * xtrabackup and nc (for xtrabackup-based SST) + * mariabackup and nc (for mariabackup-based SST) 2.2 Upgrade system tables. @@ -380,14 +380,14 @@ to join or start a cluster. wsrep_sst_method=rsync What method to use to copy database state to a newly joined node. Supported methods: - - mysqldump: slow (except for small datasets) but allows for upgrade - between major MySQL versions or InnoDB features. - - rsync: much faster on large datasets (default). - - rsync_wan: same as rsync but with deltaxfer to minimize network traffic. - - xtrabackup: very fast and practically non-blocking SST method based on - Percona's xtrabackup tool. + - mysqldump: slow (except for small datasets) but allows for upgrade + between major MySQL versions or InnoDB features. + - rsync: much faster on large datasets (default). + - rsync_wan: same as rsync but with deltaxfer to minimize network traffic. + - mariabackup: very fast and practically non-blocking SST method based on + mariabackup tool (enhanced version of Percona's xtrabackup). - (for xtrabackup to work the following settings must be present in my.cnf + (for mariabackup to work the following settings must be present in my.cnf on all nodes: [mysqld] wsrep_sst_auth=root: diff --git a/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result index d0fac1e3d14..91f45c93257 100644 --- a/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result +++ b/mysql-test/suite/galera/r/galera_autoinc_sst_mariabackup.result @@ -1,4 +1,6 @@ connection node_1; +connection node_2; +connection node_1; CREATE TABLE t1 (f1 INTEGER PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB; CREATE PROCEDURE p1 () BEGIN diff --git a/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result new file mode 100644 index 00000000000..481a85711be --- /dev/null +++ b/mysql-test/suite/galera/r/galera_ist_innodb_flush_logs.result @@ -0,0 +1,204 @@ +Performing State Transfer on a server that has been killed and restarted +connection node_1; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +COMMIT; +connection node_2; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +INSERT INTO t1 VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +INSERT INTO t1 VALUES ('node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +INSERT INTO t1 VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave; +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +SET AUTOCOMMIT=ON; +connection node_1; +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +SET AUTOCOMMIT=ON; +Performing State Transfer on a server that has been killed and restarted +while a DDL was in progress on it +connection node_1; +CREATE TABLE t1 (f1 CHAR(255)) ENGINE=InnoDB; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +INSERT INTO t1 VALUES ('node1_committed_before'); +connection node_2; +START TRANSACTION; +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +INSERT INTO t1 VALUES ('node2_committed_before'); +COMMIT; +SET GLOBAL debug_dbug = 'd,sync.alter_opened_table'; +connection node_1; +ALTER TABLE t1 ADD COLUMN f2 INTEGER; +connection node_2; +SET wsrep_sync_wait = 0; +Killing server ... +connection node_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +INSERT INTO t1 (f1) VALUES ('node1_committed_during'); +COMMIT; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +connect node_1a_galera_st_kill_slave_ddl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +connection node_2; +Performing --wsrep-recover ... +connection node_2; +Starting server ... +Using --wsrep-start-position when starting mysqld ... +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +INSERT INTO t1 (f1) VALUES ('node2_committed_after'); +COMMIT; +connection node_1; +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_committed_after'); +COMMIT; +SET AUTOCOMMIT=OFF; +START TRANSACTION; +INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +INSERT INTO t1 (f1) VALUES ('node1_committed_after'); +COMMIT; +connection node_1a_galera_st_kill_slave_ddl; +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +INSERT INTO t1 (f1) VALUES ('node1_to_be_rollbacked_after'); +ROLLBACK; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +COMMIT; +SET AUTOCOMMIT=ON; +connection node_1; +SELECT COUNT(*) = 2 FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 't1'; +COUNT(*) = 2 +1 +SELECT COUNT(*) = 35 FROM t1; +COUNT(*) = 35 +1 +SELECT COUNT(*) = 0 FROM (SELECT COUNT(*) AS c, f1 FROM t1 GROUP BY f1 HAVING c NOT IN (5, 10)) AS a1; +COUNT(*) = 0 +1 +DROP TABLE t1; +COMMIT; +SET AUTOCOMMIT=ON; +SET GLOBAL debug_dbug = $debug_orig; diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf index 7e557717744..bd6bf9d4f98 100644 --- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.cnf @@ -9,4 +9,3 @@ wsrep_provider_options='base_port=@mysqld.1.#galera_port;gcache.size=1;pc.ignore [mysqld.2] wsrep_provider_options='base_port=@mysqld.2.#galera_port;gcache.size=1;pc.ignore_sb=true' - diff --git a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test index 731059dc584..9d5f821a170 100644 --- a/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test +++ b/mysql-test/suite/galera/t/galera_autoinc_sst_mariabackup.test @@ -8,6 +8,10 @@ --source include/have_innodb.inc --source include/have_mariabackup.inc +--let $node_1=node_1 +--let $node_2=node_2 +--source include/auto_increment_offset_save.inc + --connection node_1 --let $connection_id = `SELECT CONNECTION_ID()` @@ -94,3 +98,7 @@ DROP TABLE t1; CALL mtr.add_suppression("gcs_caused\\(\\) returned -1 \\(Operation not permitted\\)"); CALL mtr.add_suppression("WSREP: Action message in non-primary configuration from member 0"); + +--let $node_1=node_1a +--let $node_2=node_2a +--source include/auto_increment_offset_restore.inc diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf new file mode 100644 index 00000000000..7979b23e085 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.cnf @@ -0,0 +1,13 @@ +!include ../galera_2nodes.cnf + +[mysqld] +wsrep_sst_method=mariabackup +wsrep_sst_auth=root: + +innodb_flush_log_at_trx_commit=0 + +[mysqld.1] +wsrep_provider_options='base_port=@mysqld.1.#galera_port;pc.ignore_sb=true' + +[mysqld.2] +wsrep_provider_options='base_port=@mysqld.2.#galera_port;pc.ignore_sb=true' diff --git a/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test new file mode 100644 index 00000000000..fd362a26840 --- /dev/null +++ b/mysql-test/suite/galera/t/galera_ist_innodb_flush_logs.test @@ -0,0 +1,13 @@ +# +# This test performs server kill and IST while innodb_flush_logs_on_trx_commit = 0 +# This confirms that IST can properly catch up even in the face of relaxed single-node durability +# +# + +--source include/big_test.inc +--source include/galera_cluster.inc +--source include/have_innodb.inc +--source include/have_mariabackup.inc + +--source suite/galera/include/galera_st_kill_slave.inc +--source suite/galera/include/galera_st_kill_slave_ddl.inc diff --git a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test index 07838702deb..fd362a26840 100644 --- a/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test +++ b/mysql-test/suite/galera/t/galera_ist_mariabackup_innodb_flush_logs.test @@ -7,6 +7,7 @@ --source include/big_test.inc --source include/galera_cluster.inc --source include/have_innodb.inc +--source include/have_mariabackup.inc --source suite/galera/include/galera_st_kill_slave.inc --source suite/galera/include/galera_st_kill_slave_ddl.inc diff --git a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result index cbdac640c36..51f167b8f47 100644 --- a/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result +++ b/mysql-test/suite/sys_vars/r/wsrep_sst_method_basic.result @@ -33,6 +33,10 @@ SET @@global.wsrep_sst_method="xtrabackup-v2"; SELECT @@global.wsrep_sst_method; @@global.wsrep_sst_method xtrabackup-v2 +SET @@global.wsrep_sst_method="mariabackup"; +SELECT @@global.wsrep_sst_method; +@@global.wsrep_sst_method +mariabackup SET @@global.wsrep_sst_method=default; SELECT @@global.wsrep_sst_method; @@global.wsrep_sst_method diff --git a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test index 3f40a3922dd..be038eb4baf 100644 --- a/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test +++ b/mysql-test/suite/sys_vars/t/wsrep_sst_method_basic.test @@ -23,10 +23,15 @@ SET @@global.wsrep_sst_method=rsync; SELECT @@global.wsrep_sst_method; SET @@global.wsrep_sst_method=mysqldump; SELECT @@global.wsrep_sst_method; +# The xtrabackup and xtrabackup-v2 methods are obsolete, +# but we can still select them (they will be automatically +# replaced to mariabackup): SET @@global.wsrep_sst_method=xtrabackup; SELECT @@global.wsrep_sst_method; SET @@global.wsrep_sst_method="xtrabackup-v2"; SELECT @@global.wsrep_sst_method; +SET @@global.wsrep_sst_method="mariabackup"; +SELECT @@global.wsrep_sst_method; SET @@global.wsrep_sst_method=default; SELECT @@global.wsrep_sst_method; diff --git a/scripts/CMakeLists.txt b/scripts/CMakeLists.txt index 464c00d57da..901a774be4b 100644 --- a/scripts/CMakeLists.txt +++ b/scripts/CMakeLists.txt @@ -274,8 +274,6 @@ ELSE() SET(WSREP_SCRIPTS wsrep_sst_mysqldump wsrep_sst_rsync - wsrep_sst_xtrabackup - wsrep_sst_xtrabackup-v2 wsrep_sst_mariabackup ) # The following script is sourced from other SST scripts, so it should diff --git a/scripts/wsrep_sst_xtrabackup-v2.sh b/scripts/wsrep_sst_xtrabackup-v2.sh deleted file mode 100644 index 2de384806b2..00000000000 --- a/scripts/wsrep_sst_xtrabackup-v2.sh +++ /dev/null @@ -1,1260 +0,0 @@ -#!/bin/bash -ue -# Copyright (C) 2013 Percona 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -# MA 02110-1301 USA. - -# Documentation: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -# Make sure to read that before proceeding! - - - - -. $(dirname $0)/wsrep_sst_common - -ealgo="" -ekey="" -ekeyfile="" -encrypt=0 -nproc=1 -ecode=0 -ssyslog="" -ssystag="" -XTRABACKUP_PID="" -tca="" -tcert="" -tkey="" -sockopt="" -progress="" -ttime=0 -totime=0 -ecmd="" -rlimit="" -# Initially -stagemsg="${WSREP_SST_OPT_ROLE}" -cpat="" -ib_home_dir="" -ib_log_dir="" -ib_undo_dir="" - -sfmt="tar" -strmcmd="" -tfmt="" -tcmd="" -rebuild=0 -rebuildcmd="" -payload=0 -pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " -pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " -STATDIR="" -uextra=0 -disver="" - -tmpopts="" -itmpdir="" -xtmpdir="" - -scomp="" -sdecomp="" -ssl_dhparams="" - -ssl_cert="" -ssl_ca="" -ssl_key="" - -if pv --help 2>/dev/null | grep -q FORMAT;then - pvopts+=$pvformat -fi -pcmd="pv $pvopts" -declare -a RC - -INNOBACKUPEX_BIN=innobackupex -DATA="${WSREP_SST_OPT_DATA}" -INFO_FILE="xtrabackup_galera_info" -IST_FILE="xtrabackup_ist" -MAGIC_FILE="${DATA}/${INFO_FILE}" - -# Setting the path for ss and ip -export PATH="/usr/sbin:/sbin:$PATH" - -OS=$(uname) - -if ! which lsof > /dev/null; then - wsrep_log_error "lsof tool not found in PATH! Make sure you have it installed." - exit 2 # ENOENT -fi - -timeit(){ - local stage=$1 - shift - local cmd="$@" - local x1 x2 took extcode - - if [[ $ttime -eq 1 ]];then - x1=$(date +%s) - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? - x2=$(date +%s) - took=$(( x2-x1 )) - wsrep_log_info "NOTE: $stage took $took seconds" - totime=$(( totime+took )) - else - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? - fi - return $extcode -} - -get_keys() -{ - # $encrypt -eq 1 is for internal purposes only - if [[ $encrypt -ge 2 || $encrypt -eq -1 ]];then - return - fi - - if [[ $encrypt -eq 0 ]];then - if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then - wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " - fi - return - fi - - if [[ $sfmt == 'tar' ]];then - wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" - encrypt=-1 - return - fi - - wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" - - if [[ -z $ealgo ]];then - wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" - exit 3 - fi - - if [[ -z $ekey && ! -r $ekeyfile ]];then - wsrep_log_error "FATAL: Either key or keyfile must be readable" - exit 3 - fi - - if [[ -z $ekey ]];then - ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" - else - wsrep_log_warning "Using the 'encrypt-key' option causes the encryption key" - wsrep_log_warning "to be set via the command-line and is considered insecure." - wsrep_log_warning "It is recommended to use the 'encrypt-key-file' option instead." - - ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" - fi - - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - ecmd+=" -d" - fi - - stagemsg+="-XB-Encrypted" -} - -# -# If the ssl_dhparams variable is already set, uses that as a source -# of dh parameters for OpenSSL. Otherwise, looks for dhparams.pem in the -# datadir, and creates it there if it can't find the file. -# No input parameters -# -check_for_dhparams() -{ - if [[ -z "$ssl_dhparams" ]]; then - if ! [[ -r "$DATA/dhparams.pem" ]]; then - wsrep_check_programs openssl - wsrep_log_info "Could not find dhparams file, creating $DATA/dhparams.pem" - - if ! openssl dhparam -out "$DATA/dhparams.pem" 2048 >/dev/null 2>&1 - then - wsrep_log_error "******** FATAL ERROR ********************************* " - wsrep_log_error "* Could not create the dhparams.pem file with OpenSSL. " - wsrep_log_error "****************************************************** " - exit 22 - fi - fi - ssl_dhparams="$DATA/dhparams.pem" - fi -} - -# -# verifies that the certificate matches the private key -# doing this will save us having to wait for a timeout that would -# otherwise occur. -# -# 1st param: path to the cert -# 2nd param: path to the private key -# -verify_cert_matches_key() -{ - local cert_path=$1 - local key_path=$2 - - wsrep_check_programs openssl diff - - # generate the public key from the cert and the key - # they should match (otherwise we can't create an SSL connection) - if ! diff <(openssl x509 -in "$cert_path" -pubkey -noout) <(openssl rsa -in "$key_path" -pubout 2>/dev/null) >/dev/null 2>&1 - then - wsrep_log_error "******** FATAL ERROR ************************* " - wsrep_log_error "* The certifcate and private key do not match. " - wsrep_log_error "* Please check your certificate and key files. " - wsrep_log_error "********************************************** " - exit 22 - fi -} - -# Checks to see if the file exists -# If the file does not exist (or cannot be read), issues an error -# and exits -# -# 1st param: file name to be checked (for read access) -# 2nd param: 1st error message (header) -# 3rd param: 2nd error message (footer, optional) -# -verify_file_exists() -{ - local file_path=$1 - local error_message1=$2 - local error_message2=$3 - - if ! [[ -r "$file_path" ]]; then - wsrep_log_error "******** FATAL ERROR ************************* " - wsrep_log_error "* $error_message1 " - wsrep_log_error "* Could not find/access : $file_path " - - if ! [[ -z "$error_message2" ]]; then - wsrep_log_error "* $error_message2 " - fi - - wsrep_log_error "********************************************** " - exit 22 - fi -} - -get_transfer() -{ - TSST_PORT=${WSREP_SST_OPT_PORT:-4444} - - if [[ $tfmt == 'nc' ]];then - wsrep_check_programs nc - - if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then - wsrep_log_error "******** FATAL ERROR *********************** " - wsrep_log_error "* Using SSL encryption (encrypt= 2, 3, or 4) " - wsrep_log_error "* is not supported when using nc(netcat). " - wsrep_log_error "******************************************** " - exit 22 - fi - - wsrep_log_info "Using netcat as streamer" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h 2>&1 | grep -q ncat; then - # Ncat - tcmd="nc $sockopt -l ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then - # Debian netcat - tcmd="nc $sockopt -dl ${TSST_PORT}" - else - # traditional netcat - tcmd="nc $sockopt -l -p ${TSST_PORT}" - fi - else - if nc -h 2>&1 | grep -q ncat;then - # Ncat - tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then - # Debian netcat - tcmd="nc ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" - else - # traditional netcat - tcmd="nc -q0 ${WSREP_SST_OPT_HOST_UNESCAPED} ${TSST_PORT}" - fi - fi - else - tfmt='socat' - wsrep_log_info "Using socat as streamer" - wsrep_check_programs socat - - donor_extra="" - joiner_extra="" - if [[ $encrypt -eq 2 || $encrypt -eq 3 || $encrypt -eq 4 ]]; then - if ! socat -V | grep -q WITH_OPENSSL; then - wsrep_log_error "******** FATAL ERROR ****************** " - wsrep_log_error "* socat is not openssl enabled. " - wsrep_log_error "* Unable to encrypt SST communications. " - wsrep_log_error "*************************************** " - exit 2 - fi - - # Determine the socat version - SOCAT_VERSION=`socat -V 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1` - if [[ -z "$SOCAT_VERSION" ]]; then - wsrep_log_error "******** FATAL ERROR **************** " - wsrep_log_error "* Cannot determine the socat version. " - wsrep_log_error "************************************* " - exit 2 - fi - - # socat versions < 1.7.3 will have 512-bit dhparams (too small) - # so create 2048-bit dhparams and send that as a parameter - # socat version >= 1.7.3, checks to see if the peername matches the hostname - # set commonname="" to disable the peername checks - # - if ! check_for_version "$SOCAT_VERSION" "1.7.3"; then - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then - # dhparams check (will create ssl_dhparams if needed) - check_for_dhparams - joiner_extra=",dhparam=$ssl_dhparams" - fi - fi - if check_for_version "$SOCAT_VERSION" "1.7.3"; then - donor_extra=',commonname=""' - fi - fi - - if [[ $encrypt -eq 2 ]]; then - wsrep_log_warning "**** WARNING **** encrypt=2 is deprecated and will be removed in a future release" - wsrep_log_info "Using openssl based encryption with socat: with crt and ca" - - verify_file_exists "$tcert" "Both certificate and CA files are required." \ - "Please check the 'tcert' option. " - verify_file_exists "$tca" "Both certificate and CA files are required." \ - "Please check the 'tca' option. " - - stagemsg+="-OpenSSL-Encrypted-2" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - wsrep_log_info "Decrypting with CERT: $tcert, CA: $tca" - tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},cafile=${tca}${joiner_extra}${sockopt} stdio" - else - wsrep_log_info "Encrypting with CERT: $tcert, CA: $tca" - tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},cafile=${tca}${donor_extra}${sockopt}" - fi - elif [[ $encrypt -eq 3 ]];then - wsrep_log_warning "**** WARNING **** encrypt=3 is deprecated and will be removed in a future release" - wsrep_log_info "Using openssl based encryption with socat: with key and crt" - - verify_file_exists "$tcert" "Both certificate and key files are required." \ - "Please check the 'tcert' option. " - verify_file_exists "$tkey" "Both certificate and key files are required." \ - "Please check the 'tkey' option. " - - stagemsg+="-OpenSSL-Encrypted-3" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - wsrep_log_info "Decrypting with CERT: $tcert, KEY: $tkey" - tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${tcert},key=${tkey},verify=0${joiner_extra}${sockopt} stdio" - else - wsrep_log_info "Encrypting with CERT: $tcert, KEY: $tkey" - tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${tcert},key=${tkey},verify=0${sockopt}" - fi - elif [[ $encrypt -eq 4 ]]; then - wsrep_log_info "Using openssl based encryption with socat: with key, crt, and ca" - - verify_file_exists "$ssl_ca" "CA, certificate, and key files are required." \ - "Please check the 'ssl-ca' option. " - verify_file_exists "$ssl_cert" "CA, certificate, and key files are required." \ - "Please check the 'ssl-cert' option. " - verify_file_exists "$ssl_key" "CA, certificate, and key files are required." \ - "Please check the 'ssl-key' option. " - - # Check to see that the key matches the cert - verify_cert_matches_key $ssl_cert $ssl_key - - stagemsg+="-OpenSSL-Encrypted-4" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then - wsrep_log_info "Decrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca" - tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${joiner_extra}${sockopt} stdio" - else - wsrep_log_info "Encrypting with CERT: $ssl_cert, KEY: $ssl_key, CA: $ssl_ca" - tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=${ssl_cert},key=${ssl_key},cafile=${ssl_ca},verify=1${donor_extra}${sockopt}" - fi - - else - if [[ $encrypt -eq 1 ]]; then - wsrep_log_warning "**** WARNING **** encrypt=1 is deprecated and will be removed in a future release" - fi - - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]]; then - tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" - else - tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}" - fi - fi - fi -} - -get_footprint() -{ - pushd $WSREP_SST_OPT_DATA 1>/dev/null - payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') - if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then - # QuickLZ has around 50% compression ratio - # When compression/compaction used, the progress is only an approximate. - payload=$(( payload*1/2 )) - fi - popd 1>/dev/null - pcmd+=" -s $payload" - adjust_progress -} - -adjust_progress() -{ - - if ! command -v pv >/dev/null;then - wsrep_log_error "pv not found in path: $PATH" - wsrep_log_error "Disabling all progress/rate-limiting" - pcmd="" - rlimit="" - progress="" - return - fi - - if [[ -n $progress && $progress != '1' ]];then - if [[ -e $progress ]];then - pcmd+=" 2>>$progress" - else - pcmd+=" 2>$progress" - fi - elif [[ -z $progress && -n $rlimit ]];then - # When rlimit is non-zero - pcmd="pv -q" - fi - - if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then - wsrep_log_info "Rate-limiting SST to $rlimit" - pcmd+=" -L \$rlimit" - fi -} - -read_cnf() -{ - sfmt=$(parse_cnf sst streamfmt "xbstream") - tfmt=$(parse_cnf sst transferfmt "socat") - tca=$(parse_cnf sst tca "") - tcert=$(parse_cnf sst tcert "") - tkey=$(parse_cnf sst tkey "") - encrypt=$(parse_cnf sst encrypt 0) - sockopt=$(parse_cnf sst sockopt "") - progress=$(parse_cnf sst progress "") - rebuild=$(parse_cnf sst rebuild 0) - ttime=$(parse_cnf sst time 0) - if [ "${OS}" = "FreeBSD" ]; then - cpat=$(parse_cnf sst cpat '.*\.pem$|.*init\.ok$|.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$') - else - cpat=$(parse_cnf sst cpat '.*\.pem$\|.*init\.ok$\|.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') - fi - ealgo=$(parse_cnf xtrabackup encrypt "") - ekey=$(parse_cnf xtrabackup encrypt-key "") - ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") - scomp=$(parse_cnf sst compressor "") - sdecomp=$(parse_cnf sst decompressor "") - - - # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html - if [[ -z $ealgo ]];then - ealgo=$(parse_cnf sst encrypt-algo "") - ekey=$(parse_cnf sst encrypt-key "") - ekeyfile=$(parse_cnf sst encrypt-key-file "") - fi - - # Pull the parameters needed for encrypt=4 - ssl_ca=$(parse_cnf sst ssl-ca "") - if [[ -z "$ssl_ca" ]]; then - ssl_ca=$(parse_cnf --mysqld ssl-ca "") - fi - ssl_cert=$(parse_cnf sst ssl-cert "") - if [[ -z "$ssl_cert" ]]; then - ssl_cert=$(parse_cnf --mysqld ssl-cert "") - fi - ssl_key=$(parse_cnf sst ssl-key "") - if [[ -z "$ssl_key" ]]; then - ssl_key=$(parse_cnf --mysqld ssl-key "") - fi - - rlimit=$(parse_cnf sst rlimit "") - uextra=$(parse_cnf sst use-extra 0) - iopts=$(parse_cnf sst inno-backup-opts "") - iapts=$(parse_cnf sst inno-apply-opts "") - impts=$(parse_cnf sst inno-move-opts "") - stimeout=$(parse_cnf sst sst-initial-timeout 100) - ssyslog=$(parse_cnf sst sst-syslog 0) - ssystag=$(parse_cnf mysqld_safe syslog-tag "${SST_SYSLOG_TAG:-}") - ssystag+="-" - - if [[ $ssyslog -ne -1 ]];then - if $MY_PRINT_DEFAULTS mysqld_safe | grep -q -- "--syslog";then - ssyslog=1 - fi - fi -} - -get_stream() -{ - if [[ $sfmt == 'xbstream' ]];then - wsrep_log_info "Streaming with xbstream" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="xbstream -x" - else - strmcmd="xbstream -c \${INFO_FILE}" - fi - else - sfmt="tar" - wsrep_log_info "Streaming with tar" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="tar xfi - " - else - strmcmd="tar cf - \${INFO_FILE} " - fi - - fi -} - -get_proc() -{ - set +e - nproc=$(grep -c processor /proc/cpuinfo) - [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 - set -e -} - -sig_joiner_cleanup() -{ - wsrep_log_error "Removing $MAGIC_FILE file due to signal" - rm -f "$MAGIC_FILE" -} - -cleanup_joiner() -{ - # Since this is invoked just after exit NNN - local estatus=$? - if [[ $estatus -ne 0 ]];then - wsrep_log_error "Cleanup after exit with status:$estatus" - elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then - wsrep_log_info "Removing the sst_in_progress file" - wsrep_cleanup_progress_file - fi - if [[ -n $progress && -p $progress ]];then - wsrep_log_info "Cleaning up fifo file $progress" - rm $progress - fi - if [[ -n ${STATDIR:-} ]];then - [[ -d $STATDIR ]] && rm -rf $STATDIR - fi - - # Final cleanup - pgid=$(ps -o pgid= $$ | grep -o '[0-9]*') - - # This means no setsid done in mysqld. - # We don't want to kill mysqld here otherwise. - if [[ $$ -eq $pgid ]];then - - # This means a signal was delivered to the process. - # So, more cleanup. - if [[ $estatus -ge 128 ]];then - kill -KILL -$$ || true - fi - - fi - - exit $estatus -} - -check_pid() -{ - local pid_file="$1" - [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 -} - -cleanup_donor() -{ - # Since this is invoked just after exit NNN - local estatus=$? - if [[ $estatus -ne 0 ]];then - wsrep_log_error "Cleanup after exit with status:$estatus" - fi - - if [[ -n ${XTRABACKUP_PID:-} ]];then - if check_pid $XTRABACKUP_PID - then - wsrep_log_error "xtrabackup process is still running. Killing... " - kill_xtrabackup - fi - - fi - rm -f ${DATA}/${IST_FILE} || true - - if [[ -n $progress && -p $progress ]];then - wsrep_log_info "Cleaning up fifo file $progress" - rm -f $progress || true - fi - - wsrep_log_info "Cleaning up temporary directories" - - if [[ -n $xtmpdir ]];then - [[ -d $xtmpdir ]] && rm -rf $xtmpdir || true - fi - - if [[ -n $itmpdir ]];then - [[ -d $itmpdir ]] && rm -rf $itmpdir || true - fi - - # Final cleanup - pgid=$(ps -o pgid= $$ | grep -o '[0-9]*') - - # This means no setsid done in mysqld. - # We don't want to kill mysqld here otherwise. - if [[ $$ -eq $pgid ]];then - - # This means a signal was delivered to the process. - # So, more cleanup. - if [[ $estatus -ge 128 ]];then - kill -KILL -$$ || true - fi - - fi - - exit $estatus - -} - -kill_xtrabackup() -{ - local PID=$(cat $XTRABACKUP_PID) - [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : - wsrep_log_info "Removing xtrabackup pid file $XTRABACKUP_PID" - rm -f "$XTRABACKUP_PID" || true -} - -# waits ~1 minute for nc/socat to open the port and then reports ready -# (regardless of timeout) -wait_for_listen() -{ - local HOST=$1 - local PORT=$2 - local MODULE=$3 - local LSOF_OUT - - for i in {1..300} - do - LSOF_OUT=$(lsof -sTCP:LISTEN -i TCP:${PORT} -a -c nc -c socat -F c 2> /dev/null || :) - [ -n "${LSOF_OUT}" ] && break - sleep 0.2 - done - - echo "ready ${HOST}:${PORT}/${MODULE}//${WSREP_SST_OPT_SST_VER:-1}" -} - -check_extra() -{ - local use_socket=1 - if [[ $uextra -eq 1 ]];then - if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then - local eport=$(parse_cnf --mysqld extra-port) - if [[ -n $eport ]];then - # Xtrabackup works only locally. - # Hence, setting host to 127.0.0.1 unconditionally. - wsrep_log_info "SST through extra_port $eport" - INNOEXTRA+=" --host=127.0.0.1 --port=$eport " - use_socket=0 - else - wsrep_log_error "Extra port $eport null, failing" - exit 1 - fi - else - wsrep_log_info "Thread pool not set, ignore the option use_extra" - fi - fi - if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then - INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" - fi -} - -recv_joiner() -{ - local dir=$1 - local msg=$2 - local tmt=$3 - local checkf=$4 - local ltcmd - - if [[ ! -d ${dir} ]];then - # This indicates that IST is in progress - return - fi - - pushd ${dir} 1>/dev/null - set +e - - if [[ $tmt -gt 0 ]] && command -v timeout >/dev/null;then - if timeout --help | grep -q -- '-k';then - ltcmd="timeout -k $(( tmt+10 )) $tmt $tcmd" - else - ltcmd="timeout -s9 $tmt $tcmd" - fi - timeit "$msg" "$ltcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" - else - timeit "$msg" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" - fi - - set -e - popd 1>/dev/null - - if [[ ${RC[0]} -eq 124 ]];then - wsrep_log_error "Possible timeout in receving first data from donor in gtid stage" - exit 32 - fi - - for ecode in "${RC[@]}";do - if [[ $ecode -ne 0 ]];then - wsrep_log_error "Error while getting data from donor node: " \ - "exit codes: ${RC[@]}" - exit 32 - fi - done - - if [[ $checkf -eq 1 && ! -r "${MAGIC_FILE}" ]];then - # this message should cause joiner to abort - wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" - wsrep_log_info "Contents of datadir" - wsrep_log_info "$(ls -l ${dir}/*)" - exit 32 - fi -} - - -send_donor() -{ - local dir=$1 - local msg=$2 - - pushd ${dir} 1>/dev/null - set +e - timeit "$msg" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" - set -e - popd 1>/dev/null - - - for ecode in "${RC[@]}";do - if [[ $ecode -ne 0 ]];then - wsrep_log_error "Error while getting data from donor node: " \ - "exit codes: ${RC[@]}" - exit 32 - fi - done - -} - -# Returns the version string in a standardized format -# Input "1.2.3" => echoes "010203" -# Wrongly formatted values => echoes "000000" -normalize_version() -{ - local major=0 - local minor=0 - local patch=0 - - # Only parses purely numeric version numbers, 1.2.3 - # Everything after the first three values are ignored - if [[ $1 =~ ^([0-9]+)\.([0-9]+)\.?([0-9]*)([\.0-9])*$ ]]; then - major=${BASH_REMATCH[1]} - minor=${BASH_REMATCH[2]} - patch=${BASH_REMATCH[3]} - fi - - printf %02d%02d%02d $major $minor $patch -} - -# Compares two version strings -# The first parameter is the version to be checked -# The second parameter is the minimum version required -# Returns 1 (failure) if $1 >= $2, 0 (success) otherwise -check_for_version() -{ - local local_version_str="$( normalize_version $1 )" - local required_version_str="$( normalize_version $2 )" - - if [[ "$local_version_str" < "$required_version_str" ]]; then - return 1 - else - return 0 - fi -} - -monitor_process() -{ - local sst_stream_pid=$1 - - while true ; do - - if ! ps --pid "${WSREP_SST_OPT_PARENT}" &>/dev/null; then - wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." - kill -- -"${WSREP_SST_OPT_PARENT}" - exit 32 - fi - - if ! ps --pid "${sst_stream_pid}" &>/dev/null; then - break - fi - - sleep 0.1 - - done -} - - -wsrep_check_programs "$INNOBACKUPEX_BIN" - -# check the version, we require XB-2.4 to ensure that we can pass the -# datadir via the command-line option -XB_REQUIRED_VERSION="2.3.5" - -XB_VERSION=`$INNOBACKUPEX_BIN --version 2>&1 | grep -oe '[0-9]\.[0-9][\.0-9]*' | head -n1` -if [[ -z $XB_VERSION ]]; then - wsrep_log_error "FATAL: Cannot determine the $INNOBACKUPEX_BIN version. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST" - exit 2 -fi - -if ! check_for_version $XB_VERSION $XB_REQUIRED_VERSION; then - wsrep_log_error "FATAL: The $INNOBACKUPEX_BIN version is $XB_VERSION. Needs xtrabackup-$XB_REQUIRED_VERSION or higher to perform SST" - exit 2 -fi - - -rm -f "${MAGIC_FILE}" - -if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then - wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" - exit 22 -fi - -read_cnf - -if ${INNOBACKUPEX_BIN} /tmp --help 2>/dev/null | grep -q -- '--version-check'; then - disver="--no-version-check" -fi - -if [[ ${FORCE_FTWRL:-0} -eq 1 ]];then - wsrep_log_info "Forcing FTWRL due to environment variable FORCE_FTWRL equal to $FORCE_FTWRL" - iopts+=" --no-backup-locks " -fi - - -INNOEXTRA="" - -if [[ $ssyslog -eq 1 ]];then - - if ! command -v logger >/dev/null;then - wsrep_log_error "logger not in path: $PATH. Ignoring" - else - - wsrep_log_info "Logging all stderr of SST/Innobackupex to syslog" - - exec 2> >(logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE) - - wsrep_log_error() - { - logger -p daemon.err -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@" - } - - wsrep_log_info() - { - logger -p daemon.info -t ${ssystag}wsrep-sst-$WSREP_SST_OPT_ROLE "$@" - } - - INNOAPPLY="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-apply " - INNOMOVE="2>&1 | logger -p daemon.err -t ${ssystag}innobackupex-move " - INNOBACKUP="2> >(logger -p daemon.err -t ${ssystag}innobackupex-backup)" - fi - -else - INNOAPPLY="&>\${DATA}/innobackup.prepare.log" - INNOMOVE="&>\${DATA}/innobackup.move.log" - INNOBACKUP="2>\${DATA}/innobackup.backup.log" -fi - -get_stream -get_transfer - -INNODB_DATA_HOME_DIR=${INNODB_DATA_HOME_DIR:-""} -# Try to set INNODB_DATA_HOME_DIR from the command line: -if [ ! -z "$INNODB_DATA_HOME_DIR_ARG" ]; then - INNODB_DATA_HOME_DIR=$INNODB_DATA_HOME_DIR_ARG -fi -# if INNODB_DATA_HOME_DIR env. variable is not set, try to get it from my.cnf -if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf mysqld$WSREP_SST_OPT_SUFFIX_VALUE innodb-data-home-dir '') -fi -if [ -z "$INNODB_DATA_HOME_DIR" ]; then - INNODB_DATA_HOME_DIR=$(parse_cnf --mysqld innodb-data-home-dir "") -fi -if [ ! -z "$INNODB_DATA_HOME_DIR" ]; then - INNOEXTRA+=" --innodb-data-home-dir=$INNODB_DATA_HOME_DIR" -fi - -if [ -n "$INNODB_DATA_HOME_DIR" ]; then - # handle both relative and absolute paths - INNODB_DATA_HOME_DIR=$(cd $DATA; mkdir -p "$INNODB_DATA_HOME_DIR"; cd $INNODB_DATA_HOME_DIR; pwd -P) -else - # default to datadir - INNODB_DATA_HOME_DIR=$(cd $DATA; pwd -P) -fi - -INNOAPPLY="${INNOBACKUPEX_BIN} $disver $iapts \$INNOEXTRA --apply-log \$rebuildcmd \${DATA} ${INNOAPPLY}" -INNOMOVE="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $impts --move-back --force-non-empty-directories \${DATA} ${INNOMOVE}" -INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} $disver $iopts \$tmpopts \$INNOEXTRA --galera-info --stream=\$sfmt \$itmpdir ${INNOBACKUP}" - -if [ "$WSREP_SST_OPT_ROLE" = "donor" ] -then - trap cleanup_donor EXIT - - if [ $WSREP_SST_OPT_BYPASS -eq 0 ] - then - usrst=0 - if [[ -z $WSREP_SST_OPT_SST_VER ]];then - wsrep_log_error "Upgrade joiner to 5.6.21 or higher for backup locks support" - wsrep_log_error "The joiner is not supported for this version of donor" - exit 93 - fi - - if [[ -z $(parse_cnf --mysqld tmpdir "") && -z $(parse_cnf xtrabackup tmpdir "") ]];then - xtmpdir=$(mktemp -d) - tmpopts=" --tmpdir=$xtmpdir " - wsrep_log_info "Using $xtmpdir as xtrabackup temporary directory" - fi - - itmpdir=$(mktemp -d) - wsrep_log_info "Using $itmpdir as innobackupex temporary directory" - - if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then - INNOEXTRA+=" --user=$WSREP_SST_OPT_USER" - usrst=1 - fi - - if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then - INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD" - elif [[ $usrst -eq 1 ]];then - # Empty password, used for testing, debugging etc. - INNOEXTRA+=" --password=" - fi - - get_keys - check_extra - - wsrep_log_info "Streaming GTID file before SST" - - # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id - # (separated by a space). - echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}" - - ttcmd="$tcmd" - - if [[ $encrypt -eq 1 ]];then - if [[ -n $scomp ]];then - tcmd=" \$ecmd | $scomp | $tcmd " - else - tcmd=" \$ecmd | $tcmd " - fi - elif [[ -n $scomp ]];then - tcmd=" $scomp | $tcmd " - fi - - send_donor $DATA "${stagemsg}-gtid" - - # Restore the transport commmand to its original state - tcmd="$ttcmd" - if [[ -n $progress ]];then - get_footprint - tcmd="$pcmd | $tcmd" - elif [[ -n $rlimit ]];then - adjust_progress - tcmd="$pcmd | $tcmd" - fi - - wsrep_log_info "Sleeping before data transfer for SST" - sleep 10 - - wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444}" - - # Add compression to the head of the stream (if specified) - if [[ -n $scomp ]]; then - tcmd="$scomp | $tcmd" - fi - - # Add encryption to the head of the stream (if specified) - if [[ $encrypt -eq 1 ]]; then - tcmd=" \$ecmd | $tcmd " - fi - - set +e - timeit "${stagemsg}-SST" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" - set -e - - if [ ${RC[0]} -ne 0 ]; then - wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ - "Check ${DATA}/innobackup.backup.log" - exit 22 - elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then - wsrep_log_error "$tcmd finished with error: ${RC[1]}" - exit 22 - fi - - # innobackupex implicitly writes PID to fixed location in $xtmpdir - XTRABACKUP_PID="$xtmpdir/xtrabackup_pid" - - - else # BYPASS FOR IST - - wsrep_log_info "Bypassing the SST for IST" - echo "continue" # now server can resume updating data - - # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id - # (separated by a space). - echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}" - echo "1" > "${DATA}/${IST_FILE}" - get_keys - if [[ $encrypt -eq 1 ]];then - if [[ -n $scomp ]];then - tcmd=" \$ecmd | $scomp | $tcmd " - else - tcmd=" \$ecmd | $tcmd " - fi - elif [[ -n $scomp ]];then - tcmd=" $scomp | $tcmd " - fi - strmcmd+=" \${IST_FILE}" - - send_donor $DATA "${stagemsg}-IST" - - fi - - echo "done ${WSREP_SST_OPT_GTID}" - wsrep_log_info "Total time on donor: $totime seconds" - -elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] -then - [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" - [[ -n $SST_PROGRESS_FILE ]] && touch $SST_PROGRESS_FILE - - ib_home_dir=$INNODB_DATA_HOME_DIR - ib_log_dir=$(parse_cnf --mysqld innodb-log-group-home-dir "") - ib_undo_dir=$(parse_cnf --mysqld innodb-undo-directory "") - - stagemsg="Joiner-Recv" - - sencrypted=1 - nthreads=1 - - MODULE="xtrabackup_sst" - - rm -f "${DATA}/${IST_FILE}" - - # May need xtrabackup_checkpoints later on - rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile - - wait_for_listen ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT:-4444} ${MODULE} & - - trap sig_joiner_cleanup HUP PIPE INT TERM - trap cleanup_joiner EXIT - - if [[ -n $progress ]];then - adjust_progress - tcmd+=" | $pcmd" - fi - - get_keys - if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then - if [[ -n $sdecomp ]];then - strmcmd=" $sdecomp | \$ecmd | $strmcmd" - else - strmcmd=" \$ecmd | $strmcmd" - fi - elif [[ -n $sdecomp ]];then - strmcmd=" $sdecomp | $strmcmd" - fi - - STATDIR=$(mktemp -d) - MAGIC_FILE="${STATDIR}/${INFO_FILE}" - recv_joiner $STATDIR "${stagemsg}-gtid" $stimeout 1 - - - if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null - then - wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." - exit 32 - fi - - if [ ! -r "${STATDIR}/${IST_FILE}" ] - then - - if [[ -d ${DATA}/.sst ]];then - wsrep_log_info "WARNING: Stale temporary SST directory: ${DATA}/.sst from previous state transfer. Removing" - rm -rf ${DATA}/.sst - fi - mkdir -p ${DATA}/.sst - (recv_joiner $DATA/.sst "${stagemsg}-SST" 0 0) & - jpid=$! - wsrep_log_info "Proceeding with SST" - - - wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" - if [ "${OS}" = "FreeBSD" ]; then - find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ - else - find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+ - fi - - tempdir=$(parse_cnf --mysqld log-bin "") - if [[ -n ${tempdir:-} ]];then - binlog_dir=$(dirname $tempdir) - binlog_file=$(basename $tempdir) - if [[ -n ${binlog_dir:-} && $binlog_dir != '.' && $binlog_dir != $DATA ]];then - pattern="$binlog_dir/$binlog_file\.[0-9]+$" - wsrep_log_info "Cleaning the binlog directory $binlog_dir as well" - find $binlog_dir -maxdepth 1 -type f -regex $pattern -exec rm -fv {} 1>&2 \+ || true - rm $binlog_dir/*.index || true - fi - fi - - - - TDATA=${DATA} - DATA="${DATA}/.sst" - - - MAGIC_FILE="${DATA}/${INFO_FILE}" - wsrep_log_info "Waiting for SST streaming to complete!" - monitor_process $jpid - - get_proc - - if [[ ! -s ${DATA}/xtrabackup_checkpoints ]];then - wsrep_log_error "xtrabackup_checkpoints missing, failed innobackupex/SST on donor" - exit 2 - fi - - # Rebuild indexes for compact backups - if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then - wsrep_log_info "Index compaction detected" - rebuild=1 - fi - - if [[ $rebuild -eq 1 ]];then - nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) - wsrep_log_info "Rebuilding during prepare with $nthreads threads" - rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" - fi - - if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then - - wsrep_log_info "Compressed qpress files found" - - if ! command -v qpress >/dev/null;then - wsrep_log_error "qpress not found in path: $PATH" - exit 22 - fi - - if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then - count=$(find ${DATA} -type f -name '*.qp' | wc -l) - count=$(( count*2 )) - if pv --help | grep -q FORMAT;then - pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" - else - pvopts="-f -s $count -l -N Decompression" - fi - pcmd="pv $pvopts" - adjust_progress - dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" - else - dcmd="xargs -n 2 qpress -T${nproc}d" - fi - - - # Decompress the qpress files - wsrep_log_info "Decompression with $nproc threads" - timeit "Joiner-Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" - extcode=$? - - if [[ $extcode -eq 0 ]];then - wsrep_log_info "Removing qpress files after decompression" - find ${DATA} -type f -name '*.qp' -delete - if [[ $? -ne 0 ]];then - wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" - fi - else - wsrep_log_error "Decompression failed. Exit code: $extcode" - exit 22 - fi - fi - - - if [[ ! -z $WSREP_SST_OPT_BINLOG ]];then - - BINLOG_DIRNAME=$(dirname $WSREP_SST_OPT_BINLOG) - BINLOG_FILENAME=$(basename $WSREP_SST_OPT_BINLOG) - - # To avoid comparing data directory and BINLOG_DIRNAME - mv $DATA/${BINLOG_FILENAME}.* $BINLOG_DIRNAME/ 2>/dev/null || true - - pushd $BINLOG_DIRNAME &>/dev/null - for bfiles in $(ls -1 ${BINLOG_FILENAME}.[0-9]*);do - echo ${BINLOG_DIRNAME}/${bfiles} >> ${BINLOG_FILENAME}.index - done - popd &> /dev/null - - fi - - wsrep_log_info "Preparing the backup at ${DATA}" - timeit "Xtrabackup prepare stage" "$INNOAPPLY" - - if [ $? -ne 0 ]; - then - wsrep_log_error "${INNOBACKUPEX_BIN} apply finished with errors. Check ${DATA}/innobackup.prepare.log" - exit 22 - fi - - MAGIC_FILE="${TDATA}/${INFO_FILE}" - set +e - rm $TDATA/innobackup.prepare.log $TDATA/innobackup.move.log - set -e - wsrep_log_info "Moving the backup to ${TDATA}" - timeit "Xtrabackup move stage" "$INNOMOVE" - if [[ $? -eq 0 ]];then - wsrep_log_info "Move successful, removing ${DATA}" - rm -rf $DATA - DATA=${TDATA} - else - wsrep_log_error "Move failed, keeping ${DATA} for further diagnosis" - wsrep_log_error "Check ${DATA}/innobackup.move.log for details" - exit 22 - fi - - - else - wsrep_log_info "${IST_FILE} received from donor: Running IST" - fi - - if [[ ! -r ${MAGIC_FILE} ]];then - wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" - exit 2 - fi - wsrep_log_info "Galera co-ords from recovery: $(cat ${MAGIC_FILE})" - cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id - wsrep_log_info "Total time on joiner: $totime seconds" -fi - -exit 0 diff --git a/scripts/wsrep_sst_xtrabackup.sh b/scripts/wsrep_sst_xtrabackup.sh deleted file mode 100644 index 41ed4485de5..00000000000 --- a/scripts/wsrep_sst_xtrabackup.sh +++ /dev/null @@ -1,692 +0,0 @@ -#!/bin/bash -ue -# Copyright (C) 2013 Percona 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 -# the Free Software Foundation; version 2 of the License. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; see the file COPYING. If not, write to the -# Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston -# MA 02110-1301 USA. - -# Optional dependencies and options documented here: http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html -# Make sure to read that before proceeding! - - - - -. $(dirname $0)/wsrep_sst_common - -ealgo="" -ekey="" -ekeyfile="" -encrypt=0 -nproc=1 -ecode=0 -XTRABACKUP_PID="" -tcert="" -tpem="" -sockopt="" -progress="" -ttime=0 -totime=0 -lsn="${WSREP_SST_OPT_LSN}" -incremental=0 -ecmd="" -rlimit="" - -sfmt="tar" -strmcmd="" -tfmt="" -tcmd="" -rebuild=0 -rebuildcmd="" -payload=0 -pvformat="-F '%N => Rate:%r Avg:%a Elapsed:%t %e Bytes: %b %p' " -pvopts="-f -i 10 -N $WSREP_SST_OPT_ROLE " -uextra=0 - -if pv --help 2>/dev/null | grep -q FORMAT;then - pvopts+=$pvformat -fi -pcmd="pv $pvopts" -declare -a RC - -INNOBACKUPEX_BIN=innobackupex -DATA="${WSREP_SST_OPT_DATA}" -INFO_FILE="xtrabackup_galera_info" -IST_FILE="xtrabackup_ist" -MAGIC_FILE="${DATA}/${INFO_FILE}" - -# Setting the path for ss and ip -export PATH="/usr/sbin:/sbin:$PATH" - -timeit(){ - local stage=$1 - shift - local cmd="$@" - local x1 x2 took extcode - - if [[ $ttime -eq 1 ]];then - x1=$(date +%s) - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? - x2=$(date +%s) - took=$(( x2-x1 )) - wsrep_log_info "NOTE: $stage took $took seconds" - totime=$(( totime+took )) - else - wsrep_log_info "Evaluating $cmd" - eval "$cmd" - extcode=$? - fi - return $extcode -} - -get_keys() -{ - if [[ $encrypt -eq 2 ]];then - return - fi - - if [[ $encrypt -eq 0 ]];then - if $MY_PRINT_DEFAULTS xtrabackup | grep -q encrypt;then - wsrep_log_error "Unexpected option combination. SST may fail. Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html " - fi - return - fi - - if [[ $sfmt == 'tar' ]];then - wsrep_log_info "NOTE: Xtrabackup-based encryption - encrypt=1 - cannot be enabled with tar format" - encrypt=0 - return - fi - - wsrep_log_info "Xtrabackup based encryption enabled in my.cnf - Supported only from Xtrabackup 2.1.4" - - if [[ -z $ealgo ]];then - wsrep_log_error "FATAL: Encryption algorithm empty from my.cnf, bailing out" - exit 3 - fi - - if [[ -z $ekey && ! -r $ekeyfile ]];then - wsrep_log_error "FATAL: Either key or keyfile must be readable" - exit 3 - fi - - if [[ -z $ekey ]];then - ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key-file=$ekeyfile" - else - ecmd="xbcrypt --encrypt-algo=$ealgo --encrypt-key=$ekey" - fi - - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - ecmd+=" -d" - fi -} - -get_transfer() -{ - TSST_PORT=${WSREP_SST_OPT_PORT:-4444} - - if [[ $tfmt == 'nc' ]];then - wsrep_check_programs nc - wsrep_log_info "Using netcat as streamer" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - if nc -h 2>&1 | grep -q ncat;then - # Ncat - tcmd="nc -l ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then - # Debian netcat - tcmd="nc -dl ${TSST_PORT}" - else - # traditional netcat - tcmd="nc -l -p ${TSST_PORT}" - fi - else - if nc -h 2>&1 | grep -q ncat;then - # Ncat - tcmd="nc ${REMOTEIP} ${TSST_PORT}" - elif nc -h 2>&1 | grep -q -- '-d\>';then - # Debian netcat - tcmd="nc ${REMOTEIP} ${TSST_PORT}" - else - # traditional netcat - tcmd="nc -q0 ${REMOTEIP} ${TSST_PORT}" - fi - fi - else - tfmt='socat' - wsrep_check_programs socat - wsrep_log_info "Using socat as streamer" - - if [[ $encrypt -eq 2 ]] && ! socat -V | grep -q OPENSSL;then - wsrep_log_info "NOTE: socat is not openssl enabled, falling back to plain transfer" - encrypt=0 - fi - - if [[ $encrypt -eq 2 ]];then - wsrep_log_info "Using openssl based encryption with socat" - if [[ -z $tpem || -z $tcert ]];then - wsrep_log_error "Both PEM and CRT files required" - exit 22 - fi - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - wsrep_log_info "Decrypting with PEM $tpem, CA: $tcert" - tcmd="socat -u openssl-listen:${TSST_PORT},reuseaddr,cert=$tpem,cafile=${tcert}${sockopt} stdio" - else - wsrep_log_info "Encrypting with PEM $tpem, CA: $tcert" - tcmd="socat -u stdio openssl-connect:${WSREP_SST_OPT_HOST}:${TSST_PORT},cert=$tpem,cafile=${tcert}${sockopt}" - fi - else - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - tcmd="socat -u TCP-LISTEN:${TSST_PORT},reuseaddr${sockopt} stdio" - else - tcmd="socat -u stdio TCP:${WSREP_SST_OPT_HOST}:${TSST_PORT}${sockopt}" - fi - fi - fi - -} - -get_footprint() -{ - pushd $WSREP_SST_OPT_DATA 1>/dev/null - payload=$(find . -regex '.*\.ibd$\|.*\.MYI$\|.*\.MYD$\|.*ibdata1$' -type f -print0 | du --files0-from=- --block-size=1 -c -s | awk 'END { print $1 }') - if $MY_PRINT_DEFAULTS xtrabackup | grep -q -- "--compress";then - # QuickLZ has around 50% compression ratio - # When compression/compaction used, the progress is only an approximate. - payload=$(( payload*1/2 )) - fi - popd 1>/dev/null - pcmd+=" -s $payload" - adjust_progress -} - -adjust_progress() -{ - if [[ -n $progress && $progress != '1' ]];then - if [[ -e $progress ]];then - pcmd+=" 2>>$progress" - else - pcmd+=" 2>$progress" - fi - elif [[ -z $progress && -n $rlimit ]];then - # When rlimit is non-zero - pcmd="pv -q" - fi - - if [[ -n $rlimit && "$WSREP_SST_OPT_ROLE" == "donor" ]];then - wsrep_log_info "Rate-limiting SST to $rlimit" - pcmd+=" -L \$rlimit" - fi -} - -read_cnf() -{ - sfmt=$(parse_cnf sst streamfmt "tar") - tfmt=$(parse_cnf sst transferfmt "socat") - tcert=$(parse_cnf sst tca "") - tpem=$(parse_cnf sst tcert "") - encrypt=$(parse_cnf sst encrypt 0) - sockopt=$(parse_cnf sst sockopt "") - progress=$(parse_cnf sst progress "") - rebuild=$(parse_cnf sst rebuild 0) - ttime=$(parse_cnf sst time 0) - incremental=$(parse_cnf sst incremental 0) - ealgo=$(parse_cnf xtrabackup encrypt "") - ekey=$(parse_cnf xtrabackup encrypt-key "") - ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") - - # Refer to http://www.percona.com/doc/percona-xtradb-cluster/manual/xtrabackup_sst.html - if [[ -z $ealgo ]];then - ealgo=$(parse_cnf sst encrypt-algo "") - ekey=$(parse_cnf sst encrypt-key "") - ekeyfile=$(parse_cnf sst encrypt-key-file "") - fi - rlimit=$(parse_cnf sst rlimit "") - uextra=$(parse_cnf sst use_extra 0) -} - -get_stream() -{ - if [[ $sfmt == 'xbstream' ]];then - wsrep_log_info "Streaming with xbstream" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="xbstream -x" - else - strmcmd="xbstream -c \${INFO_FILE} \${IST_FILE}" - fi - else - sfmt="tar" - wsrep_log_info "Streaming with tar" - if [[ "$WSREP_SST_OPT_ROLE" == "joiner" ]];then - strmcmd="tar xfi - --recursive-unlink -h" - else - strmcmd="tar cf - \${INFO_FILE} \${IST_FILE}" - fi - - fi -} - -get_proc() -{ - set +e - nproc=$(grep -c processor /proc/cpuinfo) - [[ -z $nproc || $nproc -eq 0 ]] && nproc=1 - set -e -} - -sig_joiner_cleanup() -{ - wsrep_log_error "Removing $MAGIC_FILE file due to signal" - rm -f "$MAGIC_FILE" -} - -cleanup_joiner() -{ - # Since this is invoked just after exit NNN - local estatus=$? - if [[ $estatus -ne 0 ]];then - wsrep_log_error "Cleanup after exit with status:$estatus" - fi - if [ "${WSREP_SST_OPT_ROLE}" = "joiner" ];then - wsrep_log_info "Removing the sst_in_progress file" - wsrep_cleanup_progress_file - fi - if [[ -n $progress && -p $progress ]];then - wsrep_log_info "Cleaning up fifo file $progress" - rm $progress - fi -} - -check_pid() -{ - local pid_file="$1" - [ -r "$pid_file" ] && ps -p $(cat "$pid_file") >/dev/null 2>&1 -} - -cleanup_donor() -{ - # Since this is invoked just after exit NNN - local estatus=$? - if [[ $estatus -ne 0 ]];then - wsrep_log_error "Cleanup after exit with status:$estatus" - fi - - if [[ -n $XTRABACKUP_PID ]];then - if check_pid $XTRABACKUP_PID - then - wsrep_log_error "xtrabackup process is still running. Killing... " - kill_xtrabackup - fi - - rm -f $XTRABACKUP_PID - fi - rm -f ${DATA}/${IST_FILE} - - if [[ -n $progress && -p $progress ]];then - wsrep_log_info "Cleaning up fifo file $progress" - rm $progress - fi -} - -kill_xtrabackup() -{ - local PID=$(cat $XTRABACKUP_PID) - [ -n "$PID" -a "0" != "$PID" ] && kill $PID && (kill $PID && kill -9 $PID) || : - rm -f "$XTRABACKUP_PID" -} - -# waits ~10 seconds for nc to open the port and then reports ready -# (regardless of timeout) -wait_for_listen() -{ - local PORT=$1 - local ADDR=$2 - local MODULE=$3 - for i in {1..50} - do - ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break - sleep 0.2 - done - if [[ $incremental -eq 1 ]];then - echo "ready ${ADDR}/${MODULE}/$lsn" - else - echo "ready ${ADDR}/${MODULE}" - fi -} - -check_extra() -{ - local use_socket=1 - if [[ $uextra -eq 1 ]];then - if [ $(parse_cnf --mysqld thread-handling) = 'pool-of-threads'];then - local eport=$(parse_cnf --mysqld extra-port) - if [[ -n $eport ]];then - # Xtrabackup works only locally. - # Hence, setting host to 127.0.0.1 unconditionally. - wsrep_log_info "SST through extra_port $eport" - INNOEXTRA+=" --host=127.0.0.1 --port=$eport " - use_socket=0 - else - wsrep_log_error "Extra port $eport null, failing" - exit 1 - fi - else - wsrep_log_info "Thread pool not set, ignore the option use_extra" - fi - fi - if [[ $use_socket -eq 1 ]] && [[ -n "${WSREP_SST_OPT_SOCKET}" ]];then - INNOEXTRA+=" --socket=${WSREP_SST_OPT_SOCKET}" - fi -} - -wsrep_check_programs "innobackupex" - -rm -f "${MAGIC_FILE}" - -if [[ ! ${WSREP_SST_OPT_ROLE} == 'joiner' && ! ${WSREP_SST_OPT_ROLE} == 'donor' ]];then - wsrep_log_error "Invalid role ${WSREP_SST_OPT_ROLE}" - exit 22 -fi - -read_cnf -get_stream -get_transfer - -INNOEXTRA="" -INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} --apply-log \$rebuildcmd \${DATA} &>\${DATA}/innobackup.prepare.log" -INNOBACKUP="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \$INNOEXTRA --galera-info --stream=\$sfmt \${TMPDIR} 2>\${DATA}/innobackup.backup.log" - -if [ "$WSREP_SST_OPT_ROLE" = "donor" ] -then - trap cleanup_donor EXIT - - if [ $WSREP_SST_OPT_BYPASS -eq 0 ] - then - usrst=0 - TMPDIR="${TMPDIR:-/tmp}" - - if [[ -n "${WSREP_SST_OPT_USER:-}" && "$WSREP_SST_OPT_USER" != "(null)" ]]; then - INNOEXTRA+=" --user=$WSREP_SST_OPT_USER" - usrst=1 - fi - - if [ -n "${WSREP_SST_OPT_PSWD:-}" ]; then - INNOEXTRA+=" --password=$WSREP_SST_OPT_PSWD" - elif [[ $usrst -eq 1 ]];then - # Empty password, used for testing, debugging etc. - INNOEXTRA+=" --password=" - fi - - get_keys - if [[ $encrypt -eq 1 ]];then - if [[ -n $ekey ]];then - INNOEXTRA+=" --encrypt=$ealgo --encrypt-key=$ekey " - else - INNOEXTRA+=" --encrypt=$ealgo --encrypt-key-file=$ekeyfile " - fi - fi - - if [[ -n $lsn ]];then - INNOEXTRA+=" --incremental --incremental-lsn=$lsn " - fi - - check_extra - - wsrep_log_info "Streaming the backup to joiner at ${WSREP_SST_OPT_HOST} ${WSREP_SST_OPT_PORT}" - - if [[ -n $progress ]];then - get_footprint - tcmd="$pcmd | $tcmd" - elif [[ -n $rlimit ]];then - adjust_progress - tcmd="$pcmd | $tcmd" - fi - - set +e - timeit "Donor-Transfer" "$INNOBACKUP | $tcmd; RC=( "\${PIPESTATUS[@]}" )" - set -e - - if [ ${RC[0]} -ne 0 ]; then - wsrep_log_error "${INNOBACKUPEX_BIN} finished with error: ${RC[0]}. " \ - "Check ${DATA}/innobackup.backup.log" - exit 22 - elif [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then - wsrep_log_error "$tcmd finished with error: ${RC[1]}" - exit 22 - fi - - # innobackupex implicitly writes PID to fixed location in ${TMPDIR} - XTRABACKUP_PID="${TMPDIR}/xtrabackup_pid" - - else # BYPASS FOR IST - - wsrep_log_info "Bypassing the SST for IST" - echo "continue" # now server can resume updating data - - # Store donor's wsrep GTID (state ID) and wsrep_gtid_domain_id - # (separated by a space) - echo "${WSREP_SST_OPT_GTID} ${WSREP_SST_OPT_GTID_DOMAIN_ID}" > "${MAGIC_FILE}" - echo "1" > "${DATA}/${IST_FILE}" - get_keys - pushd ${DATA} 1>/dev/null - set +e - if [[ $encrypt -eq 1 ]];then - tcmd=" $ecmd | $tcmd" - fi - timeit "Donor-IST-Unencrypted-transfer" "$strmcmd | $tcmd; RC=( "\${PIPESTATUS[@]}" )" - set -e - popd 1>/dev/null - - for ecode in "${RC[@]}";do - if [[ $ecode -ne 0 ]];then - wsrep_log_error "Error while streaming data to joiner node: " \ - "exit codes: ${RC[@]}" - exit 1 - fi - done - fi - - echo "done ${WSREP_SST_OPT_GTID}" - wsrep_log_info "Total time on donor: $totime seconds" - -elif [ "${WSREP_SST_OPT_ROLE}" = "joiner" ] -then - [[ -e $SST_PROGRESS_FILE ]] && wsrep_log_info "Stale sst_in_progress file: $SST_PROGRESS_FILE" - touch $SST_PROGRESS_FILE - - if [[ ! -e ${DATA}/ibdata1 ]];then - incremental=0 - fi - - if [[ $incremental -eq 1 ]];then - wsrep_log_info "Incremental SST enabled" - #lsn=$(/pxc/bin/mysqld $WSREP_SST_OPT_CONF --basedir=/pxc --wsrep-recover 2>&1 | grep -o 'log sequence number .*' | cut -d " " -f 4 | head -1) - lsn=$(grep to_lsn xtrabackup_checkpoints | cut -d= -f2 | tr -d ' ') - wsrep_log_info "Recovered LSN: $lsn" - fi - - sencrypted=1 - nthreads=1 - - MODULE="xtrabackup_sst" - - # May need xtrabackup_checkpoints later on - rm -f ${DATA}/xtrabackup_binary ${DATA}/xtrabackup_galera_info ${DATA}/xtrabackup_logfile - - ADDR="${WSREP_SST_OPT_HOST}:${WSREP_SST_OPT_PORT:-4444}" - - wait_for_listen ${WSREP_SST_OPT_PORT:-4444} ${ADDR} ${MODULE} & - - trap sig_joiner_cleanup HUP PIPE INT TERM - trap cleanup_joiner EXIT - - if [[ -n $progress ]];then - adjust_progress - tcmd+=" | $pcmd" - fi - - if [[ $incremental -eq 1 ]];then - BDATA=$DATA - DATA=$(mktemp -d) - MAGIC_FILE="${DATA}/${INFO_FILE}" - fi - - get_keys - set +e - if [[ $encrypt -eq 1 && $sencrypted -eq 1 ]];then - strmcmd=" $ecmd | $strmcmd" - fi - - pushd ${DATA} 1>/dev/null - timeit "Joiner-Recv-Unencrypted" "$tcmd | $strmcmd; RC=( "\${PIPESTATUS[@]}" )" - popd 1>/dev/null - - set -e - - if [[ $sfmt == 'xbstream' ]];then - # Special handling till lp:1193240 is fixed" - if [[ ${RC[$(( ${#RC[@]}-1 ))]} -eq 1 ]];then - wsrep_log_error "Xbstream failed" - wsrep_log_error "Data directory ${DATA} may not be empty: lp:1193240" \ - "Manual intervention required in that case" - exit 32 - fi - fi - - wait %% # join for wait_for_listen thread - - for ecode in "${RC[@]}";do - if [[ $ecode -ne 0 ]];then - wsrep_log_error "Error while getting data from donor node: " \ - "exit codes: ${RC[@]}" - exit 32 - fi - done - - if [ ! -r "${MAGIC_FILE}" ] - then - # this message should cause joiner to abort - wsrep_log_error "xtrabackup process ended without creating '${MAGIC_FILE}'" - wsrep_log_info "Contents of datadir" - wsrep_log_info "$(ls -l ${DATA}/**/*)" - exit 32 - fi - - if ! ps -p ${WSREP_SST_OPT_PARENT} &>/dev/null - then - wsrep_log_error "Parent mysqld process (PID:${WSREP_SST_OPT_PARENT}) terminated unexpectedly." - exit 32 - fi - - if [ ! -r "${DATA}/${IST_FILE}" ] - then - wsrep_log_info "Proceeding with SST" - wsrep_log_info "Removing existing ib_logfile files" - if [[ $incremental -ne 1 ]];then - rm -f ${DATA}/ib_logfile* - else - rm -f ${BDATA}/ib_logfile* - fi - - get_proc - - # Rebuild indexes for compact backups - if grep -q 'compact = 1' ${DATA}/xtrabackup_checkpoints;then - wsrep_log_info "Index compaction detected" - rebuild=1 - fi - - if [[ $rebuild -eq 1 ]];then - nthreads=$(parse_cnf xtrabackup rebuild-threads $nproc) - wsrep_log_info "Rebuilding during prepare with $nthreads threads" - rebuildcmd="--rebuild-indexes --rebuild-threads=$nthreads" - fi - - if test -n "$(find ${DATA} -maxdepth 1 -type f -name '*.qp' -print -quit)";then - - wsrep_log_info "Compressed qpress files found" - - if ! command -v qpress >/dev/null;then - wsrep_log_error "qpress not found in path: $PATH" - exit 22 - fi - - if [[ -n $progress ]] && pv --help | grep -q 'line-mode';then - count=$(find ${DATA} -type f -name '*.qp' | wc -l) - count=$(( count*2 )) - if pv --help | grep -q FORMAT;then - pvopts="-f -s $count -l -N Decompression -F '%N => Rate:%r Elapsed:%t %e Progress: [%b/$count]'" - else - pvopts="-f -s $count -l -N Decompression" - fi - pcmd="pv $pvopts" - adjust_progress - dcmd="$pcmd | xargs -n 2 qpress -T${nproc}d" - else - dcmd="xargs -n 2 qpress -T${nproc}d" - fi - - wsrep_log_info "Removing existing ibdata1 file" - rm -f ${DATA}/ibdata1 - - # Decompress the qpress files - wsrep_log_info "Decompression with $nproc threads" - timeit "Decompression" "find ${DATA} -type f -name '*.qp' -printf '%p\n%h\n' | $dcmd" - extcode=$? - - if [[ $extcode -eq 0 ]];then - wsrep_log_info "Removing qpress files after decompression" - find ${DATA} -type f -name '*.qp' -delete - if [[ $? -ne 0 ]];then - wsrep_log_error "Something went wrong with deletion of qpress files. Investigate" - fi - else - wsrep_log_error "Decompression failed. Exit code: $extcode" - exit 22 - fi - fi - - if [[ $incremental -eq 1 ]];then - # Added --ibbackup=xtrabackup_55 because it fails otherwise citing connection issues. - INNOAPPLY="${INNOBACKUPEX_BIN} ${WSREP_SST_OPT_CONF} \ - --ibbackup=xtrabackup_55 --apply-log $rebuildcmd --redo-only $BDATA --incremental-dir=${DATA} &>>${BDATA}/innobackup.prepare.log" - fi - - wsrep_log_info "Preparing the backup at ${DATA}" - timeit "Xtrabackup prepare stage" "$INNOAPPLY" - - if [[ $incremental -eq 1 ]];then - wsrep_log_info "Cleaning up ${DATA} after incremental SST" - [[ -d ${DATA} ]] && rm -rf ${DATA} - DATA=$BDATA - fi - - if [ $? -ne 0 ]; - then - wsrep_log_error "${INNOBACKUPEX_BIN} finished with errors. Check ${DATA}/innobackup.prepare.log" - exit 22 - fi - else - wsrep_log_info "${IST_FILE} received from donor: Running IST" - fi - - if [[ ! -r ${MAGIC_FILE} ]];then - wsrep_log_error "SST magic file ${MAGIC_FILE} not found/readable" - exit 2 - fi - - cat "${MAGIC_FILE}" # Output : UUID:seqno wsrep_gtid_domain_id - wsrep_log_info "Total time on joiner: $totime seconds" -fi - -exit 0 diff --git a/sql/wsrep_sst.cc b/sql/wsrep_sst.cc index e648a7f4c69..7a542ab88f1 100644 --- a/sql/wsrep_sst.cc +++ b/sql/wsrep_sst.cc @@ -803,6 +803,7 @@ ssize_t wsrep_sst_prepare (void** msg) { const char* addr_in= NULL; const char* addr_out= NULL; + const char* method; if (!strcmp(wsrep_sst_method, WSREP_SST_SKIP)) { @@ -861,7 +862,8 @@ ssize_t wsrep_sst_prepare (void** msg) } ssize_t addr_len= -ENOSYS; - if (!strcmp(wsrep_sst_method, WSREP_SST_MYSQLDUMP)) + method = wsrep_sst_method; + if (!strcmp(method, WSREP_SST_MYSQLDUMP)) { addr_len= sst_prepare_mysqldump (addr_in, &addr_out); if (addr_len < 0) unireg_abort(1); @@ -871,6 +873,13 @@ ssize_t wsrep_sst_prepare (void** msg) /*! A heuristic workaround until we learn how to stop and start engines */ if (SE_initialized) { + if (!strcmp(method, WSREP_SST_XTRABACKUP) || + !strcmp(method, WSREP_SST_XTRABACKUPV2)) + { + WSREP_WARN("The %s SST method is deprecated, so it is automatically " + "replaced by %s", method, WSREP_SST_MARIABACKUP); + method = WSREP_SST_MARIABACKUP; + } // we already did SST at initializaiton, now engines are running // sql_print_information() is here because the message is too long // for WSREP_INFO. @@ -880,28 +889,28 @@ ssize_t wsrep_sst_prepare (void** msg) "Wsrep provider won't be able to fall back to it " "if other means of state transfer are unavailable. " "In that case you will need to restart the server.", - wsrep_sst_method); + method); *msg = 0; return 0; } - addr_len = sst_prepare_other (wsrep_sst_method, sst_auth_real, + addr_len = sst_prepare_other (method, sst_auth_real, addr_in, &addr_out); if (addr_len < 0) { WSREP_ERROR("Failed to prepare for '%s' SST. Unrecoverable.", - wsrep_sst_method); + method); unireg_abort(1); } } - size_t const method_len(strlen(wsrep_sst_method)); + size_t const method_len(strlen(method)); size_t const msg_len (method_len + addr_len + 2 /* + auth_len + 1*/); *msg = malloc (msg_len); if (NULL != *msg) { char* const method_ptr(reinterpret_cast(*msg)); - strcpy (method_ptr, wsrep_sst_method); + strcpy (method_ptr, method); char* const addr_ptr(method_ptr + method_len + 1); strcpy (addr_ptr, addr_out); diff --git a/sql/wsrep_sst.h b/sql/wsrep_sst.h index cc0f1f5389d..29724a00797 100644 --- a/sql/wsrep_sst.h +++ b/sql/wsrep_sst.h @@ -49,6 +49,9 @@ #define WSREP_SST_MYSQLDUMP "mysqldump" #define WSREP_SST_RSYNC "rsync" #define WSREP_SST_SKIP "skip" +#define WSREP_SST_MARIABACKUP "mariabackup" +#define WSREP_SST_XTRABACKUP "xtrabackup" +#define WSREP_SST_XTRABACKUPV2 "xtrabackupv2" #define WSREP_SST_DEFAULT WSREP_SST_RSYNC #define WSREP_SST_ADDRESS_AUTO "AUTO" #define WSREP_SST_AUTH_MASK "********" From 65525550ab8988a1a1a36d0403824ebaec160347 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 17 Dec 2018 16:09:28 +0100 Subject: [PATCH 07/72] Don't default to bundled zlib This reverts part of c54271723c6 --- cmake/zlib.cmake | 5 ----- 1 file changed, 5 deletions(-) diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index 840337d1ca3..bfb2b70be74 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -34,11 +34,6 @@ ENDMACRO() MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) - # For NDBCLUSTER: Use bundled zlib by default - IF (NOT WITH_ZLIB) - SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform") - ENDIF() - IF(WITH_ZLIB STREQUAL "bundled") MYSQL_USE_BUNDLED_ZLIB() ELSE() From 977073e3dccd32c36d59a0a9dc4d9f8e0331f7c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Dec 2018 12:38:38 +0200 Subject: [PATCH 08/72] After-merge fix --- storage/innobase/fil/fil0crypt.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index c0c9cc01872..da40ddd8e65 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -2589,7 +2589,7 @@ fil_space_verify_crypt_checksum(const byte* page, const page_size_t& page_size) if (checksum == BUF_NO_CHECKSUM_MAGIC) { return true; } - if (zip_size) { + if (page_size.is_compressed()) { return checksum == page_zip_calc_checksum( page, page_size.physical(), SRV_CHECKSUM_ALGORITHM_CRC32) From 171271edf8204d6a958a00631ea6ce4050f84b9e Mon Sep 17 00:00:00 2001 From: Thirunarayanan Balathandayuthapani Date: Tue, 18 Dec 2018 18:07:17 +0530 Subject: [PATCH 09/72] MDEV-18025 Mariabackup fails to detect corrupted page_compressed=1 tables Problem: ======= Mariabackup seems to fail to verify the pages of compressed tables. The reason is that both fil_space_verify_crypt_checksum() and buf_page_is_corrupted() will skip the validation for compressed pages. Fix: ==== Mariabackup should call fil_page_decompress() for compressed and encrypted compressed page. After that, call buf_page_is_corrupted() to check the page corruption. --- extra/mariabackup/fil_cur.cc | 29 ++++++++++-- .../mariabackup/encrypted_page_compressed.opt | 6 +++ .../encrypted_page_compressed.result | 6 +++ .../encrypted_page_compressed.test | 47 +++++++++++++++++++ .../unencrypted_page_compressed.result | 6 +++ .../unencrypted_page_compressed.test | 46 ++++++++++++++++++ storage/innobase/buf/buf0buf.cc | 5 +- 7 files changed, 139 insertions(+), 6 deletions(-) create mode 100644 mysql-test/suite/mariabackup/encrypted_page_compressed.opt create mode 100644 mysql-test/suite/mariabackup/encrypted_page_compressed.result create mode 100644 mysql-test/suite/mariabackup/encrypted_page_compressed.test create mode 100644 mysql-test/suite/mariabackup/unencrypted_page_compressed.result create mode 100644 mysql-test/suite/mariabackup/unencrypted_page_compressed.test diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index c2693e6f616..b677e9973b7 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -31,6 +31,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include "fil_cur.h" #include "fil0crypt.h" +#include "fil0pagecompress.h" #include "common.h" #include "read_filt.h" #include "xtrabackup.h" @@ -346,6 +347,7 @@ read_retry: for (page = cursor->buf, i = 0; i < npages; page += cursor->page_size, i++) { ulint page_no = cursor->buf_page_no + i; + ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE); if (cursor->space_id == TRX_SYS_SPACE && page_no >= FSP_EXTENT_SIZE @@ -367,12 +369,31 @@ read_retry: memcpy(tmp_page, page, cursor->page_size); if (!fil_space_decrypt(space, tmp_frame, - tmp_page, &decrypted) - || buf_page_is_corrupted(true, tmp_page, - cursor->zip_size, - space)) { + tmp_page, &decrypted)) { goto corrupted; } + + if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + goto page_decomp; + } + + if (buf_page_is_corrupted( + true, tmp_page, cursor->zip_size, space)) { + goto corrupted; + } + + } else if (page_type == FIL_PAGE_PAGE_COMPRESSED) { + memcpy(tmp_page, page, cursor->page_size); +page_decomp: + ulint decomp = fil_page_decompress(tmp_frame, tmp_page); + + if (!decomp + || (decomp != srv_page_size && cursor->zip_size) + || buf_page_is_corrupted( + true, tmp_page, cursor->zip_size, space)) { + goto corrupted; + } + } else if (buf_page_is_corrupted(true, page, cursor->zip_size, space)) { corrupted: diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.opt b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt new file mode 100644 index 00000000000..e5a02a1a1c9 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.opt @@ -0,0 +1,6 @@ +--innodb-encryption-rotate-key-age=2 +--innodb-encryption-threads=4 +--innodb-tablespaces-encryption +--plugin-load-add=$FILE_KEY_MANAGEMENT_SO +--loose-file-key-management +--loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/logkey.txt diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.result b/mysql-test/suite/mariabackup/encrypted_page_compressed.result new file mode 100644 index 00000000000..92ad84fc04a --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.result @@ -0,0 +1,6 @@ +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); +# Corrupt the table +# xtrabackup backup +FOUND /Database page corruption detected/ in backup.log +drop table t1; diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.test b/mysql-test/suite/mariabackup/encrypted_page_compressed.test new file mode 100644 index 00000000000..eaca762d459 --- /dev/null +++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.test @@ -0,0 +1,47 @@ +source include/have_file_key_management.inc; +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes encrypted=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); + +let $MYSQLD_DATADIR=`select @@datadir`; +let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; + +--source include/shutdown_mysqld.inc + +--echo # Corrupt the table + +perl; +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); + +my $ibd_file = $ENV{'t1_IBD'}; + +my $chunk; +my $page_size = $ENV{'INNODB_PAGE_SIZE'}; + +sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; +sysseek IBD_FILE, $page_size * 3 + 75, SEEK_CUR; +$chunk = '\xAA\xAA\xAA\xAA'; +syswrite IBD_FILE, $chunk, 4; + +close IBD_FILE; +EOF + +--source include/start_mysqld.inc + +echo # xtrabackup backup; +--disable_result_log +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + +drop table t1; +rmdir $targetdir; diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.result b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result new file mode 100644 index 00000000000..b4cb27d307b --- /dev/null +++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.result @@ -0,0 +1,6 @@ +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); +# Corrupt the table +# xtrabackup backup +FOUND /Database page corruption detected/ in backup.log +drop table t1; diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test new file mode 100644 index 00000000000..48df75bc5c2 --- /dev/null +++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test @@ -0,0 +1,46 @@ +CREATE TABLE t1 (a INT AUTO_INCREMENT PRIMARY KEY, b TEXT, c char(200)) ENGINE=InnoDB page_compressed=yes; +insert into t1(b, c) values("mariadb", "mariabackup"); + +let $MYSQLD_DATADIR=`select @@datadir`; +let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; + +--source include/shutdown_mysqld.inc + +--echo # Corrupt the table + +perl; +use strict; +use warnings; +use Fcntl qw(:DEFAULT :seek); + +my $ibd_file = $ENV{'t1_IBD'}; + +my $chunk; +my $page_size = $ENV{'INNODB_PAGE_SIZE'}; + +sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; +sysseek IBD_FILE, 16384 * 3 + 75, SEEK_CUR; +$chunk = '\xAA\xAA\xAA\xAA'; +syswrite IBD_FILE, $chunk, 4; + +close IBD_FILE; +EOF + +--source include/start_mysqld.inc + +echo # xtrabackup backup; +--disable_result_log +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; +--error 1 +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +--enable_result_log + +--let SEARCH_PATTERN=Database page corruption detected +--let SEARCH_FILE=$backuplog +--source include/search_pattern_in_file.inc +remove_file $backuplog; + +drop table t1; +rmdir $targetdir; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 11661cf2c40..af68f894aca 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -452,6 +452,8 @@ decompress_with_slot: decrypt. */ if (!fil_space_verify_crypt_checksum( dst_frame, buf_page_get_zip_size(bpage))) { + +decrypt_failed: ib_logf(IB_LOG_LEVEL_ERROR, "Encrypted page %u:%u in file %s" " looks corrupted; key_version=" ULINTPF, @@ -460,7 +462,7 @@ decompress_with_slot: mach_read_from_4( FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + dst_frame)); -decrypt_failed: + /* Mark page encrypted in case it should be. */ if (space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) { @@ -4769,7 +4771,6 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) not anymore encrypted. */ corrupted = buf_page_is_corrupted(true, dst_frame, zip_size, space); - if (!corrupted) { bpage->encrypted = false; } else { From b0fd06a6f27212cee770961171439a44626d8f14 Mon Sep 17 00:00:00 2001 From: Sergey Vojtovich Date: Tue, 18 Dec 2018 17:07:29 +0400 Subject: [PATCH 10/72] MDEV-15670 - unit.my_atomic failed in buildbot with Signal 11 thrown Workaround glibc bug: https://sourceware.org/bugzilla/show_bug.cgi?id=20116 by making unittest threads joinable. It makes code better anyway. --- unittest/mysys/lf-t.c | 5 ----- unittest/mysys/my_atomic-t.c | 17 +--------------- unittest/mysys/thr_template.c | 31 +++++++++--------------------- unittest/mysys/waiting_threads-t.c | 4 +--- 4 files changed, 11 insertions(+), 46 deletions(-) diff --git a/unittest/mysys/lf-t.c b/unittest/mysys/lf-t.c index 573a56cc1d6..c1c89f60864 100644 --- a/unittest/mysys/lf-t.c +++ b/unittest/mysys/lf-t.c @@ -48,9 +48,6 @@ pthread_handler_t test_lf_pinbox(void *arg) pins= lf_pinbox_get_pins(&lf_allocator.pinbox); } lf_pinbox_put_pins(pins); - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); if (with_my_thread_init) my_thread_end(); @@ -105,7 +102,6 @@ pthread_handler_t test_lf_alloc(void *arg) bad|= lf_allocator.mallocs - lf_alloc_pool_count(&lf_allocator); #endif } - if (!--running_threads) pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); if (with_my_thread_init) @@ -159,7 +155,6 @@ pthread_handler_t test_lf_hash(void *arg) lf_hash.size, inserts); bad|= lf_hash.count; } - if (!--running_threads) pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); if (with_my_thread_init) my_thread_end(); diff --git a/unittest/mysys/my_atomic-t.c b/unittest/mysys/my_atomic-t.c index 35e782eb360..5eb988e2e15 100644 --- a/unittest/mysys/my_atomic-t.c +++ b/unittest/mysys/my_atomic-t.c @@ -35,9 +35,6 @@ pthread_handler_t test_atomic_add(void *arg) my_atomic_add32(&bad, -x); my_atomic_rwlock_wrunlock(&rwl); } - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); return 0; } @@ -58,13 +55,6 @@ pthread_handler_t test_atomic_add64(void *arg) my_atomic_add64(&a64, -x); my_atomic_rwlock_wrunlock(&rwl); } - pthread_mutex_lock(&mutex); - if (!--running_threads) - { - bad= (a64 != 0); - pthread_cond_signal(&cond); - } - pthread_mutex_unlock(&mutex); return 0; } @@ -108,9 +98,6 @@ pthread_handler_t test_atomic_fas(void *arg) my_atomic_add32(&bad, -x); my_atomic_rwlock_wrunlock(&rwl); - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); return 0; } @@ -140,9 +127,6 @@ pthread_handler_t test_atomic_cas(void *arg) my_atomic_rwlock_wrunlock(&rwl); } while (!ok) ; } - pthread_mutex_lock(&mutex); - if (!--running_threads) pthread_cond_signal(&cond); - pthread_mutex_unlock(&mutex); return 0; } @@ -178,6 +162,7 @@ void do_tests() } a64=0; test_concurrently("my_atomic_add64", test_atomic_add64, THREADS, CYCLES); + bad= (a64 != 0); my_atomic_rwlock_destroy(&rwl); } diff --git a/unittest/mysys/thr_template.c b/unittest/mysys/thr_template.c index 7304eb50955..d1bc0868ca0 100644 --- a/unittest/mysys/thr_template.c +++ b/unittest/mysys/thr_template.c @@ -20,35 +20,34 @@ #include volatile uint32 bad; -pthread_attr_t thr_attr; pthread_mutex_t mutex; -pthread_cond_t cond; -uint running_threads; void do_tests(); void test_concurrently(const char *test, pthread_handler handler, int n, int m) { - pthread_t t; + pthread_t *threads= malloc(n * sizeof(pthread_t)); + int i; ulonglong now= my_interval_timer(); + assert(threads); bad= 0; diag("Testing %s with %d threads, %d iterations... ", test, n, m); - for (running_threads= n ; n ; n--) + for (i= n; i; i--) { - if (pthread_create(&t, &thr_attr, handler, &m) != 0) + if (pthread_create(&threads[i], 0, handler, &m) != 0) { diag("Could not create thread"); abort(); } } - pthread_mutex_lock(&mutex); - while (running_threads) - pthread_cond_wait(&cond, &mutex); - pthread_mutex_unlock(&mutex); + + for (i= n; i; i--) + pthread_join(threads[i], 0); now= my_interval_timer() - now; + free(threads); ok(!bad, "tested %s in %g secs (%d)", test, ((double)now)/1e9, bad); } @@ -60,9 +59,6 @@ int main(int argc __attribute__((unused)), char **argv) DBUG_SET_INITIAL(argv[1]); pthread_mutex_init(&mutex, 0); - pthread_cond_init(&cond, 0); - pthread_attr_init(&thr_attr); - pthread_attr_setdetachstate(&thr_attr,PTHREAD_CREATE_DETACHED); #ifdef MY_ATOMIC_MODE_RWLOCKS #if defined(HPUX11) || defined(__POWERPC__) /* showed to be very slow (scheduler-related) */ @@ -79,16 +75,7 @@ int main(int argc __attribute__((unused)), char **argv) do_tests(); - /* - workaround until we know why it crashes randomly on some machine - (BUG#22320). - */ -#ifdef NOT_USED - sleep(2); -#endif pthread_mutex_destroy(&mutex); - pthread_cond_destroy(&cond); - pthread_attr_destroy(&thr_attr); my_end(0); return exit_status(); } diff --git a/unittest/mysys/waiting_threads-t.c b/unittest/mysys/waiting_threads-t.c index 35e86aca319..eca6ba408c3 100644 --- a/unittest/mysys/waiting_threads-t.c +++ b/unittest/mysys/waiting_threads-t.c @@ -136,10 +136,8 @@ retry: pthread_mutex_unlock(&lock); pthread_mutex_unlock(& thds[id].lock); wt_thd_destroy(& thds[id].thd); - - if (!--running_threads) /* now, signal when everybody is done with deinit */ - pthread_cond_signal(&cond); pthread_mutex_unlock(&mutex); + DBUG_PRINT("wt", ("exiting")); my_thread_end(); return 0; From 1b471face8110b205b9bfb460c839127bc6862dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Tue, 18 Dec 2018 16:24:52 +0200 Subject: [PATCH 11/72] MDEV-18025: Apply the fix to XtraDB and adjust tests The fix was accidentally only applied to InnoDB, and encryption tests were not adjusted. --- mysql-test/suite/encryption/r/innodb-bad-key-change.result | 1 + .../suite/encryption/r/innodb-encryption-disable.result | 1 + mysql-test/suite/encryption/r/innodb-missing-key.result | 1 + mysql-test/suite/encryption/t/innodb-bad-key-change.test | 1 + mysql-test/suite/encryption/t/innodb-encryption-disable.test | 1 + mysql-test/suite/encryption/t/innodb-missing-key.test | 1 + storage/xtradb/buf/buf0buf.cc | 5 +++-- 7 files changed, 9 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index 51fc7a8cbc4..481dbcb285d 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -1,6 +1,7 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("mysqld: File .*keysbad3.txt' not found "); # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result index 4d15098d936..6b6aee2c7e3 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[15].ibd looks corrupted; key_version=1"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management*"); create table t5 ( `intcol1` int(32) DEFAULT NULL, diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 53ca0845c25..45a01f03c2b 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,4 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1"); # Start server with keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 9d61770f543..46a6d2fa27f 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -11,6 +11,7 @@ call mtr.add_suppression("Plugin 'file_key_management' init function returned error"); call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[0-9]+\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("mysqld: File .*keysbad3.txt' not found "); diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test index 6ade8d6e3b2..4e6147f7745 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test @@ -8,6 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[15].ibd looks corrupted; key_version=1"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management*"); diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index 6ea0528825b..c68604fdcf5 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -8,6 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1"); --echo --echo # Start server with keys2.txt diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index f23e51fb00a..85b337f641a 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -482,6 +482,8 @@ decompress_with_slot: decrypt. */ if (!fil_space_verify_crypt_checksum( dst_frame, buf_page_get_zip_size(bpage))) { + +decrypt_failed: ib_logf(IB_LOG_LEVEL_ERROR, "Encrypted page %u:%u in file %s" " looks corrupted; key_version=" ULINTPF, @@ -490,7 +492,7 @@ decompress_with_slot: mach_read_from_4( FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + dst_frame)); -decrypt_failed: + /* Mark page encrypted in case it should be. */ if (space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) { @@ -4794,7 +4796,6 @@ static dberr_t buf_page_check_corrupt(buf_page_t* bpage, fil_space_t* space) not anymore encrypted. */ corrupted = buf_page_is_corrupted(true, dst_frame, zip_size, space); - if (!corrupted) { bpage->encrypted = false; } else { From 74659e55b7dffcdbb7f8b2cac4ccea92dacebd70 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 18 Dec 2018 17:31:52 +0100 Subject: [PATCH 12/72] MDEV-16268 : sporadic checksum mismatch when opening system tablespace in backup Attempt to fix by retrying srv_sys_space.open_or_create() if it reports corruption. --- extra/mariabackup/xtrabackup.cc | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index fe768696170..cbd5a72aa34 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -3362,8 +3362,15 @@ xb_load_tablespaces() return(DB_ERROR); } - err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes, - &flush_lsn); + for (int i= 0; i < 10; i++) { + err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes, + &flush_lsn); + if (err == DB_PAGE_CORRUPTED || err == DB_CORRUPTION) { + my_sleep(1000); + } + else + break; + } if (err != DB_SUCCESS) { msg("mariabackup: Could not open data files.\n"); From 0c2fc9b3da467132cba7fd3a9d92995c98057f06 Mon Sep 17 00:00:00 2001 From: Ian Gilfillan Date: Mon, 3 Dec 2018 13:54:32 +0200 Subject: [PATCH 13/72] Update InnoDB urls --- storage/innobase/buf/buf0buf.cc | 2 +- storage/innobase/gis/gis0sea.cc | 2 +- storage/innobase/handler/ha_innodb.cc | 4 ++-- storage/innobase/ut/ut0dbg.cc | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 02568142e7a..8dc2fd20dbe 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -4391,7 +4391,7 @@ loop: << ". The most probable cause" " of this error may be that the" " table has been corrupted." - " See https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/"; + " See https://mariadb.com/kb/en/library/innodb-recovery-modes/"; } #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index 5f8657238b0..cdddc346c77 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -773,7 +773,7 @@ rtr_page_get_father_node_ptr( error << ". You should dump + drop + reimport the table to" " fix the corruption. If the crash happens at" " database startup, see " - "https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/" + "https://mariadb.com/kb/en/library/innodb-recovery-modes/" " about forcing" " recovery. Then dump + drop + reimport."; } diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 319d6faedda..52940eb2f76 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -22070,7 +22070,7 @@ const char* BUG_REPORT_MSG = const char* FORCE_RECOVERY_MSG = "Please refer to " - "https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/" + "https://mariadb.com/kb/en/library/innodb-recovery-modes/" " for information about forcing recovery."; const char* ERROR_CREATING_MSG = @@ -22088,7 +22088,7 @@ const char* SET_TRANSACTION_MSG = "Please refer to https://mariadb.com/kb/en/library/set-transaction/"; const char* INNODB_PARAMETERS_MSG = - "Please refer to https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/"; + "Please refer to https://mariadb.com/kb/en/library/innodb-system-variables/"; /********************************************************************** Converts an identifier from my_charset_filename to UTF-8 charset. diff --git a/storage/innobase/ut/ut0dbg.cc b/storage/innobase/ut/ut0dbg.cc index 56a2eb80337..05b27060a9b 100644 --- a/storage/innobase/ut/ut0dbg.cc +++ b/storage/innobase/ut/ut0dbg.cc @@ -52,7 +52,7 @@ ut_dbg_assertion_failed( " or crashes, even\n" "InnoDB: immediately after the mysqld startup, there may be\n" "InnoDB: corruption in the InnoDB tablespace. Please refer to\n" - "InnoDB: https://mariadb.com/kb/en/library/xtradbinnodb-recovery-modes/\n" + "InnoDB: https://mariadb.com/kb/en/library/innodb-recovery-modes/\n" "InnoDB: about forcing recovery.\n", stderr); fflush(stderr); From da4efd56aa9bc3c39d94a73eb216ca7f559ce734 Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 19 Dec 2018 10:38:29 +0530 Subject: [PATCH 14/72] Backported MDEV-11196(e4d10e09cf31) and MDEV-10360(8a8ba1949bf4) to 10.0 --- mysql-test/r/innodb_ext_key.result | 95 ++++++++++++++++++++++++++ mysql-test/t/innodb_ext_key.test | 106 +++++++++++++++++++++++++++++ sql/table.cc | 48 +++++++++++-- 3 files changed, 244 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/innodb_ext_key.result b/mysql-test/r/innodb_ext_key.result index 2b3b98eb26a..600269ba433 100644 --- a/mysql-test/r/innodb_ext_key.result +++ b/mysql-test/r/innodb_ext_key.result @@ -1068,5 +1068,100 @@ a 1 drop table t1, t2; set optimizer_switch=@save_optimizer_switch; +# +# MDEV-10360: Extended keys: index properties depend on index order +# +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 ( +index_id bigint(20) unsigned NOT NULL, +index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , +index_object_id int(10) unsigned NOT NULL DEFAULT '0' , +index_date_updated int(10) unsigned DEFAULT NULL , +PRIMARY KEY (index_id), +KEY object (index_class(181),index_object_id), +KEY index_date_updated (index_date_updated) +) engine=innodb; +create table t2 ( +index_id bigint(20) unsigned NOT NULL, +index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , +index_object_id int(10) unsigned NOT NULL DEFAULT '0' , +index_date_updated int(10) unsigned DEFAULT NULL , +PRIMARY KEY (index_id), +KEY index_date_updated (index_date_updated), +KEY object (index_class(181),index_object_id) +) engine=innodb; +insert into t1 select +@a:=A.a + 10*B.a + 100*C.a, +concat('val-', @a), +123456, +A.a + 10*B.a +from +t0 A, t0 B, t0 C; +insert into t2 select * from t1; +# This must have the same query plan as the query below it: +# type=range, key=index_date_updated, key_len=13 +explain +select * from t1 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range index_date_updated index_date_updated 13 NULL # Using index condition +# This used to work from the start: +explain +select * from t2 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t2 range index_date_updated index_date_updated 13 NULL # Using index condition +drop table t0,t1,t2; +# +# MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff' +# was corrupted, server crashes in opt_sum_query +set @save_innodb_file_format= @@innodb_file_format; +set @save_innodb_large_prefix= @@innodb_large_prefix; +set global innodb_file_format = BARRACUDA; +set global innodb_large_prefix = ON; +CREATE TABLE t1 ( +pk INT, +f1 VARCHAR(3), +f2 VARCHAR(1024), +PRIMARY KEY (pk), +KEY(f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; +INSERT INTO t1 VALUES (1,'foo','abc'),(2,'bar','def'); +SELECT MAX(t2.pk) FROM t1 t2 INNER JOIN t1 t3 ON t2.f1 = t3.f1 WHERE t2.pk <= 4; +MAX(t2.pk) +2 +drop table t1; +CREATE TABLE t1 ( +pk1 INT, +pk2 INT, +f1 VARCHAR(3), +f2 VARCHAR(1021), +PRIMARY KEY (pk1,pk2), +KEY(f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; +INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); +explain +select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range f2 f2 3070 NULL 1 Using index condition; Using where +drop table t1; +CREATE TABLE t1 ( +f2 INT, +pk2 INT, +f1 VARCHAR(3), +pk1 VARCHAR(1000), +PRIMARY KEY (pk1,pk2), +KEY k1(pk1,f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; +INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); +explain +select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 range k1 k1 3011 NULL 1 Using index condition; Using where +drop table t1; +set optimizer_switch=@save_ext_key_optimizer_switch; +set global innodb_file_format = @save_innodb_file_format; +set global innodb_large_prefix = @save_innodb_large_prefix; set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/t/innodb_ext_key.test b/mysql-test/t/innodb_ext_key.test index 9f3a89ff948..d53deb46348 100644 --- a/mysql-test/t/innodb_ext_key.test +++ b/mysql-test/t/innodb_ext_key.test @@ -693,5 +693,111 @@ drop table t1, t2; set optimizer_switch=@save_optimizer_switch; +--echo # +--echo # MDEV-10360: Extended keys: index properties depend on index order +--echo # +create table t0 (a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1 ( + index_id bigint(20) unsigned NOT NULL, + index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , + index_object_id int(10) unsigned NOT NULL DEFAULT '0' , + index_date_updated int(10) unsigned DEFAULT NULL , + + PRIMARY KEY (index_id), + KEY object (index_class(181),index_object_id), + KEY index_date_updated (index_date_updated) +) engine=innodb; + +create table t2 ( + index_id bigint(20) unsigned NOT NULL, + index_class varchar(265) COLLATE latin1_general_ci DEFAULT NULL , + index_object_id int(10) unsigned NOT NULL DEFAULT '0' , + index_date_updated int(10) unsigned DEFAULT NULL , + + PRIMARY KEY (index_id), + KEY index_date_updated (index_date_updated), + KEY object (index_class(181),index_object_id) +) engine=innodb; + +insert into t1 select + @a:=A.a + 10*B.a + 100*C.a, + concat('val-', @a), + 123456, + A.a + 10*B.a +from + t0 A, t0 B, t0 C; + +insert into t2 select * from t1; + +--echo # This must have the same query plan as the query below it: +--echo # type=range, key=index_date_updated, key_len=13 +--replace_column 9 # +explain +select * from t1 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; + +--echo # This used to work from the start: +--replace_column 9 # +explain +select * from t2 force index(index_date_updated) +where index_date_updated= 10 and index_id < 800; + +drop table t0,t1,t2; + + +--echo # +--echo # MDEV-11196: Error:Run-Time Check Failure #2 - Stack around the variable 'key_buff' +--echo # was corrupted, server crashes in opt_sum_query + +set @save_innodb_file_format= @@innodb_file_format; +set @save_innodb_large_prefix= @@innodb_large_prefix; +set global innodb_file_format = BARRACUDA; +set global innodb_large_prefix = ON; + +CREATE TABLE t1 ( + pk INT, + f1 VARCHAR(3), + f2 VARCHAR(1024), + PRIMARY KEY (pk), + KEY(f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; + +INSERT INTO t1 VALUES (1,'foo','abc'),(2,'bar','def'); +SELECT MAX(t2.pk) FROM t1 t2 INNER JOIN t1 t3 ON t2.f1 = t3.f1 WHERE t2.pk <= 4; +drop table t1; + +CREATE TABLE t1 ( + pk1 INT, + pk2 INT, + f1 VARCHAR(3), + f2 VARCHAR(1021), + PRIMARY KEY (pk1,pk2), + KEY(f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; + +INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); +explain +select * from t1 force index(f2) where pk1 <= 5 and pk2 <=5 and f2 = 'abc' and f1 <= '3'; +drop table t1; + +CREATE TABLE t1 ( +f2 INT, +pk2 INT, +f1 VARCHAR(3), +pk1 VARCHAR(1000), +PRIMARY KEY (pk1,pk2), +KEY k1(pk1,f2) +) ENGINE=InnoDB CHARSET utf8 ROW_FORMAT= DYNAMIC; +INSERT INTO t1 VALUES (1,2,'2','abc'),(2,3,'3','def'); +explain +select * from t1 force index(k1) where f2 <= 5 and pk2 <=5 and pk1 = 'abc' and f1 <= '3'; +drop table t1; + +set optimizer_switch=@save_ext_key_optimizer_switch; +set global innodb_file_format = @save_innodb_file_format; +set global innodb_large_prefix = @save_innodb_large_prefix; + set optimizer_switch=@save_ext_key_optimizer_switch; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/sql/table.cc b/sql/table.cc index 98bf6d8b4dd..5a34d47367a 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1690,6 +1690,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, keyinfo= share->key_info; uint primary_key= my_strcasecmp(system_charset_info, share->keynames.type_names[0], primary_key_name) ? MAX_KEY : 0; + KEY* key_first_info= NULL; if (primary_key >= MAX_KEY && keyinfo->flags & HA_NOSAME) { @@ -1769,34 +1770,71 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, keyinfo->name_length+1); } + if (!key) + key_first_info= keyinfo; + if (ext_key_parts > share->key_parts && key) { KEY_PART_INFO *new_key_part= (keyinfo-1)->key_part + (keyinfo-1)->ext_key_parts; + uint add_keyparts_for_this_key= add_first_key_parts; + uint length_bytes= 0, len_null_byte= 0, ext_key_length= 0; + Field *field; /* Do not extend the key that contains a component defined over the beginning of a field. */ for (i= 0; i < keyinfo->user_defined_key_parts; i++) - { + { uint fieldnr= keyinfo->key_part[i].fieldnr; + field= share->field[keyinfo->key_part[i].fieldnr-1]; + + if (field->null_ptr) + len_null_byte= HA_KEY_NULL_LENGTH; + + if (field->type() == MYSQL_TYPE_BLOB || + field->real_type() == MYSQL_TYPE_VARCHAR || + field->type() == MYSQL_TYPE_GEOMETRY) + { + length_bytes= HA_KEY_BLOB_LENGTH; + } + ext_key_length+= keyinfo->key_part[i].length + len_null_byte + + length_bytes; if (share->field[fieldnr-1]->key_length() != keyinfo->key_part[i].length) { - add_first_key_parts= 0; + add_keyparts_for_this_key= 0; break; } } - if (add_first_key_parts < keyinfo->ext_key_parts-keyinfo->user_defined_key_parts) - { + if (add_keyparts_for_this_key) + { + for (i= 0; i < add_keyparts_for_this_key; i++) + { + uint pk_part_length= key_first_info->key_part[i].store_length; + if (keyinfo->ext_key_part_map & 1< MAX_KEY_LENGTH) + { + add_keyparts_for_this_key= i; + break; + } + ext_key_length+= pk_part_length; + } + } + } + + if (add_keyparts_for_this_key < keyinfo->ext_key_parts - + keyinfo->user_defined_key_parts) + { share->ext_key_parts-= keyinfo->ext_key_parts; key_part_map ext_key_part_map= keyinfo->ext_key_part_map; keyinfo->ext_key_parts= keyinfo->user_defined_key_parts; keyinfo->ext_key_flags= keyinfo->flags; keyinfo->ext_key_part_map= 0; - for (i= 0; i < add_first_key_parts; i++) + for (i= 0; i < add_keyparts_for_this_key; i++) { if (ext_key_part_map & 1< Date: Wed, 19 Dec 2018 10:34:30 +0530 Subject: [PATCH 15/72] MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field Create a new constant MAX_DATA_LENGTH_FOR_KEY. Replace the value of MAX_KEY_LENGTH to also include the LENGTH and NULL BYTES of a field. --- mysql-test/r/func_group_innodb.result | 30 +++++++++++++++++++++++++++ mysql-test/t/func_group_innodb.test | 26 +++++++++++++++++++++++ sql/handler.h | 12 ++++++++--- sql/partition_info.cc | 4 ++-- sql/sql_const.h | 12 ++++++++++- sql/table.cc | 2 +- 6 files changed, 79 insertions(+), 7 deletions(-) diff --git a/mysql-test/r/func_group_innodb.result b/mysql-test/r/func_group_innodb.result index 52d5922df95..17b3c1e797e 100644 --- a/mysql-test/r/func_group_innodb.result +++ b/mysql-test/r/func_group_innodb.result @@ -246,4 +246,34 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by DROP TABLE t1; +# +# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +# +set @save_innodb_file_format= @@innodb_file_format; +set @save_innodb_large_prefix= @@innodb_large_prefix; +set global innodb_file_format = BARRACUDA; +set global innodb_large_prefix = ON; +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), +KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +MIN(t1.v1) +king +drop table t1; +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +MIN(x.v1) +NULL +drop table t1; +set global innodb_file_format = @save_innodb_file_format; +set global innodb_large_prefix = @save_innodb_large_prefix; End of 5.5 tests diff --git a/mysql-test/t/func_group_innodb.test b/mysql-test/t/func_group_innodb.test index c62d3d08496..a65d2326d0f 100644 --- a/mysql-test/t/func_group_innodb.test +++ b/mysql-test/t/func_group_innodb.test @@ -192,4 +192,30 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; DROP TABLE t1; +--echo # +--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +--echo # + +set @save_innodb_file_format= @@innodb_file_format; +set @save_innodb_large_prefix= @@innodb_large_prefix; +set global innodb_file_format = BARRACUDA; +set global innodb_large_prefix = ON; + +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +drop table t1; + +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +drop table t1; +set global innodb_file_format = @save_innodb_file_format; +set global innodb_large_prefix = @save_innodb_large_prefix; + --echo End of 5.5 tests diff --git a/sql/handler.h b/sql/handler.h index 52396b84c0d..606adade679 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -384,6 +384,12 @@ enum enum_alter_inplace_result { #define HA_KEY_NULL_LENGTH 1 #define HA_KEY_BLOB_LENGTH 2 +/* Maximum length of any index lookup key, in bytes */ + +#define MAX_KEY_LENGTH (MAX_DATA_LENGTH_FOR_KEY \ + +(MAX_REF_PARTS \ + *(HA_KEY_NULL_LENGTH + HA_KEY_BLOB_LENGTH))) + #define HA_LEX_CREATE_TMP_TABLE 1 #define HA_LEX_CREATE_IF_NOT_EXISTS 2 #define HA_LEX_CREATE_TABLE_LIKE 4 @@ -3233,14 +3239,14 @@ public: uint max_key_parts() const { return MY_MIN(MAX_REF_PARTS, max_supported_key_parts()); } uint max_key_length() const - { return MY_MIN(MAX_KEY_LENGTH, max_supported_key_length()); } + { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_length()); } uint max_key_part_length() const - { return MY_MIN(MAX_KEY_LENGTH, max_supported_key_part_length()); } + { return MY_MIN(MAX_DATA_LENGTH_FOR_KEY, max_supported_key_part_length()); } virtual uint max_supported_record_length() const { return HA_MAX_REC_LENGTH; } virtual uint max_supported_keys() const { return 0; } virtual uint max_supported_key_parts() const { return MAX_REF_PARTS; } - virtual uint max_supported_key_length() const { return MAX_KEY_LENGTH; } + virtual uint max_supported_key_length() const { return MAX_DATA_LENGTH_FOR_KEY; } virtual uint max_supported_key_part_length() const { return 255; } virtual uint min_record_length(uint options) const { return 1; } diff --git a/sql/partition_info.cc b/sql/partition_info.cc index e6a30c8a7f0..7106e741331 100644 --- a/sql/partition_info.cc +++ b/sql/partition_info.cc @@ -1990,12 +1990,12 @@ bool partition_info::check_partition_field_length() for (i= 0; i < num_part_fields; i++) store_length+= get_partition_field_store_length(part_field_array[i]); - if (store_length > MAX_KEY_LENGTH) + if (store_length > MAX_DATA_LENGTH_FOR_KEY) DBUG_RETURN(TRUE); store_length= 0; for (i= 0; i < num_subpart_fields; i++) store_length+= get_partition_field_store_length(subpart_field_array[i]); - if (store_length > MAX_KEY_LENGTH) + if (store_length > MAX_DATA_LENGTH_FOR_KEY) DBUG_RETURN(TRUE); DBUG_RETURN(FALSE); } diff --git a/sql/sql_const.h b/sql/sql_const.h index c37d8dd68f7..c0b343c6ca4 100644 --- a/sql/sql_const.h +++ b/sql/sql_const.h @@ -33,7 +33,17 @@ #define MAX_SYS_VAR_LENGTH 32 #define MAX_KEY MAX_INDEXES /* Max used keys */ #define MAX_REF_PARTS 32 /* Max parts used as ref */ -#define MAX_KEY_LENGTH 3072 /* max possible key */ + +/* + Maximum length of the data part of an index lookup key. + + The "data part" is defined as the value itself, not including the + NULL-indicator bytes or varchar length bytes ("the Extras"). We need this + value because there was a bug where length of the Extras were not counted. + + You probably need MAX_KEY_LENGTH, not this constant. +*/ +#define MAX_DATA_LENGTH_FOR_KEY 3072 #if SIZEOF_OFF_T > 4 #define MAX_REFLENGTH 8 /* Max length for record ref */ #else diff --git a/sql/table.cc b/sql/table.cc index 5a34d47367a..ded79de0e83 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1816,7 +1816,7 @@ int TABLE_SHARE::init_from_binary_frm_image(THD *thd, bool write, uint pk_part_length= key_first_info->key_part[i].store_length; if (keyinfo->ext_key_part_map & 1< MAX_KEY_LENGTH) + if (ext_key_length + pk_part_length > MAX_DATA_LENGTH_FOR_KEY) { add_keyparts_for_this_key= i; break; From 82a4d55d5c569a9adfbd863c928bd357c2e5afed Mon Sep 17 00:00:00 2001 From: Varun Gupta Date: Wed, 19 Dec 2018 18:57:14 +0530 Subject: [PATCH 16/72] MDEV-15424: Unreasonable SQL Error (1356) on select from view While printing a view containing a window function we were printing it as an Item_field object instead of an Item_window_func object. This is incorrect and this leads to us throwing an error ER_VIEW_INVALID. Fixed by adjusting the Item_ref:print function. Also made UDF function aware if there arguments have window function. --- mysql-test/r/udf.result | 14 ++++++++++++++ mysql-test/r/win.result | 18 ++++++++++++++++++ mysql-test/t/udf.test | 13 +++++++++++++ mysql-test/t/win.test | 13 +++++++++++++ sql/item.cc | 4 +++- sql/item_func.cc | 2 ++ 6 files changed, 63 insertions(+), 1 deletion(-) diff --git a/mysql-test/r/udf.result b/mysql-test/r/udf.result index 98aa2b50fc6..3a84caa828a 100644 --- a/mysql-test/r/udf.result +++ b/mysql-test/r/udf.result @@ -465,3 +465,17 @@ a b Hello HL DROP FUNCTION METAPHON; DROP TABLE t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +myfunc_int(max(a) over (order by b) , b) +154 +399 +drop view v1; +drop function myfunc_int; +drop table t1; diff --git a/mysql-test/r/win.result b/mysql-test/r/win.result index e902d62326e..2e80c2c961b 100644 --- a/mysql-test/r/win.result +++ b/mysql-test/r/win.result @@ -3470,3 +3470,21 @@ SELECT DISTINCT MIN(b1) OVER () FROM t1; MIN(b1) OVER () 1 drop table t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 4 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +select * from v1; +ifnull(max(n1) over (partition by n1),'aaa') +1 +1 +2 +4 +drop table t1; +drop view v1; diff --git a/mysql-test/t/udf.test b/mysql-test/t/udf.test index 42a813b0782..881e753de7d 100644 --- a/mysql-test/t/udf.test +++ b/mysql-test/t/udf.test @@ -528,3 +528,16 @@ DROP FUNCTION METAPHON; #INSERT INTO t1 (a) VALUES ('Hello'); #SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +drop view v1; +drop function myfunc_int; +drop table t1; diff --git a/mysql-test/t/win.test b/mysql-test/t/win.test index b0e1a16fae6..18bdfa31691 100644 --- a/mysql-test/t/win.test +++ b/mysql-test/t/win.test @@ -2227,3 +2227,16 @@ EXPLAIN SELECT DISTINCT MIN(b1) OVER () FROM t1; SELECT DISTINCT MIN(b1) OVER () FROM t1; drop table t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); + +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +select * from v1; +drop table t1; +drop view v1; diff --git a/sql/item.cc b/sql/item.cc index 1c0b6cc4043..761c9fbec3d 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -7815,7 +7815,9 @@ void Item_ref::print(String *str, enum_query_type query_type) { if (ref) { - if ((*ref)->type() != Item::CACHE_ITEM && ref_type() != VIEW_REF && + if ((*ref)->type() != Item::CACHE_ITEM && + (*ref)->type() != Item::WINDOW_FUNC_ITEM && + ref_type() != VIEW_REF && !table_name && name && alias_name_used) { THD *thd= current_thd; diff --git a/sql/item_func.cc b/sql/item_func.cc index 512c8fccab0..89ca25bbfd4 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -3484,6 +3484,8 @@ udf_handler::fix_fields(THD *thd, Item_func_or_sum *func, if (item->maybe_null) func->maybe_null=1; func->with_sum_func= func->with_sum_func || item->with_sum_func; + func->with_window_func= func->with_window_func || + item->with_window_func; func->with_field= func->with_field || item->with_field; func->with_param= func->with_param || item->with_param; func->with_subselect|= item->with_subselect; From dd72d7d561d36c2d1f5d3ccad2b388d886230392 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 19 Dec 2018 15:45:35 +0200 Subject: [PATCH 17/72] MDEV-18025: Improve test case and consistency checks Write a test case that computes valid crc32 checksums for an encrypted page, but zeroes out the payload area, so that the checksum after decryption fails. xb_fil_cur_read(): Validate the page number before trying any checksum calculation or decrypting or decompression. Also, skip zero-filled pages. For page_compressed pages, ensure that the FIL_PAGE_TYPE was changed. Also, reject FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED if no decryption was attempted. --- extra/mariabackup/fil_cur.cc | 38 ++++++++++++---- mysql-test/suite/innodb/include/crc32.pl | 33 ++++++++++++++ .../encrypted_page_corruption.result | 2 +- .../encrypted_page_corruption.test | 43 ++++++++++++++----- 4 files changed, 97 insertions(+), 19 deletions(-) create mode 100644 mysql-test/suite/innodb/include/crc32.pl diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index b677e9973b7..637acfd2e22 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -353,6 +353,27 @@ read_retry: && page_no >= FSP_EXTENT_SIZE && page_no < FSP_EXTENT_SIZE * 3) { /* We ignore the doublewrite buffer pages */ + } else if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no + && space->id != TRX_SYS_SPACE) { + /* On pages that are not all zero, the + page number must match. + + There may be a mismatch on tablespace ID, + because files may be renamed during backup. + We disable the page number check + on the system tablespace, because it may consist + of multiple files, and here we count the pages + from the start of each file.) + + The first 38 and last 8 bytes are never encrypted. */ + const ulint* p = reinterpret_cast(page); + const ulint* const end = reinterpret_cast( + page + cursor->page_size); + do { + if (*p++) { + goto corrupted; + } + } while (p != end); } else if (mach_read_from_4( page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) @@ -361,9 +382,6 @@ read_retry: != CRYPT_SCHEME_UNENCRYPTED && fil_space_verify_crypt_checksum( page, cursor->zip_size)) { - ut_ad(mach_read_from_4(page + FIL_PAGE_SPACE_ID) - == space->id); - bool decrypted = false; memcpy(tmp_page, page, cursor->page_size); @@ -381,21 +399,25 @@ read_retry: true, tmp_page, cursor->zip_size, space)) { goto corrupted; } - } else if (page_type == FIL_PAGE_PAGE_COMPRESSED) { memcpy(tmp_page, page, cursor->page_size); page_decomp: ulint decomp = fil_page_decompress(tmp_frame, tmp_page); + page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE); if (!decomp || (decomp != srv_page_size && cursor->zip_size) - || buf_page_is_corrupted( - true, tmp_page, cursor->zip_size, space)) { + || page_type == FIL_PAGE_PAGE_COMPRESSED + || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || buf_page_is_corrupted(true, tmp_page, + cursor->zip_size, + space)) { goto corrupted; } - } else if (buf_page_is_corrupted(true, page, cursor->zip_size, - space)) { + } else if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || buf_page_is_corrupted(true, page, + cursor->zip_size, space)) { corrupted: retry_count--; diff --git a/mysql-test/suite/innodb/include/crc32.pl b/mysql-test/suite/innodb/include/crc32.pl new file mode 100644 index 00000000000..c2bce09dd36 --- /dev/null +++ b/mysql-test/suite/innodb/include/crc32.pl @@ -0,0 +1,33 @@ +# The following is Public Domain / Creative Commons CC0 from +# http://billauer.co.il/blog/2011/05/perl-crc32-crc-xs-module/ + +sub mycrc32 { + my ($input, $init_value, $polynomial) = @_; + + $init_value = 0 unless (defined $init_value); + $polynomial = 0xedb88320 unless (defined $polynomial); + + my @lookup_table; + + for (my $i=0; $i<256; $i++) { + my $x = $i; + for (my $j=0; $j<8; $j++) { + if ($x & 1) { + $x = ($x >> 1) ^ $polynomial; + } else { + $x = $x >> 1; + } + } + push @lookup_table, $x; + } + + my $crc = $init_value ^ 0xffffffff; + + foreach my $x (unpack ('C*', $input)) { + $crc = (($crc >> 8) & 0xffffff) ^ $lookup_table[ ($crc ^ $x) & 0xff ]; + } + + $crc = $crc ^ 0xffffffff; + + return $crc; +} diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.result b/mysql-test/suite/mariabackup/encrypted_page_corruption.result index c985c48dbc0..0198cfb3dc0 100644 --- a/mysql-test/suite/mariabackup/encrypted_page_corruption.result +++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); +call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted."); CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; insert into t1 select repeat('a',100); # Corrupt the table diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test index f8f7bdb6567..f87e12323da 100644 --- a/mysql-test/suite/mariabackup/encrypted_page_corruption.test +++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test @@ -1,11 +1,22 @@ --source include/have_file_key_management.inc +--source include/innodb_page_size.inc -call mtr.add_suppression("\\[ERROR\\] InnoDB: The page .* in file .* cannot be decrypted."); +perl; +open(OUT, ">$ENV{MYSQLTEST_VARDIR}/log/check.txt") || die; +print OUT "--skip innodb_checksum_algorithm=crc32 needs little-endian\n" +unless unpack("L","macs")==unpack("N","scam"); +close(OUT); +EOF + +--source $MYSQLTEST_VARDIR/log/check.txt +--remove_file $MYSQLTEST_VARDIR/log/check.txt + +call mtr.add_suppression("\\[ERROR\\] InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=3\\] in file '.*test.t1\\.ibd' cannot be decrypted."); CREATE TABLE t1(c VARCHAR(128)) ENGINE INNODB, encrypted=yes; insert into t1 select repeat('a',100); -let $MYSQLD_DATADIR=`select @@datadir`; -let t1_IBD = $MYSQLD_DATADIR/test/t1.ibd; +let MYSQLD_DATADIR=`select @@datadir`; +let INNODB_PAGE_SIZE=`select @@innodb_page_size`; --source include/shutdown_mysqld.inc @@ -15,17 +26,29 @@ perl; use strict; use warnings; use Fcntl qw(:DEFAULT :seek); +do "$ENV{MTR_SUITE_DIR}/../innodb/include/crc32.pl"; -my $ibd_file = $ENV{'t1_IBD'}; +my $page_size = $ENV{INNODB_PAGE_SIZE}; -my $chunk; -my $len; +sysopen IBD_FILE, "$ENV{MYSQLD_DATADIR}/test/t1.ibd", O_RDWR +|| die "Cannot open t1.ibd\n"; +sysread(IBD_FILE, $_, 38) || die "Cannot read t1.ibd\n"; +my $space = unpack("x[34]N", $_); +sysseek(IBD_FILE, $page_size * 3, SEEK_SET) || die "Cannot seek t1.ibd\n"; -sysopen IBD_FILE, $ibd_file, O_RDWR || die "Unable to open $ibd_file"; -sysseek IBD_FILE, 16384 * 3, SEEK_CUR; -$chunk = '\xAA\xAA\xAA\xAA'; -syswrite IBD_FILE, $chunk, 4; +my $head = pack("Nx[18]", 3); # better to have a valid page number +my $body = chr(0) x ($page_size - 38 - 8); +# Calculate innodb_checksum_algorithm=crc32 for the unencrypted page. +# The following bytes are excluded: +# bytes 0..3 (the checksum is stored there) +# bytes 26..37 (encryption key version, post-encryption checksum, tablespace id) +# bytes $page_size-8..$page_size-1 (checksum, LSB of FIL_PAGE_LSN) +my $polynomial = 0x82f63b78; # CRC-32C +my $ck = mycrc32($head, 0, $polynomial) ^ mycrc32($body, 0, $polynomial); + +my $page= pack("N",$ck).$head.pack("NNN",1,$ck,$space).$body.pack("Nx[4]",$ck); +die unless syswrite(IBD_FILE, $page, $page_size) == $page_size; close IBD_FILE; EOF From f16d4d4c6ee81cfee3b0d1cb2f2219b1fa982e2e Mon Sep 17 00:00:00 2001 From: Sachin Date: Wed, 19 Dec 2018 16:33:00 +0530 Subject: [PATCH 18/72] MDEV-17720 slave_ddl_exec_mode=IDEMPOTENT does not handle DROP DATABASE Relevant if exists flag are added for create database and drop database. --- mysql-test/suite/rpl/r/rpl_idempotency.result | 12 +++++++++++ mysql-test/suite/rpl/t/rpl_idempotency.test | 21 +++++++++++++++++++ sql/sql_parse.cc | 6 ++++++ 3 files changed, 39 insertions(+) diff --git a/mysql-test/suite/rpl/r/rpl_idempotency.result b/mysql-test/suite/rpl/r/rpl_idempotency.result index 38b955d7697..03482e6fefb 100644 --- a/mysql-test/suite/rpl/r/rpl_idempotency.result +++ b/mysql-test/suite/rpl/r/rpl_idempotency.result @@ -67,6 +67,18 @@ a -3 1 include/check_slave_no_error.inc +drop table t1, t2; DROP TABLE t1, t2; +include/check_slave_no_error.inc +create database d; +create database e; +create database d; +create database if not exists e; +include/check_slave_no_error.inc +drop database d; +drop database e; +drop database d; +drop database if exists e; +include/check_slave_no_error.inc SET @@global.slave_exec_mode= @old_slave_exec_mode; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/rpl_idempotency.test b/mysql-test/suite/rpl/t/rpl_idempotency.test index 186c6260154..e801aac9b5e 100644 --- a/mysql-test/suite/rpl/t/rpl_idempotency.test +++ b/mysql-test/suite/rpl/t/rpl_idempotency.test @@ -75,9 +75,30 @@ SELECT * FROM t1 ORDER BY a; SELECT * FROM t2 ORDER BY a; --source include/check_slave_no_error.inc +connection slave; +drop table t1, t2; + connection master; DROP TABLE t1, t2; sync_slave_with_master; +--source include/check_slave_no_error.inc +create database d; +create database e; + +connection master; +create database d; +create database if not exists e; + +sync_slave_with_master; +--source include/check_slave_no_error.inc +drop database d; +drop database e; + +connection master; +drop database d; +drop database if exists e; +sync_slave_with_master; +--source include/check_slave_no_error.inc SET @@global.slave_exec_mode= @old_slave_exec_mode; diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index a9849c7248d..5ca22f0dedc 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3884,6 +3884,9 @@ end_with_restore_list: my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0)); break; } + if (slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT && + !(lex->create_info.options & HA_LEX_CREATE_IF_NOT_EXISTS)) + create_info.options|= HA_LEX_CREATE_IF_NOT_EXISTS; } #endif if (check_access(thd, CREATE_ACL, lex->name.str, NULL, NULL, 1, 0)) @@ -3915,6 +3918,9 @@ end_with_restore_list: my_message(ER_SLAVE_IGNORED_TABLE, ER(ER_SLAVE_IGNORED_TABLE), MYF(0)); break; } + if (!thd->slave_expected_error && + slave_ddl_exec_mode_options == SLAVE_EXEC_MODE_IDEMPOTENT) + lex->check_exists= 1; } #endif if (check_access(thd, DROP_ACL, lex->name.str, NULL, NULL, 1, 0)) From e765b47e41db54124c05732a903110eae08e1194 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 14 Sep 2018 18:50:37 +0300 Subject: [PATCH 19/72] MDEV-17199 Assertion `pos < table->n_v_def' failed after upgrade to 10.2 Before MDEV-5800 in MariaDB 10.2.2, InnoDB knew nothing about virtual columns. But, they would be present in the TABLE_SHARE. It appears that the MDEV-12936 fix only worked in the special case when the virtual columns are the last columns in a table definition. mysql_fields(): Remove. build_template_needs_field(): Omit virtual columns if the InnoDB table definition is known to not contain them, based on the .frm file version. build_template_field(): Clean up some code. ha_innobase::build_template(): Remove redundant computations. Loop over all MariaDB columns. Skip virtual columns if InnoDB does not know about them. calc_row_difference(): Skip not-known-to-InnoDB virtual columns. wsrep_calc_row_hash(): Skip all virtual columns. This would fix an out-of-bounds access to dict_table_t::cols[]. Also, remove some redundant computations and variables. create_table_check_doc_id_col(): Assert that the .frm file for a newly created table will be in a format where InnoDB knows about virtual columns. --- storage/innobase/handler/ha_innodb.cc | 187 ++++++++++++-------------- 1 file changed, 84 insertions(+), 103 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 52940eb2f76..62924ab8fc5 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -275,10 +275,10 @@ void set_my_errno(int err) errno = err; } -static uint mysql_fields(const TABLE *table) +static uint omits_virtual_cols(const TABLE_SHARE &share) { - return table->s->frm_version < FRM_VER_EXPRESSSIONS - ? table->s->stored_fields : table->s->fields; + return share.frm_version < FRM_VER_EXPRESSSIONS && + share.virtual_fields; } /** Checks whether the file name belongs to a partition of a table. @@ -6247,12 +6247,13 @@ no_such_table: DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); } - uint n_fields = mysql_fields(table); + uint n_fields = omits_virtual_cols(*table_share) + ? table_share->stored_fields : table_share->fields; uint n_cols = dict_table_get_n_user_cols(ib_table) + dict_table_get_n_v_cols(ib_table) - !!DICT_TF2_FLAG_IS_SET(ib_table, DICT_TF2_FTS_HAS_DOC_ID); - if (n_cols != n_fields) { + if (UNIV_UNLIKELY(n_cols != n_fields)) { ib::warn() << "Table " << norm_name << " contains " << n_cols << " user" " defined columns in InnoDB, but " << n_fields @@ -7459,6 +7460,10 @@ build_template_needs_field( { const Field* field = table->field[i]; + if (innobase_is_v_fld(field) && omits_virtual_cols(*table->s)) { + return NULL; + } + if (!index_contains) { if (read_just_key) { /* If this is a 'key read', we do not need @@ -7483,7 +7488,6 @@ build_template_needs_field( if (fetch_primary_key_cols && dict_table_col_in_clustered_key(index->table, i - num_v)) { /* This field is needed in the query */ - return(field); } @@ -7536,17 +7540,11 @@ build_template_field( templ = prebuilt->mysql_template + prebuilt->n_template++; UNIV_MEM_INVALID(templ, sizeof *templ); - - if (innobase_is_v_fld(field)) { - templ->is_virtual = true; - col = &dict_table_get_nth_v_col(index->table, v_no)->m_col; - } else { - templ->is_virtual = false; - col = dict_table_get_nth_col(index->table, i); - } + templ->is_virtual = innobase_is_v_fld(field); if (!templ->is_virtual) { templ->col_no = i; + col = dict_table_get_nth_col(index->table, i); templ->clust_rec_field_no = dict_col_get_clust_pos( col, clust_index); /* If clustered index record field is not found, lets print out @@ -7585,7 +7583,7 @@ build_template_field( << table->field[j]->field_name; } - ib::error() << "Clustered record field for column " << i + ib::fatal() << "Clustered record field for column " << i << " not found table n_user_defined " << clust_index->n_user_defined_cols << " index n_user_defined " @@ -7602,8 +7600,6 @@ build_template_field( << table->s->stored_fields << " query " << innobase_get_stmt_unsafe(current_thd, &size); - - ut_a(templ->clust_rec_field_no != ULINT_UNDEFINED); } templ->rec_field_is_prefix = FALSE; templ->rec_prefix_field_no = ULINT_UNDEFINED; @@ -7621,6 +7617,8 @@ build_template_field( &templ->rec_prefix_field_no); } } else { + ut_ad(!omits_virtual_cols(*table->s)); + col = &dict_table_get_nth_v_col(index->table, v_no)->m_col; templ->clust_rec_field_no = v_no; templ->rec_prefix_field_no = ULINT_UNDEFINED; @@ -7704,10 +7702,8 @@ ha_innobase::build_template( { dict_index_t* index; dict_index_t* clust_index; - ulint n_fields; ibool fetch_all_in_key = FALSE; ibool fetch_primary_key_cols = FALSE; - ulint i; if (m_prebuilt->select_lock_type == LOCK_X) { /* We always retrieve the whole clustered index record if we @@ -7760,7 +7756,8 @@ ha_innobase::build_template( /* Below we check column by column if we need to access the clustered index. */ - n_fields = (ulint) mysql_fields(table); + const bool skip_virtual = omits_virtual_cols(*table_share); + const ulint n_fields = table_share->fields; if (!m_prebuilt->mysql_template) { m_prebuilt->mysql_template = (mysql_row_templ_t*) @@ -7780,25 +7777,25 @@ ha_innobase::build_template( /* Note that in InnoDB, i is the column number in the table. MySQL calls columns 'fields'. */ + ulint num_v = 0; + if (active_index != MAX_KEY && active_index == pushed_idx_cond_keyno) { - ulint num_v = 0; - /* Push down an index condition or an end_range check. */ - for (i = 0; i < n_fields; i++) { - ibool index_contains; - - if (innobase_is_v_fld(table->field[i])) { - index_contains = dict_index_contains_col_or_prefix( - index, num_v, true); - if (index_contains) - { - m_prebuilt->n_template = 0; - goto no_icp; - } - } else { - index_contains = dict_index_contains_col_or_prefix( - index, i - num_v, false); + for (ulint i = 0; i < n_fields; i++) { + const Field* field = table->field[i]; + const bool is_v = innobase_is_v_fld(field); + if (is_v && skip_virtual) { + num_v++; + continue; + } + ibool index_contains + = dict_index_contains_col_or_prefix( + index, is_v ? num_v : i - num_v, is_v); + if (is_v && index_contains) { + m_prebuilt->n_template = 0; + num_v = 0; + goto no_icp; } /* Test if an end_range or an index condition @@ -7816,17 +7813,10 @@ ha_innobase::build_template( the subset field->part_of_key.is_set(active_index) which would be acceptable if end_range==NULL. */ - bool is_v = innobase_is_v_fld(table->field[i]); if (build_template_needs_field_in_icp( index, m_prebuilt, index_contains, is_v ? num_v : i - num_v, is_v)) { - /* Needed in ICP */ - const Field* field; - mysql_row_templ_t* templ; - - if (whole_row) { - field = table->field[i]; - } else { + if (!whole_row) { field = build_template_needs_field( index_contains, m_prebuilt->read_just_key, @@ -7834,15 +7824,16 @@ ha_innobase::build_template( fetch_primary_key_cols, index, table, i, num_v); if (!field) { - if (innobase_is_v_fld( - table->field[i])) { + if (is_v) { num_v++; } continue; } } - templ = build_template_field( + ut_ad(!is_v); + + mysql_row_templ_t* templ= build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, 0); @@ -7917,7 +7908,8 @@ ha_innobase::build_template( < m_prebuilt->index->n_uniq); */ } - if (innobase_is_v_fld(table->field[i])) { + + if (is_v) { num_v++; } } @@ -7929,29 +7921,24 @@ ha_innobase::build_template( /* Include the fields that are not needed in index condition pushdown. */ - for (i = 0; i < n_fields; i++) { + for (ulint i = 0; i < n_fields; i++) { mysql_row_templ_t* templ; - ibool index_contains; - - if (innobase_is_v_fld(table->field[i])) { - index_contains = dict_index_contains_col_or_prefix( - index, num_v, true); - } else { - index_contains = dict_index_contains_col_or_prefix( - index, i - num_v, false); + const Field* field = table->field[i]; + const bool is_v = innobase_is_v_fld(field); + if (is_v && skip_virtual) { + num_v++; + continue; } - bool is_v = innobase_is_v_fld(table->field[i]); + ibool index_contains + = dict_index_contains_col_or_prefix( + index, is_v ? num_v : i - num_v, is_v); if (!build_template_needs_field_in_icp( index, m_prebuilt, index_contains, is_v ? num_v : i - num_v, is_v)) { /* Not needed in ICP */ - const Field* field; - - if (whole_row) { - field = table->field[i]; - } else { + if (!whole_row) { field = build_template_needs_field( index_contains, m_prebuilt->read_just_key, @@ -7959,7 +7946,7 @@ ha_innobase::build_template( fetch_primary_key_cols, index, table, i, num_v); if (!field) { - if (innobase_is_v_fld(table->field[i])) { + if (is_v) { num_v++; } continue; @@ -7969,8 +7956,9 @@ ha_innobase::build_template( templ = build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, num_v); + ut_ad(templ->is_virtual == is_v); - if (templ->is_virtual) { + if (is_v) { num_v++; } } @@ -7980,21 +7968,26 @@ ha_innobase::build_template( } else { no_icp: mysql_row_templ_t* templ; - ulint num_v = 0; /* No index condition pushdown */ m_prebuilt->idx_cond = NULL; + ut_ad(num_v == 0); - for (i = 0; i < n_fields; i++) { - const Field* field; + for (ulint i = 0; i < n_fields; i++) { + const Field* field = table->field[i]; + const bool is_v = innobase_is_v_fld(field); if (whole_row) { + if (is_v && skip_virtual) { + num_v++; + continue; + } /* Even this is whole_row, if the seach is on a virtual column, and read_just_key is set, and field is not in this index, we will not try to fill the value since they are not stored in such index nor in the cluster index. */ - if (innobase_is_v_fld(table->field[i]) + if (is_v && m_prebuilt->read_just_key && !dict_index_contains_col_or_prefix( m_prebuilt->index, num_v, true)) @@ -8005,12 +7998,10 @@ no_icp: num_v++; continue; } - - field = table->field[i]; } else { ibool contain; - if (!innobase_is_v_fld(table->field[i])) { + if (!is_v) { contain = dict_index_contains_col_or_prefix( index, i - num_v, false); @@ -8029,7 +8020,7 @@ no_icp: fetch_primary_key_cols, index, table, i, num_v); if (!field) { - if (innobase_is_v_fld(table->field[i])) { + if (is_v) { num_v++; } continue; @@ -8039,7 +8030,8 @@ no_icp: templ = build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, num_v); - if (templ->is_virtual) { + ut_ad(templ->is_virtual == is_v); + if (is_v) { num_v++; } } @@ -8048,8 +8040,7 @@ no_icp: if (index != clust_index && m_prebuilt->need_to_access_clustered) { /* Change rec_field_no's to correspond to the clustered index record */ - for (i = 0; i < m_prebuilt->n_template; i++) { - + for (ulint i = 0; i < m_prebuilt->n_template; i++) { mysql_row_templ_t* templ = &m_prebuilt->mysql_template[i]; @@ -8482,13 +8473,12 @@ calc_row_difference( ulint n_changed = 0; dfield_t dfield; dict_index_t* clust_index; - uint i; ibool changes_fts_column = FALSE; ibool changes_fts_doc_col = FALSE; trx_t* const trx = prebuilt->trx; doc_id_t doc_id = FTS_NULL_DOC_ID; ulint num_v = 0; - uint n_fields = mysql_fields(table); + const bool skip_virtual = omits_virtual_cols(*table->s); ut_ad(!srv_read_only_mode); @@ -8498,16 +8488,15 @@ calc_row_difference( /* We use upd_buff to convert changed fields */ buf = (byte*) upd_buff; - for (i = 0; i < n_fields; i++) { + for (uint i = 0; i < table->s->fields; i++) { field = table->field[i]; - bool is_virtual = innobase_is_v_fld(field); - dict_col_t* col; - - if (is_virtual) { - col = &prebuilt->table->v_cols[num_v].m_col; - } else { - col = &prebuilt->table->cols[i - num_v]; + const bool is_virtual = innobase_is_v_fld(field); + if (is_virtual && skip_virtual) { + continue; } + dict_col_t* col = is_virtual + ? &prebuilt->table->v_cols[num_v].m_col + : &prebuilt->table->cols[i - num_v]; o_ptr = (const byte*) old_row + get_field_offset(table, field); n_ptr = (const byte*) new_row + get_field_offset(table, field); @@ -8864,33 +8853,25 @@ wsrep_calc_row_hash( row_prebuilt_t* prebuilt, /*!< in: InnoDB prebuilt struct */ THD* thd) /*!< in: user thread */ { - Field* field; - enum_field_types field_mysql_type; - uint n_fields; ulint len; const byte* ptr; - ulint col_type; - uint i; void *ctx = alloca(my_md5_context_size()); my_md5_init(ctx); - n_fields = mysql_fields(table); - - for (i = 0; i < n_fields; i++) { + for (uint i = 0; i < table->s->fields; i++) { byte null_byte=0; byte true_byte=1; - field = table->field[i]; + const Field* field = table->field[i]; + if (innobase_is_v_fld(field)) { + continue; + } ptr = (const byte*) row + get_field_offset(table, field); len = field->pack_length(); - field_mysql_type = field->type(); - - col_type = prebuilt->table->cols[i].mtype; - - switch (col_type) { + switch (prebuilt->table->cols[i].mtype) { case DATA_BLOB: ptr = row_mysql_read_blob_ref(&len, ptr, len); @@ -8900,7 +8881,7 @@ wsrep_calc_row_hash( case DATA_VARCHAR: case DATA_BINARY: case DATA_VARMYSQL: - if (field_mysql_type == MYSQL_TYPE_VARCHAR) { + if (field->type() == MYSQL_TYPE_VARCHAR) { /* This is a >= 5.0.3 type true VARCHAR where the real payload data length is stored in 1 or 2 bytes */ @@ -10786,9 +10767,9 @@ create_table_check_doc_id_col( ULINT_UNDEFINED if column is of the wrong type/name/size */ { - uint n_fields = mysql_fields(form); + ut_ad(!omits_virtual_cols(*form->s)); - for (ulint i = 0; i < n_fields; i++) { + for (ulint i = 0; i < form->s->fields; i++) { const Field* field; ulint col_type; ulint col_len; From fca44b7c1ffe5e32a94e8d4449bd1d9f91492c3a Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Thu, 13 Dec 2018 23:12:14 +0100 Subject: [PATCH 20/72] MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm) use frm_version, not mysql_version when parsing frm In particular, virtual columns are stored according to frm_version. And CHECK TABLE will overwrite mysql_version to the current server version, so it cannot correctly describe frm format. --- mysql-test/std_data/mdev17909#P#p20181029.MYD | 0 mysql-test/std_data/mdev17909#P#p20181029.MYI | Bin 0 -> 1024 bytes mysql-test/std_data/mdev17909#P#p20181128.MYD | 0 mysql-test/std_data/mdev17909#P#p20181128.MYI | Bin 0 -> 1024 bytes mysql-test/std_data/mdev17909.frm | Bin 0 -> 3284 bytes mysql-test/std_data/mdev17909.par | Bin 0 -> 48 bytes mysql-test/suite/vcol/r/upgrade.result | 16 ++++++++++++++++ mysql-test/suite/vcol/t/upgrade.test | 15 +++++++++++++++ sql/table.cc | 2 +- 9 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 mysql-test/std_data/mdev17909#P#p20181029.MYD create mode 100644 mysql-test/std_data/mdev17909#P#p20181029.MYI create mode 100644 mysql-test/std_data/mdev17909#P#p20181128.MYD create mode 100644 mysql-test/std_data/mdev17909#P#p20181128.MYI create mode 100644 mysql-test/std_data/mdev17909.frm create mode 100644 mysql-test/std_data/mdev17909.par diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYD b/mysql-test/std_data/mdev17909#P#p20181029.MYD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYI b/mysql-test/std_data/mdev17909#P#p20181029.MYI new file mode 100644 index 0000000000000000000000000000000000000000..dcdd088b4dc04a5413787cdb08d9a16b67d75c60 GIT binary patch literal 1024 zcmezOkDZZ$kujQK149bK5e7yEAmRX$K=2<-Vj=!R0Yr)giwayqAsomuFmqruOfH72 z`2my-b_o(6rUaRWxR!xfcd*}PU|_!kG=LdM-v`nn5H@U33dJ&}>kx6(7%(bu1wfq@aIoC~ZU$Y5Y>U}9jH0JPzMK#-@eV^HLO zuqmU&@C$+e4a3h*qdpo9fzc2c4S~@R7!85Z5TJDka55Am7L{a{Waj5B1=^($;20F* z8RF^hr{EN+5aj6R?y8^>;vetg7#XaQ;F4I9nxLu4rGZdYU}RuuVQ64vsSxJq6Y3hQ z;Nuz`tPtYi=%=7zZftIBW~iy)>gVq1=c-_<0BN!6a3R?O(QjyEfkVF~rhZKZhE~Q_ zP)m0N17@J#{eb-i2M#`XCoq?eNsQxQZ#eY!bf{4WbiT@cG`5B!3eL{Wx;@w?Cz!9IApkt`u7_8vz;TWW0 JXkehJ2>`7fTk)EMQ;)(wv+O3?e|fz{tSR!qC9T63Q|(vH*%g004Vp1s?za literal 0 HcmV?d00001 diff --git a/mysql-test/suite/vcol/r/upgrade.result b/mysql-test/suite/vcol/r/upgrade.result index 75684bf0e41..527bc5f3abf 100644 --- a/mysql-test/suite/vcol/r/upgrade.result +++ b/mysql-test/suite/vcol/r/upgrade.result @@ -16,3 +16,19 @@ select * from vcol_autoinc; pk v3 1 1 drop table vcol_autoinc; +check table t1 for upgrade; +Table Op Msg_type Msg_text +test.t1 check status OK +flush tables; +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `Date` datetime(6) NOT NULL, + `Data` varbinary(2000) NOT NULL, + `a` varchar(100) GENERATED ALWAYS AS (column_get(`Data`,1 as char(100) charset latin1)) VIRTUAL, + PRIMARY KEY (`Date`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 + PARTITION BY RANGE (to_days(`Date`)) +(PARTITION `p20181029` VALUES LESS THAN (737361) ENGINE = MyISAM, + PARTITION `p20181128` VALUES LESS THAN (737391) ENGINE = MyISAM) +drop table t1; diff --git a/mysql-test/suite/vcol/t/upgrade.test b/mysql-test/suite/vcol/t/upgrade.test index 3e221747dfa..146495d8ed0 100644 --- a/mysql-test/suite/vcol/t/upgrade.test +++ b/mysql-test/suite/vcol/t/upgrade.test @@ -11,3 +11,18 @@ select * from vcol_autoinc; insert vcol_autoinc (pk) values (1); select * from vcol_autoinc; drop table vcol_autoinc; + +# +# MDEV-17909 Problem by MariaDB Update 10.1.32 -> 10.2.19 (Incorrect information in file: .frm) +# +source include/have_partition.inc; +copy_file std_data/mdev17909#P#p20181029.MYD $datadir/test/t1#P#p20181029.MYD; +copy_file std_data/mdev17909#P#p20181029.MYI $datadir/test/t1#P#p20181029.MYI; +copy_file std_data/mdev17909#P#p20181128.MYD $datadir/test/t1#P#p20181128.MYD; +copy_file std_data/mdev17909#P#p20181128.MYI $datadir/test/t1#P#p20181128.MYI; +copy_file std_data/mdev17909.frm $datadir/test/t1.frm; +copy_file std_data/mdev17909.par $datadir/test/t1.par; +check table t1 for upgrade; +flush tables; +show create table t1; +drop table t1; diff --git a/sql/table.cc b/sql/table.cc index 0cf88aed4f6..dbf10bc8293 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -1027,7 +1027,7 @@ bool parse_vcol_defs(THD *thd, MEM_ROOT *mem_root, TABLE *table, while (pos < end) { uint type, expr_length; - if (table->s->mysql_version >= 100202) + if (table->s->frm_version >= FRM_VER_EXPRESSSIONS) { uint field_nr, name_length; /* see pack_expression() for how data is stored */ From a79183b01e4e1f3af55abd102715560cecbbddae Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 19 Dec 2018 02:30:22 +0100 Subject: [PATCH 21/72] correct table name in CHECK failures during ALTER TABLE --- mysql-test/r/partition_alter.result | 4 ++-- mysql-test/t/partition_alter.test | 2 -- sql/table.cc | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/mysql-test/r/partition_alter.result b/mysql-test/r/partition_alter.result index 6aa0039c8d2..d272381bc08 100644 --- a/mysql-test/r/partition_alter.result +++ b/mysql-test/r/partition_alter.result @@ -59,7 +59,7 @@ partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); alter table t1 add check (b in (0, 1)); -ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary` +ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` alter table t1 add check (b in (0, 10)); show create table t1; Table Create Table @@ -83,7 +83,7 @@ partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); alter table t1 add check (b in (0, 1)); -ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`#sql-temporary` +ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` alter table t1 add check (b in (0, 10)); show create table t1; Table Create Table diff --git a/mysql-test/t/partition_alter.test b/mysql-test/t/partition_alter.test index ce6672c4b9d..1235e5b8dc2 100644 --- a/mysql-test/t/partition_alter.test +++ b/mysql-test/t/partition_alter.test @@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); @@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); diff --git a/sql/table.cc b/sql/table.cc index dbf10bc8293..7c53246a7d3 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -5178,7 +5178,7 @@ int TABLE::verify_constraints(bool ignore_failure) field_error.append((*chk)->name.str); my_error(ER_CONSTRAINT_FAILED, MYF(ignore_failure ? ME_JUST_WARNING : 0), field_error.c_ptr(), - s->db.str, s->table_name.str); + s->db.str, s->error_table_name()); return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR; } } From 7b2e2288e9f784ea12f85dc005503511fe99f796 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 Dec 2018 14:28:30 +0100 Subject: [PATCH 22/72] MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table if the CHECK constraint failed in copy_data_between_tables(), the loop was aborted prematurely and to->auto_increment_field_not_null wasn't reset. --- mysql-test/r/check.result | 10 ++++++++++ mysql-test/t/check.test | 12 ++++++++++++ sql/sql_table.cc | 16 ++++++++-------- sql/temporary_tables.cc | 11 ++++------- 4 files changed, 34 insertions(+), 15 deletions(-) diff --git a/mysql-test/r/check.result b/mysql-test/r/check.result index e3dcda773f4..e882a4cdbe6 100644 --- a/mysql-test/r/check.result +++ b/mysql-test/r/check.result @@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +create temporary table t1 ( +id int not null auto_increment primary key, +f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +Warnings: +Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` +alter table t1; +drop table t1; diff --git a/mysql-test/t/check.test b/mysql-test/t/check.test index cce8fd34c9c..475a7996a09 100644 --- a/mysql-test/t/check.test +++ b/mysql-test/t/check.test @@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM; ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`; SHOW CREATE TABLE t1; DROP TABLE t1; + +# +# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table +# +create temporary table t1 ( + id int not null auto_increment primary key, + f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +alter table t1; +drop table t1; diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 1765e352b88..9e72278db8d 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -10065,14 +10065,7 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, error= 1; break; } - if (to->next_number_field) - { - if (auto_increment_field_copied) - to->auto_increment_field_not_null= TRUE; - else - to->next_number_field->reset(); - } - + for (Copy_field *copy_ptr=copy ; copy_ptr != copy_end ; copy_ptr++) { copy_ptr->do_copy(copy_ptr); @@ -10091,6 +10084,13 @@ copy_data_between_tables(THD *thd, TABLE *from, TABLE *to, error= 1; break; } + if (to->next_number_field) + { + if (auto_increment_field_copied) + to->auto_increment_field_not_null= TRUE; + else + to->next_number_field->reset(); + } error=to->file->ha_write_row(to->record[0]); to->auto_increment_field_not_null= FALSE; if (error) diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index 3201b306fad..87c4671ada4 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -1140,8 +1140,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share, @return Success false Failure true */ -bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, - TABLE **out_table) +bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, TABLE **out_table) { DBUG_ENTER("THD::find_and_use_tmp_table"); @@ -1151,11 +1150,9 @@ bool THD::find_and_use_tmp_table(const TABLE_LIST *tl, key_length= create_tmp_table_def_key(key, tl->get_db_name(), tl->get_table_name()); - result= - use_temporary_table(find_temporary_table(key, key_length, - TMP_TABLE_NOT_IN_USE), - out_table); - + result= use_temporary_table(find_temporary_table(key, key_length, + TMP_TABLE_NOT_IN_USE), + out_table); DBUG_RETURN(result); } From 6a73569f12fe4883937a669c262716c11d1f9238 Mon Sep 17 00:00:00 2001 From: Nikita Malyavin Date: Thu, 21 Jun 2018 16:46:11 +1000 Subject: [PATCH 23/72] MDEV-16429: Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index))' fails upon attempt to update virtual column on partitioned versioned table When using buffered sort in `UPDATE`, keyread is used. In this case, `TABLE::update_virtual_field` should be aborted, but it actually isn't, because it is called not with a top-level handler, but with the one that is actually going to access the disk. Here the problemm is issued with partitioning, so the solution is to recursively mark for keyread all the underlying partition handlers. * ha_partition: update keyread state for child partitions Closes #800 --- sql/ha_partition.cc | 104 +++++++++++++++++++++++++++++--------------- sql/ha_partition.h | 6 ++- sql/handler.h | 4 +- 3 files changed, 75 insertions(+), 39 deletions(-) diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 090102266f0..3eabc698fed 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -401,7 +401,7 @@ const char *ha_partition::table_type() const ha_partition::~ha_partition() { - DBUG_ENTER("ha_partition::~ha_partition()"); + DBUG_ENTER("ha_partition::~ha_partition"); if (m_new_partitions_share_refs.elements) m_new_partitions_share_refs.delete_elements(); if (m_file != NULL) @@ -616,7 +616,7 @@ int ha_partition::create_partitioning_metadata(const char *path, const char *old_path, int action_flag) { - DBUG_ENTER("ha_partition::create_partitioning_metadata()"); + DBUG_ENTER("ha_partition::create_partitioning_metadata"); /* We need to update total number of parts since we might write the handler @@ -6811,6 +6811,24 @@ void ha_partition::get_dynamic_partition_info(PARTITION_STATS *stat_info, } +static int extra_cb(handler *h, void *operation) +{ + return h->extra(*(enum ha_extra_function*)operation); +} + + +static int start_keyread_cb(handler* h, void *p) +{ + return h->ha_start_keyread(*(uint*)p); +} + + +static int end_keyread_cb(handler* h, void *unused) +{ + return h->ha_end_keyread(); +} + + /** General function to prepare handler for certain behavior. @@ -7131,11 +7149,12 @@ int ha_partition::extra(enum ha_extra_function operation) switch (operation) { /* Category 1), used by most handlers */ - case HA_EXTRA_KEYREAD: case HA_EXTRA_NO_KEYREAD: + DBUG_RETURN(loop_partitions(end_keyread_cb, NULL)); + case HA_EXTRA_KEYREAD: case HA_EXTRA_FLUSH: case HA_EXTRA_PREPARE_FOR_FORCED_CLOSE: - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); case HA_EXTRA_PREPARE_FOR_RENAME: case HA_EXTRA_FORCE_REOPEN: DBUG_RETURN(loop_extra_alter(operation)); @@ -7147,7 +7166,7 @@ int ha_partition::extra(enum ha_extra_function operation) case HA_EXTRA_KEYREAD_PRESERVE_FIELDS: { if (!m_myisam) - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); break; } @@ -7171,7 +7190,7 @@ int ha_partition::extra(enum ha_extra_function operation) case HA_EXTRA_PREPARE_FOR_DROP: case HA_EXTRA_FLUSH_CACHE: { - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); } case HA_EXTRA_NO_READCHECK: { @@ -7203,7 +7222,7 @@ int ha_partition::extra(enum ha_extra_function operation) m_extra_cache_size= 0; m_extra_prepare_for_update= FALSE; m_extra_cache_part_id= NO_CURRENT_PART_ID; - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); } case HA_EXTRA_IGNORE_NO_KEY: case HA_EXTRA_NO_IGNORE_NO_KEY: @@ -7237,7 +7256,7 @@ int ha_partition::extra(enum ha_extra_function operation) } /* Category 7), used by federated handlers */ case HA_EXTRA_INSERT_WITH_UPDATE: - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); /* Category 8) Operations only used by NDB */ case HA_EXTRA_DELETE_CANNOT_BATCH: case HA_EXTRA_UPDATE_CANNOT_BATCH: @@ -7264,7 +7283,7 @@ int ha_partition::extra(enum ha_extra_function operation) case HA_EXTRA_BEGIN_ALTER_COPY: case HA_EXTRA_END_ALTER_COPY: case HA_EXTRA_FAKE_START_STMT: - DBUG_RETURN(loop_extra(operation)); + DBUG_RETURN(loop_partitions(extra_cb, &operation)); default: { /* Temporary crash to discover what is wrong */ @@ -7309,24 +7328,40 @@ int ha_partition::reset(void) } /* - Special extra method for HA_EXTRA_CACHE with cachesize as extra parameter + Special extra method with additional parameter + See @ref ha_partition::extra - SYNOPSIS - extra_opt() - operation Must be HA_EXTRA_CACHE - cachesize Size of cache in full table scan + @param[in] operation operation to execute + @param[in] arg extra argument - RETURN VALUE - >0 Error code - 0 Success + @return status + @retval 0 success + @retval >0 error code + + @detail + Operations supported by extra_opt: + HA_EXTRA_KEYREAD: + arg is interpreted as key index + HA_EXTRA_CACHE: + arg is interpreted as size of cache in full table scan + + For detailed description refer to @ref ha_partition::extra */ -int ha_partition::extra_opt(enum ha_extra_function operation, ulong cachesize) +int ha_partition::extra_opt(enum ha_extra_function operation, ulong arg) { - DBUG_ENTER("ha_partition::extra_opt()"); + DBUG_ENTER("ha_partition::extra_opt"); - DBUG_ASSERT(HA_EXTRA_CACHE == operation); - prepare_extra_cache(cachesize); + switch (operation) + { + case HA_EXTRA_KEYREAD: + DBUG_RETURN(loop_partitions(start_keyread_cb, &arg)); + case HA_EXTRA_CACHE: + prepare_extra_cache(arg); + DBUG_RETURN(0); + default: + DBUG_ASSERT(0); + } DBUG_RETURN(0); } @@ -7344,7 +7379,7 @@ int ha_partition::extra_opt(enum ha_extra_function operation, ulong cachesize) void ha_partition::prepare_extra_cache(uint cachesize) { - DBUG_ENTER("ha_partition::prepare_extra_cache()"); + DBUG_ENTER("ha_partition::prepare_extra_cache"); DBUG_PRINT("info", ("cachesize %u", cachesize)); m_extra_cache= TRUE; @@ -7374,7 +7409,7 @@ int ha_partition::loop_extra_alter(enum ha_extra_function operation) { int result= 0, tmp; handler **file; - DBUG_ENTER("ha_partition::loop_extra_alter()"); + DBUG_ENTER("ha_partition::loop_extra_alter"); DBUG_ASSERT(operation == HA_EXTRA_PREPARE_FOR_RENAME || operation == HA_EXTRA_FORCE_REOPEN); @@ -7390,34 +7425,33 @@ int ha_partition::loop_extra_alter(enum ha_extra_function operation) if ((tmp= (*file)->extra(operation))) result= tmp; } - if ((tmp= loop_extra(operation))) + if ((tmp= loop_partitions(extra_cb, &operation))) result= tmp; DBUG_RETURN(result); } -/* - Call extra on all partitions +/** + Call callback(part, param) on all partitions - SYNOPSIS - loop_extra() - operation extra operation type + @param callback a callback to call for each partition + @param param a void*-parameter passed to callback - RETURN VALUE - >0 Error code - 0 Success + @return Operation status + @retval >0 Error code + @retval 0 Success */ -int ha_partition::loop_extra(enum ha_extra_function operation) +int ha_partition::loop_partitions(handler_callback callback, void *param) { int result= 0, tmp; uint i; - DBUG_ENTER("ha_partition::loop_extra()"); + DBUG_ENTER("ha_partition::loop_partitions"); for (i= bitmap_get_first_set(&m_part_info->lock_partitions); i < m_tot_parts; i= bitmap_get_next_set(&m_part_info->lock_partitions, i)) { - if ((tmp= m_file[i]->extra(operation))) + if ((tmp= callback(m_file[i], param))) result= tmp; } /* Add all used partitions to be called in reset(). */ diff --git a/sql/ha_partition.h b/sql/ha_partition.h index e348da08443..9a73eeff817 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -649,7 +649,7 @@ public: void get_dynamic_partition_info(PARTITION_STATS *stat_info, uint part_id); virtual int extra(enum ha_extra_function operation); - virtual int extra_opt(enum ha_extra_function operation, ulong cachesize); + virtual int extra_opt(enum ha_extra_function operation, ulong arg); virtual int reset(void); virtual uint count_query_cache_dependant_tables(uint8 *tables_type); virtual my_bool @@ -659,6 +659,8 @@ public: uint *n); private: + typedef int handler_callback(handler *, void *); + my_bool reg_query_cache_dependant_table(THD *thd, char *engine_key, uint engine_key_len, @@ -669,7 +671,7 @@ private: **block_table, handler *file, uint *n); static const uint NO_CURRENT_PART_ID; - int loop_extra(enum ha_extra_function operation); + int loop_partitions(handler_callback callback, void *param); int loop_extra_alter(enum ha_extra_function operations); void late_extra_cache(uint partition_id); void late_extra_no_cache(uint partition_id); diff --git a/sql/handler.h b/sql/handler.h index ed2ef822c88..d34064811f0 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -2874,7 +2874,7 @@ public: bool keyread_enabled() { return keyread < MAX_KEY; } int ha_start_keyread(uint idx) { - int res= keyread_enabled() ? 0 : extra(HA_EXTRA_KEYREAD); + int res= keyread_enabled() ? 0 : extra_opt(HA_EXTRA_KEYREAD, idx); keyread= idx; return res; } @@ -3278,7 +3278,7 @@ public: uint part_id); virtual int extra(enum ha_extra_function operation) { return 0; } - virtual int extra_opt(enum ha_extra_function operation, ulong cache_size) + virtual int extra_opt(enum ha_extra_function operation, ulong arg) { return extra(operation); } /** From f04bbed220215a0e5a5b1be9f3af5e442abe033b Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 Dec 2018 16:14:30 +0100 Subject: [PATCH 24/72] MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column add a test case --- mysql-test/r/partition_innodb.result | 17 +++++++++++++++++ mysql-test/t/partition_innodb.test | 17 +++++++++++++++++ 2 files changed, 34 insertions(+) diff --git a/mysql-test/r/partition_innodb.result b/mysql-test/r/partition_innodb.result index ec99d2879b0..0a58883bb34 100644 --- a/mysql-test/r/partition_innodb.result +++ b/mysql-test/r/partition_innodb.result @@ -956,3 +956,20 @@ test_jfg test_jfg11 test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#pmax DROP DATABASE test_jfg; +create table t1 (a int) engine=innodb; +create table t2 ( +b int, +c int, +d bit not null default 0, +v bit as (d) virtual, +key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +select t1.* from t1 join t2 on (v = a); +a +drop table t1, t2; diff --git a/mysql-test/t/partition_innodb.test b/mysql-test/t/partition_innodb.test index 5dcb83b5737..590e2fc7f07 100644 --- a/mysql-test/t/partition_innodb.test +++ b/mysql-test/t/partition_innodb.test @@ -1051,3 +1051,20 @@ SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE database_name = 'test_jfg'; DROP DATABASE test_jfg; + +# +# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column +# +create table t1 (a int) engine=innodb; +create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +select t1.* from t1 join t2 on (v = a); +drop table t1, t2; From 2ec018b281a801089afde96ec0f5968c8ed89858 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 14 Dec 2018 23:07:32 +0100 Subject: [PATCH 25/72] MDEV-17953 MariaDB 10.2.19 with TokuDB incompatible with Jemalloc 5+ Simplify the check, remove redundant code. Add a safety check to avoid linking with static jemalloc_pic.a if jemalloc version is 5+. This doesn't fix the issue on Gentoo, it should be fixed in the ebuild. --- storage/tokudb/CMakeLists.txt | 48 ++++++++++++++++++++--------------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index 86463c2997e..f3166ca8c0b 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -49,33 +49,41 @@ CHECK_JEMALLOC() IF(NOT LIBJEMALLOC) MESSAGE(WARNING "TokuDB is enabled, but jemalloc is not. This configuration is not supported") +ELSEIF(LIBJEMALLOC STREQUAL jemalloc_pic) + CHECK_CXX_SOURCE_COMPILES( +" +#include +#if JEMALLOC_VERSION_MAJOR < 5 +int main() { return 0; } +#else +#error +#endif +" JEMALLOC_OK) + IF (NOT JEMALLOC_OK) + MESSAGE(FATAL_ERROR "static jemalloc_pic.a can only be used up to jemalloc 4") + ENDIF() ELSEIF(LIBJEMALLOC STREQUAL jemalloc) FIND_LIBRARY(LIBJEMALLOC_SO jemalloc) IF(NOT LIBJEMALLOC_SO) MESSAGE(FATAL_ERROR "jemalloc is present, but cannot be found?") ENDIF() GET_FILENAME_COMPONENT(LIBJEMALLOC_PATH ${LIBJEMALLOC_SO} REALPATH CACHE) -ENDIF() -IF(LIBJEMALLOC_PATH AND (RPM OR DEB)) - UNSET(LIBJEMALLOC) - GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES) - SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE) - SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" - SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}") -ELSEIF(LIBJEMALLOC_PATH) - SET(systemd_env "#Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") #" - SET(cnf_malloc_lib "#malloc-lib=${LIBJEMALLOC_PATH}") -ELSE() - SET(systemd_env "#Environment=\"LD_PRELOAD=/path/to/libjemalloc.so\"") #" - SET(cnf_malloc_lib "#malloc-lib=/path/to/libjemalloc.so") -ENDIF() -CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) -CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY) -IF(INSTALL_SYSCONFDIR) - INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf - DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/ - COMPONENT tokudb-engine) + IF(RPM OR DEB) + UNSET(LIBJEMALLOC) + GET_DIRECTORY_PROPERTY(V DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITION CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES) + SET(CPACK_RPM_tokudb-engine_PACKAGE_REQUIRES "${V} jemalloc" PARENT_SCOPE) + ENDIF() + + IF(INSTALL_SYSCONFDIR) + SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") + SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}") + CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) + CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY) + INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf + DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/ + COMPONENT tokudb-engine) + ENDIF() ENDIF() MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow") From d13302ff6013acee9ac5fb6946d0c91e2f303224 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 16 Dec 2018 18:22:35 +0100 Subject: [PATCH 26/72] cleanup: small simplification --- sql/temporary_tables.cc | 32 +++++++------------------------- 1 file changed, 7 insertions(+), 25 deletions(-) diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index 87c4671ada4..a4ece127f96 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -1032,39 +1032,21 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length, /* A matching TMP_TABLE_SHARE is found. */ All_share_tables_list::Iterator tables_it(share->all_tmp_tables); - while ((table= tables_it++)) + bool found= false; + while (!found && (table= tables_it++)) { switch (state) { - case TMP_TABLE_IN_USE: - if (table->query_id > 0) - { - result= table; - goto done; - } - break; - case TMP_TABLE_NOT_IN_USE: - if (table->query_id == 0) - { - result= table; - goto done; - } - break; - case TMP_TABLE_ANY: - { - result= table; - goto done; - } - break; - default: /* Invalid */ - DBUG_ASSERT(0); - goto done; + case TMP_TABLE_IN_USE: found= table->query_id > 0; break; + case TMP_TABLE_NOT_IN_USE: found= table->query_id == 0; break; + case TMP_TABLE_ANY: found= true; break; } } + result= table; + break; } } -done: if (locked) { DBUG_ASSERT(m_tmp_tables_locked); From 2027841d5bc7e22ebb24a5a7538d0fd057dd8352 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Sun, 16 Dec 2018 18:32:05 +0100 Subject: [PATCH 27/72] MDEV-16110 ALTER with ALGORITHM=INPLACE breaks temporary table with virtual columns Part two, temporary tables. Make temporary tables respect TABLE::m_needs_reopen. See also 77cd754229b --- mysql-test/r/alter_table_errors.result | 19 +++++++++++++++++++ mysql-test/t/alter_table_errors.test | 11 +++++++++++ sql/temporary_tables.cc | 7 +++++++ 3 files changed, 37 insertions(+) diff --git a/mysql-test/r/alter_table_errors.result b/mysql-test/r/alter_table_errors.result index 020a30304d0..b26409e3d05 100644 --- a/mysql-test/r/alter_table_errors.result +++ b/mysql-test/r/alter_table_errors.result @@ -8,3 +8,22 @@ t CREATE TABLE `t` ( `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t; +create temporary table t1 (a int, v int as (a)); +alter table t1 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +alter table t2 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/t/alter_table_errors.test b/mysql-test/t/alter_table_errors.test index d9982ac26f4..8fa65b0f330 100644 --- a/mysql-test/t/alter_table_errors.test +++ b/mysql-test/t/alter_table_errors.test @@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb; alter table t change column a b tinyint, algorithm=inplace; show create table t; drop table t; + +create temporary table t1 (a int, v int as (a)); +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 change column a b int, algorithm=inplace; +show create table t1; + +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t2 change column a b int, algorithm=inplace; +show create table t2; diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index a4ece127f96..29c9910f332 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -1042,6 +1042,13 @@ TABLE *THD::find_temporary_table(const char *key, uint key_length, case TMP_TABLE_ANY: found= true; break; } } + if (table && unlikely(table->m_needs_reopen)) + { + share->all_tmp_tables.remove(table); + free_temporary_table(table); + it.rewind(); + continue; + } result= table; break; } From 24763451fe811bc4683bfe32f77cbe9bf0c6db6c Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 17 Dec 2018 15:58:32 +0100 Subject: [PATCH 28/72] update C/C to v3.0.8 --- libmariadb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmariadb b/libmariadb index 334964f0711..34f8887af03 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 334964f0711c3fd027f634a239eee57bc912f7ff +Subproject commit 34f8887af03d022416dd6593de91d0706e57f46b From cb4c2a98b56b836ba19f822b52ea24337cd34370 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Tue, 18 Dec 2018 15:20:37 +0100 Subject: [PATCH 29/72] always link C/C with external (to C/C) zlib it'll be either system zlib.so or bundled with the server (but still external to C/C) zlib.a --- cmake/mariadb_connector_c.cmake | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index c36087cb862..368a6cc8da5 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -6,10 +6,7 @@ ENDIF() SET(CONC_WITH_SIGNCODE ${SIGNCODE}) SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS}) - -IF(NOT TARGET zlib) - SET(CONC_WITH_EXTERNAL_ZLIB ON) -ENDIF() +SET(CONC_WITH_EXTERNAL_ZLIB ON) IF(SSL_DEFINES MATCHES "YASSL") IF(WIN32) From 8ede9b3ae542068cc02ca27ab32eb76fcfab942f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 19 Dec 2018 15:23:54 +0100 Subject: [PATCH 30/72] MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE open_grant_tables() returns -1/0/1, where -1 is an error, while 1 is not. Don't store it's return value in bool --- mysql-test/r/grant5.result | 7 +++++++ mysql-test/t/grant5.test | 10 ++++++++++ sql/sql_acl.cc | 9 +++++---- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/grant5.result b/mysql-test/r/grant5.result index d7f3b6812bb..8c32d90a640 100644 --- a/mysql-test/r/grant5.result +++ b/mysql-test/r/grant5.result @@ -16,3 +16,10 @@ show grants for foo@'%'; ERROR 42000: Access denied for user 'test'@'%' to database 'mysql' drop user test, foo; drop role foo; +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +REVOKE EXECUTE ON PROCEDURE sp FROM u; +ERROR HY000: Table 'user' was not locked with LOCK TABLES +REVOKE PROCESS ON *.* FROM u; +ERROR HY000: Table 'user' was not locked with LOCK TABLES +DROP TABLE t1; diff --git a/mysql-test/t/grant5.test b/mysql-test/t/grant5.test index 14f2fd65020..649bba7d1ca 100644 --- a/mysql-test/t/grant5.test +++ b/mysql-test/t/grant5.test @@ -23,3 +23,13 @@ show grants for foo@'%'; # user drop user test, foo; drop role foo; +# +# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +--error ER_TABLE_NOT_LOCKED +REVOKE EXECUTE ON PROCEDURE sp FROM u; +--error ER_TABLE_NOT_LOCKED +REVOKE PROCESS ON *.* FROM u; +DROP TABLE t1; diff --git a/sql/sql_acl.cc b/sql/sql_acl.cc index 0f21a6bc134..784f2338a55 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -786,8 +786,7 @@ static const int Table_procs_priv= 1 << PROCS_PRIV_TABLE; static const int Table_proxies_priv= 1 << PROXIES_PRIV_TABLE; static const int Table_roles_mapping= 1 << ROLES_MAPPING_TABLE; -static int open_grant_tables(THD *thd, TABLE_LIST *tables, - enum thr_lock_type lock_type, int tables_to_open); +static int open_grant_tables(THD *, TABLE_LIST *, enum thr_lock_type, int); const LEX_STRING acl_table_names[]= // matches enum_acl_tables { @@ -6030,7 +6029,8 @@ bool mysql_routine_grant(THD *thd, TABLE_LIST *table_list, bool is_proc, List_iterator str_list (user_list); LEX_USER *Str, *tmp_Str; TABLE_LIST tables[TABLES_MAX]; - bool create_new_users= 0, result; + bool create_new_users= 0; + int result; char *db_name, *table_name; DBUG_ENTER("mysql_routine_grant"); @@ -6465,7 +6465,8 @@ bool mysql_grant(THD *thd, const char *db, List &list, List_iterator str_list (list); LEX_USER *Str, *tmp_Str, *proxied_user= NULL; char tmp_db[SAFE_NAME_LEN+1]; - bool create_new_users=0, result; + bool create_new_users=0; + int result; TABLE_LIST tables[TABLES_MAX]; DBUG_ENTER("mysql_grant"); From ed36fc353f374892c225d191f5525f439031d939 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 20 Dec 2018 13:33:09 +0200 Subject: [PATCH 31/72] MDEV-18025: Detect corrupted innodb_page_compression=zlib pages In MDEV-13103, I made a mistake in the error handling of page_compressed=1 decryption when the default innodb_compression_algorithm=zlib is used. Due to this mistake, with certain versions of zlib, MariaDB would fail to detect a corrupted page. The problem was uncovered by the following tests: mariabackup.unencrypted_page_compressed mariabackup.encrypted_page_compressed --- storage/innobase/fil/fil0pagecompress.cc | 8 ++++---- storage/xtradb/fil/fil0pagecompress.cc | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index 25cd8e28a91..101f8fb0f31 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf) case PAGE_ZLIB_ALGORITHM: { uLong len = srv_page_size; - if (Z_OK != uncompress(tmp_buf, &len, + if (Z_OK == uncompress(tmp_buf, &len, buf + header_len, uLong(actual_size)) - && len != srv_page_size) { - return 0; + && len == srv_page_size) { + break; } } - break; + return 0; #ifdef HAVE_LZ4 case PAGE_LZ4_ALGORITHM: if (LZ4_decompress_safe(reinterpret_cast(buf) diff --git a/storage/xtradb/fil/fil0pagecompress.cc b/storage/xtradb/fil/fil0pagecompress.cc index 25cd8e28a91..101f8fb0f31 100644 --- a/storage/xtradb/fil/fil0pagecompress.cc +++ b/storage/xtradb/fil/fil0pagecompress.cc @@ -341,14 +341,14 @@ UNIV_INTERN ulint fil_page_decompress(byte* tmp_buf, byte* buf) case PAGE_ZLIB_ALGORITHM: { uLong len = srv_page_size; - if (Z_OK != uncompress(tmp_buf, &len, + if (Z_OK == uncompress(tmp_buf, &len, buf + header_len, uLong(actual_size)) - && len != srv_page_size) { - return 0; + && len == srv_page_size) { + break; } } - break; + return 0; #ifdef HAVE_LZ4 case PAGE_LZ4_ALGORITHM: if (LZ4_decompress_safe(reinterpret_cast(buf) From 9f4a4cb401980e2bd321c0680595e81087ad60d5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Thu, 20 Dec 2018 14:31:18 +0100 Subject: [PATCH 32/72] Cleanup recent mariabackup validation patches. - Refactor code to isolate page validation in page_is_corrupted() function. - Introduce --extended-validation parameter(default OFF) for mariabackup --backup to enable decryption of encrypted uncompressed pages during backup. - mariabackup would still always check checksum on encrypted data, it is needed to detect partially written pages. --- extra/mariabackup/fil_cur.cc | 155 +++++++++--------- extra/mariabackup/xtrabackup.cc | 10 ++ extra/mariabackup/xtrabackup.h | 1 + .../encrypted_page_corruption.test | 8 +- 4 files changed, 100 insertions(+), 74 deletions(-) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 637acfd2e22..b4393f7ffdd 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -265,6 +265,87 @@ xb_fil_cur_open( return(XB_FIL_CUR_SUCCESS); } +static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, fil_space_t *space) +{ + byte tmp_frame[UNIV_PAGE_SIZE_MAX]; + byte tmp_page[UNIV_PAGE_SIZE_MAX]; + + ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE); + + /* We ignore the doublewrite buffer pages.*/ + if (cursor->space_id == TRX_SYS_SPACE + && page_no >= FSP_EXTENT_SIZE + && page_no < FSP_EXTENT_SIZE * 3) { + return false; + } + + /* Validate page number. */ + if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no + && space->id != TRX_SYS_SPACE) { + /* On pages that are not all zero, the + page number must match. + + There may be a mismatch on tablespace ID, + because files may be renamed during backup. + We disable the page number check + on the system tablespace, because it may consist + of multiple files, and here we count the pages + from the start of each file.) + + The first 38 and last 8 bytes are never encrypted. */ + const ulint* p = reinterpret_cast(page); + const ulint* const end = reinterpret_cast( + page + cursor->page_size); + do { + if (*p++) { + return true; + } + } while (p != end); + + /* Whole zero page is valid. */ + return false; + } + + /* Validate encrypted pages. */ + if (mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) && + (space->crypt_data && space->crypt_data->type!= CRYPT_SCHEME_UNENCRYPTED)) { + + if (!fil_space_verify_crypt_checksum(page, cursor->zip_size)) + return true; + + /* Compressed encrypted need to be unencryped and uncompressed for verification. */ + if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED && !opt_extended_validation) + return false; + + memcpy(tmp_page, page, cursor->page_size); + + bool decrypted = false; + if (!fil_space_decrypt(space, tmp_frame,tmp_page, &decrypted)) { + return true; + } + + if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + return buf_page_is_corrupted(true, tmp_page, cursor->zip_size, space); + } + } + + if (page_type == FIL_PAGE_PAGE_COMPRESSED) { + memcpy(tmp_page, page, cursor->page_size); + } + + if (page_type == FIL_PAGE_PAGE_COMPRESSED || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + ulint decomp = fil_page_decompress(tmp_frame, tmp_page); + page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE); + + return (!decomp + || (decomp != srv_page_size && cursor->zip_size) + || page_type == FIL_PAGE_PAGE_COMPRESSED + || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || buf_page_is_corrupted(true, tmp_page, cursor->zip_size, space)); + } + + return buf_page_is_corrupted(true, page, cursor->zip_size, space); +} /************************************************************************ Reads and verifies the next block of pages from the source file. Positions the cursor after the last read non-corrupted page. @@ -284,8 +365,6 @@ xb_fil_cur_read( xb_fil_cur_result_t ret; ib_int64_t offset; ib_int64_t to_read; - byte tmp_frame[UNIV_PAGE_SIZE_MAX]; - byte tmp_page[UNIV_PAGE_SIZE_MAX]; cursor->read_filter->get_next_batch(&cursor->read_filter_ctxt, &offset, &to_read); @@ -347,78 +426,8 @@ read_retry: for (page = cursor->buf, i = 0; i < npages; page += cursor->page_size, i++) { ulint page_no = cursor->buf_page_no + i; - ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE); - if (cursor->space_id == TRX_SYS_SPACE - && page_no >= FSP_EXTENT_SIZE - && page_no < FSP_EXTENT_SIZE * 3) { - /* We ignore the doublewrite buffer pages */ - } else if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no - && space->id != TRX_SYS_SPACE) { - /* On pages that are not all zero, the - page number must match. - - There may be a mismatch on tablespace ID, - because files may be renamed during backup. - We disable the page number check - on the system tablespace, because it may consist - of multiple files, and here we count the pages - from the start of each file.) - - The first 38 and last 8 bytes are never encrypted. */ - const ulint* p = reinterpret_cast(page); - const ulint* const end = reinterpret_cast( - page + cursor->page_size); - do { - if (*p++) { - goto corrupted; - } - } while (p != end); - } else if (mach_read_from_4( - page - + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) - && space->crypt_data - && space->crypt_data->type - != CRYPT_SCHEME_UNENCRYPTED - && fil_space_verify_crypt_checksum( - page, cursor->zip_size)) { - bool decrypted = false; - - memcpy(tmp_page, page, cursor->page_size); - - if (!fil_space_decrypt(space, tmp_frame, - tmp_page, &decrypted)) { - goto corrupted; - } - - if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { - goto page_decomp; - } - - if (buf_page_is_corrupted( - true, tmp_page, cursor->zip_size, space)) { - goto corrupted; - } - } else if (page_type == FIL_PAGE_PAGE_COMPRESSED) { - memcpy(tmp_page, page, cursor->page_size); -page_decomp: - ulint decomp = fil_page_decompress(tmp_frame, tmp_page); - page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE); - - if (!decomp - || (decomp != srv_page_size && cursor->zip_size) - || page_type == FIL_PAGE_PAGE_COMPRESSED - || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED - || buf_page_is_corrupted(true, tmp_page, - cursor->zip_size, - space)) { - goto corrupted; - } - - } else if (page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED - || buf_page_is_corrupted(true, page, - cursor->zip_size, space)) { -corrupted: + if (page_is_corrupted(page, page_no, cursor, space)){ retry_count--; if (retry_count == 0) { diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index be022f7afa2..d2b241a28f5 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -206,6 +206,7 @@ char* log_ignored_opt = NULL; extern my_bool opt_use_ssl; my_bool opt_ssl_verify_server_cert; +my_bool opt_extended_validation; /* === metadata of backup === */ #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" @@ -510,6 +511,7 @@ enum options_xtrabackup OPT_XTRA_DATABASES_FILE, OPT_XTRA_CREATE_IB_LOGFILE, OPT_XTRA_PARALLEL, + OPT_XTRA_EXTENDED_VALIDATION, OPT_XTRA_STREAM, OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS_THREADS, @@ -976,6 +978,14 @@ struct my_option xb_server_options[] = (G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT, REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0}, + {"extended_validation", OPT_XTRA_EXTENDED_VALIDATION, + "Enable extended validation for Innodb data pages during backup phase." + "Will slow down backup considerably, in case encryption is used.", + (G_PTR*)&opt_extended_validation, + (G_PTR*)&opt_extended_validation, + 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, + + {"log", OPT_LOG, "Ignored option for MySQL option compatibility", (G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 9af7c861dd7..2af5396fa06 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -128,6 +128,7 @@ extern my_bool opt_noversioncheck; extern my_bool opt_no_backup_locks; extern my_bool opt_decompress; extern my_bool opt_remove_original; +extern my_bool opt_extended_validation; extern char *opt_incremental_history_name; extern char *opt_incremental_history_uuid; diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test index f87e12323da..7ee4e8c5d58 100644 --- a/mysql-test/suite/mariabackup/encrypted_page_corruption.test +++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test @@ -60,7 +60,7 @@ let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log; --disable_result_log --error 1 -exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog; +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog; --enable_result_log @@ -68,6 +68,12 @@ exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir= --let SEARCH_FILE=$backuplog --source include/search_pattern_in_file.inc remove_file $backuplog; +rmdir $targetdir; + +# Due to very constructed nature of the "corruption" (faking checksums), the "corruption" won't be found without --extended-validation +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir; +--enable_result_log drop table t1; rmdir $targetdir; From 2999492c3278528ceb9f37bd6cfca5ca5295ef9a Mon Sep 17 00:00:00 2001 From: Oleksandr Byelkin Date: Thu, 20 Dec 2018 11:22:13 +0100 Subject: [PATCH 33/72] MDEV-16036: Debug assertion failed in resignal on create temporary table Reising condition on NOTW controlled by OPTION_SQL_NOTES. --- mysql-test/main/sp.result | 35 +++++++++++++++++++++++++++++++++++ mysql-test/main/sp.test | 34 ++++++++++++++++++++++++++++++++++ sql/sql_signal.cc | 10 ++++++---- 3 files changed, 75 insertions(+), 4 deletions(-) diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index 64668e0c8ec..b7a2f865c1d 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -8731,3 +8731,38 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP FUNCTION f1; +# +# MDEV-16036: Debug assertion failed in resignal on create +# temporary table +# +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +CREATE or replace procedure p4() +AS +CONTINUE HANDLER FOR SQLWARNING +BEGIN +NULL; +END; +EXIT HANDLER FOR OTHERS -- SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; +SELECT @sqlstate, @errno, @text; +SHOW WARNINGS; +RESIGNAL; -- cause DBG_ASSERT failed +END; +BEGIN +CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +call p4(); +call p4(); +@sqlstate @errno @text +42S01 1050 Table 't1' already exists +Level Code Message +Note 1050 Table 't1' already exists +Warnings: +Note 1050 Table 't1' already exists +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; +# End of 10.3 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 72e6ad6bcba..98b85983687 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -10252,3 +10252,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # MDEV-16036: Debug assertion failed in resignal on create +--echo # temporary table +--echo # + +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +delimiter /; +CREATE or replace procedure p4() +AS + CONTINUE HANDLER FOR SQLWARNING + BEGIN + NULL; + END; + EXIT HANDLER FOR OTHERS -- SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SELECT @sqlstate, @errno, @text; + SHOW WARNINGS; + RESIGNAL; -- cause DBG_ASSERT failed + END; +BEGIN + CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +delimiter ;/ +call p4(); +call p4(); +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; + +--echo # End of 10.3 tests diff --git a/sql/sql_signal.cc b/sql/sql_signal.cc index a92d40f6bb3..1317308ceb9 100644 --- a/sql/sql_signal.cc +++ b/sql/sql_signal.cc @@ -343,13 +343,15 @@ bool Sql_cmd_common_signal::raise_condition(THD *thd, Sql_condition *cond) if (eval_signal_informations(thd, cond)) DBUG_RETURN(result); - /* SIGNAL should not signal WARN_LEVEL_NOTE */ - DBUG_ASSERT((cond->m_level == Sql_condition::WARN_LEVEL_WARN) || - (cond->m_level == Sql_condition::WARN_LEVEL_ERROR)); + /* SIGNAL should not signal WARN_LEVEL_NOTE, but RESIGNAL can */ + DBUG_ASSERT(cond->m_level == Sql_condition::WARN_LEVEL_ERROR || + cond->m_level != Sql_condition::WARN_LEVEL_NOTE || + sql_command_code() == SQLCOM_RESIGNAL); (void) thd->raise_condition(cond); - if (cond->m_level == Sql_condition::WARN_LEVEL_WARN) + if (cond->m_level == Sql_condition::WARN_LEVEL_WARN || + cond->m_level == Sql_condition::WARN_LEVEL_NOTE) { my_ok(thd); result= FALSE; From e631ea4a7c597557f2be6b9cd1118f4f3a71dccd Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Fri, 21 Dec 2018 09:41:23 +0400 Subject: [PATCH 34/72] MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS Also fixes: MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS The problem was introduced by: commit f033fbd9f2366619c52186a1a902066495539141 Changed the test case for MDEV-15571 It was later fixed, but in 10.3 only: commit ce2cf855bfc0d9c8adb64f02a7b32ddd81f9948a MDEV-16043 Assertion thd->Item_change_list::is_empty() failed in mysql_parse upon SELECT from a view reading from a versioned table This patch is a backport of ce2cf855bfc0d9c8adb64f02a7b32ddd81f9948a to 10.2 --- mysql-test/r/ps_error.result | 73 ++++++++++++++++++++++++++++++++++++ mysql-test/t/ps_error.test | 66 ++++++++++++++++++++++++++++++++ sql/sql_select.cc | 8 ++-- 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 mysql-test/r/ps_error.result create mode 100644 mysql-test/t/ps_error.test diff --git a/mysql-test/r/ps_error.result b/mysql-test/r/ps_error.result new file mode 100644 index 00000000000..c3c312e82f5 --- /dev/null +++ b/mysql-test/r/ps_error.result @@ -0,0 +1,73 @@ +# +# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +# +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +a +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +# +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +SELECT * FROM t1; +a +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/t/ps_error.test b/mysql-test/t/ps_error.test new file mode 100644 index 00000000000..5efb5d36137 --- /dev/null +++ b/mysql-test/t/ps_error.test @@ -0,0 +1,66 @@ +# +# Tests related to PS returning errors rather than doing successfull execution +# + +--echo # +--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +--echo # + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +--echo # + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +--source include/restart_mysqld.inc +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +SELECT * FROM t1; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/sql/sql_select.cc b/sql/sql_select.cc index dc948ff676a..221bdc9480c 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1318,10 +1318,12 @@ JOIN::optimize_inner() /* Convert all outer joins to inner joins if possible */ conds= simplify_joins(this, join_list, conds, TRUE, FALSE); - if (thd->is_error()) - DBUG_RETURN(1); - if (select_lex->save_leaf_tables(thd)) + if (thd->is_error() || select_lex->save_leaf_tables(thd)) + { + if (arena) + thd->restore_active_arena(arena, &backup); DBUG_RETURN(1); + } build_bitmap_for_nested_joins(join_list, 0); sel->prep_where= conds ? conds->copy_andor_structure(thd) : 0; From 40a094e4a8fdea2f07231faa0d5911ed023a320b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 21 Dec 2018 09:40:36 +0200 Subject: [PATCH 35/72] Relax a too tight suppression When using a wrong key, all encrypted pages will look corrupted, and occasionally the test may access other pages than the clustered index root page. --- mysql-test/suite/encryption/r/innodb-missing-key.result | 2 +- mysql-test/suite/encryption/t/innodb-missing-key.test | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 45a01f03c2b..da19f65dfb5 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,5 +1,5 @@ call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); -call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1"); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:[1-9][0-9]* in file .*test.t[12].ibd looks corrupted; key_version=1"); # Start server with keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index c68604fdcf5..72c24802ce9 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -8,7 +8,7 @@ # call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); -call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:3 in file .*test.t[12].ibd looks corrupted; key_version=1"); +call mtr.add_suppression("InnoDB: Encrypted page [1-9][0-9]*:[1-9][0-9]* in file .*test.t[12].ibd looks corrupted; key_version=1"); --echo --echo # Start server with keys2.txt From ed166f53fa6fb6911b7d1cc5bfdccd91563929b4 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 20 Dec 2018 17:42:16 +0300 Subject: [PATCH 36/72] MDEV-18043 data race in os_event os_event::is_set(): protect os_event::m_set with os_event::mutex --- storage/innobase/os/os0event.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/storage/innobase/os/os0event.cc b/storage/innobase/os/os0event.cc index 71b86df24a4..f2931239c3a 100644 --- a/storage/innobase/os/os0event.cc +++ b/storage/innobase/os/os0event.cc @@ -126,7 +126,10 @@ struct os_event { /** @return true if the event is in the signalled state. */ bool is_set() const UNIV_NOTHROW { - return(m_set); + mutex.enter(); + bool is_set = m_set; + mutex.exit(); + return is_set; } private: @@ -224,7 +227,7 @@ private: int64_t signal_count; /*!< this is incremented each time the event becomes signaled */ - EventMutex mutex; /*!< this mutex protects + mutable EventMutex mutex; /*!< this mutex protects the next fields */ From 0dafcf529c14b42e2e63d1634da79e0700be16a1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Thu, 20 Dec 2018 17:58:50 +0300 Subject: [PATCH 37/72] cleanup os_event --- storage/innobase/os/os0event.cc | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/storage/innobase/os/os0event.cc b/storage/innobase/os/os0event.cc index f2931239c3a..4e18a48332e 100644 --- a/storage/innobase/os/os0event.cc +++ b/storage/innobase/os/os0event.cc @@ -31,8 +31,6 @@ Created 2012-09-23 Sunny Bains #include #endif /* _WIN32 */ -#include - /** The number of microsecnds in a second. */ static const ulint MICROSECS_IN_A_SECOND = 1000000; @@ -44,9 +42,6 @@ typedef CONDITION_VARIABLE os_cond_t; typedef pthread_cond_t os_cond_t; #endif /* _WIN32 */ -typedef std::list > os_event_list_t; -typedef os_event_list_t::iterator event_iter_t; - /** InnoDB condition variable. */ struct os_event { os_event(const char* name) UNIV_NOTHROW; @@ -234,9 +229,6 @@ private: os_cond_t cond_var; /*!< condition variable is used in waiting for the event */ -public: - event_iter_t event_iter; /*!< For O(1) removal from - list */ protected: // Disable copying os_event(const os_event&); @@ -544,8 +536,6 @@ os_event_destroy( os_event_t& event) /*!< in/own: event to free */ { - if (event != NULL) { - UT_DELETE(event); - event = NULL; - } + UT_DELETE(event); + event = NULL; } From c5bb6024a78ac5cea6a4e4d7767946e7f01e880a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 21 Dec 2018 11:54:53 +0200 Subject: [PATCH 38/72] MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) btr_node_ptr_max_size(): Do not reserve extra space for indexed VARCHAR(0) columns. --- mysql-test/suite/innodb/r/data_types.result | 12 +++++++++++- mysql-test/suite/innodb/t/data_types.test | 11 ++++++++++- storage/innobase/btr/btr0cur.cc | 15 ++++++++++++++- 3 files changed, 35 insertions(+), 3 deletions(-) diff --git a/mysql-test/suite/innodb/r/data_types.result b/mysql-test/suite/innodb/r/data_types.result index 4e919e37cee..1394431b09d 100644 --- a/mysql-test/suite/innodb/r/data_types.result +++ b/mysql-test/suite/innodb/r/data_types.result @@ -77,7 +77,9 @@ t1_VARCHAR_500_BINARY VARCHAR(500) BINARY, t1_YEAR_2 YEAR(2), t1_YEAR_4 YEAR(4), t1_CHAR_0 CHAR(0), -t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 +t1_MYSQL_0 CHAR(0) CHARACTER SET utf8, +t1_VARCHAR_0 VARCHAR(0), +t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8 ) ENGINE=InnoDB; Warnings: Note 1287 'YEAR(2)' is deprecated and will be removed in a future release. Please use YEAR(4) instead @@ -151,10 +153,12 @@ t1_TINYINT DATA_INT t1_TINYINT_UNSIGNED DATA_INT UNSIGNED t1_TINYTEXT DATA_BLOB t1_VARBINARY_100 DATA_BINARY +t1_VARCHAR_0 DATA_VARCHAR t1_VARCHAR_10 DATA_VARCHAR t1_VARCHAR_10_BINARY DATA_VARMYSQL t1_VARCHAR_500 DATA_VARCHAR t1_VARCHAR_500_BINARY DATA_VARMYSQL +t1_VARMYSQL_0 DATA_VARMYSQL t1_YEAR_2 DATA_INT UNSIGNED t1_YEAR_4 DATA_INT UNSIGNED DROP TABLE t1; @@ -164,3 +168,9 @@ DROP TABLE t1; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; INSERT INTO t1 VALUES (''); DROP TABLE t1; +# +# MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) +# +CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; diff --git a/mysql-test/suite/innodb/t/data_types.test b/mysql-test/suite/innodb/t/data_types.test index c8e80c9db27..cfdd5201af2 100644 --- a/mysql-test/suite/innodb/t/data_types.test +++ b/mysql-test/suite/innodb/t/data_types.test @@ -90,7 +90,9 @@ CREATE TABLE t1 t1_YEAR_2 YEAR(2), t1_YEAR_4 YEAR(4), t1_CHAR_0 CHAR(0), - t1_MYSQL_0 CHAR(0) CHARACTER SET utf8 + t1_MYSQL_0 CHAR(0) CHARACTER SET utf8, + t1_VARCHAR_0 VARCHAR(0), + t1_VARMYSQL_0 VARCHAR(0) CHARACTER SET utf8 ) ENGINE=InnoDB; INSERT INTO t1 () VALUES (); @@ -127,3 +129,10 @@ DROP TABLE t1; CREATE TABLE t1 (c CHAR(0), KEY(c)) ENGINE=InnoDB; INSERT INTO t1 VALUES (''); DROP TABLE t1; + +--echo # +--echo # MDEV-18039 Assertion failed in btr_node_ptr_max_size for VARCHAR(0) +--echo # +CREATE TABLE t1 (c VARCHAR(0), KEY(c)) ENGINE=InnoDB; +INSERT INTO t1 VALUES (''); +DROP TABLE t1; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 3f26803d14b..9cf42a93800 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -754,9 +754,20 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) field_max_size = dict_col_get_max_size(col); if (UNIV_UNLIKELY(!field_max_size)) { switch (col->mtype) { + case DATA_VARCHAR: + if (!comp + && (!strcmp(index->table->name.m_name, + "SYS_FOREIGN") + || !strcmp(index->table->name.m_name, + "SYS_FOREIGN_COLS"))) { + break; + } + /* fall through */ + case DATA_VARMYSQL: case DATA_CHAR: case DATA_MYSQL: - /* CHAR(0) is a possible data type. + /* CHAR(0) and VARCHAR(0) are possible + data type definitions in MariaDB. The InnoDB internal SQL parser maps CHAR to DATA_VARCHAR, so DATA_CHAR (or DATA_MYSQL) is only coming from the @@ -772,6 +783,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) } continue; } + /* SYS_FOREIGN.ID is defined as CHAR in the InnoDB internal SQL parser, which translates into the incorrect VARCHAR(0). InnoDB does @@ -788,6 +800,7 @@ static ulint btr_node_ptr_max_size(const dict_index_t* index) || !strcmp(index->table->name.m_name, "SYS_FOREIGN_COLS")); ut_ad(!comp); + ut_ad(col->mtype == DATA_VARCHAR); rec_max_size += (srv_page_size == UNIV_PAGE_SIZE_MAX) ? REDUNDANT_REC_MAX_DATA_SIZE From 37b1b065f448db90fecc8e7a51cf52d22f3b4369 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 21 Dec 2018 11:29:25 +0100 Subject: [PATCH 39/72] TokuDB: generate tokudb.cnf unconditionally it's listed in MYSQL_ADD_PLUGIN() declaration, so it must always exist, jemalloc or not. --- storage/tokudb/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/tokudb/CMakeLists.txt b/storage/tokudb/CMakeLists.txt index f3166ca8c0b..3b4e4fb967e 100644 --- a/storage/tokudb/CMakeLists.txt +++ b/storage/tokudb/CMakeLists.txt @@ -78,7 +78,6 @@ ELSEIF(LIBJEMALLOC STREQUAL jemalloc) IF(INSTALL_SYSCONFDIR) SET(systemd_env "Environment=\"LD_PRELOAD=${LIBJEMALLOC_PATH}\"") SET(cnf_malloc_lib "malloc-lib=${LIBJEMALLOC_PATH}") - CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) CONFIGURE_FILE(tokudb.conf.in tokudb.conf @ONLY) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/tokudb.conf DESTINATION ${INSTALL_SYSCONFDIR}/systemd/system/mariadb.service.d/ @@ -86,6 +85,8 @@ ELSEIF(LIBJEMALLOC STREQUAL jemalloc) ENDIF() ENDIF() +CONFIGURE_FILE(tokudb.cnf.in tokudb.cnf @ONLY) + MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-shadow") MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-vla" DEBUG) MY_CHECK_AND_SET_COMPILER_FLAG("-Wno-implicit-fallthrough") From 2cf30866d7482d83b398e103b444b00661c306c7 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Fri, 21 Dec 2018 13:29:36 +0100 Subject: [PATCH 40/72] MDEV-14576 Include full name of object in message about incorrect value for column update engines/ suites followup for c4ab352b670 --- .../funcs/r/in_number_boundary_error.result | 12 +- .../r/in_number_decimal_boundary_error.result | 8 +- .../engines/iuds/r/insert_decimal.result | 12 +- .../suite/engines/iuds/r/insert_number.result | 204 +++++++++--------- .../suite/engines/iuds/r/insert_year.result | 16 +- .../engines/iuds/r/update_decimal.result | 4 +- storage/tokudb/mysql-test/tokudb/disabled.def | 4 +- 7 files changed, 130 insertions(+), 130 deletions(-) diff --git a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result index 53964697506..b1c46a3a398 100644 --- a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result +++ b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result @@ -7,7 +7,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -26,7 +26,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -45,7 +45,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -64,7 +64,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -83,7 +83,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -102,7 +102,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows diff --git a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result index 62ad9a568f9..0c9ae5453e3 100644 --- a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result +++ b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result @@ -7,7 +7,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -27,7 +27,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -47,7 +47,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -67,7 +67,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index a341de58946..860fa8a2c4c 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -110,15 +110,15 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 1 Warning 1264 Out of range value for column 'c2' at row 1 Warning 1264 Out of range value for column 'c3' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c1' at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c2' at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c3' at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2 Note 1265 Data truncated for column 'c1' at row 3 Note 1265 Data truncated for column 'c2' at row 3 Note 1265 Data truncated for column 'c3' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c1' at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c2' at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c3' at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 diff --git a/mysql-test/suite/engines/iuds/r/insert_number.result b/mysql-test/suite/engines/iuds/r/insert_number.result index d3d96082566..1355812649a 100644 --- a/mysql-test/suite/engines/iuds/r/insert_number.result +++ b/mysql-test/suite/engines/iuds/r/insert_number.result @@ -12,16 +12,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT IGNORE INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT IGNORE INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT IGNORE INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -40,15 +40,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT IGNORE INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT IGNORE INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -1378,22 +1378,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT IGNORE INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT IGNORE INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT IGNORE INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT IGNORE INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -5621,16 +5621,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -5649,15 +5649,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -6987,22 +6987,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -11321,16 +11321,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -11349,15 +11349,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -12687,22 +12687,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -17126,16 +17126,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -17154,15 +17154,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -18492,22 +18492,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -23036,16 +23036,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -23064,15 +23064,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -24402,22 +24402,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -28946,16 +28946,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -28974,15 +28974,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -30312,22 +30312,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result index ea6e10d130b..c7a0dbcba86 100644 --- a/mysql-test/suite/engines/iuds/r/insert_year.result +++ b/mysql-test/suite/engines/iuds/r/insert_year.result @@ -60,12 +60,12 @@ Warning 1264 Out of range value for column 'c1' at row 6 Warning 1264 Out of range value for column 'c2' at row 6 INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; Warnings: -Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 Warning 1264 Out of range value for column 'c1' at row 2 Warning 1264 Out of range value for column 'c2' at row 2 INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); @@ -3319,12 +3319,12 @@ Warning 1264 Out of range value for column 'c1' at row 6 Warning 1264 Out of range value for column 'c2' at row 6 INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; Warnings: -Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 Warning 1264 Out of range value for column 'c1' at row 2 Warning 1264 Out of range value for column 'c2' at row 2 INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); diff --git a/mysql-test/suite/engines/iuds/r/update_decimal.result b/mysql-test/suite/engines/iuds/r/update_decimal.result index 7b4a3ea9079..8bedcf8ab51 100644 --- a/mysql-test/suite/engines/iuds/r/update_decimal.result +++ b/mysql-test/suite/engines/iuds/r/update_decimal.result @@ -334,7 +334,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555' UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3; UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111'; Warnings: -Warning 1366 Incorrect decimal value: 'asdf' for column 'c3' at row 1 +Warning 1366 Incorrect decimal value: 'asdf' for column `test`.`t1`.`c3` at row 1 SELECT c3 FROM t1; c3 0 @@ -1099,7 +1099,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555' UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3; UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111'; Warnings: -Warning 1366 Incorrect double value: 'asdf' for column 'c3' at row 1 +Warning 1366 Incorrect double value: 'asdf' for column `test`.`t1`.`c3` at row 1 SELECT c3 FROM t1; c3 0 diff --git a/storage/tokudb/mysql-test/tokudb/disabled.def b/storage/tokudb/mysql-test/tokudb/disabled.def index 89f6992d26d..4f759001151 100644 --- a/storage/tokudb/mysql-test/tokudb/disabled.def +++ b/storage/tokudb/mysql-test/tokudb/disabled.def @@ -30,5 +30,5 @@ i_s_tokudb_lock_waits_released: unstable, race conditions i_s_tokudb_locks_released: unstable, race conditions row_format: n/a nonflushing_analyze_debug: Freezes in MariaDB 10.0 -tokudb.change_column_all_1000_1: We are too lazy to fix this properly -tokudb.change_column_all_1000_10: We are too lazy to fix this properly +change_column_all_1000_1: We are too lazy to fix this properly +change_column_all_1000_10: We are too lazy to fix this properly From 779151db80d5512c922227eeb32cb0164f9f01fa Mon Sep 17 00:00:00 2001 From: Teodor Mircea Ionita Date: Thu, 22 Nov 2018 16:26:03 +0200 Subject: [PATCH 41/72] autobake-deb: fixes for AWS SDK build eligibility checks. Add check for git command and test for internet connectivity using bash /dev/tcp interface, instead of wget and curl which might not be available, thus reducing dependencies for this script. --- 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 4e66f13615f..a08f1a404b7 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -102,7 +102,7 @@ fi # AWS SDK also requires the build machine to have network access and git, so # it cannot be part of the base version included in Linux distros, but a pure # custom built plugin. -if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && wget --timeout 15 --tries 1 --quiet --output-document /dev/null https://github.com/ +if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && $(timeout 3s bash -c 'cat > debian/control From 773479f5b305cea938b3b5835923ca3e46454a44 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 21 Dec 2018 11:18:53 +0100 Subject: [PATCH 42/72] Add test for partial backup for partitioned table. --- extra/mariabackup/xtrabackup.cc | 23 ++++++---- .../mariabackup/partition_partial.result | 31 +++++++++++++ .../suite/mariabackup/partition_partial.test | 44 +++++++++++++++++++ 3 files changed, 90 insertions(+), 8 deletions(-) create mode 100644 mysql-test/suite/mariabackup/partition_partial.result create mode 100644 mysql-test/suite/mariabackup/partition_partial.test diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 9769c875fe3..9646e0eac03 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -1469,7 +1469,7 @@ debug_sync_point(const char *name) } -static std::vector tables_for_export; +static std::set tables_for_export; static void append_export_table(const char *dbname, const char *tablename, bool is_remote) { @@ -1481,7 +1481,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool char *p=strrchr(buf, '.'); if (p) *p=0; - tables_for_export.push_back(ut_get_name(0,buf)); + std::string name=ut_get_name(0, buf); + /* Strip partition name comment from table name, if any */ + if (ends_with(name.c_str(), "*/")) + { + size_t pos= name.rfind("/*"); + if (pos != std::string::npos) + name.resize(pos); + } + tables_for_export.insert(name); } } @@ -1496,9 +1504,10 @@ static int create_bootstrap_file() fputs("SET NAMES UTF8;\n",f); enumerate_ibd_files(append_export_table); - for (size_t i= 0; i < tables_for_export.size(); i++) + for (std::set::iterator it = tables_for_export.begin(); + it != tables_for_export.end(); it++) { - const char *tab = tables_for_export[i].c_str(); + const char *tab = it->c_str(); fprintf(f, "BEGIN NOT ATOMIC " "DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;" @@ -1528,7 +1537,7 @@ static int prepare_export() snprintf(cmdline, sizeof cmdline, IF_WIN("\"","") "\"%s\" --mysqld \"%s\" " " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." - " --innodb --innodb-fast-shutdown=0" + " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, @@ -1540,7 +1549,7 @@ static int prepare_export() sprintf(cmdline, IF_WIN("\"","") "\"%s\" --mysqld" " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." - " --innodb --innodb-fast-shutdown=0" + " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, @@ -5851,7 +5860,6 @@ check_all_privileges() mysql_free_result(result); int check_result = PRIVILEGE_OK; - bool reload_checked = false; /* FLUSH TABLES WITH READ LOCK */ if (!opt_no_lock) @@ -5859,7 +5867,6 @@ check_all_privileges() check_result |= check_privilege( granted_privileges, "RELOAD", "*", "*"); - reload_checked = true; } if (!opt_no_lock) diff --git a/mysql-test/suite/mariabackup/partition_partial.result b/mysql-test/suite/mariabackup/partition_partial.result new file mode 100644 index 00000000000..62b7adf75f8 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.result @@ -0,0 +1,31 @@ +CREATE TABLE t1(i INT) ENGINE INNODB +PARTITION BY RANGE (i) +(PARTITION p1 VALUES LESS THAN (100), +PARTITION p2 VALUES LESS THAN (200), +PARTITION p3 VALUES LESS THAN (300), +PARTITION p4 VALUES LESS THAN (400)); +INSERT INTO t1 VALUES (1), (101), (201), (301); +# xtrabackup backup +INSERT INTO t1 VALUES (1), (101), (201), (301); +# xtrabackup prepare +CREATE TABLE t1_placeholder (i INT) ENGINE INNODB; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p4 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p3 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p2 WITH TABLE t1_placeholder; +ALTER TABLE t1_placeholder DISCARD TABLESPACE; +ALTER TABLE t1_placeholder IMPORT TABLESPACE; +ALTER TABLE t1 EXCHANGE PARTITION p1 WITH TABLE t1_placeholder; +SELECT * FROM t1; +i +1 +101 +201 +301 +DROP TABLE t1; +DROP TABLE t1_placeholder; diff --git a/mysql-test/suite/mariabackup/partition_partial.test b/mysql-test/suite/mariabackup/partition_partial.test new file mode 100644 index 00000000000..8e288ec997f --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.test @@ -0,0 +1,44 @@ +#--source include/innodb_page_size.inc + +# import partitioned table from table from partial backup + +CREATE TABLE t1(i INT) ENGINE INNODB +PARTITION BY RANGE (i) +(PARTITION p1 VALUES LESS THAN (100), + PARTITION p2 VALUES LESS THAN (200), + PARTITION p3 VALUES LESS THAN (300), + PARTITION p4 VALUES LESS THAN (400)); + +INSERT INTO t1 VALUES (1), (101), (201), (301); + +echo # xtrabackup backup; + +let $targetdir=$MYSQLTEST_VARDIR/tmp/backup; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup "--tables=test.t1" --target-dir=$targetdir; +--enable_result_log +INSERT INTO t1 VALUES (1), (101), (201), (301); + + +echo # xtrabackup prepare; +--disable_result_log +exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --defaults-group-suffix=.1 --prepare --export --target-dir=$targetdir; +--enable_result_log + + +let $MYSQLD_DATADIR= `select @@datadir`; +CREATE TABLE t1_placeholder (i INT) ENGINE INNODB; +let $i=4; +while($i) +{ + eval ALTER TABLE t1_placeholder DISCARD TABLESPACE; + copy_file $targetdir/test/t1#P#p$i.cfg $MYSQLD_DATADIR/test/t1_placeholder.cfg; + copy_file $targetdir/test/t1#P#p$i.ibd $MYSQLD_DATADIR/test/t1_placeholder.ibd; + eval ALTER TABLE t1_placeholder IMPORT TABLESPACE; + eval ALTER TABLE t1 EXCHANGE PARTITION p$i WITH TABLE t1_placeholder; + dec $i; +} +SELECT * FROM t1; +DROP TABLE t1; +DROP TABLE t1_placeholder; +rmdir $targetdir; From 242fedf595387db6566af56658e4c6c9a1b205e7 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 21 Dec 2018 18:58:23 +0200 Subject: [PATCH 43/72] Follow-up for MDEV-14576 - updated test result --- mysql-test/suite/storage_engine/type_bool.result | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mysql-test/suite/storage_engine/type_bool.result b/mysql-test/suite/storage_engine/type_bool.result index 87308ed63fc..10cfc08102f 100644 --- a/mysql-test/suite/storage_engine/type_bool.result +++ b/mysql-test/suite/storage_engine/type_bool.result @@ -42,8 +42,8 @@ b1 b2 0 0 INSERT INTO t1 (b1,b2) VALUES ('a','b'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'b1' at row 1 -Warning 1366 Incorrect integer value: 'b' for column 'b2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`b1` at row 1 +Warning 1366 Incorrect integer value: 'b' for column `test`.`t1`.`b2` at row 1 SELECT b1,b2 FROM t1; b1 b2 -1 -2 From b82df7117426ec35a34569994a4a6544dde78efc Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 21 Dec 2018 18:59:11 +0200 Subject: [PATCH 44/72] Updated list of unstable tests for 10.2.20 --- mysql-test/unstable-tests | 114 ++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 65 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 2e517228bfd..59a287547d4 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,21 +23,24 @@ # ############################################################################## -# Based on 10.2 85baa03c60d5e9da4890344f10fa0437337cb265 +# Based on 10.2 2cf30866d7482d83b398e103b444b00661c306c7 main.alter_table : Modified in 10.2.19 +main.alter_table_errors : Modified in 10.2.20 main.alter_table_trans : MDEV-12084 - timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 main.auto_increment_ranges_innodb : Modified in 10.2.19 -main.connect : MDEV-17282 - Wrong result +main.bigint : Modified in 10.2.20 +main.check : Modified in 10.2.20 +main.connect : MDEV-17282 - Wrong result; modified in 10.2.20 main.connect2 : MDEV-13885 - Server crash -main.constraints : Modified in 10.2.18 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout +main.create_drop_event : MDEV-16271 - Wrong result main.create_or_replace : Modified in 10.2.19 main.cte_nonrecursive : Modified in 10.2.19 -main.cte_recursive : Modified in 10.2.19 +main.cte_recursive : Modified in 10.2.20 main.ctype_latin1 : Modified in 10.2.19 main.ctype_uca : Modified in 10.2.19 main.ctype_ucs : MDEV-17681 - Data too long for column @@ -54,20 +57,18 @@ main.events_restart : MDEV-12236 - Server shutdown problem main.events_slowlog : MDEV-12821 - Wrong result main.flush : Modified in 10.2.19 main.func_concat : Modified in 10.2.19 -main.func_isnull : Modified in 10.2.18 +main.func_default : Modified in 10.2.20 main.func_json : Modified in 10.2.19 -main.func_time : Modified in 10.2.18 -main.gis : MDEV-13411 - wrong result on P8; modified in 10.2.18 -main.gis-precise : Modified in 10.2.18 -main.grant : Modified in 10.2.18 +main.func_time : Modified in 10.2.20 +main.gis : MDEV-13411 - wrong result on P8 +main.grant5 : Modified in 10.2.20 main.group_by : Modified in 10.2.19 -main.group_min_max : Modified in 10.2.18 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Plan mismatch main.index_merge_myisam : Modified in 10.2.19 +main.information_schema : Modified in 10.2.20 main.innodb_mysql_lock : MDEV-7861 - Wrong result -main.join : Modified in 10.2.18 main.kill-2 : MDEV-13257 - Wrong result main.kill_processlist-6619 : MDEV-10793 - Wrong result main.lock : Modified in 10.2.19 @@ -78,10 +79,8 @@ main.lowercase_fs_off : Modified in 10.2.19 main.mdev-504 : MDEV-15171 - warning main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.mysql : Modified in 10.2.18 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_not_windows : Modified in 10.2.18 main.mysql_upgrade_noengine : MDEV-14355 - Wrong result main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error main.mysqldump : MDEV-14800 - Stack smashing detected @@ -93,43 +92,43 @@ main.openssl_1 : MDEV-13492 - Unknown SSL error main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 main.order_by_optimizer_innodb : MDEV-10683 - Wrong result main.order_by_zerolength-4285 : Modified in 10.2.19 +main.partition : Modified in 10.2.20 +main.partition_alter : Modified in 10.2.20 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock main.partition_explicit_prune : Modified in 10.2.19 +main.partition_innodb : Modified in 10.2.20 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings -main.ps : MDEV-11017 - Wrong result; modified in 10.2.18 +main.ps : MDEV-11017 - Wrong result +main.ps_error : Added in 10.2.20 main.query_cache : MDEV-16180 - Wrong result main.query_cache_debug : MDEV-15281 - Query cache is disabled -main.range : Modified in 10.2.18 main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away -main.selectivity : Modified in 10.2.18 main.set_statement : MDEV-13183 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_explain : MDEV-10674 - Wrong result code -main.sp : MDEV-7866 - Mismatch; modified in 10.2.18 +main.sp : MDEV-7866 - Mismatch main.sp_notembedded : MDEV-10607 - internal error -main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.2.18 +main.sp-security : MDEV-10607 - sporadic "can't connect" main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cert_verify : MDEV-13735 - Server crash main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_connect : MDEV-13492 - Unknown SSL error main.ssl_timeout : MDEV-11244 - Crash -main.stat_tables : Modified in 10.2.18 +main.stat_tables : Modified in 10.2.20 main.stat_tables_par : MDEV-13266 - Wrong result main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.status : MDEV-13255 - Wrong result -main.subselect_extra_no_semijoin : Modified in 10.2.18 main.subselect_innodb : MDEV-10614 - Sporadic wrong results main.tc_heuristic_recover : MDEV-14189 - Wrong result main.type_blob : MDEV-15195 - Wrong result main.type_datetime : Modified in 10.2.19 main.type_datetime_hires : MDEV-10687 - Timeout -main.type_float : Modified in 10.2.18 -main.type_newdecimal : Modified in 10.2.19 +main.type_newdecimal : Modified in 10.2.20 main.type_year : Modified in 10.2.19 +main.udf : Modified in 10.2.20 main.userstat : MDEV-12904 - SSL errors -main.win : Modified in 10.2.19 -main.win_lead_lag : Modified in 10.2.18 +main.win : Modified in 10.2.20 main.win_percent_cume : Modified in 10.2.19 main.win_rank : Modified in 10.2.19 main.win_std : Modified in 10.2.19 @@ -179,7 +178,6 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL serv connect.pivot : MDEV-14803 - Failed to discover table connect.vcol : MDEV-12374 - Fails on Windows -connect.xml2 : Modified in 10.2.18 connect.zip : MDEV-13884 - Wrong result #---------------------------------------------------------------- @@ -188,7 +186,7 @@ encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16 encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result encryption.innochecksum : MDEV-13644 - Assertion failure -encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash +encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash; modified in 10.2.20 encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb_encrypt_log : MDEV-13725 - Wrong result encryption.innodb_encryption : MDEV-15675 - Timeout @@ -198,7 +196,7 @@ encryption.innodb_encryption-page-compression : MDEV-12630 - crash or asserti encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash encryption.innodb_first_page : MDEV-10689 - Crash encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error +encryption.innodb-force-corrupt : MDEV-17286 - SSL error; modified in 10.2.20 encryption.innodb_lotoftables : MDEV-16111 - Wrong result encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart encryption.innodb-page_encryption : MDEV-10641 - mutex problem @@ -258,14 +256,15 @@ heap.heap_btree : Modified in 10.2.19 innodb.101_compatibility : MDEV-13891 - Wrong result innodb.alter_copy : MDEV-16181 - Assertion failure; modified in 10.2.19 innodb.alter_crash : MDEV-16944 - The process cannot access the file; modified in 10.2.19 -innodb.alter_inplace_perfschema : Added in 10.2.19 +innodb.alter_inplace_perfschema : MDEV-17748 - Wrong result; added in 10.2.19 innodb.alter_kill : Modified in 10.2.19 innodb.auto_increment_dup : Modified in 10.2.19 innodb.autoinc_persist : MDEV-15282 - Assertion failure innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.data_types : Modified in 10.2.20 +innodb.default_row_format_create : Modified in 10.2.20 innodb.doublewrite : MDEV-12905 - Server crash innodb.drop_table_background : Modified in 10.2.19 -innodb.foreign-keys : Modified in 10.2.18 innodb.foreign_key : Modified in 10.2.19 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure @@ -285,10 +284,9 @@ 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-fk : MDEV-13832 - Assertion failure on shutdown innodb.innodb-get-fk : MDEV-13276 - Server crash -innodb.innodb-index : Modified in 10.2.19 +innodb.innodb-index : Modified in 10.2.20 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics innodb.innodb_information_schema : MDEV-8851 - Wrong result -innodb.innodb-lock : Modified in 10.2.18 innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result innodb.innodb_monitor : MDEV-10939 - Testcase timeout @@ -300,8 +298,6 @@ innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb-table-online : MDEV-13894 - Wrong result innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno -innodb.innodb_zip_innochecksum2 : MDEV-13882 - Extra warnings -innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable 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 @@ -315,10 +311,10 @@ innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafi innodb.rename_table_debug : Added in 10.2.19 innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning -innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.2.19 +innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.2.20 innodb.temp_table_savepoint : MDEV-16182 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate : Added in 10.2.19 +innodb.truncate : Modified in 10.2.20 innodb.truncate_crash : Added in 10.2.19 innodb.truncate_debug : Opt file added in 10.2.19 innodb.truncate_foreign : Added in 10.2.19 @@ -332,7 +328,7 @@ innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away; innodb.xa_recovery : MDEV-15279 - mysqld got exception innodb_fts.crash_recovery : Modified in 10.2.19 -innodb_fts.fts_kill_query : Modified in 10.0.37 +innodb_fts.create : Modified in 10.2.20 innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log @@ -348,6 +344,7 @@ innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed +innodb_zip.innochecksum : Modified in 10.2.20 innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings innodb_zip.restart : Opt file modified in 10.2.19 innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure @@ -361,39 +358,30 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error #---------------------------------------------------------------- -maria.concurrent : Added in 10.2.18 -maria.create : Added in 10.2.18 maria.fulltext2 : Added in 10.2.19 maria.insert_select : MDEV-12757 - Timeout maria.insert_select-7314 : MDEV-16492 - Timeout -maria.maria : MDEV-14430 - Extra warning; modified in 10.2.18 +maria.maria : MDEV-14430 - Extra warning #---------------------------------------------------------------- -mariabackup.absolute_ibdata_paths : Opt file modified in 10.2.18 +mariabackup.absolute_ibdata_paths : MDEV-14192 - Assertion failure mariabackup.apply-log-only : MDEV-14192 - Assertion failure mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure +mariabackup.backup_grants : Added in 10.2.20 mariabackup.backup_ssl : MDEV-14192 - Assertion failure -mariabackup.create_during_backup : Added in 10.2.18 -mariabackup.create_with_data_directory_during_backup : Added in 10.2.18 mariabackup.data_directory : MDEV-15270 - Error on exec -mariabackup.drop_table_during_backup : Added in 10.2.18 +mariabackup.encrypted_page_compressed : Added in 10.2.20 +mariabackup.encrypted_page_corruption : Added in 10.2.20 +mariabackup.unencrypted_page_compressed : Added in 10.2.20 mariabackup.full_backup : MDEV-16571 - Wrong result mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future mariabackup.incremental_backup : MDEV-14192 - Assertion failure -mariabackup.incremental_ddl_during_backup : Added in 10.2.18 mariabackup.incremental_encrypted : MDEV-15667 - Timeout; MDEV-14192 - Assertion failure mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.mlog_index_load : Added in 10.2.18 -mariabackup.nolock_ddl_during_backup_end : Added in 10.2.18 mariabackup.partial_exclude : MDEV-15270 - Error on exec -mariabackup.recreate_table_during_backup : Added in 10.2.18 -mariabackup.rename_during_backup : MDEV-14192 - Assertion failure; Added in 10.2.18 -mariabackup.rename_during_mdl_lock : Modified in 10.2.18 -mariabackup.skip_innodb : Added in 10.2.18 +mariabackup.rename_during_backup : MDEV-14192 - Assertion failure mariabackup.truncate_during_backup : Modified in 10.2.19 -mariabackup.undo_space_id : Opt file modified in 10.2.18 -mariabackup.unsupported_redo : Modified in 10.2.18 mariabackup.xbstream : MDEV-14192 - Crash mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 mariabackup.xb_partition : MDEV-14192 - Assertion failure; MDEV-17584 - Crash on shutdown @@ -430,8 +418,6 @@ parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MD parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind parts.partition_special_innodb : MDEV-16942 - Timeout -parts.show_create : Modified in 10.2.18 -parts.update_and_cache : Added in 10.2.18 #---------------------------------------------------------------- @@ -444,6 +430,7 @@ perfschema.bad_option_3 : MDEV-12728 - Timeout on Power perfschema.bad_option_5 : MDEV-14197 - Timeout 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 @@ -452,7 +439,7 @@ perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.rpl_gtid_func : MDEV-16897 - Wrong result -perfschema.socket_connect : MDEV-15677 - Wrong result +perfschema.socket_connect : Modified in 10.2.20 perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders perfschema.stage_mdl_procedure : MDEV-11545 - Missing row @@ -498,6 +485,7 @@ rocksdb.ttl_secondary_read_filtering : MDEV-16560 - Wrong result rocksdb.unique_check : MDEV-16576 - Wrong errno rocksdb.use_direct_reads_writes : MDEV-16646 - Server crash rocksdb.write_sync : MDEV-16965 - WRong result +rocksdb.xa : Added in 10.2.20 rocksdb_rpl.mdev12179 : MDEV-16632 - Server crash rocksdb_rpl.rpl_binlog_xid_count : MDEV-16644 - Server crash @@ -508,6 +496,7 @@ rocksdb_sys_vars.rocksdb_update_cf_options : MDEV-16955 - Bytes lost #---------------------------------------------------------------- roles.create_and_grant_role : MDEV-11772 - wrong result +roles.flush_roles-17898 : Added in 10.2.20 #---------------------------------------------------------------- @@ -526,7 +515,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_foreign_key_innodb : Modified in 10.2.18 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 @@ -570,7 +558,6 @@ rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_index_choice : MDEV-15196 - Slave crash rpl.rpl_row_lcase_tblnames : Added in 10.2.19 rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_row_spatial : Added in 10.2.18 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 @@ -593,6 +580,7 @@ rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash rpl.rpl_sync : MDEV-13830 - Assertion failure rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries +rpl.rpl_trigger : MDEV-18055 - Wrong result rpl.rpl_typeconv : Include file modified in 10.2.19 rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result @@ -629,6 +617,7 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout #---------------------------------------------------------------- +sys_vars.aria_used_for_temp_tables_basic : Modified in 10.2.20 sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result; modified in 10.2.19 sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error @@ -640,14 +629,13 @@ sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion sys_vars.slow_query_log_func : MDEV-14273 - Wrong result sys_vars.sql_low_priority_updates_func : Modified in 10.2.19 +sys_vars.sysvars_aria : Modified in 10.2.20 sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result +sys_vars.tmp_disk_table_size_func : Modified in 10.2.20 sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -sys_vars.wsrep_start_position_basic : Modified in 10.2.18 #---------------------------------------------------------------- -tokudb.* : suite.pm and multiple modifications in 10.2.18 - 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 @@ -672,8 +660,6 @@ tokudb.type_datetime : MDEV-15193 - Wrong result tokudb_alter_table.hcad_all_add2 : MDEV-15269 - Timeout -tokudb_bugs.PS-3773 : Added in 10.0.37 -tokudb_bugs.alter_table_comment_rebuild_data : Added in 10.0.37 tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output tokudb_bugs.frm_store : MDEV-12823 - Valgrind @@ -695,15 +681,13 @@ rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc unit.conc_basic-t : MDEV-15286 - not ok 7 - test_reconnect_maxpackage unit.conc_misc : MDEV-14811 - not ok 12 - test_conc49 unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236 -unit.lf : MDEV-12897 - Unexpected return code unit.ma_test_loghandler : MDEV-10638 - record read not ok -unit.my_atomic : MDEV-15670 - Signal 11 thrown #---------------------------------------------------------------- -vcol.index : Modified in 10.2.18 vcol.not_supported : MDEV-10639 - Testcase timeout vcol.races : Added in 10.2.19 +vcol.upgrade : Modified in 10.2.20 vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout vcol.vcol_misc : MDEV-16651 - Wrong error message From 975f4a1295f2b678c5ecea2cf4cfc69e177d88f5 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 21 Dec 2018 19:44:43 +0100 Subject: [PATCH 45/72] Add forgotten .opt file. --- mysql-test/suite/mariabackup/partition_partial.opt | 1 + 1 file changed, 1 insertion(+) create mode 100644 mysql-test/suite/mariabackup/partition_partial.opt diff --git a/mysql-test/suite/mariabackup/partition_partial.opt b/mysql-test/suite/mariabackup/partition_partial.opt new file mode 100644 index 00000000000..508cf185695 --- /dev/null +++ b/mysql-test/suite/mariabackup/partition_partial.opt @@ -0,0 +1 @@ +--innodb --loose-partition From 9ad1663f785d28a731ab8212ea62b8125282a27f Mon Sep 17 00:00:00 2001 From: Rakshit Kumar <32777813+rakshitkumarcse@users.noreply.github.com> Date: Sat, 22 Dec 2018 15:04:50 +0530 Subject: [PATCH 46/72] Grammatical errors of README-wsrep fixed. (#915) Docs grammar fixed --- Docs/README-wsrep | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Docs/README-wsrep b/Docs/README-wsrep index 422ec52f48a..2058e1eb14d 100644 --- a/Docs/README-wsrep +++ b/Docs/README-wsrep @@ -60,7 +60,7 @@ CONTENTS: Wsrep API developed by Codership Oy is a modern generic (database-agnostic) replication API for transactional databases with a goal to make database replication/logging subsystem completely modular and pluggable. It is developed -with flexibility and completeness in mind to satisfy broad range of modern +with flexibility and completeness in mind to satisfy a broad range of modern replication scenarios. It is equally suitable for synchronous and asynchronous, master-slave and multi-master replication. @@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please upgrade to mysql-server-5.1 first. If you're installing over an existing mysql installation, mysql-server-wsrep -will conflict with mysql-server-5.1 package, so remove it first: +will conflict with the mysql-server-5.1 package, so remove it first: $ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1 @@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny: $ sudo apt-get install psmisc $ sudo apt-get -t lenny-backports install mysql-client-5.1 -Now you should be able to install mysql-wsrep package: +Now you should be able to install the mysql-wsrep package: $ sudo dpkg -i @@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed. 3. FIRST TIME SETUP Unless you're upgrading an already installed mysql-wsrep package, you will need -to set up a few things to prepare server for operation. +to set up a few things to prepare the server for operation. 3.1 CONFIGURATION FILES @@ -162,7 +162,7 @@ to set up a few things to prepare server for operation. * Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line. * Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying - a path to provider library. If you don't have a provider, leave it as it is. + a path to the provider library. If you don't have a provider, leave it as it is. * When a new node joins the cluster it'll have to receive a state snapshot from one of the peers. This requires a privileged MySQL account with access from @@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2 This is a required parameter. Without it INSERTs into tables with AUTO_INCREMENT column may fail. autoinc lock modes 0 and 1 can cause unresolved deadlock, and make - system unresponsive. + the system unresponsive. innodb_locks_unsafe_for_binlog=1 This option is required for parallel applying. @@ -299,14 +299,14 @@ wsrep_node_address= results (multiple network interfaces, NAT, etc.) If not explicitly overridden by wsrep_sst_receive_address, the
part will be used to listen for SST (see below). And the whole
[:port] - will be passed to wsrep provider to be used as a base address in its + will be passed to the wsrep provider to be used as a base address in its communications. wsrep_node_name= Human readable node name (for easier log reading only). Defaults to hostname. wsrep_slave_threads=1 - Number of threads dedicated to processing of writesets from other nodes. + The number of threads dedicated to the processing of writesets from other nodes. For best performance should be few per CPU core. wsrep_dbug_option @@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0 wsrep_retry_autocommit=1 Retry autocommit queries and single statement transactions should they fail certification test. This is analogous to rescheduling an autocommit query - should it go into deadlock with other transactions in the database lock + should it go into a deadlock with other transactions in the database lock manager. wsrep_auto_increment_control=1 @@ -357,7 +357,7 @@ wsrep_OSU_method=TOI is not replicating and may be unable to process replication events (due to table lock). Once DDL operation is complete, the node will catch up and sync with the cluster to become fully operational again. The DDL statement or - its effects are not replicated, so it is user's responsibility to manually + its effects are not replicated, so it is the user's responsibility to manually perform this operation on each of the nodes. wsrep_forced_binlog_format=none @@ -366,7 +366,7 @@ wsrep_forced_binlog_format=none format, regardless of what the client session has specified in binlog_format. Valid choices for wsrep_forced_binlog_format are: ROW, STATEMENT, MIXED and special value NONE, meaning that there is no forced binlog format in effect. - This variable was intruduced to support STATEMENT format replication during + This variable was introduced to support STATEMENT format replication during rolling schema upgrade processing. However, in most cases ROW replication is valid for asymmetrict schema replication. @@ -412,8 +412,8 @@ wsrep_sst_auth= wsrep_sst_donor= A name of the node which should serve as state snapshot donor. This allows - to control which node will serve state snapshot request. By default the - most suitable node is chosen by wsrep provider. This is the same as given in + controlling which node will serve the state snapshot request. By default the + most suitable node is chosen by the wsrep provider. This is the same as given in wsrep_node_name. @@ -423,7 +423,7 @@ wsrep_sst_donor= for the database. They change the database structure and are non- transactional. - Release 22.3 brings a new method for performing schema upgrades. User can + Release 22.3 brings a new method for performing schema upgrades. A user can now choose whether to use the traditional total order isolation or new rolling schema upgrade method. The OSU method choice is done by global parameter: 'wsrep_OSU_method'. @@ -439,7 +439,7 @@ wsrep_sst_donor= 6.2 Rolling Schema Upgrade (RSU) - Rolling schema upgrade is new DDL processing method, where DDL will be + Rolling schema upgrade is a new DDL processing method, where DDL will be processed locally for the node. The node is disconnected of the replication for the duration of the DDL processing, so that there is only DDL statement processing in the node and it does not block the rest of the cluster. When @@ -468,7 +468,7 @@ wsrep_sst_donor= * LOCK/UNLOCK TABLES cannot be supported in multi-master setups. * lock functions (GET_LOCK(), RELEASE_LOCK()... ) -4) Query log cannot be directed to table. If you enable query logging, +4) Query log cannot be directed to a table. If you enable query logging, you must forward the log to a file: log_output = FILE Use general_log and general_log_file to choose query logging and the @@ -480,7 +480,7 @@ wsrep_sst_donor= 6) Due to cluster level optimistic concurrency control, transaction issuing COMMIT may still be aborted at that stage. There can be two transactions. writing to same rows and committing in separate cluster nodes, and only one - of the them can successfully commit. The failing one will be aborted. + of them can successfully commit. The failing one will be aborted. For cluster level aborts, MySQL/galera cluster gives back deadlock error. code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)). From 1a4248ad6c867096ac46ac11ca60f7fb5b12d5bd Mon Sep 17 00:00:00 2001 From: Julius Goryavsky Date: Sun, 23 Dec 2018 00:53:14 +0100 Subject: [PATCH 47/72] MDEV-18064: Packaging is broken for debian-based systems Packaging is broken for debian-based systems after removing xtrabackup scripts. This is due to the fact that links to the scripts are not removed from the installation file (from the debian/mariadb-server-10.3.install). Also in this fix some comments have been added to the documentation, indicating that using xtrabackup[-v2] is an deprecated, therefore user should use mariabackup instead. https://jira.mariadb.org/browse/MDEV-18064 --- debian/mariadb-server-10.3.install | 2 -- man/wsrep_sst_xtrabackup-v2.1 | 2 ++ man/wsrep_sst_xtrabackup.1 | 2 ++ 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/debian/mariadb-server-10.3.install b/debian/mariadb-server-10.3.install index a7d4d665892..e3b9ac05c9c 100644 --- a/debian/mariadb-server-10.3.install +++ b/debian/mariadb-server-10.3.install @@ -36,8 +36,6 @@ usr/bin/wsrep_sst_common usr/bin/wsrep_sst_mariabackup usr/bin/wsrep_sst_mysqldump usr/bin/wsrep_sst_rsync -usr/bin/wsrep_sst_xtrabackup -usr/bin/wsrep_sst_xtrabackup-v2 usr/lib/mysql/plugin/auth_ed25519.so usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_socket.so diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1 index 3f95e3eef0d..c8dde2f0640 100644 --- a/man/wsrep_sst_xtrabackup-v2.1 +++ b/man/wsrep_sst_xtrabackup-v2.1 @@ -13,4 +13,6 @@ wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer .SH DESCRIPTION Use: xtrabackup-based state snapshot transfer\. .PP +Note that the xtrabackup-v2 method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\. +.PP For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1 index c171a7cf954..1fe5037d8b7 100644 --- a/man/wsrep_sst_xtrabackup.1 +++ b/man/wsrep_sst_xtrabackup.1 @@ -13,4 +13,6 @@ wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer .SH DESCRIPTION Use: xtrabackup-based state snapshot transfer\. .PP +Note that the xtrabackup method is deprecated after version 10\.1, with newer versions you should use mariabackup instead\. +.PP For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ From 812bb1303c4a012edb8de9f6ad4c1d97d29533f6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 24 Dec 2018 09:53:17 +0100 Subject: [PATCH 48/72] (still) Packaging is broken for debian-based systems fix the AWS SDK build eligibility checks. followup for 779151db80d --- 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 a08f1a404b7..6f859aa01ef 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -102,7 +102,7 @@ fi # AWS SDK also requires the build machine to have network access and git, so # it cannot be part of the base version included in Linux distros, but a pure # custom built plugin. -if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && $(timeout 3s bash -c 'cat > debian/control From 835f49d9ce11ba5166da15409f7f75dcf7b5252d Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Mon, 24 Dec 2018 09:22:55 -0500 Subject: [PATCH 49/72] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 0ecdac30b5d..c7d57913442 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=2 -MYSQL_VERSION_PATCH=20 +MYSQL_VERSION_PATCH=21 From 734029fa7960d54d9c50adfca4ac6739a4ea0347 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Wed, 26 Dec 2018 00:00:49 +0300 Subject: [PATCH 50/72] Fix a trivial (and harmless) merge error --- storage/rocksdb/ha_rocksdb.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 4a1f19f45de..a6689f7707f 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -3770,7 +3770,6 @@ static int rocksdb_commit(handlerton* hton, THD* thd, bool commit_tx) We get here when committing a statement within a transaction. */ tx->make_stmt_savepoint_permanent(); - tx->make_stmt_savepoint_permanent(); } if (my_core::thd_tx_isolation(thd) <= ISO_READ_COMMITTED) { From d89d12e3b723ba7a5113b3cdffd1d4a48127ff0a Mon Sep 17 00:00:00 2001 From: Alexander Barkov Date: Wed, 26 Dec 2018 12:10:50 +0400 Subject: [PATCH 51/72] MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT --- mysql-test/main/func_hybrid_type.result | 18 ++++++++++++++ mysql-test/main/func_hybrid_type.test | 16 ++++++++++++ mysql-test/main/func_math.result | 33 +++++++++++++++++++++++++ mysql-test/main/func_math.test | 25 +++++++++++++++++++ sql/item_func.cc | 10 +++----- 5 files changed, 95 insertions(+), 7 deletions(-) diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index ebf7191a3f7..04c428e745d 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -3753,5 +3753,23 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +IFNULL(SLEEP(0.01), NULL DIV d) AS f0, +IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f0` decimal(1,0) DEFAULT NULL, + `f1` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# # End of 10.3 tests # diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 954c7de53fa..f754d660140 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -611,6 +611,22 @@ CREATE TABLE t1 AS SELECT SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + IFNULL(SLEEP(0.01), NULL DIV d) AS f0, + IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + --echo # --echo # End of 10.3 tests --echo # diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 832ca69d3ea..eafee43e2a2 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -1285,3 +1285,36 @@ E59B9BE4BA94E585AD 2914501801 E4B883E585ABE4B99D 2374586519 DROP TABLE t1; SET NAMES default; +# +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +NULL DIV d AS d_null, +'' DIV d AS d_empty_string, +X'32' DIV d AS d_hex_string2, +X'3232' DIV d AS d_hex_string4, +TIME(0) DIV d AS d_time, +CURRENT_DATE DIV d AS d_date, +CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d_null` int(1) unsigned DEFAULT NULL, + `d_empty_string` int(1) unsigned DEFAULT NULL, + `d_hex_string2` int(1) unsigned DEFAULT NULL, + `d_hex_string4` int(2) unsigned DEFAULT NULL, + `d_time` int(7) unsigned DEFAULT NULL, + `d_date` int(8) unsigned DEFAULT NULL, + `d_datetime` bigint(14) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index a2c54b58a67..bf95cfd7868 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -897,3 +897,28 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET SELECT HEX(a), CRC32(a) from t1; DROP TABLE t1; SET NAMES default; + +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + NULL DIV d AS d_null, + '' DIV d AS d_empty_string, + X'32' DIV d AS d_hex_string2, + X'3232' DIV d AS d_hex_string4, + TIME(0) DIV d AS d_time, + CURRENT_DATE DIV d AS d_date, + CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/sql/item_func.cc b/sql/item_func.cc index f902191d9cf..3b9dfc9d97a 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1752,13 +1752,9 @@ longlong Item_func_int_div::val_int() bool Item_func_int_div::fix_length_and_dec() { - Item_result argtype= args[0]->result_type(); - /* use precision ony for the data type it is applicable for and valid */ - uint32 char_length= args[0]->max_char_length() - - (argtype == DECIMAL_RESULT || argtype == INT_RESULT ? - args[0]->decimals : 0); - fix_char_length(char_length > MY_INT64_NUM_DECIMAL_DIGITS ? - MY_INT64_NUM_DECIMAL_DIGITS : char_length); + uint32 prec= args[0]->decimal_int_part(); + set_if_smaller(prec, MY_INT64_NUM_DECIMAL_DIGITS); + fix_char_length(prec); maybe_null=1; unsigned_flag=args[0]->unsigned_flag | args[1]->unsigned_flag; return false; From e2939795b140beb894e31d06986677b425a87f86 Mon Sep 17 00:00:00 2001 From: Teodor Mircea Ionita Date: Wed, 26 Dec 2018 16:55:54 +0000 Subject: [PATCH 52/72] travis: Fix ccache not used on macOS targets --- .travis.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 629e3b31523..b85928b0175 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,7 +17,7 @@ compiler: - clang cache: - timeout: 300 + timeout: 500 apt: true ccache: true directories: @@ -158,6 +158,7 @@ before_install: brew update; brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre; brew link ccache; + export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi before_script: From ab4bc8442094a2be8cdb74bfcddfccede81ac03d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 27 Dec 2018 18:19:41 +0200 Subject: [PATCH 53/72] Follow-up to MDEV-14585: Remove dict_temp_file_num Now that InnoDB startup drops tables whose name starts with #sql, the table ID alone should be enough to create a unique table name. dict_temp_file_num, dict_mem_init(): Remove. dict_mem_create_temporary_tablename(): Use a combination of "#sql-ib" and the ID of the table that is being rebuilt in TRUNCATE TABLE, or discarded in the commit of table-rebuilding ALTER TABLE...ALGORITHM=INPLACE, or deferred to the DROP queue. Thanks to Sergey Vojtovich for pointing this out. --- storage/innobase/dict/dict0mem.cc | 29 ++--------------------------- storage/innobase/include/dict0mem.h | 4 ---- storage/innobase/srv/srv0srv.cc | 2 -- 3 files changed, 2 insertions(+), 33 deletions(-) diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 3056f73f0cb..077fab8f131 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -34,7 +34,6 @@ Created 1/8/1996 Heikki Tuuri #include "mach0data.h" #include "dict0dict.h" #include "fts0priv.h" -#include "ut0crc32.h" #include "lock0lock.h" #include "sync0sync.h" #include "row0row.h" @@ -82,10 +81,6 @@ const char table_name_t::part_suffix[4] = "#P#"; #endif -/** An interger randomly initialized at startup used to make a temporary -table name as unuique as possible. */ -static ib_uint32_t dict_temp_file_num; - /** Display an identifier. @param[in,out] s output stream @param[in] id_name SQL identifier (other than table name) @@ -1105,35 +1100,15 @@ dict_mem_create_temporary_tablename( ut_ad(dbend); size_t dblen = size_t(dbend - dbtab) + 1; - /* Increment a randomly initialized number for each temp file. */ - my_atomic_add32((int32*) &dict_temp_file_num, 1); - - size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20 + 1 + 10); + size = dblen + (sizeof(TEMP_FILE_PREFIX) + 3 + 20); name = static_cast(mem_heap_alloc(heap, size)); memcpy(name, dbtab, dblen); snprintf(name + dblen, size - dblen, - TEMP_FILE_PREFIX_INNODB UINT64PF "-" UINT32PF, - id, dict_temp_file_num); + TEMP_FILE_PREFIX_INNODB UINT64PF, id); return(name); } -/** Initialize dict memory variables */ -void -dict_mem_init(void) -{ - /* Initialize a randomly distributed temporary file number */ - ib_uint32_t now = static_cast(ut_time()); - - const byte* buf = reinterpret_cast(&now); - - dict_temp_file_num = ut_crc32(buf, sizeof(now)); - - DBUG_PRINT("dict_mem_init", - ("Starting Temporary file number is " UINT32PF, - dict_temp_file_num)); -} - /** Validate the search order in the foreign key set. @param[in] fk_set the foreign key set to be validated @return true if search order is fine in the set, false otherwise. */ diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index 63cf5c8bbec..a2ad0e2e546 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -494,10 +494,6 @@ dict_mem_create_temporary_tablename( const char* dbtab, table_id_t id); -/** Initialize dict memory variables */ -void -dict_mem_init(void); - /** SQL identifier name wrapper for pretty-printing */ class id_name_t { diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index f3cab013437..312bf9abb84 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1071,8 +1071,6 @@ srv_init() trx_i_s_cache_init(trx_i_s_cache); ut_crc32_init(); - - dict_mem_init(); } /*********************************************************************//** From b74eb5a5feb41164f7e5cab986cf203537c2128a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Fri, 28 Dec 2018 12:28:16 +0200 Subject: [PATCH 54/72] row_drop_table_for_mysql(): Correct a parameter to innobase_format_name() This fixes a regression that was introduced in MySQL 5.6.6 in an error handling code path, in the following change: commit 024f363d6b5f09b20d1bba411af55be95c7398d3 Author: kevin.lewis@oracle.com <> Date: Fri Jun 15 09:01:42 2012 -0500 Bug #14169459 INNODB; DROP TABLE DOES NOT DELETE THE IBD FILE FOR A TEMPORARY TABLE. --- storage/innobase/row/row0mysql.cc | 3 ++- storage/xtradb/row/row0mysql.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index d9e18a99201..68329658618 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -4323,7 +4323,8 @@ do_drop: char msg_tablename[MAX_FULL_NAME_LEN + 1]; innobase_format_name( - msg_tablename, sizeof(tablename), + msg_tablename, + sizeof msg_tablename, tablename, FALSE); ib_logf(IB_LOG_LEVEL_INFO, diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index cb6e6bbcb1f..e828d8a8611 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -4347,7 +4347,8 @@ do_drop: char msg_tablename[MAX_FULL_NAME_LEN + 1]; innobase_format_name( - msg_tablename, sizeof(tablename), + msg_tablename, + sizeof msg_tablename, tablename, FALSE); ib_logf(IB_LOG_LEVEL_INFO, From c5a5eaa9a996015517c1ebbce19551c6e650cba1 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Fri, 14 Dec 2018 01:28:55 +0300 Subject: [PATCH 55/72] MDEV-17470 Orphan temporary files after interrupted ALTER cause InnoDB: Operating system error number 17 and eventual fatal error 71 Orphan #sql* tables may remain after ALTER TABLE was interrupted by timeout or KILL or client disconnect. This is a regression caused by MDEV-16515. Similar to temporary tables (MDEV-16647), we had better ignore the KILL when dropping the original table in the final part of ALTER TABLE. Closes #1020 --- .../suite/innodb/r/innodb-alter-debug.result | 21 ++++++++++++++ .../suite/innodb/t/innodb-alter-debug.test | 28 +++++++++++++++++++ storage/innobase/row/row0mysql.cc | 5 ++-- storage/xtradb/row/row0mysql.cc | 5 ++-- 4 files changed, 55 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result index d888fb5b034..5ce93b96c77 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-debug.result +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -68,3 +68,24 @@ SET DEBUG_SYNC = 'now SIGNAL S2'; ERROR 23000: Duplicate entry '1' for key 'a' SET DEBUG_SYNC='RESET'; DROP TABLE t1; +# +# MDEV-17470 Orphan temporary files after interrupted ALTER +# cause InnoDB: Operating system error number 17 and eventual +# fatal error 71 +# +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8); +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +LOCK TABLE t1 READ; +SET max_statement_time= 1; +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +SET DEBUG_SYNC = 'now SIGNAL stop_waining'; +SET DEBUG_SYNC = 'now WAIT_FOR stop_waining'; +UNLOCK TABLES; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test index bc4b2ad8e56..d32faf39aad 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-debug.test +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -100,3 +100,31 @@ DROP TABLE t1; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc + +--echo # +--echo # MDEV-17470 Orphan temporary files after interrupted ALTER +--echo # cause InnoDB: Operating system error number 17 and eventual +--echo # fatal error 71 +--echo # +CREATE TABLE t1 (pk INT AUTO_INCREMENT PRIMARY KEY, i INT) ENGINE=InnoDB; +INSERT INTO t1 VALUES (NULL,1),(NULL,2),(NULL,3),(NULL,4),(NULL,5),(NULL,6),(NULL,7),(NULL,8); +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; +INSERT INTO t1 SELECT NULL, i FROM t1; + +LOCK TABLE t1 READ; + +--connect (con1,localhost,root,,test) +SET max_statement_time= 1; +--error ER_STATEMENT_TIMEOUT +ALTER TABLE t1 FORCE, ALGORITHM=COPY; +SET DEBUG_SYNC = 'now SIGNAL stop_waining'; +--disconnect con1 + +--connection default +SET DEBUG_SYNC = 'now WAIT_FOR stop_waining'; +UNLOCK TABLES; +DROP TABLE t1; +SET DEBUG_SYNC = 'RESET'; diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index bb815de3138..6ec45c591eb 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -4224,9 +4224,10 @@ row_drop_table_for_mysql( calling btr_search_drop_page_hash_index() while we hold the InnoDB dictionary lock, we will drop any adaptive hash index entries upfront. */ + const bool is_temp = dict_table_is_temporary(table) + || strstr(tablename_minus_db, tmp_file_prefix); while (buf_LRU_drop_page_hash_for_tablespace(table)) { - if ((!dict_table_is_temporary(table) - && trx_is_interrupted(trx)) + if ((!is_temp && trx_is_interrupted(trx)) || srv_shutdown_state != SRV_SHUTDOWN_NONE) { err = DB_INTERRUPTED; goto funct_exit; diff --git a/storage/xtradb/row/row0mysql.cc b/storage/xtradb/row/row0mysql.cc index 88ebe24f3bb..a5381df1995 100644 --- a/storage/xtradb/row/row0mysql.cc +++ b/storage/xtradb/row/row0mysql.cc @@ -4234,9 +4234,10 @@ row_drop_table_for_mysql( calling btr_search_drop_page_hash_index() while we hold the InnoDB dictionary lock, we will drop any adaptive hash index entries upfront. */ + const bool is_temp = dict_table_is_temporary(table) + || strstr(tablename_minus_db, tmp_file_prefix); while (buf_LRU_drop_page_hash_for_tablespace(table)) { - if ((!dict_table_is_temporary(table) - && trx_is_interrupted(trx)) + if ((!is_temp && trx_is_interrupted(trx)) || srv_shutdown_state != SRV_SHUTDOWN_NONE) { err = DB_INTERRUPTED; goto funct_exit; From ed66acb291eb698530b20e82667e1b6c450c7cfc Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Sat, 29 Dec 2018 02:06:19 +0100 Subject: [PATCH 56/72] Silence LeakSanitizer by default in mariabackup, so that phanthom "leaks" would not hide more interesting information, like invalid memory accesses. some "leaks" are expected - partly this is due to weird options parsing, that runs twice, and does not free memory after the first run. - also we do not mind to exit() whenever it makes sense, without full cleanup. --- extra/mariabackup/xtrabackup.cc | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index d2b241a28f5..df8e1e245fc 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -6844,3 +6844,12 @@ int main(int argc, char **argv) exit(EXIT_SUCCESS); } + + +#if defined (__SANITIZE_ADDRESS__) && defined (__linux__) +/* Avoid LeakSanitizer's false positives. */ +const char* __asan_default_options() +{ + return "detect_leaks=0"; +} +#endif From 68143c8905352361c30595864a90f494d9a3d99f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 29 Dec 2018 10:57:26 +0200 Subject: [PATCH 57/72] MDEV-17470: Fix the test for --embedded --- .../suite/innodb/r/innodb-alter-debug.result | 7 ++---- .../suite/innodb/t/innodb-alter-debug.test | 24 +++++++++++-------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-alter-debug.result b/mysql-test/suite/innodb/r/innodb-alter-debug.result index 5ce93b96c77..fa6670e6fb3 100644 --- a/mysql-test/suite/innodb/r/innodb-alter-debug.result +++ b/mysql-test/suite/innodb/r/innodb-alter-debug.result @@ -81,11 +81,8 @@ INSERT INTO t1 SELECT NULL, i FROM t1; INSERT INTO t1 SELECT NULL, i FROM t1; INSERT INTO t1 SELECT NULL, i FROM t1; LOCK TABLE t1 READ; -SET max_statement_time= 1; ALTER TABLE t1 FORCE, ALGORITHM=COPY; -ERROR 70100: Query execution was interrupted (max_statement_time exceeded) -SET DEBUG_SYNC = 'now SIGNAL stop_waining'; -SET DEBUG_SYNC = 'now WAIT_FOR stop_waining'; +kill query @id; +ERROR 70100: Query execution was interrupted UNLOCK TABLES; DROP TABLE t1; -SET DEBUG_SYNC = 'RESET'; diff --git a/mysql-test/suite/innodb/t/innodb-alter-debug.test b/mysql-test/suite/innodb/t/innodb-alter-debug.test index d32faf39aad..3c457294884 100644 --- a/mysql-test/suite/innodb/t/innodb-alter-debug.test +++ b/mysql-test/suite/innodb/t/innodb-alter-debug.test @@ -98,9 +98,6 @@ SET DEBUG_SYNC='RESET'; DROP TABLE t1; -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc - --echo # --echo # MDEV-17470 Orphan temporary files after interrupted ALTER --echo # cause InnoDB: Operating system error number 17 and eventual @@ -117,14 +114,21 @@ INSERT INTO t1 SELECT NULL, i FROM t1; LOCK TABLE t1 READ; --connect (con1,localhost,root,,test) -SET max_statement_time= 1; ---error ER_STATEMENT_TIMEOUT -ALTER TABLE t1 FORCE, ALGORITHM=COPY; -SET DEBUG_SYNC = 'now SIGNAL stop_waining'; ---disconnect con1 +let $ID= `SELECT @id := CONNECTION_ID()`; +send ALTER TABLE t1 FORCE, ALGORITHM=COPY; --connection default -SET DEBUG_SYNC = 'now WAIT_FOR stop_waining'; +let $wait_condition= select 1 from information_schema.processlist where state='Waiting for table metadata lock'; +source include/wait_condition.inc; +let $ignore= `SELECT @id := $ID`; +kill query @id; +--connection con1 +--error ER_QUERY_INTERRUPTED +reap; +--disconnect con1 +--connection default UNLOCK TABLES; DROP TABLE t1; -SET DEBUG_SYNC = 'RESET'; + +# Wait till all disconnects are completed +--source include/wait_until_count_sessions.inc From 802ce9672ff630bbef08235e0e39bf599075f985 Mon Sep 17 00:00:00 2001 From: Eugene Kosov Date: Sat, 29 Dec 2018 20:44:40 +0300 Subject: [PATCH 58/72] MDEV-18041 Database corruption after renaming a prefix-indexed column This is a regression after MDEV-13671. The bug is related to key part prefix lengths wich are stored in SYS_FIELDS. Storage format is not obvious and was handled incorrectly which led to data dictionary corruption. SYS_FIELDS.POS actually contains prefix length too in case if any key part has prefix length. innobase_rename_column_try(): fixed prefixes handling Tests for prefixed indexes added too. Closes #1063 --- mysql-test/suite/innodb/r/innodb-alter.result | 21 ++++++++++++ mysql-test/suite/innodb/t/innodb-alter.test | 13 ++++++++ storage/innobase/handler/handler0alter.cc | 32 +++++++++++-------- storage/xtradb/handler/handler0alter.cc | 32 +++++++++++-------- 4 files changed, 70 insertions(+), 28 deletions(-) diff --git a/mysql-test/suite/innodb/r/innodb-alter.result b/mysql-test/suite/innodb/r/innodb-alter.result index 2f9b832328b..57638a84517 100644 --- a/mysql-test/suite/innodb/r/innodb-alter.result +++ b/mysql-test/suite/innodb/r/innodb-alter.result @@ -865,6 +865,27 @@ WHERE T.NAME='test/t1'; NAME a DROP TABLE t1; +# and an MDEV-18041 regression related to indexes prefixes +create table `test` ( +`test_old` varchar(255) NOT NULL, +`other` varchar(255) NOT NULL, +PRIMARY KEY (`test_old`,`other`), +UNIQUE KEY uk (`test_old`(100), `other`) +) ENGINE=InnoDB; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_old 0 +other 1 +test_old 0 +other 1 +alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +name pos +test_new 0 +other 1 +test_new 0 +other 1 +drop table `test`; # # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN # DICT_MEM_TABLE_COL_RENAME_LOW diff --git a/mysql-test/suite/innodb/t/innodb-alter.test b/mysql-test/suite/innodb/t/innodb-alter.test index 30e3292ec10..a47573626aa 100644 --- a/mysql-test/suite/innodb/t/innodb-alter.test +++ b/mysql-test/suite/innodb/t/innodb-alter.test @@ -522,6 +522,19 @@ SELECT C.NAME FROM INFORMATION_SCHEMA.INNODB_SYS_COLUMNS C INNER JOIN WHERE T.NAME='test/t1'; DROP TABLE t1; +--echo # and an MDEV-18041 regression related to indexes prefixes +create table `test` ( + `test_old` varchar(255) NOT NULL, + `other` varchar(255) NOT NULL, + PRIMARY KEY (`test_old`,`other`), + UNIQUE KEY uk (`test_old`(100), `other`) +) ENGINE=InnoDB; + +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +alter table `test` CHANGE COLUMN `test_old` `test_new` varchar(255) NOT NULL; +select name, pos from information_schema.innodb_SYS_FIELDS where name in ('test_old', 'other', 'test_new'); +drop table `test`; + --echo # --echo # BUG 20029625 - HANDLE_FATAL_SIGNAL (SIG=11) IN diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 6d9255a628e..8fbdf6c6884 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -4533,36 +4533,40 @@ err_exit: index != NULL; index = dict_table_get_next_index(index)) { + bool has_prefixes = false; + for (size_t i = 0; i < dict_index_get_n_fields(index); i++) { + if (dict_index_get_nth_field(index, i)->prefix_len) { + has_prefixes = true; + break; + } + } + for (ulint i = 0; i < dict_index_get_n_fields(index); i++) { - if (my_strcasecmp( - system_charset_info, - dict_index_get_nth_field(index, i)->name, - from)) { + const dict_field_t* field + = dict_index_get_nth_field(index, i); + if (my_strcasecmp(system_charset_info, field->name, + from)) { continue; } info = pars_info_create(); + int pos = i; + if (has_prefixes) { + pos = (pos << 16) + field->prefix_len; + } + pars_info_add_ull_literal(info, "indexid", index->id); - pars_info_add_int4_literal(info, "nth", i); + pars_info_add_int4_literal(info, "nth", pos); pars_info_add_str_literal(info, "new", to); error = que_eval_sql( info, "PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n" "BEGIN\n" - "UPDATE SYS_FIELDS SET COL_NAME=:new\n" "WHERE INDEX_ID=:indexid\n" "AND POS=:nth;\n" - - /* Try again, in case there is a prefix_len - encoded in SYS_FIELDS.POS */ - - "UPDATE SYS_FIELDS SET COL_NAME=:new\n" - "WHERE INDEX_ID=:indexid\n" - "AND POS>=65536*:nth AND POS<65536*(:nth+1);\n" - "END;\n", FALSE, trx); diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index 9508adbbd12..bdec9a076ac 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -4547,36 +4547,40 @@ err_exit: index != NULL; index = dict_table_get_next_index(index)) { + bool has_prefixes = false; + for (size_t i = 0; i < dict_index_get_n_fields(index); i++) { + if (dict_index_get_nth_field(index, i)->prefix_len) { + has_prefixes = true; + break; + } + } + for (ulint i = 0; i < dict_index_get_n_fields(index); i++) { - if (my_strcasecmp( - system_charset_info, - dict_index_get_nth_field(index, i)->name, - from)) { + const dict_field_t* field + = dict_index_get_nth_field(index, i); + if (my_strcasecmp(system_charset_info, field->name, + from)) { continue; } info = pars_info_create(); + int pos = i; + if (has_prefixes) { + pos = (pos << 16) + field->prefix_len; + } + pars_info_add_ull_literal(info, "indexid", index->id); - pars_info_add_int4_literal(info, "nth", i); + pars_info_add_int4_literal(info, "nth", pos); pars_info_add_str_literal(info, "new", to); error = que_eval_sql( info, "PROCEDURE RENAME_SYS_FIELDS_PROC () IS\n" "BEGIN\n" - "UPDATE SYS_FIELDS SET COL_NAME=:new\n" "WHERE INDEX_ID=:indexid\n" "AND POS=:nth;\n" - - /* Try again, in case there is a prefix_len - encoded in SYS_FIELDS.POS */ - - "UPDATE SYS_FIELDS SET COL_NAME=:new\n" - "WHERE INDEX_ID=:indexid\n" - "AND POS>=65536*:nth AND POS<65536*(:nth+1);\n" - "END;\n", FALSE, trx); From 50c9469be821e1942a8a9c5f37132e1855c40c86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sat, 29 Dec 2018 22:59:20 +0200 Subject: [PATCH 59/72] MDEV-18105 Mariabackup fails to copy encrypted InnoDB system tablespace if LSN>4G This is a regression caused by commit 8c43f963882a9d5ac4e4289c8dd3dbcaeb40a0ce that was part of the MDEV-12112 fixes. page_is_corrupted(): Never interpret page_no=0 as encrypted. --- extra/mariabackup/fil_cur.cc | 13 ++++++++++--- mysql-test/suite/mariabackup/huge_lsn.opt | 4 ++++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index b4393f7ffdd..c370d521947 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -306,9 +306,16 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, f return false; } - /* Validate encrypted pages. */ - if (mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) && - (space->crypt_data && space->crypt_data->type!= CRYPT_SCHEME_UNENCRYPTED)) { + /* Validate encrypted pages. The first page is never encrypted. + In the system tablespace, the first page would be written with + FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds + 4,294,967,295, the mach_read_from_4() below would wrongly + interpret the page as encrypted. We prevent that by checking + page_no first. */ + if (page_no + && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) + && space->crypt_data + && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) { if (!fil_space_verify_crypt_checksum(page, cursor->zip_size)) return true; diff --git a/mysql-test/suite/mariabackup/huge_lsn.opt b/mysql-test/suite/mariabackup/huge_lsn.opt index 74a6450a1ef..c65b76fb7d2 100644 --- a/mysql-test/suite/mariabackup/huge_lsn.opt +++ b/mysql-test/suite/mariabackup/huge_lsn.opt @@ -1,4 +1,8 @@ --innodb-encrypt-log=ON +--innodb-tablespaces-encryption +--innodb-encrypt-tables=ON +--innodb-encryption-rotate-key-age=1 +--innodb-encryption-threads=4 --plugin-load-add=$FILE_KEY_MANAGEMENT_SO --loose-file-key-management --loose-file-key-management-filekey=FILE:$MTR_SUITE_DIR/filekeys-data.key From 2450fd67ed403bb8a154925dd1ca500b23f5b3cc Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 12:03:15 +0100 Subject: [PATCH 60/72] fix the test for 2019 --- mysql-test/r/mysqldump.result | 6 +++--- mysql-test/t/mysqldump.test | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/r/mysqldump.result b/mysql-test/r/mysqldump.result index 99b14189282..bb9bba01fdf 100644 --- a/mysql-test/r/mysqldump.result +++ b/mysql-test/r/mysqldump.result @@ -4317,12 +4317,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database second; create database third; @@ -4330,7 +4330,7 @@ use third; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database third; set time_zone = 'SYSTEM'; diff --git a/mysql-test/t/mysqldump.test b/mysql-test/t/mysqldump.test index cb12919a823..a8820f42541 100644 --- a/mysql-test/t/mysqldump.test +++ b/mysql-test/t/mysqldump.test @@ -1803,7 +1803,7 @@ show create event ee1; ## prove three works (with spaces and tabs on the end) # start with one from the previous restore -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql From 32150d2513b2de1ff5b4ac3f4d9aa3470ae1c333 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 19:28:48 +0100 Subject: [PATCH 61/72] compilation warning on Windows --- storage/innobase/handler/handler0alter.cc | 2 +- storage/xtradb/handler/handler0alter.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 8fbdf6c6884..25019b8f964 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -4551,7 +4551,7 @@ err_exit: info = pars_info_create(); - int pos = i; + ulint pos = i; if (has_prefixes) { pos = (pos << 16) + field->prefix_len; } diff --git a/storage/xtradb/handler/handler0alter.cc b/storage/xtradb/handler/handler0alter.cc index bdec9a076ac..e932e2cbbdb 100644 --- a/storage/xtradb/handler/handler0alter.cc +++ b/storage/xtradb/handler/handler0alter.cc @@ -4565,7 +4565,7 @@ err_exit: info = pars_info_create(); - int pos = i; + ulint pos = i; if (has_prefixes) { pos = (pos << 16) + field->prefix_len; } From 884caeafbaea50f5380c21c844b4a65323b5eb11 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 19:32:05 +0100 Subject: [PATCH 62/72] fix RHEL8 "ambiguous python shebang" build failures --- storage/tokudb/mysql-test/tokudb/t/change_column_bin.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_char.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py | 0 .../tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_int.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py | 0 .../tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py | 0 storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py | 0 10 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_bin.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_char.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_int.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py mode change 100755 => 100644 storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_bin_rename.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_binary.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_charbinary.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_char_rename.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_key.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_not_supported.py old mode 100755 new mode 100644 diff --git a/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py b/storage/tokudb/mysql-test/tokudb/t/change_column_int_rename.py old mode 100755 new mode 100644 From 099186d09eae20e6d656f556b90dc245d64013b0 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Wed, 2 Jan 2019 13:42:11 -0500 Subject: [PATCH 63/72] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index c7d57913442..976b857053d 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=2 -MYSQL_VERSION_PATCH=21 +MYSQL_VERSION_PATCH=22 From 1f9f72b13e17a42540fd8ee7892faa52d6308a33 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 16:34:15 +0100 Subject: [PATCH 64/72] fix debian builds for cosmic --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index 47dd568e06d..edd11a99373 100644 --- a/debian/control +++ b/debian/control @@ -479,7 +479,7 @@ Description: OQGraph storage engine for MariaDB Package: mariadb-plugin-tokudb Architecture: any Depends: mariadb-server-10.2 (= ${binary:Version}), - libjemalloc1 (>= 3.0.0~), + libjemalloc1 (>= 3.0.0~) | libjemalloc2, ${misc:Depends}, ${shlibs:Depends} Breaks: mariadb-server-10.0, From cf8a564686666d9f69dc101fecba85a4ef6b0342 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 19:29:58 +0100 Subject: [PATCH 65/72] compilation warning on windows --- storage/innobase/handler/ha_innodb.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 62924ab8fc5..611387d749b 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -7956,7 +7956,7 @@ ha_innobase::build_template( templ = build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, num_v); - ut_ad(templ->is_virtual == is_v); + ut_ad(templ->is_virtual == (ulint)is_v); if (is_v) { num_v++; @@ -8030,7 +8030,7 @@ no_icp: templ = build_template_field( m_prebuilt, clust_index, index, table, field, i - num_v, num_v); - ut_ad(templ->is_virtual == is_v); + ut_ad(templ->is_virtual == (ulint)is_v); if (is_v) { num_v++; } From 2f368bb967795de5b96f21ff9d12c847df86029f Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Wed, 2 Jan 2019 19:33:52 +0100 Subject: [PATCH 66/72] fix RHEL8 "ambiguous python shebang" build failures --- CMakeLists.txt | 1 + cmake/cpack_rpm.cmake | 2 ++ storage/rocksdb/CMakeLists.txt | 4 +++- storage/rocksdb/{myrocks_hotbackup => myrocks_hotbackup.py} | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) rename storage/rocksdb/{myrocks_hotbackup => myrocks_hotbackup.py} (99%) diff --git a/CMakeLists.txt b/CMakeLists.txt index 90fadcec839..d1d12869a70 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -330,6 +330,7 @@ MYSQL_CHECK_SSL() MYSQL_CHECK_READLINE() SET(MALLOC_LIBRARY "system") +SET(PYTHON_SHEBANG "/usr/bin/env python") CHECK_PCRE() diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index b88d5634483..6bc0cc81ada 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -219,6 +219,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") ALTERNATIVE_NAME("server" "mariadb-server") ALTERNATIVE_NAME("server" "mysql-compat-server") ALTERNATIVE_NAME("test" "mariadb-test") +ELSEIF(RPM MATCHES "(rhel|centos)8") + SET(PYTHON_SHEBANG "/usr/bin/python3") ENDIF() # workaround for lots of perl dependencies added by rpmbuild diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt index 2689dc7151c..acbab49c586 100644 --- a/storage/rocksdb/CMakeLists.txt +++ b/storage/rocksdb/CMakeLists.txt @@ -217,7 +217,9 @@ TARGET_LINK_LIBRARIES(sst_dump rocksdblib) MYSQL_ADD_EXECUTABLE(mysql_ldb tools/mysql_ldb.cc COMPONENT rocksdb-engine) TARGET_LINK_LIBRARIES(mysql_ldb rocksdb_tools rocksdb_aux_lib) -INSTALL_SCRIPT(myrocks_hotbackup COMPONENT rocksdb-engine) +CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/myrocks_hotbackup.py + ${CMAKE_CURRENT_BINARY_DIR}/myrocks_hotbackup @ONLY) +INSTALL_SCRIPT(${CMAKE_CURRENT_BINARY_DIR}/myrocks_hotbackup COMPONENT rocksdb-engine) IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") SET_TARGET_PROPERTIES(rocksdb_tools sst_dump mysql_ldb PROPERTIES COMPILE_FLAGS -frtti) diff --git a/storage/rocksdb/myrocks_hotbackup b/storage/rocksdb/myrocks_hotbackup.py similarity index 99% rename from storage/rocksdb/myrocks_hotbackup rename to storage/rocksdb/myrocks_hotbackup.py index ef1e934f3fd..69c75b7cbfd 100755 --- a/storage/rocksdb/myrocks_hotbackup +++ b/storage/rocksdb/myrocks_hotbackup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!@PYTHON_SHEBANG@ from __future__ import division from optparse import OptionParser From 8cbb0bfaf71a88d0b0c681e7026121c4309620d6 Mon Sep 17 00:00:00 2001 From: Sergei Golubchik Date: Mon, 31 Dec 2018 00:25:27 +0100 Subject: [PATCH 67/72] "fix" sequence.temporary test --- sql/ha_sequence.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sql/ha_sequence.cc b/sql/ha_sequence.cc index d5064af16c3..a199892f971 100644 --- a/sql/ha_sequence.cc +++ b/sql/ha_sequence.cc @@ -114,7 +114,7 @@ int ha_sequence::open(const char *name, int mode, uint flags) if (unlikely((error= table->s->sequence->read_initial_values(table)))) file->ha_close(); } - else + else if (!table->s->tmp_table) table->m_needs_reopen= true; /* From 7158edcba3af3766e9329f9927ce4adfd2a40bf8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jan 2019 16:24:22 +0200 Subject: [PATCH 68/72] MDEV-18129 Backup fails for encrypted tables: mariabackup: Database page corruption detected at page 1 If an encrypted table is created during backup, then mariabackup --backup could wrongly fail. This caused a failure of the test mariabackup.huge_lsn once on buildbot. This is due to the way how InnoDB creates .ibd files. It would first write a dummy page 0 with no encryption information. Due to this, xb_fil_cur_open() could wrongly interpret that the table is not encrypted. Subsequently, page_is_corrupted() would compare the computed page checksum to the wrong checksum. (There are both "before" and "after" checksums for encrypted pages.) To work around this problem, we introduce a Boolean option --backup-encrypted that is enabled by default. With this option, Mariabackup will assume that a nonzero key_version implies that the page is encrypted. We need this option in order to be able to copy encrypted tables from MariaDB 10.1 or 10.2, because unencrypted pages that were originally created before MySQL 5.1.48 could contain nonzero garbage in the fields that were repurposed for encryption. Later, MDEV-18128 would clean up the way how .ibd files are created, to remove the need for this option. page_is_corrupted(): Add missing const qualifiers, and do not check space->crypt_data unless --skip-backup-encrypted has been specified. xb_fil_cur_read(): After a failed page read, output a page dump. --- extra/mariabackup/fil_cur.cc | 19 +++++++++++++------ extra/mariabackup/xtrabackup.cc | 14 ++++++++++++-- extra/mariabackup/xtrabackup.h | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index c370d521947..46465575a48 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -265,7 +265,9 @@ xb_fil_cur_open( return(XB_FIL_CUR_SUCCESS); } -static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, fil_space_t *space) +static bool page_is_corrupted(const byte *page, ulint page_no, + const xb_fil_cur_t *cursor, + const fil_space_t *space) { byte tmp_frame[UNIV_PAGE_SIZE_MAX]; byte tmp_page[UNIV_PAGE_SIZE_MAX]; @@ -293,8 +295,8 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, f from the start of each file.) The first 38 and last 8 bytes are never encrypted. */ - const ulint* p = reinterpret_cast(page); - const ulint* const end = reinterpret_cast( + const ulint* p = reinterpret_cast(page); + const ulint* const end = reinterpret_cast( page + cursor->page_size); do { if (*p++) { @@ -314,8 +316,9 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, f page_no first. */ if (page_no && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) - && space->crypt_data - && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED) { + && (opt_backup_encrypted + || (space->crypt_data + && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) { if (!fil_space_verify_crypt_checksum(page, cursor->zip_size)) return true; @@ -327,7 +330,10 @@ static bool page_is_corrupted(byte *page, ulint page_no, xb_fil_cur_t *cursor, f memcpy(tmp_page, page, cursor->page_size); bool decrypted = false; - if (!fil_space_decrypt(space, tmp_frame,tmp_page, &decrypted)) { + if (!space->crypt_data + || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED + || !fil_space_decrypt(space, tmp_frame, tmp_page, + &decrypted)) { return true; } @@ -444,6 +450,7 @@ read_retry: "corrupted.\n", cursor->thread_n, cursor->abs_path); ret = XB_FIL_CUR_ERROR; + buf_page_print(page, cursor->page_size); break; } msg("[%02u] mariabackup: " diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index df8e1e245fc..5edfb8b31f3 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -207,6 +207,7 @@ char* log_ignored_opt = NULL; extern my_bool opt_use_ssl; my_bool opt_ssl_verify_server_cert; my_bool opt_extended_validation; +my_bool opt_backup_encrypted; /* === metadata of backup === */ #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" @@ -512,6 +513,7 @@ enum options_xtrabackup OPT_XTRA_CREATE_IB_LOGFILE, OPT_XTRA_PARALLEL, OPT_XTRA_EXTENDED_VALIDATION, + OPT_XTRA_BACKUP_ENCRYPTED, OPT_XTRA_STREAM, OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS_THREADS, @@ -979,12 +981,20 @@ struct my_option xb_server_options[] = REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0}, {"extended_validation", OPT_XTRA_EXTENDED_VALIDATION, - "Enable extended validation for Innodb data pages during backup phase." - "Will slow down backup considerably, in case encryption is used.", + "Enable extended validation for Innodb data pages during backup phase. " + "Will slow down backup considerably, in case encryption is used. " + "May fail if tables are created during the backup.", (G_PTR*)&opt_extended_validation, (G_PTR*)&opt_extended_validation, 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, + {"backup_encrypted", OPT_XTRA_BACKUP_ENCRYPTED, + "In --backup, assume that nonzero key_version implies that the page" + " is encrypted. Use --backup --skip-backup-encrypted to allow" + " copying unencrypted that were originally created before MySQL 5.1.48.", + (G_PTR*)&opt_backup_encrypted, + (G_PTR*)&opt_backup_encrypted, + 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, {"log", OPT_LOG, "Ignored option for MySQL option compatibility", (G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0, diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 2af5396fa06..e870ecbe2eb 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -129,6 +129,7 @@ extern my_bool opt_no_backup_locks; extern my_bool opt_decompress; extern my_bool opt_remove_original; extern my_bool opt_extended_validation; +extern my_bool opt_backup_encrypted; extern char *opt_incremental_history_name; extern char *opt_incremental_history_uuid; From 23e4446adc0de8b6f763f746fd20f0e546a40129 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 3 Jan 2019 22:14:55 +0200 Subject: [PATCH 69/72] Fix a merge error in the parent commit Fix an inadvertently inverted condition that caused galera.galera_sst_mariabackup_table_options test failure. --- extra/mariabackup/fil_cur.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 4ce32f828d2..e1b7c670f57 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -343,8 +343,8 @@ static bool page_is_corrupted(const byte *page, ulint page_no, bool decrypted = false; if (!space->crypt_data || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED - || fil_space_decrypt(space, tmp_frame, tmp_page, - &decrypted)) { + || !fil_space_decrypt(space, tmp_frame, tmp_page, + &decrypted)) { return true; } From c902a033b98f2eb11bc1e61cca9d3cb908ecff20 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Fri, 4 Jan 2019 08:49:01 +0100 Subject: [PATCH 70/72] Disable a test that is failing very often. --- mysql-test/suite/innodb/disabled.def | 1 + 1 file changed, 1 insertion(+) diff --git a/mysql-test/suite/innodb/disabled.def b/mysql-test/suite/innodb/disabled.def index 35c941f8af7..aea780e26d8 100644 --- a/mysql-test/suite/innodb/disabled.def +++ b/mysql-test/suite/innodb/disabled.def @@ -11,3 +11,4 @@ ############################################################################## create-index-debug : MDEV-13680 InnoDB may crash when btr_page_alloc() fails +alter_inplace_perfschema : MDEV-17748 nnodb.alter_inplace_perfschema fails in buildbot with wrong result From 968f1b5db69adf387e90b15970f43438419856da Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 4 Jan 2019 17:24:54 +0200 Subject: [PATCH 71/72] Fix the location of test files --- mysql-test/{r => main}/ps_error.result | 0 mysql-test/{t => main}/ps_error.test | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename mysql-test/{r => main}/ps_error.result (100%) rename mysql-test/{t => main}/ps_error.test (100%) diff --git a/mysql-test/r/ps_error.result b/mysql-test/main/ps_error.result similarity index 100% rename from mysql-test/r/ps_error.result rename to mysql-test/main/ps_error.result diff --git a/mysql-test/t/ps_error.test b/mysql-test/main/ps_error.test similarity index 100% rename from mysql-test/t/ps_error.test rename to mysql-test/main/ps_error.test From faf206a848684bc0f87c93a2b47a55063bbccc6c Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 4 Jan 2019 17:25:19 +0200 Subject: [PATCH 72/72] Updated list of unstable tests for 10.3.12 release --- mysql-test/unstable-tests | 213 +++++++++++++++++++------------------- 1 file changed, 104 insertions(+), 109 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 45b72f0fade..78863e991d8 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,7 +23,7 @@ # ############################################################################## -# Based on bb-10.3-release 49a91a6cf89871082fd0a6b7d4b8482c429e942c +# Based on 10.3 c902a033b98f2eb11bc1e61cca9d3cb908ecff20 #----------------------------------------------------------------------- @@ -51,6 +51,7 @@ binlog.load_data_stm_view : MDEV-16948 binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint binlog_encryption.encrypted_master : MDEV-14201 - Extra warnings binlog_encryption.encrypted_master_switch_to_unencrypted : MDEV-14190 - Can't init tc log +binlog_encryption.encrypted_slave : MDEV-18135 - SSL error: key too small binlog_encryption.encryption_combo : MDEV-14199 - Table is marked as crashed binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash binlog_encryption.rpl_checksum : MDEV-16951 - Wrong result @@ -75,13 +76,17 @@ compat/oracle.sp-cursor : Modified in compat/oracle.sp-cursor-rowtype : Modified in 10.3.11 compat/oracle.sp-package : Modified in 10.3.11 compat/oracle.sp-package-mysqldump : Modified in 10.3.11 -compat/oracle.table_value_constr : Modified in 10.3.10 #----------------------------------------------------------------------- +connect.alter : MDEV-18135 - SSL error: key too small +connect.drop-open-error : MDEV-18135 - SSL error: key too small +connect.json : MDEV-18135 - SSL error: key too small +connect.part_file : MDEV-18135 - SSL error: key too small +connect.part_table : MDEV-18135 - SSL error: key too small connect.pivot : MDEV-14803 - Failed to discover table +connect.secure_file_priv : MDEV-18135 - SSL error: key too small connect.vcol : MDEV-12374 - Fails on Windows -connect.xml2 : Modified in 10.3.10 connect.zip : MDEV-13884 - Wrong result #----------------------------------------------------------------------- @@ -90,12 +95,12 @@ encryption.create_or_replace : MDEV-12694 encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result encryption.innochecksum : MDEV-13644 - Assertion failure -encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash +encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash; modified in 10.3.12 encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.3.11 encryption.innodb_encryption_tables : MDEV-17339 - Crash on restart encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error +encryption.innodb-force-corrupt : MDEV-17286 - SSL error; modified in 10.3.12 encryption.innodb-missing-key : MDEV-14728 - SSL error encryption.innodb-page_encryption : MDEV-10641 - mutex problem encryption.innodb-page_encryption_log_encryption : MDEV-17339 - Crash on restart @@ -133,7 +138,6 @@ federated.federatedx : MDEV-10617 #----------------------------------------------------------------------- -funcs_1.is_check_constraints : Added in 10.3.10 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 @@ -154,7 +158,7 @@ galera_3nodes.* : Suite is no gcol.gcol_partition_innodb : Modified in 10.3.11 gcol.gcol_rollback : MDEV-16954 - Unknown storage engine 'InnoDB' gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion -gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result; modified in 10.3.10 +gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result gcol.innodb_virtual_fk_restart : MDEV-17466 - Assertion failure gcol.innodb_virtual_index : Modifed in 10.3.11 @@ -174,34 +178,29 @@ innodb.alter_not_null : Modified in innodb.auto_increment_dup : Modified in 10.3.11 innodb.autoinc_persist : MDEV-15282 - Assertion failure innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.data_types : Modified in 10.3.12 +innodb.default_row_format_create : Modified in 10.3.12 innodb.ddl_purge : Combinations changed in 10.3.11 innodb.doublewrite : MDEV-12905 - Server crash -innodb.drop_table_background : Modified in 10.2.19 innodb.foreign_key : Modified in 10.3.11 -innodb.foreign-keys : Modified in 10.3.10 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-17742 - Assertion failure innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup -innodb.innodb-alter : Modified in 10.3.11 -innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.3.11 +innodb.innodb-alter : Modified in 10.3.12 +innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.3.12 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout innodb.innodb-alter-tempfile : MDEV-15285 - Table already exists innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown innodb.innodb-get-fk : MDEV-13276 - Server crash -innodb.innodb-index : Modified in 10.3.11 +innodb.innodb-index : Modified in 10.3.12 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics -innodb.innodb-lock : Modified in 10.3.10 -innodb.innodb-page_compression_bzip2 : Modified in 10.3.10 innodb.innodb-page_compression_default : MDEV-13644 - Assertion failure -innodb.innodb-page_compression_lz4 : Modified in 10.3.10 -innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result; modified in 10.3.10 -innodb.innodb-page_compression_lzo : Modified in 10.3.10 +innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result innodb.innodb-page_compression_snappy : MDEV-13644 - Assertion failure -innodb.innodb-page_compression_tables : Modified in 10.3.10 -innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem; modified in 10.3.10 +innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb-table-online : MDEV-13894 - Wrong result innodb.innodb-wl5522 : MDEV-13644 - Assertion failure innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno @@ -222,10 +221,7 @@ innodb.innodb_stats : MDEV-10682 innodb.innodb_stats_persistent : MDEV-17745 - Wrong result innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait -innodb.innodb_zip_innochecksum2 : MDEV-13882 - Extra warnings -innodb.innodb_zip_innochecksum3 : MDEV-14486 - Resource temporarily unavailable innodb.instant_alter : Modified in 10.3.11 -innodb.instant_alter_debug : Modified in 10.3.10 innodb.instant_alter_rollback : Modified in 10.3.11 innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start @@ -237,29 +233,21 @@ innodb.purge_secondary : MDEV-15681 innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile -innodb.rename_table_debug : Added in 10.2.19 innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning -innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.3.11 +innodb.table_flags : MDEV-13572 - Wrong result; modified in 10.3.12 innodb.temp_table_savepoint : MDEV-16182 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate : Added in 10.3.10 -innodb.truncate_crash : Added in 10.3.10 -innodb.truncate_debug : Opt file added in 10.2.19 -innodb.truncate_foreign : Added in 10.3.10 -innodb.truncate_inject : Opt file added in 10.2.19 -innodb.truncate_missing : Added in 10.3.10 -innodb.truncate_purge_debug : Opt file added in 10.2.19 -innodb.truncate_restart : Opt file added in 10.2.19 +innodb.truncate : Modified in 10.3.12 innodb.update_time : MDEV-14804 - Wrong result -innodb.undo_truncate : MDEV-17340 - Server hung; added in 10.3.10 -innodb.undo_truncate_recover : MDEV-13080 - Missing checkpoint; MDEV-17679 - Server has gone away; added in 10.3.10 +innodb.undo_truncate : MDEV-17340 - Server hung +innodb.undo_truncate_recover : MDEV-13080 - Missing checkpoint; MDEV-17679 - Server has gone away innodb.xa_recovery : MDEV-15279 - mysqld got exception #----------------------------------------------------------------------- innodb_fts.crash_recovery : Modified in 10.3.11 -innodb_fts.fts_kill_query : Modified in 10.0.37 +innodb_fts.create : Modified in 10.3.12 innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log @@ -280,35 +268,32 @@ innodb_gis.types : MDEV-15679 #----------------------------------------------------------------------- innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed +innodb_zip.innochecksum : Modified in 10.3.12 innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings -innodb_zip.restart : Opt file modified in 10.2.19 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; opt file added in 10.2.19 -innodb_zip.wl6501_crash_3 : Opt file added in 10.2.19 -innodb_zip.wl6501_crash_4 : Opt file added in 10.2.19 -innodb_zip.wl6501_crash_5 : Opt file added in 10.2.19 -innodb_zip.wl6501_scale_1 : Opt file added in 10.2.19 +innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192 #----------------------------------------------------------------------- -main.alter_table : Modified in 10.3.11 +main.alter_table : Modified in 10.3.12 +main.alter_table_errors : Modified in 10.3.12 main.alter_table_trans : MDEV-12084 - timeout main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 main.auto_increment_ranges_innodb : Modified in 10.3.11 main.bigint : Modified in 10.3.11 main.case : Modified in 10.3.11 -main.connect : MDEV-16270, MDEV-17282 - Wrong result +main.check : Modified in 10.3.12 +main.connect : MDEV-17282 - Wrong result; modified in 10.3.12 main.connect2 : MDEV-13885 - Server crash -main.constraints : Modified in 10.3.10 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result main.create_or_replace : Modified in 10.3.11 main.cte_nonrecursive : Modified in 10.3.11 -main.cte_recursive : Modified in 10.3.11 +main.cte_recursive : Modified in 10.3.12 main.ctype_latin1 : Modified in 10.3.11 main.ctype_uca : Modified in 10.3.11 main.ctype_ucs : MDEV-17681 - Data too long for column @@ -329,21 +314,22 @@ main.events_slowlog : MDEV-12821 main.flush : Modified in 10.3.11 main.func_concat : Modified in 10.3.11 main.func_default : Modified in 10.3.11 -main.func_isnull : Modified in 10.3.10 +main.func_group_innodb : Modified in 10.3.12 +main.func_hybrid_type : Modified in 10.3.12 main.func_json : Modified in 10.3.11 main.func_like : Modified in 10.3.11 -main.func_time : Modified in 10.3.11 -main.gis : MDEV-13411 - wrong result on P8; modified in 10.3.10 -main.gis-precise : Modified in 10.3.10 -main.grant : Modified in 10.3.10 +main.func_math : Modified in 10.3.12 +main.func_time : Modified in 10.3.12 +main.gis : MDEV-13411 - wrong result on P8 +main.grant5 : Modified in 10.3.12 main.group_by : Modified in 10.3.11 -main.group_min_max : Modified in 10.3.10 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Plan mismatch main.index_merge_myisam : Modified in 10.3.11 +main.information_schema : Modified in 10.3.12 main.innodb_mysql_lock : MDEV-7861 - Wrong result -main.join : Modified in 10.3.10 +main.invisible_field_debug : Modified in 10.3.12 main.join_cache : MDEV-17743 - Bad address from storage engine MyISAM main.join_outer : Modified in 10.3.11 main.kill-2 : MDEV-13257 - Wrong result @@ -356,12 +342,10 @@ main.lowercase_fs_off : Modified in main.mdev375 : MDEV-10607 - sporadic "can't connect" main.mdev-504 : MDEV-15171 - warning main.merge : MDEV-10607 - sporadic "can't connect" -main.mysql : Modified in 10.3.10 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_not_windows : Modified in 10.3.10 main.mysqld_option_err : MDEV-12747 - Timeout -main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.3.11 +main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.3.12 main.mysqldump-max : Modified in 10.3.11 main.mysqldump-utf8mb4 : Added in 10.3.11 main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug @@ -375,27 +359,29 @@ main.opt_tvc : Modified in main.order_by_optimizer_innodb : MDEV-10683 - Wrong result main.order_by_zerolength-4285 : Modified in 10.3.11 main.parser : Modified in 10.3.11 +main.partition : Modified in 10.3.12 +main.partition_alter : Modified in 10.3.12 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock -main.partition_error : Modified in 10.3.10 main.partition_explicit_prune : Modified in 10.3.11 -main.partition_innodb : Modified in 10.3.11 +main.partition_innodb : Modified in 10.3.12 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.partition_pruning : Modified in 10.3.11 -main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.3.10 +main.pool_of_threads : MDEV-18135 - SSL error: key too small +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count +main.ps_error : Added in 10.3.12 main.query_cache_debug : MDEV-15281 - Query cache is disabled main.query_cache : MDEV-16180 - Wrong result -main.range : Modified in 10.3.10 -main.range_debug : Added in 10.3.10 +main.range_innodb : Modified in 10.3.12 main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away -main.selectivity : Modified in 10.3.10 +main.read_only : Modified in 10.3.12 main.set_statement : MDEV-13183 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_explain : MDEV-10674 - Wrong result code -main.sp : MDEV-7866 - Mismatch; modified in 10.3.10 +main.sp : MDEV-7866 - Mismatch; modified in 10.3.12 main.sp-cursor : Modified in 10.3.11 main.sp-for-loop : Modified in 10.3.11 main.sp_notembedded : MDEV-10607 - internal error -main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.3.10 +main.sp-security : MDEV-10607 - sporadic "can't connect" main.sql_safe_updates : Added in 10.3.11 main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_ca : MDEV-10895 - SSL connection error on Power @@ -403,24 +389,20 @@ main.ssl_cert_verify : MDEV-13735 main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_connect : MDEV-13492 - Unknown SSL error main.ssl_timeout : MDEV-11244 - Crash -main.stat_tables : Modified in 10.3.10 +main.stat_tables : Modified in 10.3.12 main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.stat_tables_par : MDEV-13266 - Wrong result main.status : MDEV-13255 - Wrong result -main.subselect_extra_no_semijoin : Modified in 10.3.10 main.subselect_innodb : MDEV-10614 - Wrong result -main.table_value_constr : Modified in 10.3.10 main.tc_heuristic_recover : MDEV-14189 - Wrong result -main.temp_table : Modified in 10.3.10 main.type_blob : MDEV-15195 - Wrong result main.type_datetime : Modified in 10.3.11 main.type_datetime_hires : MDEV-10687 - Timeout -main.type_float : Modified in 10.3.10 -main.type_newdecimal : Modified in 10.3.11 +main.type_newdecimal : Modified in 10.3.12 main.type_year : Modified in 10.3.11 +main.udf : Modified in 10.3.12 main.userstat : MDEV-12904 - SSL errors -main.win : Modified in 10.3.11 -main.win_lead_lag : Modified in 10.3.10 +main.win : Modified in 10.3.12 main.win_percent_cume : Modified in 10.3.11 main.win_percentile : Modified in 10.3.11 main.win_rank : Modified in 10.3.11 @@ -429,44 +411,38 @@ main.xa : MDEV-11769 #----------------------------------------------------------------------- -maria.concurrent : Added in 10.3.10 -maria.create : Added in 10.3.10 maria.fulltext2 : Added in 10.3.11 maria.insert_select : MDEV-12757 - Timeout maria.insert_select-7314 : MDEV-16492 - Timeout -maria.maria : MDEV-14430 - Extra warning; modified in 10.3.10 +maria.maria : MDEV-14430 - Extra warning #----------------------------------------------------------------------- -mariabackup.absolute_ibdata_paths : MDEV-16571 - Wrong result; opt file modified in 10.3.10 +mariabackup.absolute_ibdata_paths : MDEV-16571 - Wrong result mariabackup.apply-log-only : MDEV-14192 - Assertion failure mariabackup.apply-log-only-incr : MDEV-14192 - Assertion failure +mariabackup.backup_grants : Added in 10.3.12 mariabackup.backup_ssl : MDEV-14192 - Assertion failure -mariabackup.create_during_backup : Added in 10.3.10 -mariabackup.create_with_data_directory_during_backup : Added in 10.3.10 mariabackup.data_directory : MDEV-15270 - Error on exec -mariabackup.drop_table_during_backup : Added in 10.3.10 +mariabackup.encrypted_page_compressed : Added in 10.3.12 +mariabackup.encrypted_page_corruption : Added in 10.3.12 mariabackup.full_backup : MDEV-16571 - Wrong result -mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future +mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future; opt file modified in 10.3.12 mariabackup.incremental_backup : MDEV-14192 - Assertion failure -mariabackup.incremental_ddl_during_backup : Added in 10.3.10 mariabackup.incremental_encrypted : MDEV-15667 - timeout +mariabackup.innodb_log_optimize_ddl : MDEV-14192 - Assertion failure mariabackup.log_checksum_mismatch : MDEV-16571 - Wrong result mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.mlog_index_load : MDEV-14192 - Assertion failure; added in 10.3.10 -mariabackup.nolock_ddl_during_backup_end : Added in 10.3.10 +mariabackup.mlog_index_load : MDEV-14192 - Assertion failure mariabackup.partial_exclude : MDEV-15270 - Error on exec -mariabackup.recreate_table_during_backup : Added in 10.3.10 -mariabackup.rename_during_backup : Added in 10.3.10 -mariabackup.rename_during_mdl_lock : MDEV-14192 - Assertion failure; modified in 10.3.10 -mariabackup.skip_innodb : Added in 10.3.10 -mariabackup.truncate_during_backup : Added in 10.3.10 -mariabackup.undo_space_id : Opt file modified in 10.3.10 -mariabackup.unsupported_redo : MDEV-14192 - Crash; modified in 10.3.10 -mariabackup.xb_aws_key_management : MDEV-17341 - Missing warning +mariabackup.partition_partial : Added in 10.3.12 +mariabackup.rename_during_backup : MDEV-14192 - Assertion failure +mariabackup.rename_during_mdl_lock : MDEV-14192 - Assertion failure +mariabackup.system_versioning : MDEV-14192 - Assertion failure +mariabackup.unencrypted_page_compressed : Added in 10.3.12 +mariabackup.unsupported_redo : MDEV-14192 - Crash mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault mariabackup.xb_file_key_management : MDEV-16571 - Wrong result -mariabackup.xb_history : MDEV-16268 - Error on exec mariabackup.xb_page_compress : MDEV-14810 - status: 1, errno: 11 mariabackup.xb_partition : MDEV-14192 - Crash; MDEV-17584 - Crash upon shutdown mariabackup.xb_rocksdb : MDEV-17338 - Server hung on shutdown @@ -503,8 +479,6 @@ parts.partition_debug_innodb : MDEV-10891 parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind parts.partition_special_innodb : MDEV-16942 - Timeout -parts.show_create : Modified in 10.3.10 -parts.update_and_cache : Added in 10.3.10 #----------------------------------------------------------------------- @@ -525,8 +499,9 @@ perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash perfschema.privilege_table_io : MDEV-13184 - Extra lines +perfschema.relaylog : MDEV-18134 - Wrong result perfschema.rpl_gtid_func : MDEV-16897 - Wrong result -perfschema.socket_connect : MDEV-15677 - Wrong result +perfschema.socket_connect : Modified in 10.3.12 perfschema.socket_summary_by_event_name_func : MDEV-10622 - Wrong result perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders perfschema.stage_mdl_procedure : MDEV-11545 - Missing row @@ -548,6 +523,32 @@ plugins.thread_pool_server_audit : MDEV-14295 rocksdb.* : Too many crashes in various tests +rocksdb.2pc_group_commit : MDEV-14455 - Wrong result +rocksdb.allow_no_primary_key_with_sk : MDEV-16639 - Server crash +rocksdb.autoinc_crash_safe_partition : MDEV-16639, MDEV-16637 - Server crash +rocksdb.autoinc_vars_thread : MDEV-16573 - Debug sync timed out +rocksdb.bloomfilter2 : MDEV-16564 - Wrong result +rocksdb.deadlock : MDEV-16033 - Timeout +rocksdb.drop_index_inplace : MDEV-14162 - Crash on shutdown +rocksdb.drop_table : MDEV-14308 - Timeout +rocksdb.drop_table3 : MDEV-16949 - Server crash +rocksdb.dup_key_update : MDEV-17284 - Wrong result +rocksdb.locking_issues : MDEV-14464 - Wrong result +rocksdb.mariadb_ignore_dirs : MDEV-16639 - Server crash +rocksdb.mariadb_port_fixes : MDEV-16387 - Wrong plan +rocksdb.max_open_files : MDEV-16639 - Server crash +rocksdb.perf_context : MDEV-17285 - Wrong results +rocksdb.rocksdb_cf_options : MDEV-16639 - Server crash +rocksdb.rocksdb_cf_per_partition : MDEV-16636 - Wrong result +rocksdb.rocksdb_parts : MDEV-13843 - Wrong result +rocksdb.ttl_primary_read_filtering : MDEV-16560 - Wrong result +rocksdb.ttl_secondary : MDEV-16943 - Timeout +rocksdb.ttl_secondary_read_filtering : MDEV-16560 - Wrong result +rocksdb.unique_check : MDEV-16576 - Wrong errno +rocksdb.use_direct_reads_writes : MDEV-16646 - Server crash +rocksdb.write_sync : MDEV-16965 - WRong result +rocksdb.xa : Added in 10.3.12 + #----------------------------------------------------------------------- rocksdb_rpl.mdev12179 : MDEV-16632 - Crash @@ -562,6 +563,7 @@ rocksdb_sys_vars.rocksdb_update_cf_options : MDEV-16955 #----------------------------------------------------------------------- roles.create_and_grant_role : MDEV-11772 - wrong result +roles.flush_roles-17898 : Added in 10.3.12 #----------------------------------------------------------------------- @@ -585,15 +587,15 @@ rpl.rpl_drop_db : Modified in 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_foreign_key_innodb : Modified in 10.3.10 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_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection; modified in 10.3.12 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_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings rpl.rpl_gtid_until : MDEV-10625 - warnings in error log +rpl.rpl_idempotency : Modified in 10.3.12 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 @@ -631,7 +633,6 @@ rpl.rpl_row_img_eng_noblob : MDEV-13875 rpl.rpl_row_index_choice : MDEV-15196 - Slave crash rpl.rpl_row_lcase_tblnames : Added in 10.3.11 rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_row_spatial : Added in 10.3.10 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 @@ -648,16 +649,15 @@ rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 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_000001 : MDEV-16274 - Connection attributes were truncated rpl.rpl_stm_lcase_tblnames : Added in 10.3.11 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_reset_slave : MDEV-16274 - Connection attributes were truncated rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash rpl.rpl_sync : MDEV-13830 - Assertion failure rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries +rpl.rpl_trigger : MDEV-18055 - Wrong result rpl.rpl_typeconv : Include file modified in 10.3.11 rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result rpl.show_status_stop_slave_race-7126 : MDEV-17438 - Timeout @@ -689,10 +689,8 @@ spider/handler.* : MDEV-10987, #----------------------------------------------------------------------- -sql_sequence.auto_increment : Added in 10.3.10 sql_sequence.concurrent_create : MDEV-16635 - Server crash sql_sequence.create : Modified in 10.3.11 -sql_sequence.next : Modified in 10.3.10 #----------------------------------------------------------------------- @@ -705,6 +703,7 @@ stress.ddl_innodb : MDEV-10635 #----------------------------------------------------------------------- +sys_vars.aria_used_for_temp_tables_basic : Modified in 10.3.12 sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result; modified in 10.3.11 sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error @@ -716,14 +715,14 @@ sys_vars.log_slow_admin_statements_func : MDEV-12235 sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion sys_vars.sql_low_priority_updates_func : Modified in 10.3.11 sys_vars.slow_query_log_func : MDEV-14273 - Wrong result +sys_vars.sysvars_aria : Modified in 10.3.12 sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result +sys_vars.tmp_disk_table_size_func : Modified in 10.3.12 sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -sys_vars.wsrep_start_position_basic : Modified in 10.3.10 +sys_vars.wsrep_sst_method_basic : Modified in 10.3.12 #----------------------------------------------------------------------- -tokudb.* : suite.pm and massive modifications in 10.3.10 - 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 @@ -756,8 +755,6 @@ tokudb_backup.* : MDEV-11001 #----------------------------------------------------------------------- -tokudb_bugs.PS-3773 : Added in 10.0.37 -tokudb_bugs.alter_table_comment_rebuild_data : Added in 10.0.37 tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output tokudb_bugs.frm_store : MDEV-12823 - Valgrind @@ -783,22 +780,20 @@ tokudb_sys_vars.* : MDEV-11001 unit.conc_basic-t : MDEV-15286 - not ok 7 - test_reconnect_maxpackage unit.conc_misc : MDEV-14811 - not ok 12 - test_conc49 unit.conc_ps_bugs : MDEV-13252 - not ok 44 test_bug4236 -unit.lf : MDEV-12897 - Signal 11 thrown unit.ma_test_loghandler : MDEV-10638 - record read not ok unit.my_atomic : MDEV-15670 - Signal 11 thrown #----------------------------------------------------------------------- -vcol.index : Modified in 10.3.10 vcol.not_supported : MDEV-10639 - Testcase timeout vcol.races : Added in 10.3.11 +vcol.upgrade : Modified in 10.3.12 vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout vcol.vcol_misc : MDEV-16651 - Wrong error message #----------------------------------------------------------------------- versioning.online : Modified in 10.3.11 -versioning.truncate : Modified in 10.3.10 versioning.trx_id : Modified in 10.3.11 versioning.trx_id_versioning_attribute_persistence : Modified in 10.3.11