diff options
Diffstat (limited to 'storage')
165 files changed, 652 insertions, 627 deletions
diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index c96f5d8d122..00d8a56acba 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -87,9 +87,7 @@ class ha_archive final : public handler public: ha_archive(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_archive() - { - } + ~ha_archive() = default; const char *index_type(uint inx) { return "NONE"; } ulonglong table_flags() const { diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index baa140bc04a..04ca65f2a53 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -44,9 +44,7 @@ class ha_blackhole final : public handler public: ha_blackhole(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_blackhole() - { - } + ~ha_blackhole() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes diff --git a/storage/connect/array.cpp b/storage/connect/array.cpp index a5c2e065742..1eeb4ac05ca 100644 --- a/storage/connect/array.cpp +++ b/storage/connect/array.cpp @@ -975,13 +975,13 @@ PSZ ARRAY::MakeArrayList(PGLOBAL g) xtrc(1, "Arraylist: len=%d\n", len); p = (char *)PlugSubAlloc(g, NULL, len); - strcpy(p, "("); + safe_strcpy(p, len, "("); for (i = 0; i < Nval;) { Value->SetValue_pvblk(Vblp, i); Value->Prints(g, tp, z); - strcat(p, tp); - strcat(p, (++i == Nval) ? ")" : ","); + safe_strcat(p, len, tp); + safe_strcat(p, len, (++i == Nval) ? ")" : ","); } // enfor i xtrc(1, "Arraylist: newlen=%d\n", strlen(p)); diff --git a/storage/connect/blkfil.h b/storage/connect/blkfil.h index 61b02c53c14..27e6fd4b166 100644 --- a/storage/connect/blkfil.h +++ b/storage/connect/blkfil.h @@ -31,7 +31,7 @@ class DllExport BLOCKFILTER : public BLOCK { /* Block Filter */ virtual void Prints(PGLOBAL g, char *ps, uint z); protected: - BLOCKFILTER(void) {} // Standard constructor not to be used + BLOCKFILTER(void) = default; // Standard constructor not to be used // Members PTDBDOS Tdbp; // Owner TDB @@ -54,7 +54,7 @@ class DllExport BLKFILLOG : public BLOCKFILTER { /* Logical Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKFILLOG(void) {} // Standard constructor not to be used + BLKFILLOG(void) = default; // Standard constructor not to be used // Members PBF *Fil; // Points to Block filter args @@ -75,7 +75,7 @@ class DllExport BLKFILARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void) {} protected: - BLKFILARI(void) {} // Standard constructor not to be used + BLKFILARI(void) = default; // Standard constructor not to be used // Members PDOSCOL Colp; // Points to column argument @@ -97,7 +97,7 @@ class DllExport BLKFILAR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILAR2(void) {} // Standard constructor not to be used + BLKFILAR2(void) = default; // Standard constructor not to be used // Members uint Bmp; // The value bitmap used to test blocks @@ -118,7 +118,7 @@ class DllExport BLKFILMR2 : public BLKFILARI { /* Arithm. Op Block Filter */ virtual void MakeValueBitmap(void); protected: - BLKFILMR2(void) {} // Standard constructor not to be used + BLKFILMR2(void) = default; // Standard constructor not to be used // Members int Nbm; // The number of ULONG bitmaps @@ -141,7 +141,7 @@ class DllExport BLKSPCARI : public BLOCKFILTER { /* Arithm. Op Block Filter */ virtual int BlockEval(PGLOBAL g); protected: - BLKSPCARI(void) {} // Standard constructor not to be used + BLKSPCARI(void) = default; // Standard constructor not to be used // Members PCOL Cpx; // Point to subquery "constant" column diff --git a/storage/connect/block.h b/storage/connect/block.h index e8871277d48..5351c2e6354 100644 --- a/storage/connect/block.h +++ b/storage/connect/block.h @@ -55,7 +55,7 @@ class DllExport BLOCK { void operator delete(void*, long long) {} void operator delete(void*) {} - virtual ~BLOCK() {} + virtual ~BLOCK() = default; }; // end of class BLOCK #endif // !BLOCK_DEFINED diff --git a/storage/connect/bson.cpp b/storage/connect/bson.cpp index 1eef3c063d6..6bea4eb5d85 100644 --- a/storage/connect/bson.cpp +++ b/storage/connect/bson.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include <my_global.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -598,7 +599,7 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) try { if (!bvp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -606,9 +607,8 @@ PSZ BDOC::Serialize(PGLOBAL g, PBVAL bvp, char* fn, int pretty) b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file diff --git a/storage/connect/bson.h b/storage/connect/bson.h index acc36e8e0ed..e3a15a41952 100644 --- a/storage/connect/bson.h +++ b/storage/connect/bson.h @@ -165,7 +165,7 @@ public: protected: // Default constructor not to be used - BJSON(void) {} + BJSON(void) = default; }; // end of class BJSON /***********************************************************************/ @@ -203,5 +203,5 @@ protected: bool comma; // True if Pretty = 1 // Default constructor not to be used - BDOC(void) {} + BDOC(void) = default; }; // end of class BDOC diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp index d2ddfc5f489..f92bdb46727 100644 --- a/storage/connect/bsonudf.cpp +++ b/storage/connect/bsonudf.cpp @@ -3572,7 +3572,7 @@ char *bson_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type= TYPE_JAR; BJNX bnx(g); PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; @@ -4911,7 +4911,7 @@ char *bbin_make_array(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endfor i if ((bsp = BbinAlloc(bnx.G, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5109,8 +5109,9 @@ char *bbin_array_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (arp) - if ((bsp = BbinAlloc(g, initid->max_length, arp))) - strcat(bsp->Msg, " array"); + if ((bsp = BbinAlloc(g, initid->max_length, arp))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); + } if (!bsp) { *res_length = 0; @@ -5156,8 +5157,9 @@ char *bbin_object_grp(UDF_INIT *initid, UDF_ARGS *, char *result, PUSH_WARNING("Result truncated to json_grp_size values"); if (bop) - if ((bsp = BbinAlloc(g, initid->max_length, bop))) - strcat(bsp->Msg, " object"); + if ((bsp = BbinAlloc(g, initid->max_length, bop))) { + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); + } if (!bsp) { *res_length = 0; @@ -5201,7 +5203,7 @@ char *bbin_make_object(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i), bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5256,7 +5258,7 @@ char *bbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, jvp, bnx.MakeKey(args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5315,7 +5317,7 @@ char *bbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, bnx.SetKeyValue(objp, bnx.MakeValue(args, i + 1), MakePSZ(g, args, i)); if ((bsp = BbinAlloc(bnx.G, initid->max_length, objp))) { - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5723,7 +5725,7 @@ char *bbin_item_merge(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif Xchk if (!CheckMemory(g, initid, args, 2, false, false, true)) { - JTYP type; + JTYP type = TYPE_JAR; BJNX bnx(g); PBVAL jvp = NULL, top = NULL; PBVAL jsp[2] = {NULL, NULL}; @@ -6078,7 +6080,7 @@ char *bbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, // pretty = pty; if ((bsp = BbinAlloc(bnx.G, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { diff --git a/storage/connect/bsonudf.h b/storage/connect/bsonudf.h index 0fe3715617e..e355fe7b48e 100644 --- a/storage/connect/bsonudf.h +++ b/storage/connect/bsonudf.h @@ -143,7 +143,7 @@ protected: my_bool AddPath(void); // Default constructor not to be used - BJNX(void) {} + BJNX(void) = default; // Members PBVAL Row; diff --git a/storage/connect/catalog.h b/storage/connect/catalog.h index 48347d7519e..2649a50cf76 100644 --- a/storage/connect/catalog.h +++ b/storage/connect/catalog.h @@ -61,7 +61,7 @@ class DllExport CATALOG { friend class OEMDEF; public: CATALOG(void); // Constructor - virtual ~CATALOG() { } // Make -Wdelete-non-virtual-dtor happy + virtual ~CATALOG() = default; // Make -Wdelete-non-virtual-dtor happy // Implementation int GetCblen(void) {return Cblen;} diff --git a/storage/connect/colblk.h b/storage/connect/colblk.h index c9712f516b5..e67ba3ba3f9 100644 --- a/storage/connect/colblk.h +++ b/storage/connect/colblk.h @@ -177,7 +177,7 @@ class DllExport TIDBLK : public SPCBLK { protected: // Default constructor not to be used - TIDBLK(void) {} + TIDBLK(void) = default; // Members PCSZ Tname; // The current table name @@ -200,7 +200,7 @@ class DllExport PRTBLK : public SPCBLK { protected: // Default constructor not to be used - PRTBLK(void) {} + PRTBLK(void) = default; // Members PCSZ Pname; // The current partition name @@ -223,7 +223,7 @@ class DllExport SIDBLK : public SPCBLK { protected: // Default constructor not to be used - SIDBLK(void) {} + SIDBLK(void) = default; // Members PCSZ Sname; // The current server name diff --git a/storage/connect/csort.h b/storage/connect/csort.h index 6e700059881..cce01df4199 100644 --- a/storage/connect/csort.h +++ b/storage/connect/csort.h @@ -33,7 +33,7 @@ class DllExport CSORT { public: // Constructor CSORT(bool cns, int th = THRESH, int mth = MTHRESH); - virtual ~CSORT() {} + virtual ~CSORT() = default; protected: // Implementation /*********************************************************************/ diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index c7206b4def3..7cd46fd1181 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -443,7 +443,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) hp->Headlen, hp->Filedate[0], hp->Filedate[1], hp->Filedate[2]); - strcat(g->Message, buf); + safe_strcat(g->Message, sizeof(g->Message), buf); } // endif info #endif // 0 diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index dfe5cb5cfc4..6cf6331abd4 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -35,7 +35,7 @@ class DllExport DBFBASE { protected: // Default constructor, not to be used - DBFBASE(void) {} + DBFBASE(void) = default; // Members int Records; /* records in the file */ diff --git a/storage/connect/filamfix.cpp b/storage/connect/filamfix.cpp index 117a4e8dda6..3298a83394c 100644 --- a/storage/connect/filamfix.cpp +++ b/storage/connect/filamfix.cpp @@ -36,6 +36,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -881,7 +883,6 @@ bool BGXFAM::OpenTableFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); } else rc = 0; @@ -1002,7 +1003,7 @@ int BGXFAM::Cardinality(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strcat(g->Message, filename); + safe_strcat(g->Message, sizeof(g->Message), filename); return -1; } else return 0; // File does not exist @@ -1382,7 +1383,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, _MAX_PATH, ".t"); remove(tempname); // Be sure it does not exist yet #if defined(_WIN32) @@ -1391,11 +1393,12 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { DWORD rc = GetLastError(); - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, + tempname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strcat(g->Message, tempname); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -1403,8 +1406,8 @@ bool BGXFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strcat(g->Message, strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)" %s", rc, + MODE_INSERT, tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX diff --git a/storage/connect/filamgz.cpp b/storage/connect/filamgz.cpp index d6c48cb25a9..0eaf3571a80 100644 --- a/storage/connect/filamgz.cpp +++ b/storage/connect/filamgz.cpp @@ -33,6 +33,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -128,12 +130,13 @@ int GZFAM::GetFileLength(PGLOBAL g) /***********************************************************************/ bool GZFAM::OpenTableFile(PGLOBAL g) { - char opmode[4], filename[_MAX_PATH]; - MODE mode = Tdbp->GetMode(); + const char *opmode; + char filename[_MAX_PATH]; + MODE mode = Tdbp->GetMode(); switch (mode) { case MODE_READ: - strcpy(opmode, "r"); + opmode = "rb"; break; case MODE_UPDATE: /*****************************************************************/ @@ -147,7 +150,7 @@ bool GZFAM::OpenTableFile(PGLOBAL g) DelRows = Cardinality(g); // This will erase the entire file - strcpy(opmode, "w"); + opmode = "wb"; // Block = 0; // For ZBKFAM // Last = Nrec; // For ZBKFAM Tdbp->ResetSize(); @@ -158,7 +161,7 @@ bool GZFAM::OpenTableFile(PGLOBAL g) break; case MODE_INSERT: - strcpy(opmode, "a+"); + opmode = "a+b"; break; default: snprintf(g->Message, sizeof(g->Message), MSG(BAD_OPEN_MODE), mode); @@ -170,13 +173,11 @@ bool GZFAM::OpenTableFile(PGLOBAL g) /* Use specific zlib functions. */ /* Treat files as binary. */ /*********************************************************************/ - strcat(opmode, "b"); Zfile = gzopen(PlugSetPath(filename, To_File, Tdbp->GetPath()), opmode); if (Zfile == NULL) { - snprintf(g->Message, sizeof(g->Message), MSG(GZOPEN_ERROR), - opmode, (int)errno, filename); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(GZOPEN_ERROR) ": %s", + opmode, (int)errno, filename, strerror(errno)); return (mode == MODE_READ && errno == ENOENT) ? PushWarning(g, Tdbp) : true; } // endif Zfile diff --git a/storage/connect/filamtxt.cpp b/storage/connect/filamtxt.cpp index 7a5d16accb2..f8168887e89 100644 --- a/storage/connect/filamtxt.cpp +++ b/storage/connect/filamtxt.cpp @@ -38,6 +38,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -593,7 +595,7 @@ bool DOSFAM::OpenTableFile(PGLOBAL g) } // endswitch Mode // For blocked I/O or for moving lines, open the table in binary - strcat(opmode, (Bin) ? "b" : "t"); + safe_strcat(opmode, sizeof(opmode), (Bin) ? "b" : "t"); // Now open the file stream PlugSetPath(filename, To_File, Tdbp->GetPath()); @@ -1081,7 +1083,8 @@ bool DOSFAM::OpenTempFile(PGLOBAL g) /* Open the temporary file, Spos is at the beginning of file. */ /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(tempname, tempname), ".t"); + PlugRemoveType(tempname, tempname); + safe_strcat(tempname, sizeof(tempname), ".t"); if (!(T_Stream = PlugOpenFile(g, tempname, "wb"))) { if (trace(1)) @@ -1170,7 +1173,8 @@ int DOSFAM::RenameTempFile(PGLOBAL g) if (!Abort) { PlugSetPath(filename, To_File, Tdbp->GetPath()); - strcat(PlugRemoveType(filetemp, filename), ".ttt"); + PlugRemoveType(filetemp, filename); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security diff --git a/storage/connect/filamvct.cpp b/storage/connect/filamvct.cpp index 76e9336dedf..184df646cb7 100644 --- a/storage/connect/filamvct.cpp +++ b/storage/connect/filamvct.cpp @@ -42,6 +42,8 @@ #include <fcntl.h> #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Include application header files: */ /* global.h is header containing all global declarations. */ @@ -194,7 +196,7 @@ int VCTFAM::GetBlockInfo(PGLOBAL g) if (Header == 2) { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } if ((h = global_open(g, MSGID_CANNOT_OPEN, filename, O_RDONLY)) == -1 @@ -251,7 +253,7 @@ bool VCTFAM::SetBlockInfo(PGLOBAL g) } else { // Header == 2 PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); s= global_fopen(g, MSGID_CANNOT_OPEN, filename, "wb"); } // endif Header @@ -587,7 +589,7 @@ bool VCTFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strncpy(g->Message, msg, sizeof(g->Message)); + safe_strcpy(g->Message, sizeof(msg), msg); rc = true; } // end catch @@ -891,8 +893,7 @@ bool VCTFAM::OpenTempFile(PGLOBAL g) /*********************************************************************/ PlugSetPath(tempname, To_File, Tdbp->GetPath()); PlugRemoveType(tempname, tempname); - strncat(tempname, ".t", _MAX_PATH - strlen(tempname)); - + safe_strcat(tempname, sizeof(tempname), ".t"); if (MaxBlk) { if (MakeEmptyFile(g, tempname)) return true; @@ -1562,7 +1563,7 @@ bool VCMFAM::InitInsert(PGLOBAL g) htrc("Exception %d: %s\n", n, g->Message); rc = true; } catch (const char *msg) { - strncpy(g->Message, msg, sizeof(g->Message)); + safe_strcpy(g->Message, sizeof(g->Message), msg); rc = true; } // end catch @@ -2082,10 +2083,10 @@ bool VECFAM::AllocateBuffer(PGLOBAL g) // Allocate all that is needed to move lines and make Temp if (UseTemp) { Tempat = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); - strcpy(Tempat, Colfn); + safe_strcpy(Tempat, _MAX_PATH, Colfn); PlugSetPath(Tempat, Tempat, Tdbp->GetPath()); PlugRemoveType(Tempat, Tempat); - strncat(Tempat, ".t", _MAX_PATH - strlen(Tempat)); + safe_strcat(Tempat, _MAX_PATH, ".t"); T_Fbs = (PFBLOCK *)PlugSubAlloc(g, NULL, Ncol * sizeof(PFBLOCK)); } // endif UseTemp @@ -2460,7 +2461,7 @@ int VECFAM::RenameTempFile(PGLOBAL g) snprintf(filename, _MAX_PATH, Colfn, i+1); PlugSetPath(filename, filename, Tdbp->GetPath()); PlugRemoveType(filetemp, filename); - strncat(filetemp, ".ttt", _MAX_PATH - strlen(filetemp)); + safe_strcat(filetemp, sizeof(filetemp), ".ttt"); remove(filetemp); // May still be there from previous error if (rename(filename, filetemp)) { // Save file for security @@ -3221,7 +3222,7 @@ int BGVFAM::GetBlockInfo(PGLOBAL g) if (Header == 2) { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } #if defined(_WIN32) @@ -3300,7 +3301,7 @@ bool BGVFAM::SetBlockInfo(PGLOBAL g) } else // Header == 2 { PlugRemoveType(filename, filename); - strncat(filename, ".blk", _MAX_PATH - strlen(filename)); + safe_strcat(filename, sizeof(filename), ".blk"); } if (h == INVALID_HANDLE_VALUE) { @@ -3398,7 +3399,7 @@ bool BGVFAM::MakeEmptyFile(PGLOBAL g, PCSZ fn) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strncat(g->Message, filename, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), filename); if (h != INVALID_HANDLE_VALUE) CloseHandle(h); @@ -3534,7 +3535,7 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)filename, sizeof(filename), NULL); - strncat(g->Message, filename, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), filename); } // endif Hfile if (trace(1)) @@ -3622,8 +3623,8 @@ bool BGVFAM::OpenTableFile(PGLOBAL g) if (Hfile == INVALID_HANDLE_VALUE) { rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, mode, filename); - strncat(g->Message, strerror(errno), sizeof(g->Message) - strlen(g->Message)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR)"%s", rc, mode, + filename, strerror(errno)); } // endif Hfile if (trace(1)) @@ -3967,7 +3968,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) tempname = (char*)PlugSubAlloc(g, NULL, _MAX_PATH); PlugSetPath(tempname, To_File, Tdbp->GetPath()); PlugRemoveType(tempname, tempname); - strncat(tempname, ".t", _MAX_PATH - strlen(tempname)); + safe_strcat(tempname, _MAX_PATH, ".t"); if (!MaxBlk) remove(tempname); // Be sure it does not exist yet @@ -3986,7 +3987,7 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)tempname, _MAX_PATH, NULL); - strncat(g->Message, tempname, sizeof(g->Message) - strlen(g->Message)); + safe_strcat(g->Message, sizeof(g->Message), tempname); return true; } // endif Tfile #else // UNIX @@ -3996,8 +3997,8 @@ bool BGVFAM::OpenTempFile(PGLOBAL g) if (Tfile == INVALID_HANDLE_VALUE) { int rc = errno; - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR), rc, MODE_INSERT, tempname); - strncat(g->Message, strerror(errno), sizeof(g->Message) - strlen(g->Message)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_ERROR) "%s", rc, MODE_INSERT, + tempname, strerror(errno)); return true; } //endif Tfile #endif // UNIX diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index f0ee947bc23..5a1e40cccb2 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -29,6 +29,7 @@ #include <fcntl.h> #endif // !_WIN32 #include <time.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -181,7 +182,8 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) while (true) { if (!(FileData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { - strcat(strcat(strcpy(filename, drive), direc), FileData.cFileName); + snprintf(filename, sizeof(filename), "%s%s%s", + drive, direc, FileData.cFileName); if (ZipFile(g, zutp, filename, FileData.cFileName, buf)) { FindClose(hSearch); @@ -217,7 +219,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) struct dirent *entry; _splitpath(filename, NULL, direc, pattern, ftype); - strcat(pattern, ftype); + safe_strcat(pattern, sizeof(pattern), ftype); // Start searching files in the target directory. if (!(dir = opendir(direc))) { @@ -226,7 +228,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) } // endif dir while ((entry = readdir(dir))) { - strcat(strcpy(fn, direc), entry->d_name); + snprintf(fn, sizeof(fn), "%s%s", direc, entry->d_name); if (lstat(fn, &fileinfo) < 0) { snprintf(g->Message, sizeof(g->Message), "%s: %s", fn, strerror(errno)); @@ -240,7 +242,7 @@ static bool ZipFiles(PGLOBAL g, ZIPUTIL *zutp, PCSZ pat, char *buf) if (fnmatch(pattern, entry->d_name, 0)) continue; // Not a match - strcat(strcpy(filename, direc), entry->d_name); + snprintf(filename, sizeof(filename), "%s%s", direc, entry->d_name); if (ZipFile(g, zutp, filename, entry->d_name, buf)) { closedir(dir); diff --git a/storage/connect/filter.h b/storage/connect/filter.h index 12ac3a169c1..0c3fa41046a 100644 --- a/storage/connect/filter.h +++ b/storage/connect/filter.h @@ -77,7 +77,7 @@ class DllExport FILTER : public XOBJECT { /* Filter description block */ // PFIL Copy(PTABS t); protected: - FILTER(void) {} // Standard constructor not to be used + FILTER(void) = default; // Standard constructor not to be used void Constr(PGLOBAL g, OPVAL opc, int opm, PPARM *tp); // Members diff --git a/storage/connect/javaconn.cpp b/storage/connect/javaconn.cpp index bf104402628..efde2e86330 100644 --- a/storage/connect/javaconn.cpp +++ b/storage/connect/javaconn.cpp @@ -33,6 +33,8 @@ #define NODW #endif // !_WIN32 +#include <m_string.h> + /***********************************************************************/ /* Required objects includes. */ /***********************************************************************/ @@ -231,15 +233,16 @@ bool JAVAConn::GetJVM(PGLOBAL g) #if defined(_WIN32) for (ntry = 0; !LibJvm && ntry < 3; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "\\jvm.dll"); + snprintf(soname, sizeof(soname), "%s\\jvm.dll", JvmPath); + ntry = 3; // No other try } else if (ntry < 2 && getenv("JAVA_HOME")) { - strcpy(soname, getenv("JAVA_HOME")); + safe_strcpy(soname, sizeof(soname), getenv("JAVA_HOME")); if (ntry == 1) - strcat(soname, "\\jre"); + safe_strcat(soname, sizeof(soname), "\\jre"); - strcat(soname, "\\bin\\client\\jvm.dll"); + safe_strcat(soname, sizeof(soname), "\\bin\\client\\jvm.dll"); } else { // Try to find it through the registry char version[16]; @@ -247,11 +250,12 @@ bool JAVAConn::GetJVM(PGLOBAL g) LONG rc; DWORD BufferSize = 16; - strcpy(soname, "jvm.dll"); // In case it fails + safe_strcpy(soname, sizeof(soname), "jvm.dll"); // In case it fails if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "CurrentVersion", RRF_RT_ANY, NULL, (PVOID)&version, &BufferSize)) == ERROR_SUCCESS) { - strcat(strcat(javaKey, "\\"), version); + safe_strcat(javaKey, sizeof(javaKey), "\\"); + safe_strcat(javaKey, sizeof(javaKey), version); BufferSize = sizeof(soname); if ((rc = RegGetValue(HKEY_LOCAL_MACHINE, javaKey, "RuntimeLib", @@ -272,11 +276,11 @@ bool JAVAConn::GetJVM(PGLOBAL g) char buf[256]; DWORD rc = GetLastError(); - snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR), rc, soname); FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, rc, 0, (LPTSTR)buf, sizeof(buf), NULL); - strcat(strcat(g->Message, ": "), buf); + snprintf(g->Message, sizeof(g->Message), MSG(DLL_LOAD_ERROR)": %s", rc, + soname, buf); } else if (!(CreateJavaVM = (CRTJVM)GetProcAddress((HINSTANCE)LibJvm, "JNI_CreateJavaVM"))) { snprintf(g->Message, sizeof(g->Message), MSG(PROCADD_ERROR), GetLastError(), "JNI_CreateJavaVM"); @@ -301,13 +305,14 @@ bool JAVAConn::GetJVM(PGLOBAL g) for (ntry = 0; !LibJvm && ntry < 2; ntry++) { if (!ntry && JvmPath) { - strcat(strcpy(soname, JvmPath), "/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/libjvm.so", JvmPath); ntry = 2; } else if (!ntry && getenv("JAVA_HOME")) { // TODO: Replace i386 by a better guess - strcat(strcpy(soname, getenv("JAVA_HOME")), "/jre/lib/i386/client/libjvm.so"); + snprintf(soname, sizeof(soname), "%s/jre/lib/i386/client/libjvm.so", + getenv("JAVA_HOME")); } else { // Will need LD_LIBRARY_PATH to be set - strcpy(soname, "libjvm.so"); + safe_strcpy(soname, sizeof(soname), "libjvm.so"); ntry = 2; } // endelse diff --git a/storage/connect/json.cpp b/storage/connect/json.cpp index 4c78a9f1ecc..4490f179d24 100644 --- a/storage/connect/json.cpp +++ b/storage/connect/json.cpp @@ -10,6 +10,7 @@ /* Include relevant sections of the MariaDB header file. */ /***********************************************************************/ #include <my_global.h> +#include <m_string.h> /***********************************************************************/ /* Include application header files: */ @@ -268,7 +269,7 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { jdp->dfp = GetDefaultPrec(); if (!jsp) { - strcpy(g->Message, "Null json tree"); + safe_strcpy(g->Message, sizeof(g->Message), "Null json tree"); throw 1; } else if (!fn) { // Serialize to a string @@ -276,9 +277,8 @@ PSZ Serialize(PGLOBAL g, PJSON jsp, char* fn, int pretty) { b = pretty == 1; } else { if (!(fs = fopen(fn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, fn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR) ": %s", + "w", (int)errno, fn, strerror(errno)); throw 2; } else if (pretty >= 2) { // Serialize to a pretty file diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp index 6f5b0883fe1..45a0bb963e7 100644 --- a/storage/connect/jsonudf.cpp +++ b/storage/connect/jsonudf.cpp @@ -4756,7 +4756,7 @@ char *jbin_array(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((arp = (PJAR)JsonNew(g, TYPE_JAR)) && (bsp = JbinAlloc(g, args, initid->max_length, arp))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); for (uint i = 0; i < args->arg_count; i++) arp->AddArrayValue(g, MakeValue(g, args, i)); @@ -4833,7 +4833,7 @@ char *jbin_array_add_values(UDF_INIT *initid, UDF_ARGS *args, char *result, arp->InitArray(gb); if ((bsp = JbinAlloc(g, args, initid->max_length, top))) { - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); bsp->Jsp = arp; } // endif bsp @@ -5054,7 +5054,7 @@ char *jbin_object(UDF_INIT *initid, UDF_ARGS *args, char *result, if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5110,7 +5110,7 @@ char *jbin_object_nonull(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, jvp, MakeKey(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5169,7 +5169,7 @@ char *jbin_object_key(UDF_INIT *initid, UDF_ARGS *args, char *result, objp->SetKeyValue(g, MakeValue(g, args, i + 1), MakePSZ(g, args, i)); if ((bsp = JbinAlloc(g, args, initid->max_length, objp))) - strcat(bsp->Msg, " object"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " object"); } else bsp = NULL; @@ -5391,7 +5391,7 @@ char *jbin_object_list(UDF_INIT *initid, UDF_ARGS *args, char *result, } // endif CheckMemory if ((bsp = JbinAlloc(g, args, initid->max_length, jarp))) - strcat(bsp->Msg, " array"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " array"); // Keep result of constant function g->Xchk = (initid->const_item) ? bsp : NULL; @@ -5466,7 +5466,7 @@ char *jbin_get_item(UDF_INIT *initid, UDF_ARGS *args, char *result, jsp = (jvp->GetJsp()) ? jvp->GetJsp() : JvalNew(g, TYPE_JVAL, jvp->GetValue(g)); if ((bsp = JbinAlloc(g, args, initid->max_length, jsp))) - strcat(bsp->Msg, " item"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " item"); else *error = 1; @@ -5826,7 +5826,7 @@ char *jbin_file(UDF_INIT *initid, UDF_ARGS *args, char *result, pretty = pty; if ((bsp = JbinAlloc(g, args, len, jsp))) { - strcat(bsp->Msg, " file"); + safe_strcat(bsp->Msg, sizeof(bsp->Msg), " file"); bsp->Filename = fn; bsp->Pretty = pretty; } else { @@ -6162,9 +6162,8 @@ char* JUP::UnprettyJsonFile(PGLOBAL g, char *fn, char *outfn, int lrecl) { /* Parse the json file and allocate its tree structure. */ /*********************************************************************************/ if (!(fs = fopen(outfn, "wb"))) { - snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR), - "w", (int)errno, outfn); - strcat(strcat(g->Message, ": "), strerror(errno)); + snprintf(g->Message, sizeof(g->Message), MSG(OPEN_MODE_ERROR)": %s", + "w", (int)errno, outfn, strerror(errno)); CloseMemMap(mm.memory, len); return NULL; } // endif fs diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h index ada0dbcd96b..4378bddf9ba 100644 --- a/storage/connect/jsonudf.h +++ b/storage/connect/jsonudf.h @@ -349,7 +349,7 @@ protected: my_bool AddPath(void); // Default constructor not to be used - JSNX(void) {} + JSNX(void) = default; // Members PJSON Row; diff --git a/storage/connect/myconn.cpp b/storage/connect/myconn.cpp index 4c16a7fc1aa..bb6f72de1f8 100644 --- a/storage/connect/myconn.cpp +++ b/storage/connect/myconn.cpp @@ -405,18 +405,20 @@ PQRYRES SrcColumns(PGLOBAL g, const char *host, const char *db, port = mysqld_port; if (!strnicmp(srcdef, "select ", 7) || strstr(srcdef, "%s")) { - query = (char *)PlugSubAlloc(g, NULL, strlen(srcdef) + 10); + size_t query_sz = strlen(srcdef) + 10; + query = (char *)PlugSubAlloc(g, NULL, query_sz); if ((p= strstr(srcdef, "%s"))) { /* Replace %s with 1=1 */ - sprintf(query, "%.*s1=1%s", (int) (p - srcdef), srcdef, p + 2); // dummy where clause + snprintf(query, query_sz, "%.*s1=1%s", + (int) (p - srcdef), srcdef, p + 2); // dummy where clause } - else - strcpy(query, srcdef); + else + safe_strcpy(query, query_sz, srcdef); if (!strnicmp(srcdef, "select ", 7)) - strcat(query, " LIMIT 0"); + safe_strcat(query, query_sz, " LIMIT 0"); } else query = (char *)srcdef; diff --git a/storage/connect/tabbson.h b/storage/connect/tabbson.h index 1696f4dfdbc..9d5a8b7daf5 100644 --- a/storage/connect/tabbson.h +++ b/storage/connect/tabbson.h @@ -257,7 +257,7 @@ protected: bool SetArrayOptions(PGLOBAL g, char* p, int i, PSZ nm); // Default constructor not to be used - BSONCOL(void) {} + BSONCOL(void) = default; // Members TDBBSN *Tbp; // To the JSN table block diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 80dfe63845d..22bb5c63ce3 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -245,7 +245,7 @@ class DllExport DOSCOL : public COLBLK { bool AddDistinctValue(PGLOBAL g); // Default constructor not to be used - DOSCOL(void) {} + DOSCOL(void) = default; // Members PVBLK Min; // Array of block min values diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h index 5f859a2bffe..1a0d756bfcf 100644 --- a/storage/connect/tabfix.h +++ b/storage/connect/tabfix.h @@ -82,7 +82,7 @@ class DllExport BINCOL : public DOSCOL { static void SetEndian(void); protected: - BINCOL(void) {} // Default constructor not to be used + BINCOL(void) = default; // Default constructor not to be used // Members static char Endian; // The host endian setting (L or B) diff --git a/storage/connect/tabfmt.h b/storage/connect/tabfmt.h index c46b5a3074e..268d00b1724 100644 --- a/storage/connect/tabfmt.h +++ b/storage/connect/tabfmt.h @@ -121,7 +121,7 @@ class DllExport CSVCOL : public DOSCOL { protected: // Default constructor not to be used - CSVCOL(void) {} + CSVCOL(void) = default; // Members int Fldnum; // Field ordinal number (0 based) diff --git a/storage/connect/tabjmg.h b/storage/connect/tabjmg.h index cf7cff83b68..06c1462d103 100644 --- a/storage/connect/tabjmg.h +++ b/storage/connect/tabjmg.h @@ -118,7 +118,7 @@ public: protected: // Default constructor not to be used - JMGCOL(void) {} + JMGCOL(void) = default; //char *GetProjPath(PGLOBAL g); //char *Mini(PGLOBAL g, const bson_t *bson, bool b); diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index 623e5b6d509..dcf40620dae 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -238,7 +238,7 @@ public: PJSON GetRow(PGLOBAL g); // Default constructor not to be used - JSONCOL(void) {} + JSONCOL(void) = default; // Members PGLOBAL G; // Support of parse memory diff --git a/storage/connect/tabmul.h b/storage/connect/tabmul.h index a9d3f88cc44..a01e4e7fdf2 100644 --- a/storage/connect/tabmul.h +++ b/storage/connect/tabmul.h @@ -237,7 +237,7 @@ class DIRCOL : public COLBLK { protected: // Default constructor not to be used - DIRCOL(void) {} + DIRCOL(void) = default; #if defined(_WIN32) void SetTimeValue(PGLOBAL g, FILETIME& ftime); #endif // _WIN32 diff --git a/storage/connect/taboccur.h b/storage/connect/taboccur.h index 13bc055cd6f..8cd507acb7d 100644 --- a/storage/connect/taboccur.h +++ b/storage/connect/taboccur.h @@ -99,7 +99,7 @@ class OCCURCOL : public COLBLK { protected: // Default constructor not to be used - OCCURCOL(void) {} + OCCURCOL(void) = default; // Members int I; @@ -121,7 +121,7 @@ class RANKCOL : public COLBLK { protected: // Default constructor not to be used - RANKCOL(void) {} + RANKCOL(void) = default; // Members }; // end of class RANKCOL diff --git a/storage/connect/tabpivot.h b/storage/connect/tabpivot.h index d819d55a61a..0a37804ff87 100644 --- a/storage/connect/tabpivot.h +++ b/storage/connect/tabpivot.h @@ -188,7 +188,7 @@ class SRCCOL : public PRXCOL { protected: // Default constructor not to be used - SRCCOL(void) {} + SRCCOL(void) = default; // Members }; // end of class SRCCOL diff --git a/storage/connect/tabsys.h b/storage/connect/tabsys.h index 0c6017af177..0a427b12dae 100644 --- a/storage/connect/tabsys.h +++ b/storage/connect/tabsys.h @@ -108,7 +108,7 @@ class INICOL : public COLBLK { protected: // Default constructor not to be used - INICOL(void) {} + INICOL(void) = default; // Members char *Valbuf; // To the key value buffer @@ -176,7 +176,7 @@ class XINCOL : public INICOL { protected: // Default constructor not to be used - XINCOL(void) {} + XINCOL(void) = default; // Members }; // end of class XINICOL diff --git a/storage/connect/tabutil.h b/storage/connect/tabutil.h index c8e7e75106f..6cf2b11632b 100644 --- a/storage/connect/tabutil.h +++ b/storage/connect/tabutil.h @@ -122,7 +122,7 @@ class DllExport PRXCOL : public COLBLK { char *Decode(PGLOBAL g, const char *cnm); // Default constructor not to be used - PRXCOL(void) {} + PRXCOL(void) = default; // Members PCOL Colp; // Points to matching table column diff --git a/storage/connect/tabvct.h b/storage/connect/tabvct.h index 189a9ae2221..06ccde71bcb 100644 --- a/storage/connect/tabvct.h +++ b/storage/connect/tabvct.h @@ -110,7 +110,7 @@ class DllExport VCTCOL : public DOSCOL { virtual void ReadBlock(PGLOBAL g); virtual void WriteBlock(PGLOBAL g); - VCTCOL(void) {} // Default constructor not to be used + VCTCOL(void) = default; // Default constructor not to be used // Members PVBLK Blk; // Block buffer diff --git a/storage/connect/tabvir.h b/storage/connect/tabvir.h index e7313bbae67..b92ca0c50f8 100644 --- a/storage/connect/tabvir.h +++ b/storage/connect/tabvir.h @@ -21,7 +21,7 @@ PQRYRES VirColumns(PGLOBAL g, bool info); class DllExport VIRDEF : public TABDEF { /* Logical table description */ public: // Constructor - VIRDEF(void) {} + VIRDEF(void) = default; // Implementation virtual const char *GetType(void) {return "VIRTUAL";} @@ -86,7 +86,7 @@ class VIRCOL : public COLBLK { protected: // Default constructor not to be used - VIRCOL(void) {} + VIRCOL(void) = default; // No additional members }; // end of class VIRCOL diff --git a/storage/connect/tabxcl.h b/storage/connect/tabxcl.h index 2ae96703548..08beb5fe6ac 100644 --- a/storage/connect/tabxcl.h +++ b/storage/connect/tabxcl.h @@ -95,7 +95,7 @@ class XCLCOL : public PRXCOL { protected: // Default constructor not to be used - XCLCOL(void) {} + XCLCOL(void) = default; // Members char *Cbuf; // The column buffer diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h index d36e4dc01d0..3c16fae99bc 100644 --- a/storage/connect/tabzip.h +++ b/storage/connect/tabzip.h @@ -23,7 +23,7 @@ class DllExport ZIPDEF : public DOSDEF { /* Table description */ friend class UNZFAM; public: // Constructor - ZIPDEF(void) {} + ZIPDEF(void) = default; // Implementation virtual const char *GetType(void) {return "ZIP";} @@ -94,7 +94,7 @@ public: protected: // Default constructor not to be used - ZIPCOL(void) {} + ZIPCOL(void) = default; // Members TDBZIP *Tdbz; diff --git a/storage/connect/xtable.h b/storage/connect/xtable.h index 1b499e09047..58acf550a0b 100644 --- a/storage/connect/xtable.h +++ b/storage/connect/xtable.h @@ -264,7 +264,7 @@ class DllExport CATCOL : public COLBLK { virtual void ReadColumn(PGLOBAL g); protected: - CATCOL(void) {} // Default constructor not to be used + CATCOL(void) = default; // Default constructor not to be used // Members PTDBCAT Tdbp; // Points to ODBC table block diff --git a/storage/example/ha_example.h b/storage/example/ha_example.h index 92acce5b7bb..78b07ed5d9f 100644 --- a/storage/example/ha_example.h +++ b/storage/example/ha_example.h @@ -68,9 +68,7 @@ class ha_example: public handler public: ha_example(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_example() - { - } + ~ha_example() = default; /** @brief The name of the index type that will be used for display. diff --git a/storage/federated/ha_federated.cc b/storage/federated/ha_federated.cc index 2a375a41200..efb598bf91e 100644 --- a/storage/federated/ha_federated.cc +++ b/storage/federated/ha_federated.cc @@ -1665,7 +1665,7 @@ int ha_federated::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, diff --git a/storage/federated/ha_federated.h b/storage/federated/ha_federated.h index 317271f60b4..b5ee49755cb 100644 --- a/storage/federated/ha_federated.h +++ b/storage/federated/ha_federated.h @@ -121,7 +121,7 @@ private: int real_connect(); public: ha_federated(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federated() {} + ~ha_federated() = default; /* Next pointer used in transaction */ diff --git a/storage/federatedx/federatedx_io_null.cc b/storage/federatedx/federatedx_io_null.cc index b1058dbd2f5..8a2394f2150 100644 --- a/storage/federatedx/federatedx_io_null.cc +++ b/storage/federatedx/federatedx_io_null.cc @@ -118,9 +118,7 @@ federatedx_io_null::federatedx_io_null(FEDERATEDX_SERVER *aserver) } -federatedx_io_null::~federatedx_io_null() -{ -} +federatedx_io_null::~federatedx_io_null() = default; void federatedx_io_null::reset() diff --git a/storage/federatedx/federatedx_pushdown.cc b/storage/federatedx/federatedx_pushdown.cc index 0d58e0d8270..e9a9791a859 100644 --- a/storage/federatedx/federatedx_pushdown.cc +++ b/storage/federatedx/federatedx_pushdown.cc @@ -144,7 +144,7 @@ ha_federatedx_derived_handler::ha_federatedx_derived_handler(THD *thd, derived= dt; } -ha_federatedx_derived_handler::~ha_federatedx_derived_handler() {} +ha_federatedx_derived_handler::~ha_federatedx_derived_handler() = default; int ha_federatedx_derived_handler::init_scan() { @@ -281,7 +281,7 @@ ha_federatedx_select_handler::ha_federatedx_select_handler(THD *thd, select= sel; } -ha_federatedx_select_handler::~ha_federatedx_select_handler() {} +ha_federatedx_select_handler::~ha_federatedx_select_handler() = default; int ha_federatedx_select_handler::init_scan() { diff --git a/storage/federatedx/ha_federatedx.cc b/storage/federatedx/ha_federatedx.cc index a39e707b401..62a71aa6db6 100644 --- a/storage/federatedx/ha_federatedx.cc +++ b/storage/federatedx/ha_federatedx.cc @@ -1834,7 +1834,7 @@ int ha_federatedx::open(const char *name, int mode, uint test_if_locked) class Net_error_handler : public Internal_error_handler { public: - Net_error_handler() {} + Net_error_handler() = default; public: bool handle_condition(THD *thd, uint sql_errno, const char* sqlstate, diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 6876db5cbb8..a67fe1efa8f 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -315,7 +315,7 @@ private: int real_connect(FEDERATEDX_SHARE *my_share, uint create_flag); public: ha_federatedx(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_federatedx() {} + ~ha_federatedx() = default; /* The name of the index type that will be used for display don't implement this method unless you really have indexes diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index beb97601c06..eed91176136 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -36,7 +36,7 @@ class ha_heap final : public handler my_bool internal_table; public: ha_heap(handlerton *hton, TABLE_SHARE *table); - ~ha_heap() {} + ~ha_heap() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override; const char *index_type(uint inx) override { diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index c1e4d95efcf..3b1a285104c 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -75,12 +75,6 @@ IF(WITH_INNODB_EXTRA_DEBUG) ENDIF() ADD_FEATURE_INFO(INNODB_EXTRA_DEBUG WITH_INNODB_EXTRA_DEBUG "Extra InnoDB debug checks") - -CHECK_FUNCTION_EXISTS(sched_getcpu HAVE_SCHED_GETCPU) -IF(HAVE_SCHED_GETCPU) - ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1) -ENDIF() - IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1) ENDIF() diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 6528eb0173f..36dc578dc7f 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -1768,6 +1768,7 @@ dberr_t btr_cur_t::open_leaf(bool first, dict_index_t *index, ut_ad(root_leaf_rw_latch != RW_NO_LATCH); upper_rw_latch= root_leaf_rw_latch; mtr->rollback_to_savepoint(savepoint); + height= ULINT_UNDEFINED; continue; } else diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 21ef245a3ae..0a4da87083a 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -3075,8 +3075,7 @@ or decrypt/decompress just failed. @retval DB_SUCCESS if page has been read and is not corrupted @retval DB_PAGE_CORRUPTED if page based on checksum check is corrupted @retval DB_DECRYPTION_FAILED if page post encryption checksum matches but -after decryption normal page checksum does not match. -@retval DB_TABLESPACE_DELETED if accessed tablespace is not found */ +after decryption normal page checksum does not match. */ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, const fil_node_t &node) { @@ -3133,7 +3132,8 @@ static dberr_t buf_page_check_corrupt(buf_page_t *bpage, @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails -@retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ +@retval DB_DECRYPTION_FAILED if the page cannot be decrypted +@retval DB_FAIL if the page contains the wrong ID */ dberr_t buf_page_t::read_complete(const fil_node_t &node) { const page_id_t expected_id{id()}; diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index f5b31c1f3f8..6c994b8c9bd 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -398,6 +398,11 @@ buf_block_t* buf_LRU_get_free_block(buf_LRU_get get) mysql_mutex_assert_owner(&buf_pool.mutex); goto got_mutex; } + DBUG_EXECUTE_IF("recv_ran_out_of_buffer", + if (recv_recovery_is_on() + && recv_sys.apply_log_recs) { + goto flush_lru; + }); mysql_mutex_lock(&buf_pool.mutex); got_mutex: buf_LRU_check_size_of_non_data_objects(); @@ -487,7 +492,9 @@ not_found: removing the block from buf_pool.page_hash and buf_pool.LRU is fairly involved (particularly in case of ROW_FORMAT=COMPRESSED pages). We can do that in a separate patch sometime in future. */ - +#ifndef DBUG_OFF +flush_lru: +#endif if (!buf_flush_LRU(innodb_lru_flush_size)) { MONITOR_INC(MONITOR_LRU_SINGLE_FLUSH_FAILURE_COUNT); ++flush_failures; diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 24890ff3d91..3906ff65dfb 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -264,6 +264,9 @@ buf_read_page_low( /* The i/o was already completed in space->io() */ *err = bpage->read_complete(*fio.node); space->release(); + if (*err == DB_FAIL) { + *err = DB_PAGE_CORRUPTED; + } } return true; diff --git a/storage/innobase/dict/dict0defrag_bg.cc b/storage/innobase/dict/dict0defrag_bg.cc index 964e75aacc1..b688f3970fc 100644 --- a/storage/innobase/dict/dict0defrag_bg.cc +++ b/storage/innobase/dict/dict0defrag_bg.cc @@ -311,7 +311,7 @@ btr_get_size_and_reserved( return ULINT_UNDEFINED; } - mtr->s_lock_space(index->table->space); + mtr->x_lock_space(index->table->space); ulint n = fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_LEAF + root->page.frame, used, mtr); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index f3e11c10bad..04b1ec88ac3 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -1475,7 +1475,7 @@ invalid: goto invalid; } - mtr.s_lock_space(index->table->space); + mtr.x_lock_space(index->table->space); ulint dummy, size; index->stat_index_size @@ -2674,7 +2674,7 @@ empty_index: } uint16_t root_level = btr_page_get_level(root->page.frame); - mtr.s_lock_space(index->table->space); + mtr.x_lock_space(index->table->space); ulint dummy, size; result.index_size = fseg_n_reserved_pages(*root, PAGE_HEADER + PAGE_BTR_SEG_LEAF @@ -2984,6 +2984,7 @@ dict_stats_update_persistent( index_stats_t stats = dict_stats_analyze_index(index); if (stats.is_bulk_operation()) { + dict_stats_empty_table(table, false); return DB_SUCCESS_LOCKED_REC; } @@ -3024,6 +3025,12 @@ dict_stats_update_persistent( stats = dict_stats_analyze_index(index); table->stats_mutex_lock(); + if (stats.is_bulk_operation()) { + table->stats_mutex_unlock(); + dict_stats_empty_table(table, false); + return DB_SUCCESS_LOCKED_REC; + } + index->stat_index_size = stats.index_size; index->stat_n_leaf_pages = stats.n_leaf_pages; diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 067aca49b4c..4918cefb947 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1678,8 +1678,9 @@ fil_crypt_get_page_throttle( return NULL; } - if (DB_SUCCESS_LOCKED_REC - != fseg_page_is_allocated(space, state->offset)) { + if (offset % (zip_size ? zip_size : srv_page_size) + && DB_SUCCESS_LOCKED_REC + != fseg_page_is_allocated(space, offset)) { /* page is already freed */ return NULL; } diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index f3e3322de4b..f7625974886 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -2655,7 +2655,7 @@ dberr_t fseg_page_is_allocated(fil_space_t *space, unsigned page) mtr.start(); if (!space->is_owner()) - mtr.s_lock_space(space); + mtr.x_lock_space(space); if (page >= space->free_limit || page >= space->size_in_header); else if (const buf_block_t *b= diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 7cba8c46fff..de1f2042be3 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2982,10 +2982,8 @@ ha_innobase::ha_innobase( /*********************************************************************//** Destruct ha_innobase handler. */ -ha_innobase::~ha_innobase() +ha_innobase::~ha_innobase() = default; /*======================*/ -{ -} /*********************************************************************//** Updates the user_thd field in a handle and also allocates a new InnoDB diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 846cf5e5f3a..59aa1ac08ad 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -740,7 +740,8 @@ public: @param node data file @return whether the operation succeeded @retval DB_PAGE_CORRUPTED if the checksum fails - @retval DB_DECRYPTION_FAILED if the page cannot be decrypted */ + @retval DB_DECRYPTION_FAILED if the page cannot be decrypted + @retval DB_FAIL if the page contains the wrong ID */ dberr_t read_complete(const fil_node_t &node); /** Note that a block is no longer dirty, while not removing @@ -1002,7 +1003,7 @@ even after we release the buffer pool mutex. */ class HazardPointer { public: - virtual ~HazardPointer() {} + virtual ~HazardPointer() = default; /** @return current value */ buf_page_t *get() const { mysql_mutex_assert_owner(m_mutex); return m_hp; } @@ -1041,16 +1042,15 @@ protected: class FlushHp : public HazardPointer { public: - ~FlushHp() override {} + ~FlushHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage != NULL); - /* We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(list, m_hp); @@ -1062,15 +1062,15 @@ public: /** Class implementing buf_pool.LRU hazard pointer */ class LRUHp : public HazardPointer { public: - ~LRUHp() override {} + ~LRUHp() override = default; /** Adjust the value of hp. This happens when some other thread working on the same list attempts to remove the hp from the list. @param bpage buffer block to be compared */ + MY_ATTRIBUTE((nonnull)) void adjust(const buf_page_t *bpage) override { - ut_ad(bpage); /** We only support reverse traversal for now. */ if (is_hp(bpage)) m_hp= UT_LIST_GET_PREV(LRU, m_hp); @@ -1085,8 +1085,7 @@ itr in that position and the other thread can start scan from there */ class LRUItr : public LRUHp { public: - LRUItr() : LRUHp() {} - ~LRUItr() override {} + ~LRUItr() override = default; /** Select from where to start a scan. If we have scanned too deep into the LRU list it resets the value to the tail diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index 82a0f780723..f6169227433 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -101,7 +101,7 @@ struct table_name_t char* m_name; /** Default constructor */ - table_name_t() {} + table_name_t() = default; /** Constructor */ table_name_t(char* name) : m_name(name) {} diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 6a2148d487c..cdb159a5b26 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -283,17 +283,6 @@ struct mtr_t { memo_push(lock, MTR_MEMO_SX_LOCK); } - /** Acquire a tablespace S-latch. - @param space tablespace */ - void s_lock_space(fil_space_t *space) - { - ut_ad(space->purpose == FIL_TYPE_TEMPORARY || - space->purpose == FIL_TYPE_IMPORT || - space->purpose == FIL_TYPE_TABLESPACE); - memo_push(space, MTR_MEMO_SPACE_S_LOCK); - space->s_lock(); - } - /** Acquire an exclusive tablespace latch. @param space tablespace */ void x_lock_space(fil_space_t *space); @@ -346,9 +335,8 @@ public: /** Check if we are holding tablespace latch @param space tablespace to search for - @param shared whether to look for shared latch, instead of exclusive @return whether space.latch is being held */ - bool memo_contains(const fil_space_t& space, bool shared= false) const + bool memo_contains(const fil_space_t& space) const MY_ATTRIBUTE((warn_unused_result)); #ifdef UNIV_DEBUG /** Check if we are holding an rw-latch in this mini-transaction @@ -401,7 +389,7 @@ public: break; case MTR_MEMO_MODIFY: case MTR_MEMO_S_LOCK: case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: - case MTR_MEMO_SPACE_X_LOCK: case MTR_MEMO_SPACE_S_LOCK: + case MTR_MEMO_SPACE_X_LOCK: ut_ad("invalid type" == 0); } #endif diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 1de31126a88..19db13a12b6 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -342,8 +342,6 @@ enum mtr_memo_type_t { MTR_MEMO_SX_LOCK = RW_SX_LATCH << 5, /** wr_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1, - /** rd_lock() on fil_space_t::latch */ - MTR_MEMO_SPACE_S_LOCK = MTR_MEMO_SX_LOCK << 2 + MTR_MEMO_SPACE_X_LOCK = MTR_MEMO_SX_LOCK << 1 }; #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/include/rem0rec.h b/storage/innobase/include/rem0rec.h index dcf26e57e7e..2f038ab349f 100644 --- a/storage/innobase/include/rem0rec.h +++ b/storage/innobase/include/rem0rec.h @@ -1223,7 +1223,7 @@ public: } /** Destructor */ - ~rec_printer() override {} + ~rec_printer() override = default; private: /** Copy constructor */ diff --git a/storage/innobase/include/row0mysql.h b/storage/innobase/include/row0mysql.h index a49e2c3f441..a9f1c87d600 100644 --- a/storage/innobase/include/row0mysql.h +++ b/storage/innobase/include/row0mysql.h @@ -702,7 +702,7 @@ struct row_prebuilt_t { /** Callback for row_mysql_sys_index_iterate() */ struct SysIndexCallback { - virtual ~SysIndexCallback() { } + virtual ~SysIndexCallback() = default; /** Callback method @param mtr current mini transaction diff --git a/storage/innobase/include/trx0purge.h b/storage/innobase/include/trx0purge.h index 3711599bd8c..ac39d3ec45b 100644 --- a/storage/innobase/include/trx0purge.h +++ b/storage/innobase/include/trx0purge.h @@ -56,7 +56,7 @@ public: typedef trx_rsegs_t::iterator iterator; typedef trx_rsegs_t::const_iterator const_iterator; - TrxUndoRsegs() {} + TrxUndoRsegs() = default; /** Constructor */ TrxUndoRsegs(trx_rseg_t& rseg) diff --git a/storage/innobase/include/ut0new.h b/storage/innobase/include/ut0new.h index cd116cc3a20..f4183e4c61a 100644 --- a/storage/innobase/include/ut0new.h +++ b/storage/innobase/include/ut0new.h @@ -283,7 +283,7 @@ public: { } #else - ut_allocator() {} + ut_allocator() = default; ut_allocator(PSI_memory_key) {} #endif /* UNIV_PFS_MEMORY */ diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 95541ea574e..fe16ce149da 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -323,7 +323,7 @@ class logger { protected: /* This class must not be used directly */ - ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() {} + ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger() = default; public: template<typename T> ATTRIBUTE_COLD ATTRIBUTE_NOINLINE logger& operator<<(const T& rhs) diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 66b98c5c046..fbfe37d7d41 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -725,8 +725,10 @@ static struct bool reinit_all() { retry: + log_sys.latch.wr_unlock(); bool fail= false; buf_block_t *free_block= buf_LRU_get_free_block(have_no_mutex); + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&recv_sys.mutex); for (auto d= defers.begin(); d != defers.end(); ) @@ -1859,7 +1861,7 @@ inline bool page_recv_t::trim(lsn_t start_lsn) { while (log.head) { - if (log.head->lsn >= start_lsn) return false; + if (log.head->lsn > start_lsn) return false; last_offset= 1; /* the next record must not be same_page */ log_rec_t *next= log.head->next; recv_sys.free(log.head); @@ -2485,6 +2487,9 @@ inline recv_sys_t::parse_mtr_result recv_sys_t::parse(store_t store, source &l) goto record_corrupted; static_assert(UT_ARR_SIZE(truncated_undo_spaces) == TRX_SYS_MAX_UNDO_SPACES, "compatibility"); + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. */ + trim({space_id, 0}, lsn); truncated_undo_spaces[space_id - srv_undo_space_id_start]= { lsn, page_no }; if (undo_space_trunc) @@ -3364,7 +3369,12 @@ void recv_sys_t::apply(bool last_batch) const trunc& t= truncated_undo_spaces[id]; if (t.lsn) { - trim(page_id_t(id + srv_undo_space_id_start, 0), t.lsn); + /* The entire undo tablespace will be reinitialized by + innodb_undo_log_truncate=ON. Discard old log for all pages. + Even though we recv_sys_t::parse() already invoked trim(), + this will be needed in case recovery consists of multiple batches + (there was an invocation with !last_batch). */ + trim({id + srv_undo_space_id_start, 0}, t.lsn); if (fil_space_t *space = fil_space_get(id + srv_undo_space_id_start)) { ut_ad(UT_LIST_GET_LEN(space->chain) == 1); @@ -3378,8 +3388,21 @@ void recv_sys_t::apply(bool last_batch) fil_system.extend_to_recv_size(); + /* We must release log_sys.latch and recv_sys.mutex before + invoking buf_LRU_get_free_block(). Allocating a block may initiate + a redo log write and therefore acquire log_sys.latch. To avoid + deadlocks, log_sys.latch must not be acquired while holding + recv_sys.mutex. */ + mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); + buf_block_t *free_block= buf_LRU_get_free_block(have_no_mutex); + if (!last_batch) + log_sys.latch.wr_lock(SRW_LOCK_CALL); + mysql_mutex_lock(&mutex); + for (map::iterator p= pages.begin(); p != pages.end(); ) { const page_id_t page_id= p->first; @@ -3425,7 +3448,11 @@ erase_for_space: { next_free_block: mysql_mutex_unlock(&mutex); + if (!last_batch) + log_sys.latch.wr_unlock(); free_block= buf_LRU_get_free_block(have_no_mutex); + if (!last_batch) + log_sys.latch.wr_lock(SRW_LOCK_CALL); mysql_mutex_lock(&mutex); break; } @@ -4143,6 +4170,11 @@ read_only_recovery: || recv_sys.is_corrupt_fs()) { goto err_exit; } + + /* In case of multi-batch recovery, + redo log for the last batch is not + applied yet. */ + ut_d(recv_sys.after_apply = false); } } else { ut_ad(recv_sys.pages.empty()); diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index d2f62b5c39e..d642c7266bb 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -52,9 +52,6 @@ void mtr_memo_slot_t::release() const static_cast<fil_space_t*>(object)->set_committed_size(); static_cast<fil_space_t*>(object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(object)->s_unlock(); - break; default: buf_page_t *bpage= static_cast<buf_page_t*>(object); ut_d(const auto s=) @@ -262,9 +259,6 @@ void mtr_t::release_unlogged() static_cast<fil_space_t*>(slot.object)->set_committed_size(); static_cast<fil_space_t*>(slot.object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(slot.object)->s_unlock(); - break; case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: static_cast<index_lock*>(slot.object)-> @@ -404,9 +398,6 @@ void mtr_t::commit() static_cast<fil_space_t*>(slot.object)->set_committed_size(); static_cast<fil_space_t*>(slot.object)->x_unlock(); break; - case MTR_MEMO_SPACE_S_LOCK: - static_cast<fil_space_t*>(slot.object)->s_unlock(); - break; case MTR_MEMO_X_LOCK: case MTR_MEMO_SX_LOCK: static_cast<index_lock*>(slot.object)-> @@ -457,7 +448,20 @@ void mtr_t::commit() buf_flush_ahead(m_commit_lsn, lsns.second == PAGE_FLUSH_SYNC); } else + { + if (m_freed_pages) + { + ut_ad(!m_freed_pages->empty()); + ut_ad(m_freed_space == fil_system.temp_space); + ut_ad(!m_trim_pages); + for (const auto &range : *m_freed_pages) + m_freed_space->add_free_range(range); + delete m_freed_pages; + m_freed_pages= nullptr; + m_freed_space= nullptr; + } release(); + } func_exit: release_resources(); @@ -1298,18 +1302,14 @@ bool mtr_t::have_u_or_x_latch(const buf_block_t &block) const /** Check if we are holding exclusive tablespace latch @param space tablespace to search for -@param shared whether to look for shared latch, instead of exclusive @return whether space.latch is being held */ -bool mtr_t::memo_contains(const fil_space_t& space, bool shared) const +bool mtr_t::memo_contains(const fil_space_t& space) const { - const mtr_memo_type_t type= shared - ? MTR_MEMO_SPACE_S_LOCK : MTR_MEMO_SPACE_X_LOCK; - for (const mtr_memo_slot_t &slot : m_memo) { - if (slot.object == &space && slot.type == type) + if (slot.object == &space && slot.type == MTR_MEMO_SPACE_X_LOCK) { - ut_ad(shared || space.is_owner()); + ut_ad(space.is_owner()); return true; } } diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 63bd39feb4d..1060e702db4 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -766,10 +766,9 @@ corrupted: max_trx_id is ignored for temp tables because it not required for MVCC. */ if (n_core && !index->is_primary() && !index->table->is_temporary()) { - page_update_max_trx_id(new_block, - new_page_zip, + page_update_max_trx_id(new_block, nullptr, page_get_max_trx_id(block->page.frame), - mtr); + mtr); } if (new_page_zip) { diff --git a/storage/innobase/rem/rem0cmp.cc b/storage/innobase/rem/rem0cmp.cc index 92ec8ba0869..e48cad01530 100644 --- a/storage/innobase/rem/rem0cmp.cc +++ b/storage/innobase/rem/rem0cmp.cc @@ -724,9 +724,12 @@ cmp_rec_rec_simple( /* If we ran out of fields, the ordering columns of rec1 were equal to rec2. Issue a duplicate key error if needed. */ - if (!null_eq && table && dict_index_is_unique(index)) { - /* Report erroneous row using new version of table. */ - innobase_rec_to_mysql(table, rec1, index, offsets1); + if (!null_eq && index->is_unique()) { + if (table) { + /* Report erroneous row using new version + of table. */ + innobase_rec_to_mysql(table, rec1, index, offsets1); + } return(0); } diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 133ad520d01..5d7ea475d43 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -349,8 +349,8 @@ public: << index->name; } - /** Descructor */ - ~IndexPurge() UNIV_NOTHROW { } + /** Destructor */ + ~IndexPurge() UNIV_NOTHROW = default; /** Purge delete marked records. @return DB_SUCCESS or error code. */ @@ -691,7 +691,7 @@ struct FetchIndexRootPages : public AbstractCallback { m_table(table), m_index(0, 0) UNIV_NOTHROW { } /** Destructor */ - ~FetchIndexRootPages() UNIV_NOTHROW override { } + ~FetchIndexRootPages() UNIV_NOTHROW override = default; /** Fetch the clustered index root page in the tablespace @param iter Tablespace iterator diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 7c4e5a0d890..2e4f8c283f9 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -389,17 +389,6 @@ thread ensures that we flush the log files at least once per second. */ static time_t srv_last_log_flush_time; -/* Interval in seconds at which various tasks are performed by the -master thread when server is active. In order to balance the workload, -we should try to keep intervals such that they are not multiple of -each other. For example, if we have intervals for various tasks -defined as 5, 10, 15, 60 then all tasks will be performed when -current_time % 60 == 0 and no tasks will be performed when -current_time % 5 != 0. */ - -# define SRV_MASTER_CHECKPOINT_INTERVAL (7) -# define SRV_MASTER_DICT_LRU_INTERVAL (47) - /** Buffer pool dump status frequence in percentages */ ulong srv_buf_dump_status_frequency; @@ -1342,7 +1331,7 @@ static void srv_master_do_active_tasks(ulonglong counter_time) MONITOR_INC(MONITOR_MASTER_ACTIVE_LOOPS); - if (!(counter_time % (SRV_MASTER_DICT_LRU_INTERVAL * 1000000ULL))) { + if (!(counter_time % (47 * 1000000ULL))) { srv_main_thread_op_info = "enforcing dict cache limit"; if (ulint n_evicted = dict_sys.evict_table_LRU(true)) { MONITOR_INC_VALUE( diff --git a/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index bea913e424f..009e8ca5fe7 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -64,7 +64,7 @@ private: public: ha_maria(handlerton *hton, TABLE_SHARE * table_arg); - ~ha_maria() {} + ~ha_maria() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override final; const char *index_type(uint key_number) override final; ulonglong table_flags() const override final diff --git a/storage/maria/ha_s3.cc b/storage/maria/ha_s3.cc index c00f42d74c1..8c105522c11 100644 --- a/storage/maria/ha_s3.cc +++ b/storage/maria/ha_s3.cc @@ -233,7 +233,7 @@ ha_create_table_option s3_table_option_list[]= ha_s3::ha_s3(handlerton *hton, TABLE_SHARE *table_arg) - :ha_maria(hton, table_arg), in_alter_table(S3_NO_ALTER) + :ha_maria(hton, table_arg), in_alter_table(S3_NO_ALTER), open_args(NULL) { /* Remove things that S3 doesn't support */ int_table_flags&= ~(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | diff --git a/storage/maria/s3_func.c b/storage/maria/s3_func.c index 491a8e0a323..3d18ba8800d 100644 --- a/storage/maria/s3_func.c +++ b/storage/maria/s3_func.c @@ -351,7 +351,7 @@ int aria_copy_to_s3(ms3_st *s3_client, const char *aws_bucket, if (display) printf("Copying frm file %s\n", filename); - end= strmov(aws_path_end,"/frm"); + strmov(aws_path_end,"/frm"); convert_frm_to_s3_format(alloc_block); /* Note that frm is not compressed! */ @@ -1232,7 +1232,7 @@ static void convert_index_to_s3_format(uchar *header, ulong block_size, uchar *base_pos; uint base_offset; - memcpy(state.header.file_version, header, sizeof(state.header)); + memcpy(&state.header, header, sizeof(state.header)); base_offset= mi_uint2korr(state.header.base_pos); base_pos= header + base_offset; @@ -1251,7 +1251,7 @@ static void convert_index_to_disk_format(uchar *header) uchar *base_pos; uint base_offset; - memcpy(state.header.file_version, header, sizeof(state.header)); + memcpy(&state.header, header, sizeof(state.header)); base_offset= mi_uint2korr(state.header.base_pos); base_pos= header + base_offset; diff --git a/storage/mroonga/lib/mrn_count_skip_checker.cpp b/storage/mroonga/lib/mrn_count_skip_checker.cpp index dfa1a11d2b8..cd22be31ef2 100644 --- a/storage/mroonga/lib/mrn_count_skip_checker.cpp +++ b/storage/mroonga/lib/mrn_count_skip_checker.cpp @@ -40,8 +40,7 @@ namespace mrn { is_storage_mode_(is_storage_mode) { } - CountSkipChecker::~CountSkipChecker() { - } + CountSkipChecker::~CountSkipChecker() = default; bool CountSkipChecker::check() { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_database_repairer.cpp b/storage/mroonga/lib/mrn_database_repairer.cpp index c0c4a90e8f7..08ddd84943e 100644 --- a/storage/mroonga/lib/mrn_database_repairer.cpp +++ b/storage/mroonga/lib/mrn_database_repairer.cpp @@ -57,8 +57,7 @@ namespace mrn { mrn_db_file_suffix_length_(strlen(MRN_DB_FILE_SUFFIX)) { } - DatabaseRepairer::~DatabaseRepairer() { - } + DatabaseRepairer::~DatabaseRepairer() = default; bool DatabaseRepairer::is_crashed(void) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_field_normalizer.cpp b/storage/mroonga/lib/mrn_field_normalizer.cpp index d7a81f749fc..db1af550a14 100644 --- a/storage/mroonga/lib/mrn_field_normalizer.cpp +++ b/storage/mroonga/lib/mrn_field_normalizer.cpp @@ -30,8 +30,7 @@ namespace mrn { field_(field) { } - FieldNormalizer::~FieldNormalizer() { - } + FieldNormalizer::~FieldNormalizer() = default; bool FieldNormalizer::should_normalize() { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp index 73639685d0e..dd3165cdadf 100644 --- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -70,8 +70,7 @@ namespace mrn { key_info_(key_info) { } - MultipleColumnKeyCodec::~MultipleColumnKeyCodec() { - } + MultipleColumnKeyCodec::~MultipleColumnKeyCodec() = default; int MultipleColumnKeyCodec::encode(const uchar *mysql_key, uint mysql_key_length, diff --git a/storage/mroonga/lib/mrn_query_parser.cpp b/storage/mroonga/lib/mrn_query_parser.cpp index 92387e259a8..b32ebd2c443 100644 --- a/storage/mroonga/lib/mrn_query_parser.cpp +++ b/storage/mroonga/lib/mrn_query_parser.cpp @@ -44,8 +44,7 @@ namespace mrn { match_columns_(match_columns) { } - QueryParser::~QueryParser() { - } + QueryParser::~QueryParser() = default; grn_rc QueryParser::parse(const char *query, size_t query_length) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/lib/mrn_time_converter.cpp b/storage/mroonga/lib/mrn_time_converter.cpp index 9bb8d89a082..7d7555bb47a 100644 --- a/storage/mroonga/lib/mrn_time_converter.cpp +++ b/storage/mroonga/lib/mrn_time_converter.cpp @@ -33,11 +33,9 @@ #define MRN_CLASS_NAME "mrn::TimeConverter" namespace mrn { - TimeConverter::TimeConverter() { - } + TimeConverter::TimeConverter() = default; - TimeConverter::~TimeConverter() { - } + TimeConverter::~TimeConverter() = default; time_t TimeConverter::tm_to_time_gm(struct tm *time, bool *truncated) { MRN_DBUG_ENTER_METHOD(); diff --git a/storage/mroonga/vendor/groonga/lib/alloc.c b/storage/mroonga/vendor/groonga/lib/alloc.c index 94e31901cec..adb35e04c45 100644 --- a/storage/mroonga/vendor/groonga/lib/alloc.c +++ b/storage/mroonga/vendor/groonga/lib/alloc.c @@ -828,7 +828,7 @@ grn_free_default(grn_ctx *ctx, void *ptr, if (ptr) { GRN_ADD_ALLOC_COUNT(-1); } else { - GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (%s:%d) <%d>", + GRN_LOG(ctx, GRN_LOG_ALERT, "free fail (nullptr) (%s:%d) <%d>", file, line, alloc_count); } } diff --git a/storage/mroonga/vendor/groonga/lib/dat/array.hpp b/storage/mroonga/vendor/groonga/lib/dat/array.hpp index de60e3bd590..58186ff4127 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/array.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/array.hpp @@ -33,7 +33,7 @@ class GRN_DAT_API Array { } template <UInt32 U> explicit Array(T (&array)[U]) : ptr_(array), size_(U) {} - ~Array() {} + ~Array() = default; const T &operator[](UInt32 i) const { GRN_DAT_DEBUG_THROW_IF(i >= size_); diff --git a/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp b/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp index 357b5250e99..740a56edfde 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/cursor.hpp @@ -25,8 +25,8 @@ namespace dat { class GRN_DAT_API Cursor { public: - Cursor() {} - virtual ~Cursor() {} + Cursor() = default; + virtual ~Cursor() = default; virtual void close() = 0; diff --git a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp index 1afbd0955bc..b6e2893ad07 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/dat.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/dat.hpp @@ -175,12 +175,8 @@ class Exception : public std::exception { file_(file), line_(line), what_((what != NULL) ? what : "") {} - Exception(const Exception &ex) throw() - : std::exception(ex), - file_(ex.file_), - line_(ex.line_), - what_(ex.what_) {} - virtual ~Exception() throw() {} + Exception(const Exception &ex) throw() = default; + virtual ~Exception() throw() = default; virtual ErrorCode code() const throw() = 0; virtual const char *file() const throw() { @@ -208,7 +204,7 @@ class Error : public Exception { : Exception(file, line, what) {} Error(const Error &ex) throw() : Exception(ex) {} - virtual ~Error() throw() {} + virtual ~Error() throw() = default; virtual ErrorCode code() const throw() { return T; diff --git a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp index de969839586..d3caf510dcd 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/id-cursor.cpp @@ -33,7 +33,7 @@ IdCursor::IdCursor() end_(INVALID_KEY_ID), count_(0) {} -IdCursor::~IdCursor() {} +IdCursor::~IdCursor() = default; void IdCursor::open(const Trie &trie, const String &min_str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/key.hpp b/storage/mroonga/vendor/groonga/lib/dat/key.hpp index eb0324cd8d3..717ad90a715 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/key.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/key.hpp @@ -99,7 +99,7 @@ class GRN_DAT_API Key { // Disallows instantiation. Key() : id_and_length_low_(INVALID_KEY_ID << 4), length_high_(0) {} - ~Key() {} + ~Key() = default; // Disallows copy and assignment. Key(const Key &); diff --git a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp index 67520305703..d9fd995beae 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/predictive-cursor.cpp @@ -35,7 +35,7 @@ PredictiveCursor::PredictiveCursor() end_(0), min_length_(0) {} -PredictiveCursor::~PredictiveCursor() {} +PredictiveCursor::~PredictiveCursor() = default; void PredictiveCursor::open(const Trie &trie, const String &str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp index 83adeb3731e..5f491c6644f 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/prefix-cursor.cpp @@ -33,7 +33,7 @@ PrefixCursor::PrefixCursor() cur_(0), end_(0) {} -PrefixCursor::~PrefixCursor() {} +PrefixCursor::~PrefixCursor() = default; void PrefixCursor::open(const Trie &trie, const String &str, diff --git a/storage/mroonga/vendor/groonga/lib/dat/string.hpp b/storage/mroonga/vendor/groonga/lib/dat/string.hpp index aead21cac18..281333ee18f 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/string.hpp +++ b/storage/mroonga/vendor/groonga/lib/dat/string.hpp @@ -35,9 +35,7 @@ class GRN_DAT_API String { explicit String(const char (&str)[T]) : ptr_(reinterpret_cast<const UInt8 *>(str)), length_(T - 1) {} - String(const String &rhs) - : ptr_(rhs.ptr_), - length_(rhs.length_) {} + String(const String &rhs) = default; String &operator=(const String &rhs) { set_ptr(rhs.ptr()); diff --git a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp index b2c6a84ffa7..47d53209953 100644 --- a/storage/mroonga/vendor/groonga/lib/dat/trie.cpp +++ b/storage/mroonga/vendor/groonga/lib/dat/trie.cpp @@ -55,7 +55,7 @@ Trie::Trie() entries_(), key_buf_() {} -Trie::~Trie() {} +Trie::~Trie() = default; void Trie::create(const char *file_name, UInt64 file_size, diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 68ad636c48e..0914d531788 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -53,7 +53,7 @@ class ha_myisam final : public handler public: ha_myisam(handlerton *hton, TABLE_SHARE *table_arg); - ~ha_myisam() {} + ~ha_myisam() = default; handler *clone(const char *name, MEM_ROOT *mem_root) override; const char *index_type(uint key_number) override; ulonglong table_flags() const override { return int_table_flags; } diff --git a/storage/perfschema/cursor_by_account.h b/storage/perfschema/cursor_by_account.h index 30ee3761f37..59adf2e0fc8 100644 --- a/storage/perfschema/cursor_by_account.h +++ b/storage/perfschema/cursor_by_account.h @@ -51,8 +51,7 @@ protected: cursor_by_account(const PFS_engine_table_share *share); public: - ~cursor_by_account() - {} + ~cursor_by_account() = default; protected: virtual void make_row(PFS_account *account)= 0; diff --git a/storage/perfschema/cursor_by_host.h b/storage/perfschema/cursor_by_host.h index e7ae47fef72..a2ddae4b644 100644 --- a/storage/perfschema/cursor_by_host.h +++ b/storage/perfschema/cursor_by_host.h @@ -51,8 +51,7 @@ protected: cursor_by_host(const PFS_engine_table_share *share); public: - ~cursor_by_host() - {} + ~cursor_by_host() = default; protected: virtual void make_row(PFS_host *host)= 0; diff --git a/storage/perfschema/cursor_by_thread.h b/storage/perfschema/cursor_by_thread.h index 910291c2be3..89d97997a41 100644 --- a/storage/perfschema/cursor_by_thread.h +++ b/storage/perfschema/cursor_by_thread.h @@ -51,8 +51,7 @@ protected: cursor_by_thread(const PFS_engine_table_share *share); public: - ~cursor_by_thread() - {} + ~cursor_by_thread() = default; protected: virtual void make_row(PFS_thread *thread)= 0; diff --git a/storage/perfschema/cursor_by_thread_connect_attr.h b/storage/perfschema/cursor_by_thread_connect_attr.h index aa1b63ad51e..3c273708e39 100644 --- a/storage/perfschema/cursor_by_thread_connect_attr.h +++ b/storage/perfschema/cursor_by_thread_connect_attr.h @@ -70,8 +70,7 @@ protected: cursor_by_thread_connect_attr(const PFS_engine_table_share *share); public: - ~cursor_by_thread_connect_attr() - {} + ~cursor_by_thread_connect_attr() = default; protected: virtual void make_row(PFS_thread *thread, uint ordinal)= 0; diff --git a/storage/perfschema/cursor_by_user.h b/storage/perfschema/cursor_by_user.h index ca4fef9209c..f5b6800d9b1 100644 --- a/storage/perfschema/cursor_by_user.h +++ b/storage/perfschema/cursor_by_user.h @@ -51,8 +51,7 @@ protected: cursor_by_user(const PFS_engine_table_share *share); public: - ~cursor_by_user() - {} + ~cursor_by_user() = default; protected: virtual void make_row(PFS_user *user)= 0; diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index 982876216aa..57aa40c7e86 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -238,8 +238,7 @@ ha_perfschema::ha_perfschema(handlerton *hton, TABLE_SHARE *share) : handler(hton, share), m_table_share(NULL), m_table(NULL) {} -ha_perfschema::~ha_perfschema() -{} +ha_perfschema::~ha_perfschema() = default; int ha_perfschema::open(const char *name, int mode, uint test_if_locked) { diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index d8646938bdb..6a9351b9d91 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -670,11 +670,9 @@ int PFS_engine_table::update_row_values(TABLE *, class PFS_internal_schema_access : public ACL_internal_schema_access { public: - PFS_internal_schema_access() - {} + PFS_internal_schema_access() = default; - ~PFS_internal_schema_access() - {} + ~PFS_internal_schema_access() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/storage/perfschema/pfs_engine_table.h b/storage/perfschema/pfs_engine_table.h index 6280a3799b3..1f31c4fcdf6 100644 --- a/storage/perfschema/pfs_engine_table.h +++ b/storage/perfschema/pfs_engine_table.h @@ -125,8 +125,7 @@ public: void get_normalizer(PFS_instr_class *instr_class); /** Destructor. */ - virtual ~PFS_engine_table() - {} + virtual ~PFS_engine_table() = default; /** Helper, assign a value to a long field. @@ -337,11 +336,9 @@ struct PFS_engine_table_share class PFS_readonly_acl : public ACL_internal_table_access { public: - PFS_readonly_acl() - {} + PFS_readonly_acl() = default; - ~PFS_readonly_acl() - {} + ~PFS_readonly_acl() = default; virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -357,11 +354,9 @@ extern PFS_readonly_acl pfs_readonly_acl; class PFS_truncatable_acl : public ACL_internal_table_access { public: - PFS_truncatable_acl() - {} + PFS_truncatable_acl() = default; - ~PFS_truncatable_acl() - {} + ~PFS_truncatable_acl() = default; virtual ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -377,11 +372,9 @@ extern PFS_truncatable_acl pfs_truncatable_acl; class PFS_updatable_acl : public ACL_internal_table_access { public: - PFS_updatable_acl() - {} + PFS_updatable_acl() = default; - ~PFS_updatable_acl() - {} + ~PFS_updatable_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -397,11 +390,9 @@ extern PFS_updatable_acl pfs_updatable_acl; class PFS_editable_acl : public ACL_internal_table_access { public: - PFS_editable_acl() - {} + PFS_editable_acl() = default; - ~PFS_editable_acl() - {} + ~PFS_editable_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; @@ -416,11 +407,9 @@ extern PFS_editable_acl pfs_editable_acl; class PFS_unknown_acl : public ACL_internal_table_access { public: - PFS_unknown_acl() - {} + PFS_unknown_acl() = default; - ~PFS_unknown_acl() - {} + ~PFS_unknown_acl() = default; ACL_internal_access_result check(privilege_t want_access, privilege_t *save_priv) const; diff --git a/storage/perfschema/pfs_visitor.cc b/storage/perfschema/pfs_visitor.cc index 4cb0673f1b2..17ef39448f9 100644 --- a/storage/perfschema/pfs_visitor.cc +++ b/storage/perfschema/pfs_visitor.cc @@ -895,8 +895,7 @@ PFS_connection_wait_visitor m_index= klass->m_event_name_index; } -PFS_connection_wait_visitor::~PFS_connection_wait_visitor() -{} +PFS_connection_wait_visitor::~PFS_connection_wait_visitor() = default; void PFS_connection_wait_visitor::visit_global() { @@ -959,12 +958,9 @@ void PFS_connection_wait_visitor::visit_thread(PFS_thread *pfs) } } -PFS_connection_all_wait_visitor -::PFS_connection_all_wait_visitor() -{} +PFS_connection_all_wait_visitor::PFS_connection_all_wait_visitor() = default; -PFS_connection_all_wait_visitor::~PFS_connection_all_wait_visitor() -{} +PFS_connection_all_wait_visitor::~PFS_connection_all_wait_visitor() = default; void PFS_connection_all_wait_visitor::visit_global() { @@ -1010,8 +1006,7 @@ PFS_connection_stage_visitor::PFS_connection_stage_visitor(PFS_stage_class *klas m_index= klass->m_event_name_index; } -PFS_connection_stage_visitor::~PFS_connection_stage_visitor() -{} +PFS_connection_stage_visitor::~PFS_connection_stage_visitor() = default; void PFS_connection_stage_visitor::visit_global() { @@ -1064,8 +1059,7 @@ PFS_connection_statement_visitor m_index= klass->m_event_name_index; } -PFS_connection_statement_visitor::~PFS_connection_statement_visitor() -{} +PFS_connection_statement_visitor::~PFS_connection_statement_visitor() = default; void PFS_connection_statement_visitor::visit_global() { @@ -1114,11 +1108,10 @@ void PFS_connection_statement_visitor::visit_thread(PFS_thread *pfs) /** Instance wait visitor */ PFS_connection_all_statement_visitor -::PFS_connection_all_statement_visitor() -{} +::PFS_connection_all_statement_visitor() = default; -PFS_connection_all_statement_visitor::~PFS_connection_all_statement_visitor() -{} +PFS_connection_all_statement_visitor +::~PFS_connection_all_statement_visitor() = default; void PFS_connection_all_statement_visitor::visit_global() { @@ -1259,11 +1252,9 @@ void PFS_connection_all_transaction_visitor::visit_thread(PFS_thread *pfs) } #endif -PFS_connection_stat_visitor::PFS_connection_stat_visitor() -{} +PFS_connection_stat_visitor::PFS_connection_stat_visitor() = default; -PFS_connection_stat_visitor::~PFS_connection_stat_visitor() -{} +PFS_connection_stat_visitor::~PFS_connection_stat_visitor() = default; void PFS_connection_stat_visitor::visit_global() {} @@ -1360,8 +1351,7 @@ PFS_connection_status_visitor(STATUS_VAR *status_vars) : m_status_vars(status_va memset(m_status_vars, 0, sizeof(STATUS_VAR)); } -PFS_connection_status_visitor::~PFS_connection_status_visitor() -{} +PFS_connection_status_visitor::~PFS_connection_status_visitor() = default; /** Aggregate from global status. */ void PFS_connection_status_visitor::visit_global() @@ -1396,11 +1386,9 @@ void PFS_connection_status_visitor::visit_THD(THD *thd) } -PFS_instance_wait_visitor::PFS_instance_wait_visitor() -{} +PFS_instance_wait_visitor::PFS_instance_wait_visitor() = default; -PFS_instance_wait_visitor::~PFS_instance_wait_visitor() -{} +PFS_instance_wait_visitor::~PFS_instance_wait_visitor() = default; void PFS_instance_wait_visitor::visit_mutex_class(PFS_mutex_class *pfs) { @@ -1460,11 +1448,9 @@ void PFS_instance_wait_visitor::visit_socket(PFS_socket *pfs) /** Table IO wait visitor */ -PFS_object_wait_visitor::PFS_object_wait_visitor() -{} +PFS_object_wait_visitor::PFS_object_wait_visitor() = default; -PFS_object_wait_visitor::~PFS_object_wait_visitor() -{} +PFS_object_wait_visitor::~PFS_object_wait_visitor() = default; void PFS_object_wait_visitor::visit_global() { @@ -1488,11 +1474,9 @@ void PFS_object_wait_visitor::visit_table(PFS_table *pfs) } } -PFS_table_io_wait_visitor::PFS_table_io_wait_visitor() -{} +PFS_table_io_wait_visitor::PFS_table_io_wait_visitor() = default; -PFS_table_io_wait_visitor::~PFS_table_io_wait_visitor() -{} +PFS_table_io_wait_visitor::~PFS_table_io_wait_visitor() = default; void PFS_table_io_wait_visitor::visit_global() { @@ -1545,11 +1529,9 @@ void PFS_table_io_wait_visitor::visit_table(PFS_table *pfs) /** Table IO stat visitor */ -PFS_table_io_stat_visitor::PFS_table_io_stat_visitor() -{} +PFS_table_io_stat_visitor::PFS_table_io_stat_visitor() = default; -PFS_table_io_stat_visitor::~PFS_table_io_stat_visitor() -{} +PFS_table_io_stat_visitor::~PFS_table_io_stat_visitor() = default; void PFS_table_io_stat_visitor::visit_table_share(PFS_table_share *pfs) { @@ -1591,11 +1573,9 @@ void PFS_table_io_stat_visitor::visit_table(PFS_table *pfs) /** Index IO stat visitor */ -PFS_index_io_stat_visitor::PFS_index_io_stat_visitor() -{} +PFS_index_io_stat_visitor::PFS_index_io_stat_visitor() = default; -PFS_index_io_stat_visitor::~PFS_index_io_stat_visitor() -{} +PFS_index_io_stat_visitor::~PFS_index_io_stat_visitor() = default; void PFS_index_io_stat_visitor::visit_table_share_index(PFS_table_share *pfs, uint index) { @@ -1613,11 +1593,9 @@ void PFS_index_io_stat_visitor::visit_table_index(PFS_table *pfs, uint index) /** Table lock wait visitor */ -PFS_table_lock_wait_visitor::PFS_table_lock_wait_visitor() -{} +PFS_table_lock_wait_visitor::PFS_table_lock_wait_visitor() = default; -PFS_table_lock_wait_visitor::~PFS_table_lock_wait_visitor() -{} +PFS_table_lock_wait_visitor::~PFS_table_lock_wait_visitor() = default; void PFS_table_lock_wait_visitor::visit_global() { @@ -1636,11 +1614,9 @@ void PFS_table_lock_wait_visitor::visit_table(PFS_table *pfs) /** Table lock stat visitor */ -PFS_table_lock_stat_visitor::PFS_table_lock_stat_visitor() -{} +PFS_table_lock_stat_visitor::PFS_table_lock_stat_visitor() = default; -PFS_table_lock_stat_visitor::~PFS_table_lock_stat_visitor() -{} +PFS_table_lock_stat_visitor::~PFS_table_lock_stat_visitor() = default; void PFS_table_lock_stat_visitor::visit_table_share(PFS_table_share *pfs) { @@ -1656,11 +1632,11 @@ void PFS_table_lock_stat_visitor::visit_table(PFS_table *pfs) m_stat.aggregate(& pfs->m_table_stat.m_lock_stat); } -PFS_instance_socket_io_stat_visitor::PFS_instance_socket_io_stat_visitor() -{} +PFS_instance_socket_io_stat_visitor +::PFS_instance_socket_io_stat_visitor() = default; -PFS_instance_socket_io_stat_visitor::~PFS_instance_socket_io_stat_visitor() -{} +PFS_instance_socket_io_stat_visitor +::~PFS_instance_socket_io_stat_visitor() = default; void PFS_instance_socket_io_stat_visitor::visit_socket_class(PFS_socket_class *pfs) { @@ -1674,11 +1650,11 @@ void PFS_instance_socket_io_stat_visitor::visit_socket(PFS_socket *pfs) m_socket_io_stat.aggregate(&pfs->m_socket_stat.m_io_stat); } -PFS_instance_file_io_stat_visitor::PFS_instance_file_io_stat_visitor() -{} +PFS_instance_file_io_stat_visitor +::PFS_instance_file_io_stat_visitor() = default; -PFS_instance_file_io_stat_visitor::~PFS_instance_file_io_stat_visitor() -{} +PFS_instance_file_io_stat_visitor +::~PFS_instance_file_io_stat_visitor() = default; void PFS_instance_file_io_stat_visitor::visit_file_class(PFS_file_class *pfs) { diff --git a/storage/perfschema/pfs_visitor.h b/storage/perfschema/pfs_visitor.h index 4644888ea33..c5e5f826b7c 100644 --- a/storage/perfschema/pfs_visitor.h +++ b/storage/perfschema/pfs_visitor.h @@ -67,8 +67,8 @@ struct PFS_connection_slice; class PFS_connection_visitor { public: - PFS_connection_visitor() {} - virtual ~PFS_connection_visitor() {} + PFS_connection_visitor() = default; + virtual ~PFS_connection_visitor() = default; /** Visit all connections. */ virtual void visit_global() {} /** Visit all connections of a host. */ @@ -159,8 +159,8 @@ public: class PFS_instance_visitor { public: - PFS_instance_visitor() {} - virtual ~PFS_instance_visitor() {} + PFS_instance_visitor() = default; + virtual ~PFS_instance_visitor() = default; /** Visit a mutex class. */ virtual void visit_mutex_class(PFS_mutex_class *pfs) {} /** Visit a rwlock class. */ @@ -270,8 +270,8 @@ public: class PFS_object_visitor { public: - PFS_object_visitor() {} - virtual ~PFS_object_visitor() {} + PFS_object_visitor() = default; + virtual ~PFS_object_visitor() = default; /** Visit global data. */ virtual void visit_global() {} /** Visit a table share. */ diff --git a/storage/perfschema/table_accounts.h b/storage/perfschema/table_accounts.h index f44d05b2700..239f278051d 100644 --- a/storage/perfschema/table_accounts.h +++ b/storage/perfschema/table_accounts.h @@ -67,8 +67,7 @@ protected: table_accounts(); public: - ~table_accounts() - {} + ~table_accounts() = default; private: virtual void make_row(PFS_account *pfs); diff --git a/storage/perfschema/table_all_instr.h b/storage/perfschema/table_all_instr.h index 7dfb27c6032..6895b0b2c47 100644 --- a/storage/perfschema/table_all_instr.h +++ b/storage/perfschema/table_all_instr.h @@ -84,8 +84,7 @@ protected: table_all_instr(const PFS_engine_table_share *share); public: - ~table_all_instr() - {} + ~table_all_instr() = default; protected: /** diff --git a/storage/perfschema/table_esgs_by_account_by_event_name.h b/storage/perfschema/table_esgs_by_account_by_event_name.h index dd805f4d038..98bf82e2b96 100644 --- a/storage/perfschema/table_esgs_by_account_by_event_name.h +++ b/storage/perfschema/table_esgs_by_account_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esgs_by_account_by_event_name(); public: - ~table_esgs_by_account_by_event_name() - {} + ~table_esgs_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_host_by_event_name.h b/storage/perfschema/table_esgs_by_host_by_event_name.h index 674b6bfb883..64349ecc7d9 100644 --- a/storage/perfschema/table_esgs_by_host_by_event_name.h +++ b/storage/perfschema/table_esgs_by_host_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esgs_by_host_by_event_name(); public: - ~table_esgs_by_host_by_event_name() - {} + ~table_esgs_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_thread_by_event_name.h b/storage/perfschema/table_esgs_by_thread_by_event_name.h index d009aabbdfc..4f32d76e256 100644 --- a/storage/perfschema/table_esgs_by_thread_by_event_name.h +++ b/storage/perfschema/table_esgs_by_thread_by_event_name.h @@ -109,8 +109,7 @@ protected: table_esgs_by_thread_by_event_name(); public: - ~table_esgs_by_thread_by_event_name() - {} + ~table_esgs_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_by_user_by_event_name.h b/storage/perfschema/table_esgs_by_user_by_event_name.h index a62578ca9b6..3a211d19ad4 100644 --- a/storage/perfschema/table_esgs_by_user_by_event_name.h +++ b/storage/perfschema/table_esgs_by_user_by_event_name.h @@ -110,8 +110,7 @@ protected: table_esgs_by_user_by_event_name(); public: - ~table_esgs_by_user_by_event_name() - {} + ~table_esgs_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_stage_class *klass); diff --git a/storage/perfschema/table_esgs_global_by_event_name.h b/storage/perfschema/table_esgs_global_by_event_name.h index ab70e8303ca..013e04308eb 100644 --- a/storage/perfschema/table_esgs_global_by_event_name.h +++ b/storage/perfschema/table_esgs_global_by_event_name.h @@ -76,8 +76,7 @@ protected: table_esgs_global_by_event_name(); public: - ~table_esgs_global_by_event_name() - {} + ~table_esgs_global_by_event_name() = default; protected: void make_row(PFS_stage_class *klass); diff --git a/storage/perfschema/table_esms_by_account_by_event_name.h b/storage/perfschema/table_esms_by_account_by_event_name.h index 1afe7cb09df..3ea7620204b 100644 --- a/storage/perfschema/table_esms_by_account_by_event_name.h +++ b/storage/perfschema/table_esms_by_account_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_account_by_event_name(); public: - ~table_esms_by_account_by_event_name() - {} + ~table_esms_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_digest.h b/storage/perfschema/table_esms_by_digest.h index 27b916e66ac..d231d3388f8 100644 --- a/storage/perfschema/table_esms_by_digest.h +++ b/storage/perfschema/table_esms_by_digest.h @@ -78,8 +78,7 @@ protected: table_esms_by_digest(); public: - ~table_esms_by_digest() - {} + ~table_esms_by_digest() = default; protected: void make_row(PFS_statements_digest_stat*); diff --git a/storage/perfschema/table_esms_by_host_by_event_name.h b/storage/perfschema/table_esms_by_host_by_event_name.h index 2c47d4302b6..7c8c0e777e8 100644 --- a/storage/perfschema/table_esms_by_host_by_event_name.h +++ b/storage/perfschema/table_esms_by_host_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_host_by_event_name(); public: - ~table_esms_by_host_by_event_name() - {} + ~table_esms_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_thread_by_event_name.h b/storage/perfschema/table_esms_by_thread_by_event_name.h index e4100c076f6..e4b1ba63eb8 100644 --- a/storage/perfschema/table_esms_by_thread_by_event_name.h +++ b/storage/perfschema/table_esms_by_thread_by_event_name.h @@ -109,8 +109,7 @@ protected: table_esms_by_thread_by_event_name(); public: - ~table_esms_by_thread_by_event_name() - {} + ~table_esms_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_by_user_by_event_name.h b/storage/perfschema/table_esms_by_user_by_event_name.h index 85399b18622..18516dfdb48 100644 --- a/storage/perfschema/table_esms_by_user_by_event_name.h +++ b/storage/perfschema/table_esms_by_user_by_event_name.h @@ -105,8 +105,7 @@ protected: table_esms_by_user_by_event_name(); public: - ~table_esms_by_user_by_event_name() - {} + ~table_esms_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_statement_class *klass); diff --git a/storage/perfschema/table_esms_global_by_event_name.h b/storage/perfschema/table_esms_global_by_event_name.h index 780c7fa6e4f..67dd631c71c 100644 --- a/storage/perfschema/table_esms_global_by_event_name.h +++ b/storage/perfschema/table_esms_global_by_event_name.h @@ -76,8 +76,7 @@ protected: table_esms_global_by_event_name(); public: - ~table_esms_global_by_event_name() - {} + ~table_esms_global_by_event_name() = default; protected: void make_row(PFS_statement_class *klass); diff --git a/storage/perfschema/table_events_stages.h b/storage/perfschema/table_events_stages.h index 2ef37c16a11..b4941db54eb 100644 --- a/storage/perfschema/table_events_stages.h +++ b/storage/perfschema/table_events_stages.h @@ -107,8 +107,7 @@ protected: table_events_stages_common(const PFS_engine_table_share *share, void *pos); - ~table_events_stages_common() - {} + ~table_events_stages_common() = default; void make_row(PFS_events_stages *stage); @@ -138,8 +137,7 @@ protected: table_events_stages_current(); public: - ~table_events_stages_current() - {} + ~table_events_stages_current() = default; private: friend class table_events_stages_history; @@ -174,8 +172,7 @@ protected: table_events_stages_history(); public: - ~table_events_stages_history() - {} + ~table_events_stages_history() = default; private: /** Table share lock. */ @@ -207,8 +204,7 @@ protected: table_events_stages_history_long(); public: - ~table_events_stages_history_long() - {} + ~table_events_stages_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_statements.h b/storage/perfschema/table_events_statements.h index a7fb6fd0ec7..ca8bc804b01 100644 --- a/storage/perfschema/table_events_statements.h +++ b/storage/perfschema/table_events_statements.h @@ -190,8 +190,7 @@ protected: table_events_statements_common(const PFS_engine_table_share *share, void *pos); - ~table_events_statements_common() - {} + ~table_events_statements_common() = default; void make_row_part_1(PFS_events_statements *statement, sql_digest_storage *digest); @@ -225,8 +224,7 @@ protected: table_events_statements_current(); public: - ~table_events_statements_current() - {} + ~table_events_statements_current() = default; private: friend class table_events_statements_history; @@ -263,8 +261,7 @@ protected: table_events_statements_history(); public: - ~table_events_statements_history() - {} + ~table_events_statements_history() = default; private: /** Table share lock. */ @@ -298,8 +295,7 @@ protected: table_events_statements_history_long(); public: - ~table_events_statements_history_long() - {} + ~table_events_statements_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_waits.h b/storage/perfschema/table_events_waits.h index 926d54fd970..dcd0ea6231b 100644 --- a/storage/perfschema/table_events_waits.h +++ b/storage/perfschema/table_events_waits.h @@ -146,8 +146,7 @@ protected: table_events_waits_common(const PFS_engine_table_share *share, void *pos); - ~table_events_waits_common() - {} + ~table_events_waits_common() = default; void clear_object_columns(); int make_table_object_columns(PFS_events_waits *wait); @@ -182,8 +181,7 @@ protected: table_events_waits_current(); public: - ~table_events_waits_current() - {} + ~table_events_waits_current() = default; private: friend class table_events_waits_history; @@ -219,8 +217,7 @@ protected: table_events_waits_history(); public: - ~table_events_waits_history() - {} + ~table_events_waits_history() = default; private: /** Table share lock. */ @@ -253,8 +250,7 @@ protected: table_events_waits_history_long(); public: - ~table_events_waits_history_long() - {} + ~table_events_waits_history_long() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_events_waits_summary.h b/storage/perfschema/table_events_waits_summary.h index 0cc6f18be3c..a2b45c41fae 100644 --- a/storage/perfschema/table_events_waits_summary.h +++ b/storage/perfschema/table_events_waits_summary.h @@ -81,8 +81,7 @@ protected: table_events_waits_summary_by_instance(); public: - ~table_events_waits_summary_by_instance() - {} + ~table_events_waits_summary_by_instance() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_ews_by_account_by_event_name.h b/storage/perfschema/table_ews_by_account_by_event_name.h index 6ca0f2912bd..b50704e788b 100644 --- a/storage/perfschema/table_ews_by_account_by_event_name.h +++ b/storage/perfschema/table_ews_by_account_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_account_by_event_name(); public: - ~table_ews_by_account_by_event_name() - {} + ~table_ews_by_account_by_event_name() = default; protected: void make_row(PFS_account *account, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_host_by_event_name.h b/storage/perfschema/table_ews_by_host_by_event_name.h index ac07e698f13..0a554385511 100644 --- a/storage/perfschema/table_ews_by_host_by_event_name.h +++ b/storage/perfschema/table_ews_by_host_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_host_by_event_name(); public: - ~table_ews_by_host_by_event_name() - {} + ~table_ews_by_host_by_event_name() = default; protected: void make_row(PFS_host *host, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_thread_by_event_name.h b/storage/perfschema/table_ews_by_thread_by_event_name.h index b811cd40962..9c526182bc8 100644 --- a/storage/perfschema/table_ews_by_thread_by_event_name.h +++ b/storage/perfschema/table_ews_by_thread_by_event_name.h @@ -115,8 +115,7 @@ protected: table_ews_by_thread_by_event_name(); public: - ~table_ews_by_thread_by_event_name() - {} + ~table_ews_by_thread_by_event_name() = default; protected: void make_row(PFS_thread *thread, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_by_user_by_event_name.h b/storage/perfschema/table_ews_by_user_by_event_name.h index 2dc34203d9e..3a61c8bcd54 100644 --- a/storage/perfschema/table_ews_by_user_by_event_name.h +++ b/storage/perfschema/table_ews_by_user_by_event_name.h @@ -116,8 +116,7 @@ protected: table_ews_by_user_by_event_name(); public: - ~table_ews_by_user_by_event_name() - {} + ~table_ews_by_user_by_event_name() = default; protected: void make_row(PFS_user *user, PFS_instr_class *klass); diff --git a/storage/perfschema/table_ews_global_by_event_name.h b/storage/perfschema/table_ews_global_by_event_name.h index 811dfbb6812..46aad715c22 100644 --- a/storage/perfschema/table_ews_global_by_event_name.h +++ b/storage/perfschema/table_ews_global_by_event_name.h @@ -104,8 +104,7 @@ protected: table_ews_global_by_event_name(); public: - ~table_ews_global_by_event_name() - {} + ~table_ews_global_by_event_name() = default; protected: void make_mutex_row(PFS_mutex_class *klass); diff --git a/storage/perfschema/table_file_instances.h b/storage/perfschema/table_file_instances.h index adad5dadd06..6b8ffaeb591 100644 --- a/storage/perfschema/table_file_instances.h +++ b/storage/perfschema/table_file_instances.h @@ -74,8 +74,7 @@ private: table_file_instances(); public: - ~table_file_instances() - {} + ~table_file_instances() = default; private: void make_row(PFS_file *pfs); diff --git a/storage/perfschema/table_file_summary_by_event_name.h b/storage/perfschema/table_file_summary_by_event_name.h index 877adf9476a..0c2b592ab60 100644 --- a/storage/perfschema/table_file_summary_by_event_name.h +++ b/storage/perfschema/table_file_summary_by_event_name.h @@ -75,8 +75,7 @@ private: table_file_summary_by_event_name(); public: - ~table_file_summary_by_event_name() - {} + ~table_file_summary_by_event_name() = default; private: void make_row(PFS_file_class *klass); diff --git a/storage/perfschema/table_file_summary_by_instance.h b/storage/perfschema/table_file_summary_by_instance.h index 3b044fa064d..b8b2115aeed 100644 --- a/storage/perfschema/table_file_summary_by_instance.h +++ b/storage/perfschema/table_file_summary_by_instance.h @@ -83,8 +83,7 @@ private: table_file_summary_by_instance(); public: - ~table_file_summary_by_instance() - {} + ~table_file_summary_by_instance() = default; private: void make_row(PFS_file *pfs); diff --git a/storage/perfschema/table_host_cache.h b/storage/perfschema/table_host_cache.h index bb1cb444c33..482b8a2d66a 100644 --- a/storage/perfschema/table_host_cache.h +++ b/storage/perfschema/table_host_cache.h @@ -127,8 +127,7 @@ protected: table_host_cache(); public: - ~table_host_cache() - {} + ~table_host_cache() = default; private: void materialize(THD *thd); diff --git a/storage/perfschema/table_hosts.h b/storage/perfschema/table_hosts.h index 8262beabda5..cf94bdcbf79 100644 --- a/storage/perfschema/table_hosts.h +++ b/storage/perfschema/table_hosts.h @@ -67,8 +67,7 @@ protected: table_hosts(); public: - ~table_hosts() - {} + ~table_hosts() = default; private: virtual void make_row(PFS_host *pfs); diff --git a/storage/perfschema/table_os_global_by_type.h b/storage/perfschema/table_os_global_by_type.h index 8009d2125b3..632bed522ed 100644 --- a/storage/perfschema/table_os_global_by_type.h +++ b/storage/perfschema/table_os_global_by_type.h @@ -106,8 +106,7 @@ protected: table_os_global_by_type(); public: - ~table_os_global_by_type() - {} + ~table_os_global_by_type() = default; protected: void make_table_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_performance_timers.h b/storage/perfschema/table_performance_timers.h index 5479c6f577d..15bdb5bfa93 100644 --- a/storage/perfschema/table_performance_timers.h +++ b/storage/perfschema/table_performance_timers.h @@ -73,8 +73,7 @@ protected: table_performance_timers(); public: - ~table_performance_timers() - {} + ~table_performance_timers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_session_account_connect_attrs.h b/storage/perfschema/table_session_account_connect_attrs.h index ea8d26b719b..d556394515c 100644 --- a/storage/perfschema/table_session_account_connect_attrs.h +++ b/storage/perfschema/table_session_account_connect_attrs.h @@ -43,8 +43,7 @@ protected: table_session_account_connect_attrs(); public: - ~table_session_account_connect_attrs() - {} + ~table_session_account_connect_attrs() = default; protected: virtual bool thread_fits(PFS_thread *thread); diff --git a/storage/perfschema/table_session_connect_attrs.h b/storage/perfschema/table_session_connect_attrs.h index c35f4b89f4e..f115ea1b168 100644 --- a/storage/perfschema/table_session_connect_attrs.h +++ b/storage/perfschema/table_session_connect_attrs.h @@ -43,8 +43,7 @@ protected: table_session_connect_attrs(); public: - ~table_session_connect_attrs() - {} + ~table_session_connect_attrs() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_setup_actors.h b/storage/perfschema/table_setup_actors.h index 758d3b22ef7..da5fdc37950 100644 --- a/storage/perfschema/table_setup_actors.h +++ b/storage/perfschema/table_setup_actors.h @@ -93,8 +93,7 @@ protected: table_setup_actors(); public: - ~table_setup_actors() - {} + ~table_setup_actors() = default; private: void make_row(PFS_setup_actor *actor); diff --git a/storage/perfschema/table_setup_consumers.h b/storage/perfschema/table_setup_consumers.h index 8c3479a88b1..c72108beb46 100644 --- a/storage/perfschema/table_setup_consumers.h +++ b/storage/perfschema/table_setup_consumers.h @@ -77,8 +77,7 @@ protected: table_setup_consumers(); public: - ~table_setup_consumers() - {} + ~table_setup_consumers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_setup_instruments.h b/storage/perfschema/table_setup_instruments.h index 4b6ad9b46dd..ce979c40e48 100644 --- a/storage/perfschema/table_setup_instruments.h +++ b/storage/perfschema/table_setup_instruments.h @@ -115,8 +115,7 @@ protected: table_setup_instruments(); public: - ~table_setup_instruments() - {} + ~table_setup_instruments() = default; private: void make_row(PFS_instr_class *klass, bool update_enabled, bool update_timed); diff --git a/storage/perfschema/table_setup_objects.h b/storage/perfschema/table_setup_objects.h index 2d17e2e15ff..d6cb9bc30c3 100644 --- a/storage/perfschema/table_setup_objects.h +++ b/storage/perfschema/table_setup_objects.h @@ -92,8 +92,7 @@ protected: table_setup_objects(); public: - ~table_setup_objects() - {} + ~table_setup_objects() = default; private: void make_row(PFS_setup_object *pfs); diff --git a/storage/perfschema/table_setup_timers.h b/storage/perfschema/table_setup_timers.h index 68bf9a55130..9fff43c33a3 100644 --- a/storage/perfschema/table_setup_timers.h +++ b/storage/perfschema/table_setup_timers.h @@ -73,8 +73,7 @@ protected: table_setup_timers(); public: - ~table_setup_timers() - {} + ~table_setup_timers() = default; private: /** Table share lock. */ diff --git a/storage/perfschema/table_socket_instances.h b/storage/perfschema/table_socket_instances.h index 763860d08c1..fdd978b5c3a 100644 --- a/storage/perfschema/table_socket_instances.h +++ b/storage/perfschema/table_socket_instances.h @@ -86,8 +86,7 @@ private: table_socket_instances(); public: - ~table_socket_instances() - {} + ~table_socket_instances() = default; private: void make_row(PFS_socket *pfs); diff --git a/storage/perfschema/table_socket_summary_by_event_name.h b/storage/perfschema/table_socket_summary_by_event_name.h index f386d62f8ee..3a243572979 100644 --- a/storage/perfschema/table_socket_summary_by_event_name.h +++ b/storage/perfschema/table_socket_summary_by_event_name.h @@ -76,8 +76,7 @@ private: table_socket_summary_by_event_name(); public: - ~table_socket_summary_by_event_name() - {} + ~table_socket_summary_by_event_name() = default; private: void make_row(PFS_socket_class *socket_class); diff --git a/storage/perfschema/table_socket_summary_by_instance.h b/storage/perfschema/table_socket_summary_by_instance.h index c7712871c51..b8a08db3e36 100644 --- a/storage/perfschema/table_socket_summary_by_instance.h +++ b/storage/perfschema/table_socket_summary_by_instance.h @@ -79,8 +79,7 @@ private: table_socket_summary_by_instance(); public: - ~table_socket_summary_by_instance() - {} + ~table_socket_summary_by_instance() = default; private: void make_row(PFS_socket *pfs); diff --git a/storage/perfschema/table_sync_instances.h b/storage/perfschema/table_sync_instances.h index ce756cef50c..2682c7c88a8 100644 --- a/storage/perfschema/table_sync_instances.h +++ b/storage/perfschema/table_sync_instances.h @@ -78,8 +78,7 @@ private: table_mutex_instances(); public: - ~table_mutex_instances() - {} + ~table_mutex_instances() = default; private: void make_row(PFS_mutex *pfs); @@ -137,8 +136,7 @@ private: table_rwlock_instances(); public: - ~table_rwlock_instances() - {} + ~table_rwlock_instances() = default; private: void make_row(PFS_rwlock *pfs); @@ -190,8 +188,7 @@ private: table_cond_instances(); public: - ~table_cond_instances() - {} + ~table_cond_instances() = default; private: void make_row(PFS_cond *pfs); diff --git a/storage/perfschema/table_threads.h b/storage/perfschema/table_threads.h index 078dbbda5a9..ff9f7ccb2a3 100644 --- a/storage/perfschema/table_threads.h +++ b/storage/perfschema/table_threads.h @@ -110,8 +110,7 @@ protected: table_threads(); public: - ~table_threads() - {} + ~table_threads() = default; private: virtual void make_row(PFS_thread *pfs); diff --git a/storage/perfschema/table_tiws_by_index_usage.h b/storage/perfschema/table_tiws_by_index_usage.h index 64e08683b9b..5f0c85874bd 100644 --- a/storage/perfschema/table_tiws_by_index_usage.h +++ b/storage/perfschema/table_tiws_by_index_usage.h @@ -101,8 +101,7 @@ protected: table_tiws_by_index_usage(); public: - ~table_tiws_by_index_usage() - {} + ~table_tiws_by_index_usage() = default; protected: void make_row(PFS_table_share *table_share, uint index); diff --git a/storage/perfschema/table_tiws_by_table.h b/storage/perfschema/table_tiws_by_table.h index fed3b694fde..933a6164de9 100644 --- a/storage/perfschema/table_tiws_by_table.h +++ b/storage/perfschema/table_tiws_by_table.h @@ -76,8 +76,7 @@ protected: table_tiws_by_table(); public: - ~table_tiws_by_table() - {} + ~table_tiws_by_table() = default; protected: void make_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_tlws_by_table.h b/storage/perfschema/table_tlws_by_table.h index ba0668e5938..49188abd905 100644 --- a/storage/perfschema/table_tlws_by_table.h +++ b/storage/perfschema/table_tlws_by_table.h @@ -76,8 +76,7 @@ protected: table_tlws_by_table(); public: - ~table_tlws_by_table() - {} + ~table_tlws_by_table() = default; protected: void make_row(PFS_table_share *table_share); diff --git a/storage/perfschema/table_users.h b/storage/perfschema/table_users.h index 2adc77569d9..a81c143ae2e 100644 --- a/storage/perfschema/table_users.h +++ b/storage/perfschema/table_users.h @@ -67,8 +67,7 @@ protected: table_users(); public: - ~table_users() - {} + ~table_users() = default; private: virtual void make_row(PFS_user *pfs); diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake index 29b2d83a759..096185af08f 100644 --- a/storage/rocksdb/build_rocksdb.cmake +++ b/storage/rocksdb/build_rocksdb.cmake @@ -129,10 +129,6 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64") ADD_DEFINITIONS(-DHAVE_POWER8 -DHAS_ALTIVEC) endif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64|powerpc64") -if(CMAKE_SYSTEM_PROCESSOR STREQUAL "riscv64") - set(SYSTEM_LIBS ${SYSTEM_LIBS} -latomic) -endif() - option(WITH_FALLOCATE "build with fallocate" ON) if(WITH_FALLOCATE AND UNIX) @@ -161,9 +157,9 @@ include_directories(SYSTEM ${ROCKSDB_SOURCE_DIR}/third-party/gtest-1.7.0/fused-s find_package(Threads REQUIRED) if(WIN32) - set(SYSTEM_LIBS ${SYSTEM_LIBS} Shlwapi.lib Rpcrt4.lib) + set(SYSTEM_LIBS ${SYSTEM_LIBS} ${ATOMIC_EXTRA_LIBS} Shlwapi.lib Rpcrt4.lib) else() - set(SYSTEM_LIBS ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${CMAKE_DL_LIBS}) + set(SYSTEM_LIBS ${SYSTEM_LIBS} ${CMAKE_THREAD_LIBS_INIT} ${LIBRT} ${CMAKE_DL_LIBS} ${ATOMIC_EXTRA_LIBS}) endif() set(ROCKSDB_LIBS rocksdblib}) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 7c1af7217ca..86300f1cf71 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -2270,7 +2270,7 @@ static inline uint32_t rocksdb_perf_context_level(THD *const thd) { */ interface Rdb_tx_list_walker { - virtual ~Rdb_tx_list_walker() {} + virtual ~Rdb_tx_list_walker() = default; virtual void process_tran(const Rdb_transaction *const) = 0; }; diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index f05f373cbfd..d03c183873e 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -1053,7 +1053,7 @@ struct Rdb_inplace_alter_ctx : public my_core::inplace_alter_handler_ctx { m_n_dropped_keys(n_dropped_keys), m_max_auto_incr(max_auto_incr) {} - ~Rdb_inplace_alter_ctx() {} + ~Rdb_inplace_alter_ctx() = default; private: /* Disable Copying */ diff --git a/storage/rocksdb/rdb_compact_filter.h b/storage/rocksdb/rdb_compact_filter.h index 1cd27273b56..93767b23787 100644 --- a/storage/rocksdb/rdb_compact_filter.h +++ b/storage/rocksdb/rdb_compact_filter.h @@ -204,9 +204,9 @@ class Rdb_compact_filter_factory : public rocksdb::CompactionFilterFactory { Rdb_compact_filter_factory(const Rdb_compact_filter_factory &) = delete; Rdb_compact_filter_factory &operator=(const Rdb_compact_filter_factory &) = delete; - Rdb_compact_filter_factory() {} + Rdb_compact_filter_factory() = default; - ~Rdb_compact_filter_factory() {} + ~Rdb_compact_filter_factory() = default; const char *Name() const override { return "Rdb_compact_filter_factory"; } diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h index 899c6f70071..e9fc1da728e 100644 --- a/storage/rocksdb/rdb_datadic.h +++ b/storage/rocksdb/rdb_datadic.h @@ -1177,7 +1177,7 @@ class Rdb_seq_generator { interface Rdb_tables_scanner { virtual int add_table(Rdb_tbl_def * tdef) = 0; - virtual ~Rdb_tables_scanner() {} /* Keep the compiler happy */ + virtual ~Rdb_tables_scanner() = default; /* Keep the compiler happy */ }; /* @@ -1214,7 +1214,7 @@ class Rdb_ddl_manager { public: Rdb_ddl_manager(const Rdb_ddl_manager &) = delete; Rdb_ddl_manager &operator=(const Rdb_ddl_manager &) = delete; - Rdb_ddl_manager() {} + Rdb_ddl_manager() = default; /* Load the data dictionary from on-disk storage */ bool init(Rdb_dict_manager *const dict_arg, Rdb_cf_manager *const cf_manager, diff --git a/storage/rocksdb/rdb_mutex_wrapper.h b/storage/rocksdb/rdb_mutex_wrapper.h index 33eefe9d50c..fd0790aa8e6 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.h +++ b/storage/rocksdb/rdb_mutex_wrapper.h @@ -122,7 +122,7 @@ class Rdb_mutex_factory : public rocksdb::TransactionDBMutexFactory { public: Rdb_mutex_factory(const Rdb_mutex_factory &) = delete; Rdb_mutex_factory &operator=(const Rdb_mutex_factory &) = delete; - Rdb_mutex_factory() {} + Rdb_mutex_factory() = default; /* Override parent class's virtual methods of interrest. */ @@ -137,7 +137,7 @@ class Rdb_mutex_factory : public rocksdb::TransactionDBMutexFactory { return std::make_shared<Rdb_cond_var>(); } - virtual ~Rdb_mutex_factory() override {} + virtual ~Rdb_mutex_factory() override = default; }; } // namespace myrocks diff --git a/storage/rocksdb/rdb_threads.h b/storage/rocksdb/rdb_threads.h index 7d89fe0616b..d23419df3b9 100644 --- a/storage/rocksdb/rdb_threads.h +++ b/storage/rocksdb/rdb_threads.h @@ -125,7 +125,7 @@ class Rdb_thread { void uninit(); - virtual ~Rdb_thread() {} + virtual ~Rdb_thread() = default; private: static void *thread_func(void *const thread_ptr); diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc index 38e1eea8c40..6f66e122ed9 100644 --- a/storage/sequence/sequence.cc +++ b/storage/sequence/sequence.cc @@ -390,7 +390,7 @@ public: // Reset limit because we are handling it now orig_lim->set_unlimited(); } - ~ha_seq_group_by_handler() {} + ~ha_seq_group_by_handler() = default; int init_scan() { first_row= 1 ; return 0; } int next_row(); int end_scan() { return 0; } diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result new file mode 100644 index 00000000000..b2edaff6918 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_26541.result @@ -0,0 +1,20 @@ +# +# MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds +# +INSTALL PLUGIN spider SONAME 'ha_spider.so'; +DROP FUNCTION spider_flush_table_mon_cache; +DROP FUNCTION spider_copy_tables; +DROP FUNCTION spider_ping_table; +DROP FUNCTION spider_bg_direct_sql; +DROP FUNCTION spider_direct_sql; +UNINSTALL PLUGIN spider_alloc_mem; +UNINSTALL PLUGIN spider; +DROP TABLE IF EXISTS mysql.spider_xa; +DROP TABLE IF EXISTS mysql.spider_xa_member; +DROP TABLE IF EXISTS mysql.spider_xa_failed_log; +DROP TABLE IF EXISTS mysql.spider_tables; +DROP TABLE IF EXISTS mysql.spider_link_mon_servers; +DROP TABLE IF EXISTS mysql.spider_link_failed_log; +DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; +DROP TABLE IF EXISTS mysql.spider_table_sts; +DROP TABLE IF EXISTS mysql.spider_table_crd; diff --git a/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result new file mode 100644 index 00000000000..df0f6949280 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/r/mdev_30370.result @@ -0,0 +1,3 @@ +# +# MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +# diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test new file mode 100644 index 00000000000..ffd99390748 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_26541.test @@ -0,0 +1,40 @@ +--echo # +--echo # MDEV-26541 Undefined symbol: _ZTI12ha_partition when attempting to use ha_spider.so in UBSAN builds +--echo # + +if (`select not(count(*)) from information_schema.system_variables where variable_name='have_sanitizer' and global_value="UBSAN"`) +{ +--skip test needs to be run with UBSAN +} + +# init spider + +INSTALL PLUGIN spider SONAME 'ha_spider.so'; + +let $PLUGIN_NAME= spider_flush_table_mon_cache; +let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; +while (!$PLUGIN_EXIST) +{ + let $PLUGIN_EXIST= + `SELECT COUNT(*) FROM mysql.func WHERE name = '$PLUGIN_NAME'`; +} + +# deinit spider + +DROP FUNCTION spider_flush_table_mon_cache; +DROP FUNCTION spider_copy_tables; +DROP FUNCTION spider_ping_table; +DROP FUNCTION spider_bg_direct_sql; +DROP FUNCTION spider_direct_sql; +UNINSTALL PLUGIN spider_alloc_mem; +UNINSTALL PLUGIN spider; +DROP TABLE IF EXISTS mysql.spider_xa; +DROP TABLE IF EXISTS mysql.spider_xa_member; +DROP TABLE IF EXISTS mysql.spider_xa_failed_log; +DROP TABLE IF EXISTS mysql.spider_tables; +DROP TABLE IF EXISTS mysql.spider_link_mon_servers; +DROP TABLE IF EXISTS mysql.spider_link_failed_log; +DROP TABLE IF EXISTS mysql.spider_table_position_for_recovery; +DROP TABLE IF EXISTS mysql.spider_table_sts; +DROP TABLE IF EXISTS mysql.spider_table_crd; diff --git a/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test new file mode 100644 index 00000000000..788ea2323f7 --- /dev/null +++ b/storage/spider/mysql-test/spider/bugfix/t/mdev_30370.test @@ -0,0 +1,5 @@ +--echo # +--echo # MDEV-30370 mariadbd hangs when running with --wsrep-recover and --plugin-load-add=ha_spider.so +--echo # + +--exec $MYSQLD_BOOTSTRAP_CMD --wsrep-recover --plugin-load-add=ha_spider.so diff --git a/storage/spider/spd_conn.cc b/storage/spider/spd_conn.cc index 4941c2890f5..ca556702c65 100644 --- a/storage/spider/spd_conn.cc +++ b/storage/spider/spd_conn.cc @@ -458,18 +458,25 @@ SPIDER_CONN *spider_create_conn( conn->tgt_host = tmp_host; memcpy(conn->tgt_host, share->tgt_hosts[link_idx], share->tgt_hosts_lengths[link_idx]); + conn->tgt_username_length = share->tgt_usernames_lengths[link_idx]; conn->tgt_username = tmp_username; - memcpy(conn->tgt_username, share->tgt_usernames[link_idx], - share->tgt_usernames_lengths[link_idx]); + if (conn->tgt_username_length) + memcpy(conn->tgt_username, share->tgt_usernames[link_idx], + share->tgt_usernames_lengths[link_idx]); + conn->tgt_password_length = share->tgt_passwords_lengths[link_idx]; conn->tgt_password = tmp_password; - memcpy(conn->tgt_password, share->tgt_passwords[link_idx], - share->tgt_passwords_lengths[link_idx]); + if (conn->tgt_password_length) + memcpy(conn->tgt_password, share->tgt_passwords[link_idx], + share->tgt_passwords_lengths[link_idx]); + conn->tgt_socket_length = share->tgt_sockets_lengths[link_idx]; conn->tgt_socket = tmp_socket; - memcpy(conn->tgt_socket, share->tgt_sockets[link_idx], - share->tgt_sockets_lengths[link_idx]); + if (conn->tgt_socket_length) + memcpy(conn->tgt_socket, share->tgt_sockets[link_idx], + share->tgt_sockets_lengths[link_idx]); + conn->tgt_wrapper_length = share->tgt_wrappers_lengths[link_idx]; conn->tgt_wrapper = tmp_wrapper; memcpy(conn->tgt_wrapper, share->tgt_wrappers[link_idx], diff --git a/storage/spider/spd_db_include.h b/storage/spider/spd_db_include.h index 8f8cf6c97bc..8b2ebb821df 100644 --- a/storage/spider/spd_db_include.h +++ b/storage/spider/spd_db_include.h @@ -684,8 +684,8 @@ class spider_db_util { public: uint dbton_id; - spider_db_util() {} - virtual ~spider_db_util() {} + spider_db_util() = default; + virtual ~spider_db_util() = default; virtual int append_name( spider_string *str, const char *name, @@ -828,7 +828,7 @@ public: uint dbton_id; SPIDER_DB_ROW *next_pos; spider_db_row(uint in_dbton_id) : dbton_id(in_dbton_id), next_pos(NULL) {} - virtual ~spider_db_row() {} + virtual ~spider_db_row() = default; virtual int store_to_field( Field *field, CHARSET_INFO *access_charset @@ -860,8 +860,8 @@ public: class spider_db_result_buffer { public: - spider_db_result_buffer() {} - virtual ~spider_db_result_buffer() {} + spider_db_result_buffer() = default; + virtual ~spider_db_result_buffer() = default; virtual void clear() = 0; virtual bool check_size( longlong size @@ -874,7 +874,7 @@ public: SPIDER_DB_CONN *db_conn; uint dbton_id; spider_db_result(SPIDER_DB_CONN *in_db_conn); - virtual ~spider_db_result() {} + virtual ~spider_db_result() = default; virtual void set_limit(longlong value) {} virtual bool has_result() = 0; virtual void free_result() = 0; @@ -937,7 +937,7 @@ public: spider_db_conn( SPIDER_CONN *in_conn ); - virtual ~spider_db_conn() {} + virtual ~spider_db_conn() = default; virtual int init() = 0; virtual void set_limit(longlong value) {} virtual bool is_connected() = 0; @@ -1114,7 +1114,7 @@ public: st_spider_share *share, uint dbton_id ) : dbton_id(dbton_id), spider_share(share) {} - virtual ~spider_db_share() {} + virtual ~spider_db_share() = default; virtual int init() = 0; virtual uint get_column_name_length( uint field_index @@ -1156,7 +1156,7 @@ public: spider_db_handler(ha_spider *spider, spider_db_share *db_share) : dbton_id(db_share->dbton_id), spider(spider), db_share(db_share), first_link_idx(-1) {} - virtual ~spider_db_handler() {} + virtual ~spider_db_handler() = default; virtual int init() = 0; virtual int append_index_hint( spider_string *str, @@ -1598,7 +1598,7 @@ public: spider_db_share *db_share; spider_db_copy_table(spider_db_share *db_share) : dbton_id(db_share->dbton_id), db_share(db_share) {} - virtual ~spider_db_copy_table() {} + virtual ~spider_db_copy_table() = default; virtual int init() = 0; virtual void set_sql_charset( CHARSET_INFO *cs diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc index 5bafc4e04ed..13afb5077d3 100644 --- a/storage/spider/spd_table.cc +++ b/storage/spider/spd_table.cc @@ -8945,6 +8945,7 @@ void spider_free_sts_threads( ) { bool thread_killed; DBUG_ENTER("spider_free_sts_threads"); + spider_thread->init_command = FALSE; pthread_mutex_lock(&spider_thread->mutex); thread_killed = spider_thread->killed; spider_thread->killed = TRUE; @@ -9082,12 +9083,13 @@ void *spider_table_bg_sts_action( tmp_disable_binlog(thd); thd->security_ctx->skip_grants(); thd->client_capabilities |= CLIENT_MULTI_RESULTS; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed) { pthread_mutex_lock(spd_LOCK_server_started); thd->mysys_var->current_cond = spd_COND_server_started; thd->mysys_var->current_mutex = spd_LOCK_server_started; - if (!(*spd_mysqld_server_started) && !thd->killed) + if (!(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command) { do { @@ -9097,14 +9099,16 @@ void *spider_table_bg_sts_action( spd_LOCK_server_started, &abstime); } while ( (error_num == ETIMEDOUT || error_num == ETIME) && - !(*spd_mysqld_server_started) && !thd->killed && !thread->killed + !(*spd_mysqld_server_started) && !thd->killed && !thread->killed && + thread->init_command ); } pthread_mutex_unlock(spd_LOCK_server_started); thd->mysys_var->current_cond = &thread->cond; thd->mysys_var->current_mutex = &thread->mutex; } - while (spider_init_queries[i].length && !thd->killed && !thread->killed) + while (spider_init_queries[i].length && !thd->killed && !thread->killed && + thread->init_command) { dispatch_command(COM_QUERY, thd, spider_init_queries[i].str, (uint) spider_init_queries[i].length); diff --git a/storage/spider/spd_trx.cc b/storage/spider/spd_trx.cc index 85b2cdb8a27..8e1257bad21 100644 --- a/storage/spider/spd_trx.cc +++ b/storage/spider/spd_trx.cc @@ -625,103 +625,136 @@ int spider_create_trx_alter_table( alter_table->tmp_tgt_drivers_lengths = tmp_tgt_drivers_lengths; alter_table->tmp_static_link_ids_lengths = tmp_static_link_ids_lengths; + size_t len; for(roop_count = 0; roop_count < (int) share->all_link_count; roop_count++) { - tmp_server_names[roop_count] = tmp_server_names_char; - memcpy(tmp_server_names_char, - share_alter->tmp_server_names[roop_count], - sizeof(char) * share_alter->tmp_server_names_lengths[roop_count]); - tmp_server_names_char += - share_alter->tmp_server_names_lengths[roop_count] + 1; - - tmp_tgt_table_names[roop_count] = tmp_tgt_table_names_char; - memcpy(tmp_tgt_table_names_char, - share_alter->tmp_tgt_table_names[roop_count], - sizeof(char) * share_alter->tmp_tgt_table_names_lengths[roop_count]); - tmp_tgt_table_names_char += - share_alter->tmp_tgt_table_names_lengths[roop_count] + 1; - - tmp_tgt_dbs[roop_count] = tmp_tgt_dbs_char; - memcpy(tmp_tgt_dbs_char, share_alter->tmp_tgt_dbs[roop_count], - sizeof(char) * share_alter->tmp_tgt_dbs_lengths[roop_count]); - tmp_tgt_dbs_char += - share_alter->tmp_tgt_dbs_lengths[roop_count] + 1; - - tmp_tgt_hosts[roop_count] = tmp_tgt_hosts_char; - memcpy(tmp_tgt_hosts_char, share_alter->tmp_tgt_hosts[roop_count], - sizeof(char) * share_alter->tmp_tgt_hosts_lengths[roop_count]); - tmp_tgt_hosts_char += - share_alter->tmp_tgt_hosts_lengths[roop_count] + 1; - - tmp_tgt_usernames[roop_count] = tmp_tgt_usernames_char; - memcpy(tmp_tgt_usernames_char, share_alter->tmp_tgt_usernames[roop_count], - sizeof(char) * share_alter->tmp_tgt_usernames_lengths[roop_count]); - tmp_tgt_usernames_char += - share_alter->tmp_tgt_usernames_lengths[roop_count] + 1; - - tmp_tgt_passwords[roop_count] = tmp_tgt_passwords_char; - memcpy(tmp_tgt_passwords_char, share_alter->tmp_tgt_passwords[roop_count], - sizeof(char) * share_alter->tmp_tgt_passwords_lengths[roop_count]); - tmp_tgt_passwords_char += - share_alter->tmp_tgt_passwords_lengths[roop_count] + 1; - - tmp_tgt_sockets[roop_count] = tmp_tgt_sockets_char; - memcpy(tmp_tgt_sockets_char, share_alter->tmp_tgt_sockets[roop_count], - sizeof(char) * share_alter->tmp_tgt_sockets_lengths[roop_count]); - tmp_tgt_sockets_char += - share_alter->tmp_tgt_sockets_lengths[roop_count] + 1; - - tmp_tgt_wrappers[roop_count] = tmp_tgt_wrappers_char; - memcpy(tmp_tgt_wrappers_char, share_alter->tmp_tgt_wrappers[roop_count], - sizeof(char) * share_alter->tmp_tgt_wrappers_lengths[roop_count]); - tmp_tgt_wrappers_char += - share_alter->tmp_tgt_wrappers_lengths[roop_count] + 1; - - tmp_tgt_ssl_cas[roop_count] = tmp_tgt_ssl_cas_char; - memcpy(tmp_tgt_ssl_cas_char, share_alter->tmp_tgt_ssl_cas[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_cas_lengths[roop_count]); - tmp_tgt_ssl_cas_char += - share_alter->tmp_tgt_ssl_cas_lengths[roop_count] + 1; - - tmp_tgt_ssl_capaths[roop_count] = tmp_tgt_ssl_capaths_char; - memcpy(tmp_tgt_ssl_capaths_char, - share_alter->tmp_tgt_ssl_capaths[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_capaths_lengths[roop_count]); - tmp_tgt_ssl_capaths_char += - share_alter->tmp_tgt_ssl_capaths_lengths[roop_count] + 1; - - tmp_tgt_ssl_certs[roop_count] = tmp_tgt_ssl_certs_char; - memcpy(tmp_tgt_ssl_certs_char, share_alter->tmp_tgt_ssl_certs[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_certs_lengths[roop_count]); - tmp_tgt_ssl_certs_char += - share_alter->tmp_tgt_ssl_certs_lengths[roop_count] + 1; - - tmp_tgt_ssl_ciphers[roop_count] = tmp_tgt_ssl_ciphers_char; - memcpy(tmp_tgt_ssl_ciphers_char, - share_alter->tmp_tgt_ssl_ciphers[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count]); - tmp_tgt_ssl_ciphers_char += - share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count] + 1; - - tmp_tgt_ssl_keys[roop_count] = tmp_tgt_ssl_keys_char; - memcpy(tmp_tgt_ssl_keys_char, share_alter->tmp_tgt_ssl_keys[roop_count], - sizeof(char) * share_alter->tmp_tgt_ssl_keys_lengths[roop_count]); - tmp_tgt_ssl_keys_char += - share_alter->tmp_tgt_ssl_keys_lengths[roop_count] + 1; - - tmp_tgt_default_files[roop_count] = tmp_tgt_default_files_char; - memcpy(tmp_tgt_default_files_char, - share_alter->tmp_tgt_default_files[roop_count], - sizeof(char) * share_alter->tmp_tgt_default_files_lengths[roop_count]); - tmp_tgt_default_files_char += - share_alter->tmp_tgt_default_files_lengths[roop_count] + 1; - - tmp_tgt_default_groups[roop_count] = tmp_tgt_default_groups_char; - memcpy(tmp_tgt_default_groups_char, - share_alter->tmp_tgt_default_groups[roop_count], - sizeof(char) * share_alter->tmp_tgt_default_groups_lengths[roop_count]); - tmp_tgt_default_groups_char += - share_alter->tmp_tgt_default_groups_lengths[roop_count] + 1; + if ((len= + sizeof(char) * share_alter->tmp_server_names_lengths[roop_count])) + { + tmp_server_names[roop_count]= tmp_server_names_char; + memcpy(tmp_server_names_char, share_alter->tmp_server_names[roop_count], + len); + tmp_server_names_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_table_names_lengths[roop_count])) + { + tmp_tgt_table_names[roop_count]= tmp_tgt_table_names_char; + memcpy(tmp_tgt_table_names_char, + share_alter->tmp_tgt_table_names[roop_count], len); + tmp_tgt_table_names_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_dbs_lengths[roop_count])) + { + tmp_tgt_dbs[roop_count]= tmp_tgt_dbs_char; + memcpy(tmp_tgt_dbs_char, share_alter->tmp_tgt_dbs[roop_count], len); + tmp_tgt_dbs_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_hosts_lengths[roop_count])) + { + tmp_tgt_hosts[roop_count]= tmp_tgt_hosts_char; + memcpy(tmp_tgt_hosts_char, share_alter->tmp_tgt_hosts[roop_count], len); + tmp_tgt_hosts_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_usernames_lengths[roop_count])) + { + tmp_tgt_usernames[roop_count]= tmp_tgt_usernames_char; + memcpy(tmp_tgt_usernames_char, + share_alter->tmp_tgt_usernames[roop_count], len); + tmp_tgt_usernames_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_passwords_lengths[roop_count])) + { + tmp_tgt_passwords[roop_count]= tmp_tgt_passwords_char; + memcpy(tmp_tgt_passwords_char, + share_alter->tmp_tgt_passwords[roop_count], len); + tmp_tgt_passwords_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_sockets_lengths[roop_count])) + { + tmp_tgt_sockets[roop_count]= tmp_tgt_sockets_char; + memcpy(tmp_tgt_sockets_char, share_alter->tmp_tgt_sockets[roop_count], + len); + tmp_tgt_sockets_char+= len + 1; + } + + if ((len= + sizeof(char) * share_alter->tmp_tgt_wrappers_lengths[roop_count])) + { + tmp_tgt_wrappers[roop_count]= tmp_tgt_wrappers_char; + memcpy(tmp_tgt_wrappers_char, share_alter->tmp_tgt_wrappers[roop_count], + len); + tmp_tgt_wrappers_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_ssl_cas_lengths[roop_count])) + { + tmp_tgt_ssl_cas[roop_count]= tmp_tgt_ssl_cas_char; + memcpy(tmp_tgt_ssl_cas_char, share_alter->tmp_tgt_ssl_cas[roop_count], + len); + tmp_tgt_ssl_cas_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_capaths_lengths[roop_count])) + { + tmp_tgt_ssl_capaths[roop_count]= tmp_tgt_ssl_capaths_char; + memcpy(tmp_tgt_ssl_capaths_char, + share_alter->tmp_tgt_ssl_capaths[roop_count], len); + tmp_tgt_ssl_capaths_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_certs_lengths[roop_count])) + { + tmp_tgt_ssl_certs[roop_count]= tmp_tgt_ssl_certs_char; + memcpy(tmp_tgt_ssl_certs_char, + share_alter->tmp_tgt_ssl_certs[roop_count], len); + tmp_tgt_ssl_certs_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_ssl_ciphers_lengths[roop_count])) + { + tmp_tgt_ssl_ciphers[roop_count]= tmp_tgt_ssl_ciphers_char; + memcpy(tmp_tgt_ssl_ciphers_char, + share_alter->tmp_tgt_ssl_ciphers[roop_count], len); + tmp_tgt_ssl_ciphers_char+= len + 1; + } + + if ((len= sizeof(char) * share_alter->tmp_tgt_ssl_keys_lengths[roop_count])) + { + tmp_tgt_ssl_keys[roop_count]= tmp_tgt_ssl_keys_char; + memcpy(tmp_tgt_ssl_keys_char, share_alter->tmp_tgt_ssl_keys[roop_count], + len); + tmp_tgt_ssl_keys_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_default_files_lengths[roop_count])) + { + tmp_tgt_default_files[roop_count]= tmp_tgt_default_files_char; + memcpy(tmp_tgt_default_files_char, + share_alter->tmp_tgt_default_files[roop_count], len); + tmp_tgt_default_files_char+= len + 1; + } + + if ((len= sizeof(char) * + share_alter->tmp_tgt_default_groups_lengths[roop_count])) + { + tmp_tgt_default_groups[roop_count]= tmp_tgt_default_groups_char; + memcpy(tmp_tgt_default_groups_char, + share_alter->tmp_tgt_default_groups[roop_count], len); + tmp_tgt_default_groups_char+= len + 1; + } tmp_tgt_dsns[roop_count] = tmp_tgt_dsns_char; memcpy(tmp_tgt_dsns_char, share_alter->tmp_tgt_dsns[roop_count], @@ -741,14 +774,13 @@ int spider_create_trx_alter_table( tmp_tgt_drivers_char += share_alter->tmp_tgt_drivers_lengths[roop_count] + 1; - if (share_alter->tmp_static_link_ids[roop_count]) + if ((len= sizeof(char) * + share_alter->tmp_static_link_ids_lengths[roop_count])) { tmp_static_link_ids[roop_count] = tmp_static_link_ids_char; memcpy(tmp_static_link_ids_char, - share_alter->tmp_static_link_ids[roop_count], - sizeof(char) * share_alter->tmp_static_link_ids_lengths[roop_count]); - tmp_static_link_ids_char += - share_alter->tmp_static_link_ids_lengths[roop_count] + 1; + share_alter->tmp_static_link_ids[roop_count], len); + tmp_static_link_ids_char += len + 1; } } |