diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 16:24:16 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-11-06 16:24:16 +0200 |
commit | 074c68409921032f8a64416cc4d5ebc35d95dca9 (patch) | |
tree | 615c99d326fd2ce8c0e3b533b40f0e4e3475bbc1 /storage | |
parent | 563efeceece09154f71da6303244b1df36875428 (diff) | |
parent | df563e0c037f9b2cdb22e145575f92a121b4b529 (diff) | |
download | mariadb-git-074c68409921032f8a64416cc4d5ebc35d95dca9.tar.gz |
Merge 10.3 into 10.4
Diffstat (limited to 'storage')
114 files changed, 706 insertions, 695 deletions
diff --git a/storage/connect/CMakeLists.txt b/storage/connect/CMakeLists.txt index d47307f91c1..73c7619aaa9 100644 --- a/storage/connect/CMakeLists.txt +++ b/storage/connect/CMakeLists.txt @@ -113,6 +113,7 @@ IF(CONNECT_WITH_LIBXML2) FIND_PACKAGE(LibXml2) IF (LIBXML2_FOUND) INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR}) + SET(ZLIB_LIBRARY "z") # see ZLIB_INCLUDE_DIR below SET(XML_LIBRARY ${LIBXML2_LIBRARIES}) SET(CONNECT_SOURCES ${CONNECT_SOURCES} libdoc.cpp libdoc.h) add_definitions(-DLIBXML2_SUPPORT) @@ -329,6 +330,14 @@ IF(NOT TARGET connect) RETURN() ENDIF() +# Don't link with bundled zlib and systel libxml2 at the same time. +# System libxml2 uses system zlib, might conflict with the bundled one. +IF (XML_LIBRARY AND BUILD_BUNDLED_ZLIB) + GET_PROPERTY(INCS TARGET connect PROPERTY INCLUDE_DIRECTORIES) + LIST(REMOVE_ITEM INCS ${ZLIB_INCLUDE_DIR}) + SET_PROPERTY(TARGET connect PROPERTY INCLUDE_DIRECTORIES ${INCS}) +ENDIF() + IF(WIN32) IF (libmongoc-1.0_FOUND) SET_TARGET_PROPERTIES(connect PROPERTIES LINK_FLAGS diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index f9bcffd4fdc..2460449ac62 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -255,7 +255,7 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, try { if (!c1) { - if (mode == MODE_INSERT) +// if (mode == MODE_INSERT) or CHECK TABLE // Allocate all column blocks for that table tdbp->ColDB(g, NULL, 0); diff --git a/storage/connect/global.h b/storage/connect/global.h index 472d09408c3..36e8a311124 100644 --- a/storage/connect/global.h +++ b/storage/connect/global.h @@ -1,7 +1,7 @@ /***********************************************************************/ /* GLOBAL.H: Declaration file used by all CONNECT implementations. */ /* (C) Copyright MariaDB Corporation Ab */ -/* Author Olivier Bertrand 1993-2017 */ +/* Author Olivier Bertrand 1993-2018 */ /***********************************************************************/ /***********************************************************************/ @@ -192,7 +192,7 @@ typedef struct _global { /* Global structure */ PACTIVITY Activityp; char Message[MAX_STR]; ulong More; /* Used by jsonudf */ - int Createas; /* To pass info to created table */ + int Createas; /* To pass multi to ext tables */ void *Xchk; /* indexes in create/alter */ short Alchecked; /* Checked for ALTER */ short Mrr; /* True when doing mrr */ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index 95885606dd0..d3f89aca910 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -170,9 +170,9 @@ #define JSONMAX 10 // JSON Default max grp size extern "C" { - char version[]= "Version 1.06.0007 August 06, 2018"; + char version[]= "Version 1.06.0008 October 06, 2018"; #if defined(__WIN__) - char compver[]= "Version 1.06.0007 " __DATE__ " " __TIME__; + char compver[]= "Version 1.06.0008 " __DATE__ " " __TIME__; char slash= '\\'; #else // !__WIN__ char slash= '/'; @@ -1776,13 +1776,13 @@ bool ha_connect::CheckVirtualIndex(TABLE_SHARE *s) bool ha_connect::IsPartitioned(void) { #ifdef WITH_PARTITION_STORAGE_ENGINE - if (tshp) + if (tshp) return tshp->partition_info_str_len > 0; else if (table && table->part_info) return true; else #endif - return false; + return false; } // end of IsPartitioned @@ -3286,6 +3286,58 @@ ha_rows ha_connect::records() } // end of records +int ha_connect::check(THD* thd, HA_CHECK_OPT* check_opt) +{ + int rc = HA_ADMIN_OK; + PGLOBAL g = ((table && table->in_use) ? GetPlug(table->in_use, xp) : + (xp) ? xp->g : NULL); + DBUG_ENTER("ha_connect::check"); + + if (!g || !table || xmod != MODE_READ) + DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); + + // Do not close the table if it was opened yet (possible?) + if (IsOpened()) { + if (IsPartitioned() && CheckColumnList(g)) // map can have been changed + rc = HA_ADMIN_CORRUPT; + else if (tdbp->OpenDB(g)) // Rewind table + rc = HA_ADMIN_CORRUPT; + + } else if (xp->CheckQuery(valid_query_id)) { + tdbp = NULL; // Not valid anymore + + if (OpenTable(g, false)) + rc = HA_ADMIN_CORRUPT; + + } else // possible? + DBUG_RETURN(HA_ADMIN_INTERNAL_ERROR); + + if (rc == HA_ADMIN_OK) { + TABTYPE type = GetTypeID(GetStringOption("Type", "*")); + + if (IsFileType(type)) { + if (check_opt->flags & T_MEDIUM) { + // TO DO + do { + if ((rc = CntReadNext(g, tdbp)) == RC_FX) + break; + + } while (rc != RC_EF); + + rc = (rc == RC_EF) ? HA_ADMIN_OK : HA_ADMIN_CORRUPT; + } else if (check_opt->flags & T_EXTEND) { + // TO DO + } // endif's flags + + } // endif file type + + } else + PushWarning(g, thd, 1); + + DBUG_RETURN(rc); +} // end of check + + /** Return an error message specific to this handler. @@ -3305,7 +3357,8 @@ bool ha_connect::get_error_message(int error, String* buf) if (trace(1)) htrc("GEM(%d): %s\n", error, g->Message); - buf->append(g->Message); + buf->append(ErrConvString(g->Message, strlen(g->Message), + &my_charset_latin1).ptr()); } else buf->append("Cannot retrieve error message"); @@ -3420,7 +3473,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*) push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message); rc = 0; } else - rc = HA_ERR_INTERNAL_ERROR; + rc = HA_ERR_CRASHED_ON_USAGE; // Table must be repaired } // endif rc @@ -3436,6 +3489,9 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*) rc = HA_ERR_INTERNAL_ERROR; } // end catch + if (rc) + my_message(ER_WARN_DATA_OUT_OF_RANGE, g->Message, MYF(0)); + return rc; } // end of optimize @@ -4497,14 +4553,16 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, // case SQLCOM_REPLACE_SELECT: // newmode= MODE_UPDATE; // To be checked // break; - case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: + case SQLCOM_DELETE_MULTI: + *cras = true; + case SQLCOM_DELETE: case SQLCOM_TRUNCATE: newmode= MODE_DELETE; break; - case SQLCOM_UPDATE: case SQLCOM_UPDATE_MULTI: - newmode= MODE_UPDATE; + *cras = true; + case SQLCOM_UPDATE: + newmode= MODE_UPDATE; break; case SQLCOM_SELECT: case SQLCOM_OPTIMIZE: @@ -4529,8 +4587,10 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, newmode= MODE_ANY; break; // } // endif partitioned - - default: + case SQLCOM_REPAIR: // TODO implement it + newmode = MODE_UPDATE; + break; + default: htrc("Unsupported sql_command=%d\n", thd_sql_command(thd)); strcpy(g->Message, "CONNECT Unsupported command"); my_message(ER_NOT_ALLOWED_COMMAND, g->Message, MYF(0)); @@ -4542,17 +4602,18 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, switch (thd_sql_command(thd)) { case SQLCOM_CREATE_TABLE: *chk= true; - *cras= true; + break; + case SQLCOM_UPDATE_MULTI: + case SQLCOM_DELETE_MULTI: + *cras= true; case SQLCOM_INSERT: case SQLCOM_LOAD: case SQLCOM_INSERT_SELECT: // case SQLCOM_REPLACE: // case SQLCOM_REPLACE_SELECT: case SQLCOM_DELETE: - case SQLCOM_DELETE_MULTI: case SQLCOM_TRUNCATE: case SQLCOM_UPDATE: - case SQLCOM_UPDATE_MULTI: case SQLCOM_SELECT: case SQLCOM_OPTIMIZE: case SQLCOM_SET_OPTION: @@ -4580,8 +4641,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd, break; // } // endif partitioned - case SQLCOM_CHECK: // TODO implement it - case SQLCOM_END: // Met in procedures: IF(EXISTS(SELECT... + case SQLCOM_CHECK: // TODO implement it + case SQLCOM_ANALYZE: // TODO implement it + case SQLCOM_END: // Met in procedures: IF(EXISTS(SELECT... newmode= MODE_READ; break; default: @@ -4863,7 +4925,7 @@ int ha_connect::external_lock(THD *thd, int lock_type) #endif // 0 if (cras) - g->Createas= 1; // To tell created table to ignore FLAG + g->Createas= 1; // To tell external tables of a multi-table command if (trace(1)) { #if 0 @@ -6186,9 +6248,9 @@ int ha_connect::create(const char *name, TABLE *table_arg, LEX_CSTRING cnc = table_arg->s->connect_string; #ifdef WITH_PARTITION_STORAGE_ENGINE partition_info *part_info= table_arg->part_info; -#else +#else // !WITH_PARTITION_STORAGE_ENGINE #define part_info 0 -#endif // WITH_PARTITION_STORAGE_ENGINE +#endif // !WITH_PARTITION_STORAGE_ENGINE xp= GetUser(thd, xp); PGLOBAL g= xp->g; @@ -7246,7 +7308,7 @@ maria_declare_plugin(connect) 0x0107, /* version number (1.05) */ NULL, /* status variables */ connect_system_variables, /* system variables */ - "1.06.0007", /* string version */ + "1.06.0008", /* string version */ MariaDB_PLUGIN_MATURITY_STABLE /* maturity */ } maria_declare_plugin_end; diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 98669177cdf..8504b585ae1 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -347,11 +347,7 @@ PFIL CondFilter(PGLOBAL g, Item *cond); //PFIL CheckFilter(PGLOBAL g); /** admin commands - called from mysql_admin_table */ -virtual int check(THD* thd, HA_CHECK_OPT* check_opt) -{ - // TODO: implement it - return HA_ADMIN_OK; // Just to avoid error message with checktables -} // end of check +virtual int check(THD* thd, HA_CHECK_OPT* check_opt); /** Number of rows in table. It will only be called if diff --git a/storage/connect/mysql-test/connect/disabled.def b/storage/connect/mysql-test/connect/disabled.def index 0dcf030613d..827ed58b835 100644 --- a/storage/connect/mysql-test/connect/disabled.def +++ b/storage/connect/mysql-test/connect/disabled.def @@ -9,14 +9,15 @@ # Do not use any TAB characters for whitespace. # ############################################################################## -jdbc : Variable settings depend on machine configuration -jdbc_new : Variable settings depend on machine configuration -jdbc_oracle : Variable settings depend on machine configuration -jdbc_postgresql : Variable settings depend on machine configuration -json_mongo_c : Need MongoDB running and its C Driver installed -json_java_2 : Need MongoDB running and its Java Driver installed -json_java_3 : Need MongoDB running and its Java Driver installed -mongo_c : Need MongoDB running and its C Driver installed -mongo_java_2 : Need MongoDB running and its Java Driver installed -mongo_java_3 : Need MongoDB running and its Java Driver installed -tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed +infoschema-9739 : Crashes with MariaDB 10.0 +jdbc : Variable settings depend on machine configuration +jdbc_new : Variable settings depend on machine configuration +jdbc_oracle : Variable settings depend on machine configuration +jdbc_postgresql : Variable settings depend on machine configuration +json_mongo_c : Need MongoDB running and its C Driver installed +json_java_2 : Need MongoDB running and its Java Driver installed +json_java_3 : Need MongoDB running and its Java Driver installed +mongo_c : Need MongoDB running and its C Driver installed +mongo_java_2 : Need MongoDB running and its Java Driver installed +mongo_java_3 : Need MongoDB running and its Java Driver installed +tbl_thread : Bug MDEV-9844,10179,14214 03/01/2018 OB Option THREAD removed diff --git a/storage/connect/mysql-test/connect/r/mysql_exec.result b/storage/connect/mysql-test/connect/r/mysql_exec.result index c0400bc82e7..cc77240503b 100644 --- a/storage/connect/mysql-test/connect/r/mysql_exec.result +++ b/storage/connect/mysql-test/connect/r/mysql_exec.result @@ -35,6 +35,8 @@ insert ignore into t1(id) values(NULL) 1 1 Affected rows Warning 0 1364 Field 'msg' doesn't have a default value update t1 set msg = 'Four' where id = 4 0 1 Affected rows select * from t1 0 2 Result set columns +Warnings: +Warning 1105 Result set columns # # Checking Using Procedure # @@ -48,9 +50,13 @@ CALL p1('insert ignore into t1(id) values(NULL)'); command warnings number message insert ignore into t1(id) values(NULL) 1 1 Affected rows Warning 0 1364 Field 'msg' doesn't have a default value +Warnings: +Warning 1105 Affected rows CALL p1('update t1 set msg = "Five" where id = 5'); command warnings number message update t1 set msg = "Five" where id = 5 0 1 Affected rows +Warnings: +Warning 1105 Affected rows DROP PROCEDURE p1; DROP TABLE t1; connection slave; diff --git a/storage/connect/mysql-test/connect/r/odbc_postgresql.result b/storage/connect/mysql-test/connect/r/odbc_postgresql.result index 3426d23e29c..dc23dbdb990 100644 --- a/storage/connect/mysql-test/connect/r/odbc_postgresql.result +++ b/storage/connect/mysql-test/connect/r/odbc_postgresql.result @@ -99,9 +99,9 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu mtr public t1 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 -mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0 -mtr schema1 t2 a 1 bpchar 10 60 NULL NULL 0 -mtr schema1 v1 a 1 bpchar 10 60 NULL NULL 1 +mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All columns in the schemas "public" and "schema1" CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.%'; @@ -110,16 +110,16 @@ Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Bu mtr public t1 a 4 int4 10 4 0 10 0 mtr public t2 a 4 int4 10 4 0 10 0 mtr public v1 a 4 int4 10 4 0 10 1 -mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0 -mtr schema1 t2 a 1 bpchar 10 60 NULL NULL 0 -mtr schema1 v1 a 1 bpchar 10 60 NULL NULL 1 +mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 t2 a 1 bpchar 10 40 NULL NULL 0 +mtr schema1 v1 a 1 bpchar 10 40 NULL NULL 1 DROP TABLE t1; # All tables "t1" in all schemas CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.%.t1'; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks mtr public t1 a 4 int4 10 4 0 10 0 -mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0 +mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 DROP TABLE t1; # Table "t1" in the schema "public" CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.public.t1'; @@ -131,14 +131,14 @@ DROP TABLE t1; CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='%.schema1.t1'; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks -mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0 +mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 DROP TABLE t1; # All tables "t1" in all schemas (Catalog name is ignored by PostgreSQL) CREATE TABLE t1 ENGINE=CONNECT TABLE_TYPE=ODBC CONNECTION='DSN=ConnectEnginePostgresql;UID=mtr;PWD=mtr' CATFUNC=Columns TABNAME='xxx.%.t1'; SELECT * FROM t1 ORDER BY Table_Schema, Table_Name; Table_Cat Table_Schema Table_Name Column_Name Data_Type Type_Name Column_Size Buffer_Length Decimal_Digits Radix Nullable Remarks mtr public t1 a 4 int4 10 4 0 10 0 -mtr schema1 t1 a 1 bpchar 10 60 NULL NULL 0 +mtr schema1 t1 a 1 bpchar 10 40 NULL NULL 0 DROP TABLE t1; # # Checking tables diff --git a/storage/connect/odbconn.cpp b/storage/connect/odbconn.cpp index f7b1a43a95d..6687513fa6c 100644 --- a/storage/connect/odbconn.cpp +++ b/storage/connect/odbconn.cpp @@ -2354,11 +2354,11 @@ int ODBConn::GetCatInfo(CATPARM *cap) if (!Check(rc)) ThrowDBX(rc, fnc, hstmt); - rc = SQLNumResultCols(hstmt, &ncol); - - // n because we no more ignore the first column - if ((n = (UWORD)qrp->Nbcol) > (UWORD)ncol) - ThrowDBX(MSG(COL_NUM_MISM)); + // Some data source do not implement SQLNumResultCols + if (Check(SQLNumResultCols(hstmt, &ncol))) + // n because we no more ignore the first column + if ((n = (UWORD)qrp->Nbcol) > (UWORD)ncol) + ThrowDBX(MSG(COL_NUM_MISM)); // Unconditional to handle STRBLK's pval = (PVAL *)PlugSubAlloc(g, NULL, n * sizeof(PVAL)); diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp index 139e4199ed9..f2d5eb0e69d 100644 --- a/storage/connect/tabext.cpp +++ b/storage/connect/tabext.cpp @@ -125,6 +125,12 @@ EXTDEF::EXTDEF(void) /***********************************************************************/ bool EXTDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) { + if (g->Createas) { + strcpy(g->Message, + "Multiple-table UPDATE/DELETE commands are not supported"); + return true; + } // endif multi + Desc = NULL; Tabname = GetStringCatInfo(g, "Name", (Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name); diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp index 275b5edaeae..adb3fc4fb51 100644 --- a/storage/connect/tabjdbc.cpp +++ b/storage/connect/tabjdbc.cpp @@ -1157,8 +1157,9 @@ bool TDBXJDC::OpenDB(PGLOBAL g) /* Get the command to execute. */ /*********************************************************************/ if (!(Cmdlist = MakeCMD(g))) { - Jcp->Close(); - return true; + // Next lines commented out because of CHECK TABLE + //Jcp->Close(); + //return true; } // endif Query Rows = 1; @@ -1189,8 +1190,10 @@ int TDBXJDC::ReadDB(PGLOBAL g) Fpos++; // Used for progress info Cmdlist = (Nerr > Mxr) ? NULL : Cmdlist->Next; return RC_OK; - } else + } else { + PushWarning(g, this, 1); return RC_EF; + } // endif Cmdlist } // end of ReadDB diff --git a/storage/connect/tabmysql.cpp b/storage/connect/tabmysql.cpp index 605b3822430..ceffafac02c 100644 --- a/storage/connect/tabmysql.cpp +++ b/storage/connect/tabmysql.cpp @@ -1587,8 +1587,9 @@ bool TDBMYEXC::OpenDB(PGLOBAL g) /* Get the command to execute. */ /*********************************************************************/ if (!(Cmdlist = MakeCMD(g))) { - Myc.Close(); - return true; + // Next lines commented out because of CHECK TABLE + //Myc.Close(); + //return true; } // endif Cmdlist return false; @@ -1647,8 +1648,10 @@ int TDBMYEXC::ReadDB(PGLOBAL g) ++N; return RC_OK; - } else - return RC_EF; + } else { + PushWarning(g, this, 1); + return RC_EF; + } // endif Cmdlist } // end of ReadDB diff --git a/storage/connect/tabodbc.cpp b/storage/connect/tabodbc.cpp index f7bc3934fbd..fddfb0c0420 100644 --- a/storage/connect/tabodbc.cpp +++ b/storage/connect/tabodbc.cpp @@ -1249,9 +1249,10 @@ bool TDBXDBC::OpenDB(PGLOBAL g) /* Get the command to execute. */ /*********************************************************************/ if (!(Cmdlist = MakeCMD(g))) { - Ocp->Close(); - return true; - } // endif Query + // Next lines commented out because of CHECK TABLE + //Ocp->Close(); + //return true; + } // endif Cmdlist Rows = 1; return false; @@ -1274,8 +1275,10 @@ int TDBXDBC::ReadDB(PGLOBAL g) Fpos++; // Used for progress info Cmdlist = (Nerr > Mxr) ? NULL : Cmdlist->Next; return RC_OK; - } else - return RC_EF; + } else { + PushWarning(g, this, 1); + return RC_EF; + } // endif Cmdlist } // end of ReadDB diff --git a/storage/heap/hp_create.c b/storage/heap/hp_create.c index ed669069b96..dcfff4e8e9f 100644 --- a/storage/heap/hp_create.c +++ b/storage/heap/hp_create.c @@ -1,5 +1,5 @@ -/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. - Copyright (c) 2010, 2017, MariaDB Corporation. +/* Copyright (c) 2000, 2018, Oracle and/or its affiliates. + Copyright (c) 2010, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -98,7 +98,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* fall through */ case HA_KEYTYPE_VARTEXT1: keyinfo->flag|= HA_VAR_LENGTH_KEY; - length+= 2; + /* + For BTREE algorithm, key length, greater than or equal + to 255, is packed on 3 bytes. + */ + if (keyinfo->algorithm == HA_KEY_ALG_BTREE) + length+= size_to_store_key_length(keyinfo->seg[j].length); + else + length+= 2; /* Save number of bytes used to store length */ keyinfo->seg[j].bit_start= 1; break; @@ -107,7 +114,14 @@ int heap_create(const char *name, HP_CREATE_INFO *create_info, /* fall_through */ case HA_KEYTYPE_VARTEXT2: keyinfo->flag|= HA_VAR_LENGTH_KEY; - length+= 2; + /* + For BTREE algorithm, key length, greater than or equal + to 255, is packed on 3 bytes. + */ + if (keyinfo->algorithm == HA_KEY_ALG_BTREE) + length+= size_to_store_key_length(keyinfo->seg[j].length); + else + length+= 2; /* Save number of bytes used to store length */ keyinfo->seg[j].bit_start= 2; /* diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 27b63d00c1b..7e2436a6356 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -1149,7 +1149,7 @@ btr_free_root_invalidate( static MY_ATTRIBUTE((warn_unused_result)) buf_block_t* btr_free_root_check( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, index_id_t index_id, mtr_t* mtr) @@ -1377,7 +1377,7 @@ top_loop: @param[in,out] mtr mini-transaction */ void btr_free_if_exists( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, index_id_t index_id, mtr_t* mtr) @@ -1401,7 +1401,7 @@ btr_free_if_exists( @param[in] page_size page size */ void btr_free( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { mtr_t mtr; diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc index 1376fbdbfec..0654829e3f4 100644 --- a/storage/innobase/btr/btr0cur.cc +++ b/storage/innobase/btr/btr0cur.cc @@ -217,7 +217,7 @@ btr_rec_free_externally_stored_fields( btr_latch_leaves_t btr_cur_latch_leaves( buf_block_t* block, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint latch_mode, btr_cur_t* cursor, diff --git a/storage/innobase/btr/btr0sea.cc b/storage/innobase/btr/btr0sea.cc index 58a6458c74b..8bb838187bb 100644 --- a/storage/innobase/btr/btr0sea.cc +++ b/storage/innobase/btr/btr0sea.cc @@ -1273,7 +1273,7 @@ cleanup: /** Drop possible adaptive hash index entries when a page is evicted from the buffer pool or freed in a file, or the index is being dropped. @param[in] page_id page id */ -void btr_search_drop_page_hash_when_freed(const page_id_t& page_id) +void btr_search_drop_page_hash_when_freed(const page_id_t page_id) { buf_block_t* block; mtr_t mtr; diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 0f85761f297..770235ae85b 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -2323,7 +2323,8 @@ buf_page_realloc( memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4); UNIV_MEM_INVALID(block->frame, srv_page_size); buf_block_set_state(block, BUF_BLOCK_REMOVE_HASH); - block->page.id.reset(); + block->page.id + = page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED); /* Relocate buf_pool->flush_list. */ if (block->page.oldest_modification) { @@ -3550,7 +3551,7 @@ hash_lock and reacquire it. static buf_page_t* buf_pool_watch_set( - const page_id_t& page_id, + const page_id_t page_id, rw_lock_t** hash_lock) { buf_page_t* bpage; @@ -3628,7 +3629,7 @@ page_found: buf_block_t::mutex or buf_pool->zip_mutex or both. */ bpage->state = BUF_BLOCK_ZIP_PAGE; - bpage->id.copy_from(page_id); + bpage->id = page_id; bpage->buf_fix_count = 1; ut_d(bpage->in_page_hash = TRUE); @@ -3692,9 +3693,7 @@ buf_pool_watch_remove( /** Stop watching if the page has been read in. buf_pool_watch_set(same_page_id) must have returned NULL before. @param[in] page_id page id */ -void -buf_pool_watch_unset( - const page_id_t& page_id) +void buf_pool_watch_unset(const page_id_t page_id) { buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(page_id); @@ -3726,12 +3725,10 @@ buf_pool_watch_unset( This may only be called after buf_pool_watch_set(same_page_id) has returned NULL and before invoking buf_pool_watch_unset(same_page_id). @param[in] page_id page id -@return FALSE if the given page was not read in, TRUE if it was */ -ibool -buf_pool_watch_occurred( - const page_id_t& page_id) +@return false if the given page was not read in, true if it was */ +bool buf_pool_watch_occurred(const page_id_t page_id) { - ibool ret; + bool ret; buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(page_id); rw_lock_t* hash_lock = buf_page_hash_lock_get(buf_pool, page_id); @@ -3801,9 +3798,7 @@ debug version to check that it is not accessed any more unless reallocated. @param[in] page_id page id @return control block if found in page hash table, otherwise NULL */ -buf_page_t* -buf_page_set_file_page_was_freed( - const page_id_t& page_id) +buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id) { buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(page_id); @@ -3831,9 +3826,7 @@ debug version to check that it is not accessed any more unless reallocated. @param[in] page_id page id @return control block if found in page hash table, otherwise NULL */ -buf_page_t* -buf_page_reset_file_page_was_freed( - const page_id_t& page_id) +buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id) { buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(page_id); @@ -3855,12 +3848,8 @@ buf_page_reset_file_page_was_freed( /** Attempts to discard the uncompressed frame of a compressed page. The caller should not be holding any mutexes when this function is called. -@param[in] page_id page id -@return TRUE if successful, FALSE otherwise. */ -static -void -buf_block_try_discard_uncompressed( - const page_id_t& page_id) +@param[in] page_id page id */ +static void buf_block_try_discard_uncompressed(const page_id_t page_id) { buf_page_t* bpage; buf_pool_t* buf_pool = buf_pool_get(page_id); @@ -3894,7 +3883,7 @@ the same set of mutexes or latches. @return pointer to the block */ buf_page_t* buf_page_get_zip( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { buf_page_t* bpage; @@ -4348,7 +4337,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint rw_latch, buf_block_t* guess, @@ -4425,7 +4414,7 @@ loop: it may have been freed by buf_relocate(). */ if (!buf_block_is_uncompressed(buf_pool, block) - || !page_id.equals_to(block->page.id) + || page_id != block->page.id || buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) { /* Our guess was bogus or things have changed @@ -5257,7 +5246,7 @@ Suitable for using when holding the lock_sys_t::mutex. @return pointer to a page or NULL */ buf_block_t* buf_page_try_get_func( - const page_id_t& page_id, + const page_id_t page_id, const char* file, unsigned line, mtr_t* mtr) @@ -5286,7 +5275,7 @@ buf_page_try_get_func( #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); - ut_a(page_id.equals_to(block->page.id)); + ut_a(page_id == block->page.id); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ buf_block_buf_fix_inc(block, file, line); @@ -5370,7 +5359,7 @@ static void buf_page_init( buf_pool_t* buf_pool, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, buf_block_t* block) { @@ -5438,7 +5427,7 @@ buf_page_init( ut_ad(!block->page.in_page_hash); ut_d(block->page.in_page_hash = TRUE); - block->page.id.copy_from(page_id); + block->page.id = page_id; block->page.size.copy_from(page_size); HASH_INSERT(buf_page_t, hash, buf_pool->page_hash, @@ -5468,7 +5457,7 @@ buf_page_t* buf_page_init_for_read( dberr_t* err, ulint mode, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, bool unzip) { @@ -5637,7 +5626,7 @@ buf_page_init_for_read( buf_page_init_low(bpage); bpage->state = BUF_BLOCK_ZIP_PAGE; - bpage->id.copy_from(page_id); + bpage->id = page_id; bpage->flush_observer = NULL; ut_d(bpage->in_page_hash = FALSE); @@ -5706,7 +5695,7 @@ FILE_PAGE (the other is buf_page_get_gen). @return pointer to the block, page bufferfixed */ buf_block_t* buf_page_create( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, mtr_t* mtr) { @@ -7411,7 +7400,7 @@ buf_pool_check_no_pending_io(void) std::ostream& operator<<( std::ostream& out, - const page_id_t& page_id) + const page_id_t page_id) { out << "[page id: space=" << page_id.m_space << ", page number=" << page_id.m_page_no << "]"; diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc index c368bccf253..8cf9be44ae9 100644 --- a/storage/innobase/buf/buf0dblwr.cc +++ b/storage/innobase/buf/buf0dblwr.cc @@ -853,7 +853,7 @@ buf_dblwr_check_block( but just happens to have wrongly set FIL_PAGE_TYPE, such pages should never be modified to without also adjusting the page type during page allocation or - buf_flush_init_for_writing() or fil_page_reset_type(). */ + buf_flush_init_for_writing() or fil_block_reset_type(). */ break; case FIL_PAGE_TYPE_FSP_HDR: case FIL_PAGE_IBUF_BITMAP: diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index f8ec51d00f0..a130c998e75 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -1298,7 +1298,7 @@ buf_flush_page_try( static bool buf_flush_check_neighbor( - const page_id_t& page_id, + const page_id_t page_id, buf_flush_t flush_type) { buf_page_t* bpage; @@ -1348,7 +1348,7 @@ buf_flush_check_neighbor( static ulint buf_flush_try_neighbors( - const page_id_t& page_id, + const page_id_t page_id, buf_flush_t flush_type, ulint n_flushed, ulint n_to_flush) diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index f9b2189c79a..a5ad0b91c85 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -2160,7 +2160,8 @@ buf_LRU_block_free_hashed_page( buf_page_mutex_enter(block); if (buf_pool->flush_rbt == NULL) { - block->page.id.reset(); + block->page.id + = page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED); } buf_block_set_state(block, BUF_BLOCK_MEMORY); diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc index 3c4d9d711c2..d3e15f68589 100644 --- a/storage/innobase/buf/buf0rea.cc +++ b/storage/innobase/buf/buf0rea.cc @@ -115,7 +115,7 @@ buf_read_page_low( bool sync, ulint type, ulint mode, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, bool unzip, bool ignore_missing_space = false) @@ -225,7 +225,7 @@ pages, it may happen that the page at the given page number does not get read even if we return a positive value! */ ulint buf_read_ahead_random( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ibool inside_ibuf) { @@ -404,7 +404,7 @@ after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ dberr_t buf_read_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { ulint count; @@ -442,7 +442,7 @@ released by the i/o-handler thread. @param[in] sync true if synchronous aio is desired */ void buf_read_page_background( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, bool sync) { @@ -513,7 +513,7 @@ which could result in a deadlock if the OS does not support asynchronous io. @return number of page read requests issued */ ulint buf_read_ahead_linear( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ibool inside_ibuf) { diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc index bbf58faf0b7..f288bb462b1 100644 --- a/storage/innobase/dict/dict0crea.cc +++ b/storage/innobase/dict/dict0crea.cc @@ -1525,6 +1525,21 @@ dict_create_or_check_foreign_constraint_tables(void) row_mysql_lock_data_dictionary(trx); + DBUG_EXECUTE_IF( + "create_and_drop_garbage", + err = que_eval_sql( + NULL, + "PROCEDURE CREATE_GARBAGE_TABLE_PROC () IS\n" + "BEGIN\n" + "CREATE TABLE\n" + "\"test/#sql-ib-garbage\"(ID CHAR);\n" + "CREATE UNIQUE CLUSTERED INDEX PRIMARY" + " ON \"test/#sql-ib-garbage\"(ID);\n" + "END;\n", FALSE, trx); + ut_ad(err == DB_SUCCESS); + row_drop_table_for_mysql("test/#sql-ib-garbage", trx, + SQLCOM_DROP_DB, true);); + /* Check which incomplete table definition to drop. */ if (sys_foreign_err == DB_CORRUPTION) { diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc index 25a3a4b8dfb..6a594855674 100644 --- a/storage/innobase/dict/dict0dict.cc +++ b/storage/innobase/dict/dict0dict.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. Copyright (c) 2013, 2018, MariaDB Corporation. @@ -3265,8 +3265,6 @@ dict_foreign_find_index( while (index != NULL) { if (types_idx != index - && !(index->type & DICT_FTS) - && !dict_index_is_spatial(index) && !index->to_be_dropped && !dict_index_is_online_ddl(index) && dict_foreign_qualify_index( @@ -6759,6 +6757,10 @@ dict_foreign_qualify_index( return(false); } + if (index->type & (DICT_SPATIAL | DICT_FTS)) { + return false; + } + for (ulint i = 0; i < n_cols; i++) { dict_field_t* field; const char* col_name; diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 16633b15267..4d21f90fa97 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -688,9 +688,7 @@ dict_mem_table_col_rename( s += len + 1; } - /* This could fail if the data dictionaries are out of sync. - Proceed with the renaming anyway. */ - ut_ad(!strcmp(from, s)); + ut_ad(!my_strcasecmp(system_charset_info, from, s)); dict_mem_table_col_rename_low(table, static_cast<unsigned>(nth_col), to, s, is_virtual); diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index 52c98eadbc4..b32efedea2c 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -288,7 +288,7 @@ i/o on a tablespace which does not exist */ UNIV_INLINE dberr_t fil_read( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint byte_offset, ulint len, @@ -314,7 +314,7 @@ i/o on a tablespace which does not exist */ UNIV_INLINE dberr_t fil_write( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint byte_offset, ulint len, @@ -4242,7 +4242,7 @@ dberr_t fil_io( const IORequest& type, bool sync, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint byte_offset, ulint len, @@ -4825,27 +4825,6 @@ fil_page_set_type( mach_write_to_2(page + FIL_PAGE_TYPE, type); } -/** Reset the page type. -Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE. -In MySQL 3.23.53, only undo log pages and index pages were tagged. -Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. -@param[in] page_id page number -@param[in,out] page page with invalid FIL_PAGE_TYPE -@param[in] type expected page type -@param[in,out] mtr mini-transaction */ -void -fil_page_reset_type( - const page_id_t& page_id, - byte* page, - ulint type, - mtr_t* mtr) -{ - ib::info() - << "Resetting invalid page " << page_id << " type " - << fil_page_get_type(page) << " to " << type << "."; - mlog_write_ulint(page + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr); -} - /********************************************************************//** Delete the tablespace file and any related files like .cfg. This should not be called for temporary tables. diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index b31dea67470..5c2d709e1bc 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -962,6 +962,22 @@ fsp_get_pages_to_extend_ibd( return(size_increase); } +/** Reset the page type. +Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE. +In MySQL 3.23.53, only undo log pages and index pages were tagged. +Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. +@param[in] block block with invalid FIL_PAGE_TYPE +@param[in] type expected page type +@param[in,out] mtr mini-transaction */ +ATTRIBUTE_COLD +void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr) +{ + ib::info() + << "Resetting invalid page " << block.page.id << " type " + << fil_page_get_type(block.frame) << " to " << type << "."; + mlog_write_ulint(block.frame + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr); +} + /** Put new extents to the free list if there are free extents above the free limit. If an extent happens to contain an extent descriptor page, the extent is put to the FSP_FREE_FRAG list with the page marked as used. @@ -1090,7 +1106,7 @@ fsp_fill_free_list( header, space, i, mtr, init_space, &desc_block); if (desc_block != NULL) { fil_block_check_type( - desc_block, FIL_PAGE_TYPE_XDES, mtr); + *desc_block, FIL_PAGE_TYPE_XDES, mtr); } xdes_init(descr, mtr); @@ -1149,7 +1165,7 @@ fsp_alloc_free_extent( header, space, hint, mtr, false, &desc_block); if (desc_block != NULL) { - fil_block_check_type(desc_block, FIL_PAGE_TYPE_XDES, mtr); + fil_block_check_type(*desc_block, FIL_PAGE_TYPE_XDES, mtr); } if (descr && (xdes_get_state(descr, mtr) == XDES_FREE)) { @@ -1691,7 +1707,7 @@ fsp_alloc_seg_inode( block = buf_page_get(page_id, page_size, RW_SX_LATCH, mtr); buf_block_dbg_add_level(block, SYNC_FSP_PAGE); - fil_block_check_type(block, FIL_PAGE_INODE, mtr); + fil_block_check_type(*block, FIL_PAGE_INODE, mtr); page = buf_block_get_frame(block); @@ -1997,7 +2013,7 @@ fseg_create( ? FIL_PAGE_TYPE_TRX_SYS : FIL_PAGE_TYPE_SYS; - fil_block_check_type(block, type, mtr); + fil_block_check_type(*block, type, mtr); } if (!has_done_reservation @@ -2562,7 +2578,7 @@ fseg_alloc_free_page_general( const page_size_t page_size(space->flags); inode = fseg_inode_get(seg_header, space_id, page_size, mtr, &iblock); - fil_block_check_type(iblock, FIL_PAGE_INODE, mtr); + fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); if (!has_done_reservation && !fsp_reserve_free_extents(&n_reserved, space, 2, @@ -2982,7 +2998,7 @@ fseg_free_page_func( seg_inode = fseg_inode_get(seg_header, space_id, page_size, mtr, &iblock); - fil_block_check_type(iblock, FIL_PAGE_INODE, mtr); + fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); fseg_free_page_low(seg_inode, space, page, page_size, ahi, mtr); @@ -3162,7 +3178,7 @@ fseg_free_step_func( DBUG_RETURN(TRUE); } - fil_block_check_type(iblock, FIL_PAGE_INODE, mtr); + fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); descr = fseg_get_first_extent(inode, space, page_size, mtr); if (descr != NULL) { @@ -3230,7 +3246,7 @@ fseg_free_step_not_header_func( buf_block_t* iblock; inode = fseg_inode_get(header, space_id, page_size, mtr, &iblock); - fil_block_check_type(iblock, FIL_PAGE_INODE, mtr); + fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr); descr = fseg_get_first_extent(inode, space, page_size, mtr); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 98cdc607abe..3c372045e82 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -67,7 +67,7 @@ ulong fts_max_total_cache_size; /** This is FTS result cache limit for each query and would be a configurable variable */ -ulong fts_result_cache_limit; +size_t fts_result_cache_limit; /** Variable specifying the maximum FTS max token size */ ulong fts_max_token_size; diff --git a/storage/innobase/fts/fts0que.cc b/storage/innobase/fts/fts0que.cc index 5ae8e28974e..32e08c9c941 100644 --- a/storage/innobase/fts/fts0que.cc +++ b/storage/innobase/fts/fts0que.cc @@ -75,7 +75,7 @@ struct fts_query_t { fts_table_t fts_index_table;/*!< FTS auxiliary index table def */ - ulint total_size; /*!< total memory size used by query */ + size_t total_size; /*!< total memory size used by query */ fts_doc_ids_t* deleted; /*!< Deleted doc ids that need to be filtered from the output */ diff --git a/storage/innobase/gis/gis0sea.cc b/storage/innobase/gis/gis0sea.cc index b137a768830..6fcc56170d0 100644 --- a/storage/innobase/gis/gis0sea.cc +++ b/storage/innobase/gis/gis0sea.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2016, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -389,8 +389,7 @@ rtr_pcur_getnext_from_path( if (mode != PAGE_CUR_RTREE_INSERT && mode != PAGE_CUR_RTREE_LOCATE && mode >= PAGE_CUR_CONTAIN - && btr_cur->rtr_info->need_prdt_lock - && found) { + && btr_cur->rtr_info->need_prdt_lock) { lock_prdt_t prdt; trx_t* trx = thr_get_trx( diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 30bd9444264..f43cfcefb14 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -2915,7 +2915,7 @@ ha_innobase::ha_innobase( | HA_CAN_RTREEKEYS | HA_CAN_TABLES_WITHOUT_ROLLBACK | HA_CONCURRENT_OPTIMIZE - | (srv_force_primary_key ? HA_REQUIRE_PRIMARY_KEY : 0) + | (srv_force_primary_key ? HA_WANTS_PRIMARY_KEY : 0) ), m_start_of_scan(), m_mysql_has_locked() @@ -5820,7 +5820,8 @@ innobase_build_v_templ( name = dict_table_get_v_col_name(ib_table, z); } - ut_ad(!ut_strcmp(name, field->field_name.str)); + ut_ad(!my_strcasecmp(system_charset_info, name, + field->field_name.str)); #endif const dict_v_col_t* vcol; @@ -5851,12 +5852,10 @@ innobase_build_v_templ( dict_col_t* col = dict_table_get_nth_col( ib_table, j); -#ifdef UNIV_DEBUG - const char* name = dict_table_get_col_name( - ib_table, j); - - ut_ad(!ut_strcmp(name, field->field_name.str)); -#endif + ut_ad(!my_strcasecmp(system_charset_info, + dict_table_get_col_name( + ib_table, j), + field->field_name.str)); s_templ->vtempl[j] = static_cast< mysql_row_templ_t*>( @@ -19363,10 +19362,10 @@ static MYSQL_SYSVAR_ULONG(ft_total_cache_size, fts_max_total_cache_size, "Total memory allocated for InnoDB Fulltext Search cache", NULL, NULL, 640000000, 32000000, 1600000000, 0); -static MYSQL_SYSVAR_ULONG(ft_result_cache_limit, fts_result_cache_limit, +static MYSQL_SYSVAR_SIZE_T(ft_result_cache_limit, fts_result_cache_limit, PLUGIN_VAR_RQCMDARG, "InnoDB Fulltext search query result cache limit in bytes", - NULL, NULL, 2000000000L, 1000000L, 4294967295UL, 0); + NULL, NULL, 2000000000L, 1000000L, SIZE_T_MAX, 0); static MYSQL_SYSVAR_ULONG(ft_min_token_size, fts_min_token_size, PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY, diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index e65e7a57c99..a5f9b8c8d7b 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -420,9 +420,6 @@ public: Item* idx_cond_push(uint keyno, Item* idx_cond); /* @} */ - /* An helper function for index_cond_func_innodb: */ - bool is_thd_killed(); - protected: /** diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index ec8eea636f9..f0e31545154 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -73,6 +73,12 @@ static const alter_table_operations INNOBASE_DEFAULTS = ALTER_COLUMN_NOT_NULLABLE | ALTER_ADD_STORED_BASE_COLUMN; + +/** Operations that require knowledge about row_start, row_end values */ +static const alter_table_operations INNOBASE_ALTER_VERSIONED_REBUILD + = ALTER_ADD_SYSTEM_VERSIONING + | ALTER_DROP_SYSTEM_VERSIONING; + /** Operations for rebuilding a table in place */ static const alter_table_operations INNOBASE_ALTER_REBUILD = ALTER_ADD_PK_INDEX @@ -87,8 +93,7 @@ static const alter_table_operations INNOBASE_ALTER_REBUILD /* | ALTER_STORED_COLUMN_TYPE */ - | ALTER_ADD_SYSTEM_VERSIONING - | ALTER_DROP_SYSTEM_VERSIONING + | INNOBASE_ALTER_VERSIONED_REBUILD ; /** Operations that require changes to data */ @@ -1497,13 +1502,11 @@ ha_innobase::check_if_supported_inplace_alter( { DBUG_ENTER("check_if_supported_inplace_alter"); - const bool need_rebuild = innobase_need_rebuild(ha_alter_info, table); - - if (need_rebuild - && (table->versioned(VERS_TIMESTAMP) - || altered_table->versioned(VERS_TIMESTAMP))) { + if ((ha_alter_info->handler_flags + & INNOBASE_ALTER_VERSIONED_REBUILD) + && altered_table->versioned(VERS_TIMESTAMP)) { ha_alter_info->unsupported_reason = - "Not implemented for system-versioned tables"; + "Not implemented for system-versioned timestamp tables"; DBUG_RETURN(HA_ALTER_INPLACE_NOT_SUPPORTED); } @@ -1863,6 +1866,7 @@ ha_innobase::check_if_supported_inplace_alter( cf_it.rewind(); Field **af = altered_table->field; bool fts_need_rebuild = false; + const bool need_rebuild = innobase_need_rebuild(ha_alter_info, table); while (Create_field* cf = cf_it++) { DBUG_ASSERT(cf->field @@ -2041,13 +2045,12 @@ cannot_create_many_fulltext_index: } } - // FIXME: implement Online DDL for system-versioned tables - if (need_rebuild && - (table->versioned(VERS_TRX_ID) - || altered_table->versioned(VERS_TRX_ID))) { + // FIXME: implement Online DDL for system-versioned operations + if (ha_alter_info->handler_flags & INNOBASE_ALTER_VERSIONED_REBUILD) { + if (ha_alter_info->online) { ha_alter_info->unsupported_reason = - "Not implemented for system-versioned tables"; + "Not implemented for system-versioned operations"; } online = false; @@ -2327,8 +2330,7 @@ innobase_find_fk_index( index = dict_table_get_first_index(table); while (index != NULL) { - if (!(index->type & DICT_FTS) - && dict_foreign_qualify_index( + if (dict_foreign_qualify_index( table, col_names, columns, n_cols, index, NULL, true, 0, NULL, NULL, NULL)) { @@ -8459,7 +8461,6 @@ innobase_rename_column_try( pars_info_add_ull_literal(info, "tableid", user_table->id); pars_info_add_int4_literal(info, "nth", nth_col); - pars_info_add_str_literal(info, "old", from); pars_info_add_str_literal(info, "new", to); trx->op_info = "renaming column in SYS_COLUMNS"; @@ -8469,7 +8470,7 @@ innobase_rename_column_try( "PROCEDURE RENAME_SYS_COLUMNS_PROC () IS\n" "BEGIN\n" "UPDATE SYS_COLUMNS SET NAME=:new\n" - "WHERE TABLE_ID=:tableid AND NAME=:old\n" + "WHERE TABLE_ID=:tableid\n" "AND POS=:nth;\n" "END;\n", FALSE, trx); @@ -8496,7 +8497,8 @@ err_exit: const dict_field_t& f = index->fields[i]; DBUG_ASSERT(!f.name == f.col->is_dropped()); - if (!f.name || strcmp(f.name, from)) { + if (!f.name || my_strcasecmp(system_charset_info, + f.name, from)) { continue; } @@ -8504,7 +8506,6 @@ err_exit: pars_info_add_ull_literal(info, "indexid", index->id); pars_info_add_int4_literal(info, "nth", i); - pars_info_add_str_literal(info, "old", from); pars_info_add_str_literal(info, "new", to); error = que_eval_sql( @@ -8513,14 +8514,14 @@ err_exit: "BEGIN\n" "UPDATE SYS_FIELDS SET COL_NAME=:new\n" - "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n" + "WHERE INDEX_ID=:indexid\n" "AND POS=:nth;\n" /* Try again, in case there is a prefix_len encoded in SYS_FIELDS.POS */ "UPDATE SYS_FIELDS SET COL_NAME=:new\n" - "WHERE INDEX_ID=:indexid AND COL_NAME=:old\n" + "WHERE INDEX_ID=:indexid\n" "AND POS>=65536*:nth AND POS<65536*(:nth+1);\n" "END;\n", @@ -8546,7 +8547,9 @@ rename_foreign: foreign_modified = false; for (unsigned i = 0; i < foreign->n_fields; i++) { - if (strcmp(foreign->foreign_col_names[i], from)) { + if (my_strcasecmp(system_charset_info, + foreign->foreign_col_names[i], + from)) { continue; } @@ -8554,7 +8557,6 @@ rename_foreign: pars_info_add_str_literal(info, "id", foreign->id); pars_info_add_int4_literal(info, "nth", i); - pars_info_add_str_literal(info, "old", from); pars_info_add_str_literal(info, "new", to); error = que_eval_sql( @@ -8563,8 +8565,7 @@ rename_foreign: "BEGIN\n" "UPDATE SYS_FOREIGN_COLS\n" "SET FOR_COL_NAME=:new\n" - "WHERE ID=:id AND POS=:nth\n" - "AND FOR_COL_NAME=:old;\n" + "WHERE ID=:id AND POS=:nth;\n" "END;\n", FALSE, trx); @@ -8588,7 +8589,9 @@ rename_foreign: dict_foreign_t* foreign = *it; for (unsigned i = 0; i < foreign->n_fields; i++) { - if (strcmp(foreign->referenced_col_names[i], from)) { + if (my_strcasecmp(system_charset_info, + foreign->referenced_col_names[i], + from)) { continue; } @@ -8596,7 +8599,6 @@ rename_foreign: pars_info_add_str_literal(info, "id", foreign->id); pars_info_add_int4_literal(info, "nth", i); - pars_info_add_str_literal(info, "old", from); pars_info_add_str_literal(info, "new", to); error = que_eval_sql( @@ -8605,8 +8607,7 @@ rename_foreign: "BEGIN\n" "UPDATE SYS_FOREIGN_COLS\n" "SET REF_COL_NAME=:new\n" - "WHERE ID=:id AND POS=:nth\n" - "AND REF_COL_NAME=:old;\n" + "WHERE ID=:id AND POS=:nth;\n" "END;\n", FALSE, trx); @@ -9242,14 +9243,14 @@ innobase_update_foreign_cache( @retval false on success */ static bool -change_field_versioning_try( +vers_change_field_try( trx_t* trx, const char* table_name, const table_id_t tableid, const ulint pos, const ulint prtype) { - DBUG_ENTER("change_field_versioning_try"); + DBUG_ENTER("vers_change_field_try"); pars_info_t* info = pars_info_create(); @@ -9285,25 +9286,24 @@ change_field_versioning_try( @retval false on success */ static bool -change_fields_versioning_try( +vers_change_fields_try( const Alter_inplace_info* ha_alter_info, const ha_innobase_inplace_ctx* ctx, trx_t* trx, const TABLE* table) { - DBUG_ENTER("change_fields_versioning_try"); + DBUG_ENTER("vers_change_fields_try"); DBUG_ASSERT(ha_alter_info); DBUG_ASSERT(ctx); - if (!(ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED)){ - DBUG_RETURN(false); - } - List_iterator_fast<Create_field> it( ha_alter_info->alter_info->create_list); while (const Create_field* create_field = it++) { + if (!create_field->field) { + continue; + } if (create_field->versioning == Column_definition::VERSIONING_NOT_SET) { continue; @@ -9322,9 +9322,9 @@ change_fields_versioning_try( ? col->prtype & ~DATA_VERSIONED : col->prtype | DATA_VERSIONED; - if (change_field_versioning_try(trx, table->s->table_name.str, - new_table->id, pos, - new_prtype)) { + if (vers_change_field_try(trx, table->s->table_name.str, + new_table->id, pos, + new_prtype)) { DBUG_RETURN(true); } } @@ -9339,12 +9339,12 @@ in the data dictionary cache. @param table MySQL table as it is before the ALTER operation */ static void -change_fields_versioning_cache( +vers_change_fields_cache( Alter_inplace_info* ha_alter_info, const ha_innobase_inplace_ctx* ctx, const TABLE* table) { - DBUG_ENTER("change_fields_versioning"); + DBUG_ENTER("vers_change_fields_cache"); DBUG_ASSERT(ha_alter_info); DBUG_ASSERT(ctx); @@ -9354,6 +9354,9 @@ change_fields_versioning_cache( ha_alter_info->alter_info->create_list); while (const Create_field* create_field = it++) { + if (!create_field->field) { + continue; + } dict_col_t* col = dict_table_get_nth_col( ctx->new_table, innodb_col_no(create_field->field)); @@ -9744,7 +9747,8 @@ commit_try_norebuild( DBUG_RETURN(true); } - if (change_fields_versioning_try(ha_alter_info, ctx, trx, old_table)) { + if ((ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED) + && vers_change_fields_try(ha_alter_info, ctx, trx, old_table)) { DBUG_RETURN(true); } @@ -10054,7 +10058,7 @@ commit_cache_norebuild( } if (ha_alter_info->handler_flags & ALTER_COLUMN_UNVERSIONED) { - change_fields_versioning_cache(ha_alter_info, ctx, table); + vers_change_fields_cache(ha_alter_info, ctx, table); } #ifdef MYSQL_RENAME_INDEX diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc index 4bf21c0609b..47abdceb308 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.cc +++ b/storage/innobase/ibuf/ibuf0ibuf.cc @@ -209,7 +209,7 @@ static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES]; UNIV_INLINE void ibuf_count_check( - const page_id_t& page_id) + const page_id_t page_id) { if (page_id.space() < IBUF_COUNT_N_SPACES && page_id.page_no() < IBUF_COUNT_N_PAGES) { @@ -417,9 +417,7 @@ ibuf_tree_root_get( @param[in] page_id page id @return number of entries in the insert buffer currently buffered for this page */ -ulint -ibuf_count_get( - const page_id_t& page_id) +ulint ibuf_count_get(const page_id_t page_id) { ibuf_count_check(page_id); @@ -432,7 +430,7 @@ ibuf_count_get( static void ibuf_count_set( - const page_id_t& page_id, + const page_id_t page_id, ulint val) { ibuf_count_check(page_id); @@ -675,7 +673,7 @@ UNIV_INLINE ulint ibuf_bitmap_page_get_bits_low( const page_t* page, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, #ifdef UNIV_DEBUG ulint latch_type, @@ -724,7 +722,7 @@ static void ibuf_bitmap_page_set_bits( page_t* page, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint bit, ulint val, @@ -775,7 +773,7 @@ ibuf_bitmap_page_set_bits( UNIV_INLINE const page_id_t ibuf_bitmap_page_no_calc( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { ulint bitmap_page_no; @@ -799,7 +797,7 @@ is x-latched */ static page_t* ibuf_bitmap_get_map_page_func( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, const char* file, unsigned line, @@ -1100,7 +1098,7 @@ ibuf_update_free_bits_for_two_pages_low( UNIV_INLINE ibool ibuf_fixed_addr_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { return((page_id.space() == IBUF_SPACE_ID @@ -1122,7 +1120,7 @@ in which case a new transaction is created. @return TRUE if level 2 or level 3 page */ ibool ibuf_page_low( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, #ifdef UNIV_DEBUG ibool x_latch, @@ -3344,7 +3342,7 @@ ibuf_insert_low( const dtuple_t* entry, ulint entry_size, dict_index_t* index, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, que_thr_t* thr) { @@ -3685,7 +3683,7 @@ ibuf_insert( ibuf_op_t op, const dtuple_t* entry, dict_index_t* index, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, que_thr_t* thr) { @@ -4415,7 +4413,7 @@ want to update a non-existent bitmap page */ void ibuf_merge_or_delete_for_page( buf_block_t* block, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t* page_size, ibool update_ibuf_bitmap) { @@ -4433,7 +4431,7 @@ ibuf_merge_or_delete_for_page( ulint mops[IBUF_OP_COUNT]; ulint dops[IBUF_OP_COUNT]; - ut_ad(block == NULL || page_id.equals_to(block->page.id)); + ut_ad(block == NULL || page_id == block->page.id); ut_ad(block == NULL || buf_block_get_io_fix(block) == BUF_IO_READ); if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index fc3f2c3b2fd..484bba20a4e 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -237,7 +237,7 @@ tree UNIV_INLINE buf_block_t* btr_block_get_func( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint mode, const char* file, @@ -278,7 +278,7 @@ UNIV_INLINE page_t* btr_page_get( /*=========*/ - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint mode, dict_index_t* index, @@ -380,7 +380,7 @@ btr_create( @param[in,out] mtr mini-transaction */ void btr_free_if_exists( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, index_id_t index_id, mtr_t* mtr); @@ -390,7 +390,7 @@ btr_free_if_exists( @param[in] page_size page size */ void btr_free( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size); /** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC. diff --git a/storage/innobase/include/btr0btr.ic b/storage/innobase/include/btr0btr.ic index d24458beace..2669611a9e6 100644 --- a/storage/innobase/include/btr0btr.ic +++ b/storage/innobase/include/btr0btr.ic @@ -41,7 +41,7 @@ tree UNIV_INLINE buf_block_t* btr_block_get_func( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint mode, const char* file, @@ -107,7 +107,7 @@ UNIV_INLINE page_t* btr_page_get( /*=========*/ - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint mode, dict_index_t* index, diff --git a/storage/innobase/include/btr0cur.h b/storage/innobase/include/btr0cur.h index f87370be70c..f8afa03ce3f 100644 --- a/storage/innobase/include/btr0cur.h +++ b/storage/innobase/include/btr0cur.h @@ -824,7 +824,7 @@ btr_rec_set_deleted_flag( btr_latch_leaves_t btr_cur_latch_leaves( buf_block_t* block, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint latch_mode, btr_cur_t* cursor, diff --git a/storage/innobase/include/btr0sea.h b/storage/innobase/include/btr0sea.h index 4aaf3fb835e..f0174a2610c 100644 --- a/storage/innobase/include/btr0sea.h +++ b/storage/innobase/include/btr0sea.h @@ -122,7 +122,7 @@ void btr_search_drop_page_hash_index(buf_block_t* block); /** Drop possible adaptive hash index entries when a page is evicted from the buffer pool or freed in a file, or the index is being dropped. @param[in] page_id page id */ -void btr_search_drop_page_hash_when_freed(const page_id_t& page_id); +void btr_search_drop_page_hash_when_freed(const page_id_t page_id); /** Updates the page hash index when a single record is inserted on a page. @param[in] cursor cursor which was positioned to the place to insert diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 33612f85ed6..8ca9ddd28fe 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -223,86 +223,46 @@ public: @param[in] space tablespace id @param[in] page_no page number */ page_id_t(ulint space, ulint page_no) - : - m_space(static_cast<ib_uint32_t>(space)), - m_page_no(static_cast<ib_uint32_t>(page_no)), - m_fold(ULINT_UNDEFINED) + : m_space(uint32_t(space)), m_page_no(uint32(page_no)) { ut_ad(space <= 0xFFFFFFFFU); ut_ad(page_no <= 0xFFFFFFFFU); } - /** Retrieve the tablespace id. - @return tablespace id */ - inline ib_uint32_t space() const + bool operator==(const page_id_t& rhs) const { - return(m_space); + return m_space == rhs.m_space && m_page_no == rhs.m_page_no; } + bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); } + + /** Retrieve the tablespace id. + @return tablespace id */ + uint32_t space() const { return m_space; } /** Retrieve the page number. @return page number */ - inline ib_uint32_t page_no() const - { - return(m_page_no); - } + uint32_t page_no() const { return m_page_no; } /** Retrieve the fold value. @return fold value */ - inline ulint fold() const - { - /* Initialize m_fold if it has not been initialized yet. */ - if (m_fold == ULINT_UNDEFINED) { - m_fold = (m_space << 20) + m_space + m_page_no; - ut_ad(m_fold != ULINT_UNDEFINED); - } - - return(m_fold); - } - - /** Copy the values from a given page_id_t object. - @param[in] src page id object whose values to fetch */ - inline void copy_from(const page_id_t& src) - { - m_space = src.space(); - m_page_no = src.page_no(); - m_fold = src.fold(); - } - - /** Reset the object. */ - void reset() { m_space= ~0U; m_page_no= ~0U; m_fold= ULINT_UNDEFINED; } + ulint fold() const { return (m_space << 20) + m_space + m_page_no; } /** Reset the page number only. @param[in] page_no page number */ inline void set_page_no(ulint page_no) { - m_page_no = static_cast<ib_uint32_t>(page_no); - m_fold = ULINT_UNDEFINED; + m_page_no = uint32_t(page_no); ut_ad(page_no <= 0xFFFFFFFFU); } - /** Check if a given page_id_t object is equal to the current one. - @param[in] a page_id_t object to compare - @return true if equal */ - inline bool equals_to(const page_id_t& a) const - { - return(a.space() == m_space && a.page_no() == m_page_no); - } - private: /** Tablespace id. */ - ib_uint32_t m_space; + uint32_t m_space; /** Page number. */ - ib_uint32_t m_page_no; - - /** A fold value derived from m_space and m_page_no, - used in hashing. */ - mutable ulint m_fold; - - /* Disable implicit copying. */ - void operator=(const page_id_t&); + uint32_t m_page_no; /** Declare the overloaded global operator<< as a friend of this class. Refer to the global declaration for further details. Print @@ -314,7 +274,7 @@ private: std::ostream& operator<<( std::ostream& out, - const page_id_t& page_id); + const page_id_t page_id); }; /** Print the given page_id_t object. @@ -324,7 +284,7 @@ private: std::ostream& operator<<( std::ostream& out, - const page_id_t& page_id); + const page_id_t page_id); #ifndef UNIV_INNOCHECKSUM /********************************************************************//** @@ -507,7 +467,7 @@ Suitable for using when holding the lock_sys_t::mutex. @return pointer to a page or NULL */ buf_block_t* buf_page_try_get_func( - const page_id_t& page_id, + const page_id_t page_id, const char* file, unsigned line, mtr_t* mtr); @@ -533,7 +493,7 @@ the same set of mutexes or latches. @return pointer to the block */ buf_page_t* buf_page_get_zip( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size); /** This is the general function used to get access to a database page. @@ -549,7 +509,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH @return pointer to the block or NULL */ buf_block_t* buf_page_get_gen( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint rw_latch, buf_block_t* guess, @@ -569,7 +529,7 @@ FILE_PAGE (the other is buf_page_get_gen). @return pointer to the block, page bufferfixed */ buf_block_t* buf_page_create( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, mtr_t* mtr); @@ -603,10 +563,7 @@ NOTE that it is possible that the page is not yet read from disk, though. @param[in] page_id page id @return TRUE if found in the page hash table */ -UNIV_INLINE -ibool -buf_page_peek( - const page_id_t& page_id); +inline bool buf_page_peek(const page_id_t page_id); #ifdef UNIV_DEBUG @@ -616,9 +573,7 @@ debug version to check that it is not accessed any more unless reallocated. @param[in] page_id page id @return control block if found in page hash table, otherwise NULL */ -buf_page_t* -buf_page_set_file_page_was_freed( - const page_id_t& page_id); +buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id); /** Sets file_page_was_freed FALSE if the page is found in the buffer pool. This function should be called when we free a file page and want the @@ -626,9 +581,7 @@ debug version to check that it is not accessed any more unless reallocated. @param[in] page_id page id @return control block if found in page hash table, otherwise NULL */ -buf_page_t* -buf_page_reset_file_page_was_freed( - const page_id_t& page_id); +buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id); #endif /* UNIV_DEBUG */ /********************************************************************//** @@ -1076,7 +1029,7 @@ UNIV_INLINE void buf_block_set_file_page( buf_block_t* block, - const page_id_t& page_id); + const page_id_t page_id); /*********************************************************************//** Gets the io_fix state of a block. @@ -1257,7 +1210,7 @@ buf_page_t* buf_page_init_for_read( dberr_t* err, ulint mode, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, bool unzip); @@ -1305,10 +1258,7 @@ buf_pool_from_block( /** Returns the buffer pool instance given a page id. @param[in] page_id page id @return buffer pool */ -UNIV_INLINE -buf_pool_t* -buf_pool_get( - const page_id_t& page_id); +inline buf_pool_t* buf_pool_get(const page_id_t page_id); /******************************************************************//** Returns the buffer pool instance given its array index @@ -1328,7 +1278,7 @@ UNIV_INLINE buf_page_t* buf_page_hash_get_low( buf_pool_t* buf_pool, - const page_id_t& page_id); + const page_id_t page_id); /** Returns the control block of a file page, NULL if not found. If the block is found and lock is not NULL then the appropriate @@ -1350,7 +1300,7 @@ UNIV_INLINE buf_page_t* buf_page_hash_get_locked( buf_pool_t* buf_pool, - const page_id_t& page_id, + const page_id_t page_id, rw_lock_t** lock, ulint lock_mode, bool watch = false); @@ -1373,7 +1323,7 @@ UNIV_INLINE buf_block_t* buf_block_hash_get_locked( buf_pool_t* buf_pool, - const page_id_t& page_id, + const page_id_t page_id, rw_lock_t** lock, ulint lock_mode); @@ -1413,18 +1363,14 @@ buf_pool_watch_is_sentinel( /** Stop watching if the page has been read in. buf_pool_watch_set(space,offset) must have returned NULL before. @param[in] page_id page id */ -void -buf_pool_watch_unset( - const page_id_t& page_id); +void buf_pool_watch_unset(const page_id_t page_id); /** Check if the page has been read in. This may only be called after buf_pool_watch_set(space,offset) has returned NULL and before invoking buf_pool_watch_unset(space,offset). @param[in] page_id page id @return FALSE if the given page was not read in, TRUE if it was */ -ibool -buf_pool_watch_occurred( - const page_id_t& page_id) +bool buf_pool_watch_occurred(const page_id_t page_id) MY_ATTRIBUTE((warn_unused_result)); /********************************************************************//** diff --git a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic index 8314797e78d..7ca08449c8c 100644 --- a/storage/innobase/include/buf0buf.ic +++ b/storage/innobase/include/buf0buf.ic @@ -463,10 +463,10 @@ UNIV_INLINE void buf_block_set_file_page( buf_block_t* block, - const page_id_t& page_id) + const page_id_t page_id) { buf_block_set_state(block, BUF_BLOCK_FILE_PAGE); - block->page.id.copy_from(page_id); + block->page.id = page_id; } /*********************************************************************//** @@ -1043,10 +1043,7 @@ buf_block_buf_fix_dec( /** Returns the buffer pool instance given a page id. @param[in] page_id page id @return buffer pool */ -UNIV_INLINE -buf_pool_t* -buf_pool_get( - const page_id_t& page_id) +inline buf_pool_t* buf_pool_get(const page_id_t page_id) { /* 2log of BUF_READ_AHEAD_AREA (64) */ ulint ignored_page_no = page_id.page_no() >> 6; @@ -1081,7 +1078,7 @@ UNIV_INLINE buf_page_t* buf_page_hash_get_low( buf_pool_t* buf_pool, - const page_id_t& page_id) + const page_id_t page_id) { buf_page_t* bpage; @@ -1099,7 +1096,7 @@ buf_page_hash_get_low( bpage, ut_ad(bpage->in_page_hash && !bpage->in_zip_hash && buf_page_in_file(bpage)), - page_id.equals_to(bpage->id)); + page_id == bpage->id); if (bpage) { ut_a(buf_page_in_file(bpage)); ut_ad(bpage->in_page_hash); @@ -1130,7 +1127,7 @@ UNIV_INLINE buf_page_t* buf_page_hash_get_locked( buf_pool_t* buf_pool, - const page_id_t& page_id, + const page_id_t page_id, rw_lock_t** lock, ulint lock_mode, bool watch) @@ -1174,7 +1171,7 @@ buf_page_hash_get_locked( } ut_ad(buf_page_in_file(bpage)); - ut_ad(page_id.equals_to(bpage->id)); + ut_ad(page_id == bpage->id); if (lock == NULL) { /* The caller wants us to release the page_hash lock */ @@ -1213,7 +1210,7 @@ UNIV_INLINE buf_block_t* buf_block_hash_get_locked( buf_pool_t* buf_pool, - const page_id_t& page_id, + const page_id_t page_id, rw_lock_t** lock, ulint lock_mode) { @@ -1253,11 +1250,8 @@ buf_block_hash_get_locked( NOTE that it is possible that the page is not yet read from disk, though. @param[in] page_id page id -@return TRUE if found in the page hash table */ -UNIV_INLINE -ibool -buf_page_peek( - const page_id_t& page_id) +@return true if found in the page hash table */ +inline bool buf_page_peek(const page_id_t page_id) { buf_pool_t* buf_pool = buf_pool_get(page_id); diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h index 5c766b9412a..a7c43e01467 100644 --- a/storage/innobase/include/buf0rea.h +++ b/storage/innobase/include/buf0rea.h @@ -44,7 +44,7 @@ after decryption normal page checksum does not match. @retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */ dberr_t buf_read_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size); /********************************************************************//** @@ -57,7 +57,7 @@ released by the i/o-handler thread. @param[in] sync true if synchronous aio is desired */ void buf_read_page_background( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, bool sync); @@ -79,7 +79,7 @@ pages, it may happen that the page at the given page number does not get read even if we return a positive value! */ ulint buf_read_ahead_random( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ibool inside_ibuf); @@ -111,7 +111,7 @@ which could result in a deadlock if the OS does not support asynchronous io. @return number of page read requests issued */ ulint buf_read_ahead_linear( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ibool inside_ibuf); diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index 43234bb80c6..e0af39bdee8 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -38,7 +38,6 @@ Created 10/25/1995 Heikki Tuuri // Forward declaration extern my_bool srv_use_doublewrite_buf; extern struct buf_dblwr_t* buf_dblwr; -struct trx_t; class page_id_t; /** Structure containing encryption specification */ @@ -1084,7 +1083,7 @@ dberr_t fil_io( const IORequest& type, bool sync, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, ulint byte_offset, ulint len, @@ -1155,65 +1154,6 @@ fil_page_set_type( /*==============*/ byte* page, /*!< in/out: file page */ ulint type); /*!< in: type */ -/** Reset the page type. -Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE. -In MySQL 3.23.53, only undo log pages and index pages were tagged. -Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. -@param[in] page_id page number -@param[in,out] page page with invalid FIL_PAGE_TYPE -@param[in] type expected page type -@param[in,out] mtr mini-transaction */ -void -fil_page_reset_type( - const page_id_t& page_id, - byte* page, - ulint type, - mtr_t* mtr); - -/** Get the file page type. -@param[in] page file page -@return page type */ -inline -uint16_t -fil_page_get_type(const byte* page) -{ - return(mach_read_from_2(page + FIL_PAGE_TYPE)); -} - -/** Check (and if needed, reset) the page type. -Data files created before MySQL 5.1 may contain -garbage in the FIL_PAGE_TYPE field. -In MySQL 3.23.53, only undo log pages and index pages were tagged. -Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. -@param[in] page_id page number -@param[in,out] page page with possibly invalid FIL_PAGE_TYPE -@param[in] type expected page type -@param[in,out] mtr mini-transaction */ -inline -void -fil_page_check_type( - const page_id_t& page_id, - byte* page, - ulint type, - mtr_t* mtr) -{ - ulint page_type = fil_page_get_type(page); - - if (page_type != type) { - fil_page_reset_type(page_id, page, type, mtr); - } -} - -/** Check (and if needed, reset) the page type. -Data files created before MySQL 5.1 may contain -garbage in the FIL_PAGE_TYPE field. -In MySQL 3.23.53, only undo log pages and index pages were tagged. -Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. -@param[in,out] block block with possibly invalid FIL_PAGE_TYPE -@param[in] type expected page type -@param[in,out] mtr mini-transaction */ -#define fil_block_check_type(block, type, mtr) \ - fil_page_check_type(block->page.id, block->frame, type, mtr) /********************************************************************//** Delete the tablespace file and any related files like .cfg. diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 3222f1c761a..33dce63d5e1 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -583,6 +583,44 @@ fseg_free_step_not_header_func( fseg_free_step_not_header_func(header, mtr) #endif /* BTR_CUR_HASH_ADAPT */ +/** Reset the page type. +Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE. +In MySQL 3.23.53, only undo log pages and index pages were tagged. +Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. +@param[in] block block with invalid FIL_PAGE_TYPE +@param[in] type expected page type +@param[in,out] mtr mini-transaction */ +ATTRIBUTE_COLD +void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr); + +/** Get the file page type. +@param[in] page file page +@return page type */ +inline uint16_t fil_page_get_type(const byte* page) +{ + return mach_read_from_2(page + FIL_PAGE_TYPE); +} + +/** Check (and if needed, reset) the page type. +Data files created before MySQL 5.1.48 may contain +garbage in the FIL_PAGE_TYPE field. +In MySQL 3.23.53, only undo log pages and index pages were tagged. +Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE. +@param[in] page_id page number +@param[in,out] page page with possibly invalid FIL_PAGE_TYPE +@param[in] type expected page type +@param[in,out] mtr mini-transaction */ +inline void +fil_block_check_type( + const buf_block_t& block, + ulint type, + mtr_t* mtr) +{ + if (UNIV_UNLIKELY(type != fil_page_get_type(block.frame))) { + fil_block_reset_type(block, type, mtr); + } +} + /** Checks if a page address is an extent descriptor page address. @param[in] page_id page id @param[in] page_size page size @@ -590,7 +628,7 @@ fseg_free_step_not_header_func( UNIV_INLINE ibool fsp_descr_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size); /***********************************************************//** diff --git a/storage/innobase/include/fsp0fsp.ic b/storage/innobase/include/fsp0fsp.ic index 38d890fd2f3..3258704615a 100644 --- a/storage/innobase/include/fsp0fsp.ic +++ b/storage/innobase/include/fsp0fsp.ic @@ -33,7 +33,7 @@ Created 12/18/1995 Heikki Tuuri UNIV_INLINE ibool fsp_descr_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { return((page_id.page_no() & (page_size.physical() - 1)) diff --git a/storage/innobase/include/fts0fts.h b/storage/innobase/include/fts0fts.h index 068720c1947..9a4805e6eba 100644 --- a/storage/innobase/include/fts0fts.h +++ b/storage/innobase/include/fts0fts.h @@ -394,7 +394,7 @@ extern ulong fts_max_cache_size; extern ulong fts_max_total_cache_size; /** Variable specifying the FTS result cache limit for each query */ -extern ulong fts_result_cache_limit; +extern size_t fts_result_cache_limit; /** Variable specifying the maximum FTS max token size */ extern ulong fts_max_token_size; diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h index 55a698e8b66..0bcb8d5a1d3 100644 --- a/storage/innobase/include/fts0types.h +++ b/storage/innobase/include/fts0types.h @@ -163,7 +163,7 @@ struct fts_cache_t { the document from the table. Each element is of type fts_doc_t */ - ulint total_size; /*!< total size consumed by the ilist + size_t total_size; /*!< total size consumed by the ilist field of all nodes. SYNC is run whenever this gets too big */ fts_sync_t* sync; /*!< sync structure to sync data to @@ -245,7 +245,7 @@ struct fts_fetch_t { fts_sql_callback read_record; /*!< Callback for reading index record */ - ulint total_memory; /*!< Total memory used */ + size_t total_memory; /*!< Total memory used */ }; /** For horizontally splitting an FTS auxiliary index */ diff --git a/storage/innobase/include/ha_prototypes.h b/storage/innobase/include/ha_prototypes.h index 1313705f119..15107a93807 100644 --- a/storage/innobase/include/ha_prototypes.h +++ b/storage/innobase/include/ha_prototypes.h @@ -120,6 +120,9 @@ thd_is_replication_slave_thread( /*============================*/ THD* thd); /*!< in: thread handle */ +/** @return whether statement-based replication is active */ +extern "C" int thd_rpl_stmt_based(const THD* thd); + /******************************************************************//** Returns true if the transaction this thread is processing has edited non-transactional tables. Used by the deadlock detector when deciding diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h index 8233a536abc..95a302b1439 100644 --- a/storage/innobase/include/ibuf0ibuf.h +++ b/storage/innobase/include/ibuf0ibuf.h @@ -248,7 +248,7 @@ ibuf_inside( UNIV_INLINE ibool ibuf_bitmap_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size); /** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages. @@ -265,7 +265,7 @@ in which case a new transaction is created. @return TRUE if level 2 or level 3 page */ ibool ibuf_page_low( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, #ifdef UNIV_DEBUG ibool x_latch, @@ -321,7 +321,7 @@ ibuf_insert( ibuf_op_t op, const dtuple_t* entry, dict_index_t* index, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size, que_thr_t* thr); @@ -340,7 +340,7 @@ want to update a non-existent bitmap page */ void ibuf_merge_or_delete_for_page( buf_block_t* block, - const page_id_t& page_id, + const page_id_t page_id, const page_size_t* page_size, ibool update_ibuf_bitmap); @@ -388,9 +388,7 @@ ibuf_parse_bitmap_init( @param[in] page_id page id @return number of entries in the insert buffer currently buffered for this page */ -ulint -ibuf_count_get( - const page_id_t& page_id); +ulint ibuf_count_get(const page_id_t page_id); #endif /******************************************************************//** Looks if the insert buffer is empty. diff --git a/storage/innobase/include/ibuf0ibuf.ic b/storage/innobase/include/ibuf0ibuf.ic index 355fad62f24..f6ff6f2a7fd 100644 --- a/storage/innobase/include/ibuf0ibuf.ic +++ b/storage/innobase/include/ibuf0ibuf.ic @@ -156,7 +156,7 @@ ibuf_inside( UNIV_INLINE ibool ibuf_bitmap_page( - const page_id_t& page_id, + const page_id_t page_id, const page_size_t& page_size) { return((page_id.page_no() & (page_size.physical() - 1)) diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index 0c157cb87cf..c1281af2b30 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation +Copyright (c) 2013, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -35,12 +35,6 @@ Created 11/26/1995 Heikki Tuuri /** Start a mini-transaction. */ #define mtr_start(m) (m)->start() -/** Start a synchronous mini-transaction */ -#define mtr_start_sync(m) (m)->start(true) - -/** Start an asynchronous read-only mini-transaction */ -#define mtr_start_ro(m) (m)->start(true, true) - /** Commit a mini-transaction. */ #define mtr_commit(m) (m)->commit() @@ -198,21 +192,8 @@ struct mtr_t { ~mtr_t() { } - /** Start a mini-transaction. - @param sync true if it is a synchronous mini-transaction */ - void start(bool sync = true); - - /** @return whether this is an asynchronous mini-transaction. */ - bool is_async() const - { - return(!m_sync); - } - - /** Request a future commit to be synchronous. */ - void set_sync() - { - m_sync = true; - } + /** Start a mini-transaction. */ + void start(); /** Commit the mini-transaction. */ void commit(); @@ -558,9 +539,6 @@ private: /** LSN at commit time */ volatile lsn_t m_commit_lsn; - - /** true if it is synchronous mini-transaction */ - bool m_sync; }; #include "mtr0mtr.ic" diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 8a805a85eda..157df6d2713 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1351,7 +1351,7 @@ void page_warn_strict_checksum( srv_checksum_algorithm_t curr_algo, srv_checksum_algorithm_t page_checksum, - const page_id_t& page_id); + const page_id_t page_id); #ifdef UNIV_MATERIALIZE #undef UNIV_INLINE diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h index 563d31e1a25..776757b32ec 100644 --- a/storage/innobase/include/trx0rec.h +++ b/storage/innobase/include/trx0rec.h @@ -167,8 +167,7 @@ trx_undo_rec_get_partial_row( @param[in,out] trx transaction @param[in] table table that is being renamed @return DB_SUCCESS or error code */ -dberr_t -trx_undo_report_rename(trx_t* trx, const dict_table_t* table) +dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table) MY_ATTRIBUTE((nonnull, warn_unused_result)); /***********************************************************************//** Writes information to an undo log about an insert, update, or a delete marking diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 6af212d35ff..f7e6d01c9bc 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -49,9 +49,7 @@ typedef UT_LIST_BASE_NODE_T(trx_t) trx_ut_list_t; /** Checks if a page address is the trx sys header page. @param[in] page_id page id @return true if trx sys header page */ -inline -bool -trx_sys_hdr_page(const page_id_t& page_id) +inline bool trx_sys_hdr_page(const page_id_t& page_id) { return(page_id.space() == TRX_SYS_SPACE && page_id.page_no() == TRX_SYS_PAGE_NO); diff --git a/storage/innobase/include/trx0undo.h b/storage/innobase/include/trx0undo.h index ada78615f15..60b0517db0d 100644 --- a/storage/innobase/include/trx0undo.h +++ b/storage/innobase/include/trx0undo.h @@ -107,7 +107,7 @@ trx_read_roll_ptr( @return pointer to page x-latched */ UNIV_INLINE page_t* -trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr); +trx_undo_page_get(const page_id_t page_id, mtr_t* mtr); /** Gets an undo log page and s-latches it. @param[in] page_id page id @@ -115,7 +115,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr); @return pointer to page s-latched */ UNIV_INLINE page_t* -trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr); +trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr); /******************************************************************//** Returns the next undo log record on the page in the specified log, or diff --git a/storage/innobase/include/trx0undo.ic b/storage/innobase/include/trx0undo.ic index 630638f6b7b..ac8af61be09 100644 --- a/storage/innobase/include/trx0undo.ic +++ b/storage/innobase/include/trx0undo.ic @@ -140,7 +140,7 @@ trx_read_roll_ptr( @return pointer to page x-latched */ UNIV_INLINE page_t* -trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr) +trx_undo_page_get(const page_id_t page_id, mtr_t* mtr) { buf_block_t* block = buf_page_get(page_id, univ_page_size, RW_X_LATCH, mtr); @@ -156,7 +156,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr) @return pointer to page s-latched */ UNIV_INLINE page_t* -trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr) +trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr) { buf_block_t* block = buf_page_get(page_id, univ_page_size, RW_S_LATCH, mtr); diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i index f815463d2e8..a3b50950393 100644 --- a/storage/innobase/include/univ.i +++ b/storage/innobase/include/univ.i @@ -41,7 +41,7 @@ Created 1/20/1994 Heikki Tuuri #define INNODB_VERSION_MAJOR 5 #define INNODB_VERSION_MINOR 7 -#define INNODB_VERSION_BUGFIX 23 +#define INNODB_VERSION_BUGFIX 24 /* The following is the InnoDB version as shown in SELECT plugin_version FROM information_schema.plugins; diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index 07d44596ada..76ed715e8d8 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -1981,10 +1981,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block) page number. @param[in] page_id page id @return number of pages found */ -static -ulint -recv_read_in_area( - const page_id_t& page_id) +static ulint recv_read_in_area(const page_id_t page_id) { recv_addr_t* recv_addr; ulint page_nos[RECV_READ_AHEAD_AREA]; diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index aba40c445ad..3084ba387fb 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -382,18 +382,8 @@ public: /** Constructor. Takes ownership of the mtr->m_impl, is responsible for deleting it. @param[in,out] mtr mini-transaction */ - explicit Command(mtr_t* mtr) - : - m_locks_released() - { - init(mtr); - } - - void init(mtr_t* mtr) - { - m_impl = &mtr->m_impl; - m_sync = mtr->m_sync; - } + explicit Command(mtr_t* mtr) : m_impl(&mtr->m_impl), m_locks_released() + {} /** Destructor */ ~Command() @@ -426,9 +416,6 @@ private: @return number of bytes to write in finish_write() */ ulint prepare_write(); - /** true if it is a sync mini-transaction. */ - bool m_sync; - /** The mini-transaction state. */ mtr_t::Impl* m_impl; @@ -487,17 +474,13 @@ mtr_write_log( log_close(); } -/** Start a mini-transaction. -@param sync true if it is a synchronous mini-transaction */ -void -mtr_t::start(bool sync) +/** Start a mini-transaction. */ +void mtr_t::start() { UNIV_MEM_INVALID(this, sizeof(*this)); UNIV_MEM_INVALID(&m_impl, sizeof(m_impl)); - m_sync = sync; - m_commit_lsn = 0; new(&m_impl.m_log) mtr_buf_t(); diff --git a/storage/innobase/page/page0page.cc b/storage/innobase/page/page0page.cc index 0d0d3c211e5..717f4a79507 100644 --- a/storage/innobase/page/page0page.cc +++ b/storage/innobase/page/page0page.cc @@ -2826,7 +2826,7 @@ void page_warn_strict_checksum( srv_checksum_algorithm_t curr_algo, srv_checksum_algorithm_t page_checksum, - const page_id_t& page_id) + const page_id_t page_id) { srv_checksum_algorithm_t curr_algo_nonstrict; switch (curr_algo) { diff --git a/storage/innobase/que/que0que.cc b/storage/innobase/que/que0que.cc index 947b281e4b9..ebcd7bd450e 100644 --- a/storage/innobase/que/que0que.cc +++ b/storage/innobase/que/que0que.cc @@ -689,7 +689,8 @@ que_thr_stop( trx->lock.wait_thr = thr; thr->state = QUE_THR_LOCK_WAIT; - } else if (trx->duplicates && trx->error_state == DB_DUPLICATE_KEY) { + } else if (trx->duplicates && trx->error_state == DB_DUPLICATE_KEY + && thd_rpl_stmt_based(trx->mysql_thd)) { return(FALSE); diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 6597d583c0f..8a861d1bf4c 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3654,7 +3654,7 @@ fil_tablespace_iterate( buf_block_t* block = reinterpret_cast<buf_block_t*> (ut_zalloc_nokey(sizeof *block)); block->frame = page; - block->page.id.copy_from(page_id_t(0, 0)); + block->page.id = page_id_t(0, 0); block->page.io_fix = BUF_IO_NONE; block->page.buf_fix_count = 1; block->page.state = BUF_BLOCK_FILE_PAGE; @@ -3672,8 +3672,7 @@ fil_tablespace_iterate( } if (err == DB_SUCCESS) { - block->page.id.copy_from( - page_id_t(callback.get_space_id(), 0)); + block->page.id = page_id_t(callback.get_space_id(), 0); block->page.size.copy_from(callback.get_page_size()); if (block->page.size.is_compressed()) { page_zip_set_size(&block->page.zip, diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc index 28a03b245ad..777d69cf127 100644 --- a/storage/innobase/row/row0ins.cc +++ b/storage/innobase/row/row0ins.cc @@ -1916,9 +1916,12 @@ do_possible_lock_wait: thr->lock_state = QUE_THR_LOCK_NOLOCK; - if (check_table->to_be_dropped - || trx->error_state == DB_LOCK_WAIT_TIMEOUT) { + err = trx->error_state; + if (err != DB_SUCCESS) { + } else if (check_table->to_be_dropped) { err = DB_LOCK_WAIT_TIMEOUT; + } else { + err = DB_LOCK_WAIT; } check_table->dec_fk_checks(); @@ -2338,10 +2341,10 @@ row_ins_duplicate_error_in_clust( true, ULINT_UNDEFINED, &heap); - ulint lock_type; - - lock_type = + ulint lock_type = trx->isolation_level <= TRX_ISO_READ_COMMITTED + || (trx->mysql_thd + && !thd_rpl_stmt_based(trx->mysql_thd)) ? LOCK_REC_NOT_GAP : LOCK_ORDINARY; /* We set a lock on the possible duplicate: this @@ -2381,10 +2384,7 @@ row_ins_duplicate_error_in_clust( if (row_ins_dupl_error_with_rec( rec, entry, cursor->index, offsets)) { -duplicate: - trx->error_info = cursor->index; - err = DB_DUPLICATE_KEY; - goto func_exit; + goto duplicate; } } } @@ -2427,7 +2427,10 @@ duplicate: if (row_ins_dupl_error_with_rec( rec, entry, cursor->index, offsets)) { - goto duplicate; +duplicate: + trx->error_info = cursor->index; + err = DB_DUPLICATE_KEY; + goto func_exit; } } @@ -3072,9 +3075,11 @@ row_ins_sec_index_entry_low( if (!(flags & BTR_NO_LOCKING_FLAG) && dict_index_is_unique(index) && thr_get_trx(thr)->duplicates - && thr_get_trx(thr)->isolation_level >= TRX_ISO_REPEATABLE_READ) { + && thr_get_trx(thr)->isolation_level >= TRX_ISO_REPEATABLE_READ + && thd_rpl_stmt_based(thr_get_trx(thr)->mysql_thd)) { - /* When using the REPLACE statement or ON DUPLICATE clause, a + /* In statement-based replication, when replicating a + REPLACE statement or ON DUPLICATE KEY UPDATE clause, a gap lock is taken on the position of the to-be-inserted record, to avoid other concurrent transactions from inserting the same record. */ @@ -3643,14 +3648,15 @@ row_ins( ins_node_t* node, /*!< in: row insert node */ que_thr_t* thr) /*!< in: query thread */ { - dberr_t err; - DBUG_ENTER("row_ins"); DBUG_PRINT("row_ins", ("table: %s", node->table->name.m_name)); + trx_t* trx = thr_get_trx(thr); + if (node->duplicate) { - thr_get_trx(thr)->error_state = DB_DUPLICATE_KEY; + ut_ad(thd_rpl_stmt_based(trx->mysql_thd)); + trx->error_state = DB_DUPLICATE_KEY; } if (node->state == INS_NODE_ALLOC_ROW_ID) { @@ -3676,7 +3682,7 @@ row_ins( while (node->index != NULL) { if (node->index->type != DICT_FTS) { - err = row_ins_index_entry_step(node, thr); + dberr_t err = row_ins_index_entry_step(node, thr); switch (err) { case DB_SUCCESS: @@ -3689,9 +3695,11 @@ row_ins( case DB_DUPLICATE_KEY: ut_ad(dict_index_is_unique(node->index)); - if (thr_get_trx(thr)->isolation_level + if (trx->isolation_level >= TRX_ISO_REPEATABLE_READ - && thr_get_trx(thr)->duplicates) { + && trx->duplicates + && !node->table->is_temporary() + && thd_rpl_stmt_based(trx->mysql_thd)) { /* When we are in REPLACE statement or INSERT .. ON DUPLICATE UPDATE @@ -3754,7 +3762,7 @@ row_ins( /* Save 1st dup error. Ignore subsequent dup errors. */ node->duplicate = node->index; - thr_get_trx(thr)->error_state + trx->error_state = DB_DUPLICATE_KEY; } break; @@ -3765,18 +3773,6 @@ row_ins( } } - if (node->duplicate && node->table->is_temporary()) { - ut_ad(thr_get_trx(thr)->error_state - == DB_DUPLICATE_KEY); - /* For TEMPORARY TABLE, we won't lock anything, - so we can simply break here instead of requiring - GAP locks for other unique secondary indexes, - pretending we have consumed all indexes. */ - node->index = NULL; - node->entry = NULL; - break; - } - node->index = dict_table_get_next_index(node->index); node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); @@ -3795,6 +3791,7 @@ row_ins( insertion will take place. These gap locks are needed only for unique indexes. So skipping non-unique indexes. */ if (node->duplicate) { + ut_ad(thd_rpl_stmt_based(trx->mysql_thd)); while (node->index && !dict_index_is_unique(node->index)) { @@ -3803,13 +3800,13 @@ row_ins( node->entry = UT_LIST_GET_NEXT(tuple_list, node->entry); } - thr_get_trx(thr)->error_state = DB_DUPLICATE_KEY; + trx->error_state = DB_DUPLICATE_KEY; } } ut_ad(node->entry == NULL); - thr_get_trx(thr)->error_info = node->duplicate; + trx->error_info = node->duplicate; node->state = INS_NODE_ALLOC_ROW_ID; DBUG_RETURN(node->duplicate ? DB_DUPLICATE_KEY : DB_SUCCESS); diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc index 89142946615..fa369566d9a 100644 --- a/storage/innobase/row/row0merge.cc +++ b/storage/innobase/row/row0merge.cc @@ -4108,25 +4108,31 @@ pfs_os_file_t row_merge_file_create_low( const char* path) { - pfs_os_file_t fd; #ifdef UNIV_PFS_IO /* This temp file open does not go through normal file APIs, add instrumentation to register with performance schema */ - struct PSI_file_locker* locker = NULL; + struct PSI_file_locker* locker; PSI_file_locker_state state; + if (!path) { + path = mysql_tmpdir; + } + static const char label[] = "/Innodb Merge Temp File"; + char* name = static_cast<char*>( + ut_malloc_nokey(strlen(path) + sizeof label)); + strcpy(name, path); + strcat(name, label); register_pfs_file_open_begin( &state, locker, innodb_temp_file_key, - PSI_FILE_CREATE, - "Innodb Merge Temp File", - __FILE__, __LINE__); - + PSI_FILE_CREATE, path ? name : label, __FILE__, __LINE__); + #endif - fd = innobase_mysql_tmpfile(path); + pfs_os_file_t fd = innobase_mysql_tmpfile(path); #ifdef UNIV_PFS_IO register_pfs_file_open_end(locker, fd, (fd == OS_FILE_CLOSED)?NULL:&fd); + ut_free(name); #endif if (fd == OS_FILE_CLOSED) { diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc index efbb7ac0b48..01bc344588a 100644 --- a/storage/innobase/row/row0mysql.cc +++ b/storage/innobase/row/row0mysql.cc @@ -37,6 +37,7 @@ Created 9/17/2000 Heikki Tuuri #include <sql_const.h> #include "dict0dict.h" #include "dict0load.h" +#include "dict0priv.h" #include "dict0stats.h" #include "dict0stats_bg.h" #include "dict0defrag_bg.h" @@ -3706,129 +3707,111 @@ defer: /* Deleting a row from SYS_INDEXES table will invoke dict_drop_index_tree(). */ info = pars_info_create(); - pars_info_add_str_literal(info, "table_name", name); - err = (sqlcom == SQLCOM_TRUNCATE) ? DB_SUCCESS : que_eval_sql( - info, - "PROCEDURE DROP_FOREIGN_PROC () IS\n" - "sys_foreign_id CHAR;\n" - "table_id CHAR;\n" - "foreign_id CHAR;\n" - "space_id INT;\n" - "found INT;\n" - - "DECLARE CURSOR cur_fk IS\n" - "SELECT ID FROM SYS_FOREIGN\n" - "WHERE FOR_NAME = :table_name\n" - "AND TO_BINARY(FOR_NAME)\n" - " = TO_BINARY(:table_name)\n" - "FOR UPDATE;\n" - "BEGIN\n" + pars_info_add_str_literal(info, "name", name); - "SELECT ID INTO table_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name\n" - "FOR UPDATE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - - "SELECT SPACE INTO space_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - - "found := 1;\n" - "SELECT ID INTO sys_foreign_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = 'SYS_FOREIGN'\n" - "FOR UPDATE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN') THEN\n" - " found := 0;\n" - "END IF;\n" - "IF (:table_name = 'SYS_FOREIGN_COLS') \n" - "THEN\n" - " found := 0;\n" - "END IF;\n" - - "OPEN cur_fk;\n" - "WHILE found = 1 LOOP\n" - " FETCH cur_fk INTO foreign_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " found := 0;\n" - " ELSE\n" - " DELETE FROM \n" - " SYS_FOREIGN_COLS\n" - " WHERE ID = foreign_id;\n" - " DELETE FROM SYS_FOREIGN\n" - " WHERE ID = foreign_id;\n" - " END IF;\n" - "END LOOP;\n" - "CLOSE cur_fk;\n" - - "END;\n", - FALSE, trx); - if (err == DB_SUCCESS) { - if (sqlcom != SQLCOM_TRUNCATE) { + if (sqlcom != SQLCOM_TRUNCATE + && strchr(name, '/') + && dict_table_get_low("SYS_FOREIGN") + && dict_table_get_low("SYS_FOREIGN_COLS")) { + err = que_eval_sql( + info, + "PROCEDURE DROP_FOREIGN_PROC () IS\n" + "fid CHAR;\n" + + "DECLARE CURSOR fk IS\n" + "SELECT ID FROM SYS_FOREIGN\n" + "WHERE FOR_NAME = :name\n" + "AND TO_BINARY(FOR_NAME) = TO_BINARY(:name)\n" + "FOR UPDATE;\n" + + "BEGIN\n" + "OPEN fk;\n" + "WHILE 1 = 1 LOOP\n" + " FETCH fk INTO fid;\n" + " IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" + " DELETE FROM SYS_FOREIGN_COLS WHERE ID=fid;\n" + " DELETE FROM SYS_FOREIGN WHERE ID=fid;\n" + "END LOOP;\n" + "CLOSE fk;\n" + "END;\n", FALSE, trx); + if (err == DB_SUCCESS) { info = pars_info_create(); - pars_info_add_str_literal(info, "table_name", name); + pars_info_add_str_literal(info, "name", name); + goto do_drop; + } + } else { +do_drop: + if (dict_table_get_low("SYS_VIRTUAL")) { + err = que_eval_sql( + info, + "PROCEDURE DROP_VIRTUAL_PROC () IS\n" + "tid CHAR;\n" + + "BEGIN\n" + "SELECT ID INTO tid FROM SYS_TABLES\n" + "WHERE NAME = :name FOR UPDATE;\n" + "IF (SQL % NOTFOUND) THEN RETURN;" + " END IF;\n" + "DELETE FROM SYS_VIRTUAL" + " WHERE TABLE_ID = tid;\n" + "END;\n", FALSE, trx); + if (err == DB_SUCCESS) { + info = pars_info_create(); + pars_info_add_str_literal( + info, "name", name); + } + } else { + err = DB_SUCCESS; } - err = que_eval_sql( + err = err == DB_SUCCESS ? que_eval_sql( info, "PROCEDURE DROP_TABLE_PROC () IS\n" - "table_id CHAR;\n" - "space_id INT;\n" - "index_id CHAR;\n" + "tid CHAR;\n" + "iid CHAR;\n" "DECLARE CURSOR cur_idx IS\n" "SELECT ID FROM SYS_INDEXES\n" - "WHERE TABLE_ID = table_id\n" - "FOR UPDATE;\n" + "WHERE TABLE_ID = tid FOR UPDATE;\n" "BEGIN\n" - "SELECT ID, SPACE INTO table_id,space_id\n" - "FROM SYS_TABLES\n" - "WHERE NAME = :table_name FOR UPDATE;\n" - "IF (SQL % NOTFOUND) THEN\n" - " RETURN;\n" - "END IF;\n" - - "DELETE FROM SYS_COLUMNS\n" - "WHERE TABLE_ID = table_id;\n" - "DELETE FROM SYS_TABLES\n" - "WHERE NAME = :table_name;\n" - - "DELETE FROM SYS_TABLESPACES\n" - "WHERE SPACE = space_id;\n" - "DELETE FROM SYS_DATAFILES\n" - "WHERE SPACE = space_id;\n" - - "DELETE FROM SYS_VIRTUAL\n" - "WHERE TABLE_ID = table_id;\n" + "SELECT ID INTO tid FROM SYS_TABLES\n" + "WHERE NAME = :name FOR UPDATE;\n" + "IF (SQL % NOTFOUND) THEN RETURN; END IF;\n" "OPEN cur_idx;\n" "WHILE 1 = 1 LOOP\n" - " FETCH cur_idx INTO index_id;\n" - " IF (SQL % NOTFOUND) THEN\n" - " EXIT;\n" - " ELSE\n" - " DELETE FROM SYS_FIELDS\n" - " WHERE INDEX_ID = index_id;\n" - " DELETE FROM SYS_INDEXES\n" - " WHERE ID = index_id\n" - " AND TABLE_ID = table_id;\n" - " END IF;\n" + " FETCH cur_idx INTO iid;\n" + " IF (SQL % NOTFOUND) THEN EXIT; END IF;\n" + " DELETE FROM SYS_FIELDS\n" + " WHERE INDEX_ID = iid;\n" + " DELETE FROM SYS_INDEXES\n" + " WHERE ID = iid AND TABLE_ID = tid;\n" "END LOOP;\n" "CLOSE cur_idx;\n" - "END;\n", - FALSE, trx); + "DELETE FROM SYS_COLUMNS WHERE TABLE_ID=tid;\n" + "DELETE FROM SYS_TABLES WHERE NAME=:name;\n" + + "END;\n", FALSE, trx) : err; + + if (err == DB_SUCCESS && table->space + && dict_table_get_low("SYS_TABLESPACES") + && dict_table_get_low("SYS_DATAFILES")) { + info = pars_info_create(); + pars_info_add_int4_literal(info, "id", + lint(table->space->id)); + err = que_eval_sql( + info, + "PROCEDURE DROP_SPACE_PROC () IS\n" + "BEGIN\n" + "DELETE FROM SYS_TABLESPACES\n" + "WHERE SPACE = :id;\n" + "DELETE FROM SYS_DATAFILES\n" + "WHERE SPACE = :id;\n" + "END;\n", FALSE, trx); + } } switch (err) { @@ -4579,6 +4562,9 @@ row_rename_table_for_mysql( " = TO_BINARY(:old_table_name);\n" "END;\n" , FALSE, trx); + if (err != DB_SUCCESS) { + goto end; + } } else if (n_constraints_to_drop > 0) { /* Drop some constraints of tmp tables. */ diff --git a/storage/innobase/row/row0row.cc b/storage/innobase/row/row0row.cc index ad3bb6ab9be..f5261e63e9a 100644 --- a/storage/innobase/row/row0row.cc +++ b/storage/innobase/row/row0row.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2018, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under @@ -312,7 +312,7 @@ row_build_index_entry_low( indexed long columns may be stored off-page. */ ut_ad(f.col->ord_part); - if (ext) { + if (ext && !f.col->is_virtual()) { /* See if the column is stored externally. */ const byte* buf = row_ext_lookup(ext, f.col->ind, &len); diff --git a/storage/innobase/row/row0upd.cc b/storage/innobase/row/row0upd.cc index f2724435b0d..f9567de3c1f 100644 --- a/storage/innobase/row/row0upd.cc +++ b/storage/innobase/row/row0upd.cc @@ -2221,6 +2221,7 @@ row_upd_store_v_row( } dfield_copy_data(dfield, upd_field->old_v_val); + dfield_dup(dfield, node->heap); break; } @@ -2241,6 +2242,7 @@ row_upd_store_v_row( update->old_vrow, col_no); dfield_copy_data(dfield, vfield); + dfield_dup(dfield, node->heap); } } else { /* Need to compute, this happens when diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 738377b52c9..03c91167484 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -2102,24 +2102,24 @@ files_checked: page_id_t(IBUF_SPACE_ID, FSP_IBUF_HEADER_PAGE_NO), univ_page_size, RW_X_LATCH, &mtr); - fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr); + fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr); /* Already MySQL 3.23.53 initialized FSP_IBUF_TREE_ROOT_PAGE_NO to FIL_PAGE_INDEX. No need to reset that one. */ block = buf_page_get( page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO), univ_page_size, RW_X_LATCH, &mtr); - fil_block_check_type(block, FIL_PAGE_TYPE_TRX_SYS, + fil_block_check_type(*block, FIL_PAGE_TYPE_TRX_SYS, &mtr); block = buf_page_get( page_id_t(TRX_SYS_SPACE, FSP_FIRST_RSEG_PAGE_NO), univ_page_size, RW_X_LATCH, &mtr); - fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr); + fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr); block = buf_page_get( page_id_t(TRX_SYS_SPACE, FSP_DICT_HDR_PAGE_NO), univ_page_size, RW_X_LATCH, &mtr); - fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr); + fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr); mtr.commit(); } diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 652734c4a31..0802805e281 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -279,7 +279,7 @@ trx_purge_add_undo_to_history(const trx_t* trx, trx_undo_t*& undo, mtr_t* mtr) ut_ad(srv_undo_sources || trx->undo_no == 0 || (!purge_sys.enabled() - && (srv_startup_is_before_trx_rollback_phase + && (srv_is_being_started || trx_rollback_is_active || srv_force_recovery >= SRV_FORCE_NO_BACKGROUND)) || ((trx->mysql_thd || trx->internal) diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc index 4520f05e4c3..a2f08fdb074 100644 --- a/storage/innobase/trx/trx0rec.cc +++ b/storage/innobase/trx/trx0rec.cc @@ -1991,8 +1991,7 @@ trx_undo_page_report_rename(trx_t* trx, const dict_table_t* table, @param[in,out] trx transaction @param[in] table table that is being renamed @return DB_SUCCESS or error code */ -dberr_t -trx_undo_report_rename(trx_t* trx, const dict_table_t* table) +dberr_t trx_undo_report_rename(trx_t* trx, const dict_table_t* table) { ut_ad(!trx->read_only); ut_ad(trx->id); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 600a6eb6229..0177623f908 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -1507,9 +1507,6 @@ void trx_commit_low(trx_t* trx, mtr_t* mtr) #endif if (mtr != NULL) { - - mtr->set_sync(); - trx_write_serialisation_history(trx, mtr); /* The following call commits the mini-transaction, making the @@ -1571,7 +1568,7 @@ trx_commit( if (trx->has_logged_or_recovered()) { mtr = &local_mtr; - mtr_start_sync(mtr); + mtr->start(); } else { mtr = NULL; @@ -2005,7 +2002,7 @@ trx_prepare_low(trx_t* trx) trx_rseg_t* rseg = trx->rsegs.m_redo.rseg; ut_ad(undo->rseg == rseg); - mtr.start(true); + mtr.start(); /* Change the undo log segment states from TRX_UNDO_ACTIVE to TRX_UNDO_PREPARED: these modifications to the file data diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index d0613d4f0d8..4eab0e07315 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -916,7 +916,7 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, info->last_key.keyinfo= tmp_key.keyinfo= keyinfo; info->lastinx= ~0; /* Safety */ tmp_key.data= tmp_key_buff; - for ( ;; ) + for ( ;; _ma_copy_key(&info->last_key, &tmp_key)) { if (nod_flag) { @@ -998,7 +998,6 @@ static int chk_index(HA_CHECK *param, MARIA_HA *info, MARIA_KEYDEF *keyinfo, tmp_key.data); } } - _ma_copy_key(&info->last_key, &tmp_key); (*key_checksum)+= maria_byte_checksum(tmp_key.data, tmp_key.data_length); record= _ma_row_pos_from_key(&tmp_key); @@ -5756,7 +5755,7 @@ static int sort_insert_key(MARIA_SORT_PARAM *sort_param, a_length= share->keypage_header + nod_flag; key_block->end_pos= anc_buff + share->keypage_header; bzero(anc_buff, share->keypage_header); - _ma_store_keynr(share, anc_buff, sort_param->key); + _ma_store_keynr(share, anc_buff, sort_param->keyinfo->key_nr); lastkey=0; /* No previous key in block */ } else diff --git a/storage/maria/ma_ft_boolean_search.c b/storage/maria/ma_ft_boolean_search.c index 4847429ed4b..c15186ab752 100644 --- a/storage/maria/ma_ft_boolean_search.c +++ b/storage/maria/ma_ft_boolean_search.c @@ -457,7 +457,7 @@ static int _ft2_search_no_lock(FTB *ftb, FTB_WORD *ftbw, my_bool init_search) */ ftbw->off=off; ftbw->key_root= info->cur_row.lastpos; - ftbw->keyinfo=& info->s->ft2_keyinfo; + ftbw->keyinfo= info->last_key.keyinfo= & info->s->ft2_keyinfo; r= _ma_search_first(info, ftbw->keyinfo, ftbw->key_root); DBUG_ASSERT(r==0); /* found something */ memcpy(lastkey_buf+off, info->last_key.data, diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c index cfa62ffec58..c2b521e3c02 100644 --- a/storage/maria/ma_write.c +++ b/storage/maria/ma_write.c @@ -669,13 +669,18 @@ static int w_search(register MARIA_HA *info, uint32 comp_flag, MARIA_KEY *key, else { /* popular word. two-level tree. going down */ - my_off_t root=dup_key_pos; - keyinfo= &share->ft2_keyinfo; - get_key_full_length_rdonly(off, key); - key+=off; + my_off_t root= dup_key_pos; + MARIA_KEY subkey; + get_key_full_length_rdonly(off, key->data); + subkey.keyinfo= keyinfo= &share->ft2_keyinfo; + subkey.data= key->data + off; + subkey.data_length= key->data_length - off; + subkey.ref_length= key->ref_length; + subkey.flag= key->flag; + /* we'll modify key entry 'in vivo' */ keypos-= keyinfo->keylength + page.node; - error= _ma_ck_real_write_btree(info, key, &root, comp_flag); + error= _ma_ck_real_write_btree(info, &subkey, &root, comp_flag); _ma_dpointer(share, keypos+HA_FT_WLEN, root); subkeys--; /* should there be underflow protection ? */ DBUG_ASSERT(subkeys < 0); diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp index 9dfca9c7004..4af8811800e 100644 --- a/storage/mroonga/ha_mroonga.cpp +++ b/storage/mroonga/ha_mroonga.cpp @@ -11824,7 +11824,8 @@ int ha_mroonga::storage_encode_key_timestamp2(Field *field, const uchar *key, #endif #ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 -int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key, +int ha_mroonga::storage_encode_key_datetime2(Field *field, bool is_null, + const uchar *key, uchar *buf, uint *size) { MRN_DBUG_ENTER_METHOD(); @@ -11832,7 +11833,7 @@ int ha_mroonga::storage_encode_key_datetime2(Field *field, const uchar *key, bool truncated = false; Field_datetimef *datetime2_field = (Field_datetimef *)field; - longlong packed_time = + longlong packed_time = is_null ? 0 : my_datetime_packed_from_binary(key, datetime2_field->decimals()); MYSQL_TIME mysql_time; TIME_from_longlong_datetime_packed(&mysql_time, packed_time); @@ -11960,6 +11961,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key, MRN_DBUG_ENTER_METHOD(); int error; bool truncated = false; + bool is_null = false; const uchar *ptr = key; error = mrn_change_encoding(ctx, field->charset()); @@ -11967,6 +11969,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key, DBUG_RETURN(error); if (field->null_bit) { + is_null = *ptr; ptr += 1; } @@ -12064,7 +12067,7 @@ int ha_mroonga::storage_encode_key(Field *field, const uchar *key, #endif #ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 case MYSQL_TYPE_DATETIME2: - error = storage_encode_key_datetime2(field, ptr, buf, size); + error = storage_encode_key_datetime2(field, is_null, ptr, buf, size); break; #endif #ifdef MRN_HAVE_MYSQL_TYPE_TIME2 diff --git a/storage/mroonga/ha_mroonga.hpp b/storage/mroonga/ha_mroonga.hpp index 0b3ff92a9a8..68c79703903 100644 --- a/storage/mroonga/ha_mroonga.hpp +++ b/storage/mroonga/ha_mroonga.hpp @@ -796,7 +796,7 @@ private: uchar *buf, uint *size); #endif #ifdef MRN_HAVE_MYSQL_TYPE_DATETIME2 - int storage_encode_key_datetime2(Field *field, const uchar *key, + int storage_encode_key_datetime2(Field *field, bool is_null, const uchar *key, uchar *buf, uint *size); #endif #ifdef MRN_HAVE_MYSQL_TYPE_TIME2 diff --git a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp index 9c56997d6d8..65c8259e0cc 100644 --- a/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp +++ b/storage/mroonga/lib/mrn_multiple_column_key_codec.cpp @@ -89,11 +89,13 @@ namespace mrn { for (int i = 0; i < n_key_parts && current_mysql_key < mysql_key_end; i++) { KEY_PART_INFO *key_part = &(key_info_->key_part[i]); Field *field = key_part->field; + bool is_null = false; DBUG_PRINT("info", ("mroonga: key_part->length=%u", key_part->length)); if (field->null_bit) { DBUG_PRINT("info", ("mroonga: field has null bit")); *current_grn_key = 0; + is_null = *current_mysql_key; current_mysql_key += 1; current_grn_key += 1; (*grn_key_length)++; @@ -164,7 +166,7 @@ namespace mrn { { Field_datetimef *datetimef_field = static_cast<Field_datetimef *>(field); - long long int mysql_datetime_packed = + long long int mysql_datetime_packed = is_null ? 0 : my_datetime_packed_from_binary(current_mysql_key, datetimef_field->decimals()); MYSQL_TIME mysql_time; diff --git a/storage/myisammrg/mysql-test/storage_engine/disabled.def b/storage/myisammrg/mysql-test/storage_engine/disabled.def index 227e33029d8..55fc952c20e 100644 --- a/storage/myisammrg/mysql-test/storage_engine/disabled.def +++ b/storage/myisammrg/mysql-test/storage_engine/disabled.def @@ -1,3 +1,4 @@ insert_delayed : MDEV-12880 - INSERT DELAYED is not detected as inapplicable to a table under lock lock_concurrent : MDEV-12882 - Assertion failure select_high_prio : MDEV-12885 - MDL_SHARED_READ_ONLY is taken instead of MDL_SHARED_READ +lock : MDEV-17145 (Unexpected ER_LOCK_WAIT_TIMEOUT) diff --git a/storage/perfschema/unittest/pfs-t.cc b/storage/perfschema/unittest/pfs-t.cc index 3da18ac30c0..59e0321d244 100644 --- a/storage/perfschema/unittest/pfs-t.cc +++ b/storage/perfschema/unittest/pfs-t.cc @@ -1,4 +1,4 @@ -/* Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved. +/* Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -898,6 +898,7 @@ void test_init_disabled() psi->create_file(file_key_A, "foo-instrumented", (File) 12); file_A1= lookup_file_by_name("foo-instrumented"); ok(file_A1 != NULL, "file_A1 instrumented"); + destroy_file(reinterpret_cast<PFS_thread*>(psi->get_thread()), file_A1); /* broken key + enabled T-1: no instrumentation */ @@ -1149,6 +1150,8 @@ void test_locker_disabled() psi->create_file(file_key_A, "foo", (File) 12); file_A1= (PSI_file*) lookup_file_by_name("foo"); ok(file_A1 != NULL, "instrumented"); + destroy_file(reinterpret_cast<PFS_thread*>(psi->get_thread()), + reinterpret_cast<PFS_file*>(file_A1)); socket_class_A->m_enabled= true; socket_A1= psi->init_socket(socket_key_A, NULL, NULL, 0); diff --git a/storage/rocksdb/event_listener.cc b/storage/rocksdb/event_listener.cc index 85c23f47c62..941f00cac60 100644 --- a/storage/rocksdb/event_listener.cc +++ b/storage/rocksdb/event_listener.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/event_listener.h b/storage/rocksdb/event_listener.h index 8772105de36..f666c876eac 100644 --- a/storage/rocksdb/event_listener.h +++ b/storage/rocksdb/event_listener.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #include "rocksdb/listener.h" diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 26c76a5ddef..38b33a41565 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation @@ -8563,9 +8563,17 @@ int ha_rocksdb::index_read_map_impl(uchar *const buf, const uchar *const key, packed_size); uint end_key_packed_size = 0; + /* + In MariaDB, the end_key is always the bigger end of the range. + If we are doing a reverse-ordered scan (that is, walking from the bigger + key values to smaller), we should use the smaller end of range as end_key. + */ const key_range *cur_end_key= end_key; - if (find_flag == HA_READ_PREFIX_LAST_OR_PREV) + if (find_flag == HA_READ_PREFIX_LAST_OR_PREV || + find_flag == HA_READ_BEFORE_KEY) + { cur_end_key= m_start_range; + } const uint eq_cond_len = calc_eq_cond_len(kd, find_flag, slice, bytes_changed_by_succ, cur_end_key, diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index 9b3352594d9..152ab3fa7c8 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #ifdef USE_PRAGMA_INTERFACE diff --git a/storage/rocksdb/ha_rocksdb_proto.h b/storage/rocksdb/ha_rocksdb_proto.h index 08afd9780be..26417328194 100644 --- a/storage/rocksdb/ha_rocksdb_proto.h +++ b/storage/rocksdb/ha_rocksdb_proto.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ standard header files */ diff --git a/storage/rocksdb/logger.h b/storage/rocksdb/logger.h index ca75caf9df5..b2820127711 100644 --- a/storage/rocksdb/logger.h +++ b/storage/rocksdb/logger.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #include <log.h> diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result index 10a6a02008e..a925c21e188 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rocksdb_range2.result @@ -9,3 +9,20 @@ explain select c1 from t1 where c1 > 5 limit 10; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range i i 9 NULL # Using where; Using index drop table t1; +# +# MDEV-17414: MyROCKS order desc limit 1 fails +# +create table t1 (date date); +insert into t1 values ('2018-10-04'), ('2018-10-05'); +select * from t1 where date < '2018-10-09' order by date desc limit 1; +date +2018-10-05 +alter table t1 add index date_index (date); +select * from t1 where date < '2018-10-05' order by date desc limit 1; +date +2018-10-04 +# this should not produce an empty set: +select * from t1 where date < '2018-10-09' order by date desc limit 1; +date +2018-10-05 +drop table t1; diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_range2.test b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_range2.test index a7ac236451e..28010d13753 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_range2.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rocksdb_range2.test @@ -19,3 +19,15 @@ select count(*) from t1; explain select c1 from t1 where c1 > 5 limit 10; drop table t1; +--echo # +--echo # MDEV-17414: MyROCKS order desc limit 1 fails +--echo # +create table t1 (date date); +insert into t1 values ('2018-10-04'), ('2018-10-05'); +select * from t1 where date < '2018-10-09' order by date desc limit 1; # Works as expected +alter table t1 add index date_index (date); +select * from t1 where date < '2018-10-05' order by date desc limit 1; # Works as expected +--echo # this should not produce an empty set: +select * from t1 where date < '2018-10-09' order by date desc limit 1; +drop table t1; + diff --git a/storage/rocksdb/properties_collector.cc b/storage/rocksdb/properties_collector.cc index 6670e9d69f9..7bae0317bd0 100644 --- a/storage/rocksdb/properties_collector.cc +++ b/storage/rocksdb/properties_collector.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef _WIN32 #define _CRT_RAND_S diff --git a/storage/rocksdb/properties_collector.h b/storage/rocksdb/properties_collector.h index c4a48265a50..36d980d8f53 100644 --- a/storage/rocksdb/properties_collector.h +++ b/storage/rocksdb/properties_collector.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ system header files */ diff --git a/storage/rocksdb/rdb_buff.h b/storage/rocksdb/rdb_buff.h index df6264029fa..532f74090b5 100644 --- a/storage/rocksdb/rdb_buff.h +++ b/storage/rocksdb/rdb_buff.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #include <algorithm> diff --git a/storage/rocksdb/rdb_cf_manager.cc b/storage/rocksdb/rdb_cf_manager.cc index 531243dcd0f..7875a7e919b 100644 --- a/storage/rocksdb/rdb_cf_manager.cc +++ b/storage/rocksdb/rdb_cf_manager.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation diff --git a/storage/rocksdb/rdb_cf_manager.h b/storage/rocksdb/rdb_cf_manager.h index 3f27747dce1..943b6f07c2b 100644 --- a/storage/rocksdb/rdb_cf_manager.h +++ b/storage/rocksdb/rdb_cf_manager.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_cf_options.cc b/storage/rocksdb/rdb_cf_options.cc index 9569e81472b..b71a635d8a2 100644 --- a/storage/rocksdb/rdb_cf_options.cc +++ b/storage/rocksdb/rdb_cf_options.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation diff --git a/storage/rocksdb/rdb_cf_options.h b/storage/rocksdb/rdb_cf_options.h index 19e5da6a79e..349f7c42e32 100644 --- a/storage/rocksdb/rdb_cf_options.h +++ b/storage/rocksdb/rdb_cf_options.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_compact_filter.h b/storage/rocksdb/rdb_compact_filter.h index 20ae3c740c1..ecc78de91bf 100644 --- a/storage/rocksdb/rdb_compact_filter.h +++ b/storage/rocksdb/rdb_compact_filter.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #ifdef USE_PRAGMA_IMPLEMENTATION diff --git a/storage/rocksdb/rdb_comparator.h b/storage/rocksdb/rdb_comparator.h index 963a8615c6b..b43118eda36 100644 --- a/storage/rocksdb/rdb_comparator.h +++ b/storage/rocksdb/rdb_comparator.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ system header files */ diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc index 32b01a698e1..e41a2885ad6 100644 --- a/storage/rocksdb/rdb_datadic.cc +++ b/storage/rocksdb/rdb_datadic.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation diff --git a/storage/rocksdb/rdb_datadic.h b/storage/rocksdb/rdb_datadic.h index 1385709a1c9..27ca5ca980d 100644 --- a/storage/rocksdb/rdb_datadic.h +++ b/storage/rocksdb/rdb_datadic.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ standard header files */ diff --git a/storage/rocksdb/rdb_i_s.cc b/storage/rocksdb/rdb_i_s.cc index 59ae6821214..56c67b5f205 100644 --- a/storage/rocksdb/rdb_i_s.cc +++ b/storage/rocksdb/rdb_i_s.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/rdb_i_s.h b/storage/rocksdb/rdb_i_s.h index f4c4b04a68d..a0783f7b8c0 100644 --- a/storage/rocksdb/rdb_i_s.h +++ b/storage/rocksdb/rdb_i_s.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once namespace myrocks { diff --git a/storage/rocksdb/rdb_index_merge.cc b/storage/rocksdb/rdb_index_merge.cc index ff3bfdc1f95..b6088eb8f4e 100644 --- a/storage/rocksdb/rdb_index_merge.cc +++ b/storage/rocksdb/rdb_index_merge.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/rdb_index_merge.h b/storage/rocksdb/rdb_index_merge.h index 6e53663160a..e70923bbb0e 100644 --- a/storage/rocksdb/rdb_index_merge.h +++ b/storage/rocksdb/rdb_index_merge.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_io_watchdog.cc b/storage/rocksdb/rdb_io_watchdog.cc index f09efefcd2a..5b809dbf553 100644 --- a/storage/rocksdb/rdb_io_watchdog.cc +++ b/storage/rocksdb/rdb_io_watchdog.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ /* This C++ file's header */ #include "./rdb_io_watchdog.h" diff --git a/storage/rocksdb/rdb_io_watchdog.h b/storage/rocksdb/rdb_io_watchdog.h index 8900de5b32a..9c391eee3f3 100644 --- a/storage/rocksdb/rdb_io_watchdog.h +++ b/storage/rocksdb/rdb_io_watchdog.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_mutex_wrapper.cc b/storage/rocksdb/rdb_mutex_wrapper.cc index ae41baf5dc0..9bead8ba660 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.cc +++ b/storage/rocksdb/rdb_mutex_wrapper.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/rdb_mutex_wrapper.h b/storage/rocksdb/rdb_mutex_wrapper.h index 287a6112345..567e81e5ef6 100644 --- a/storage/rocksdb/rdb_mutex_wrapper.h +++ b/storage/rocksdb/rdb_mutex_wrapper.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_perf_context.cc b/storage/rocksdb/rdb_perf_context.cc index bc381b16716..d744ff56d89 100644 --- a/storage/rocksdb/rdb_perf_context.cc +++ b/storage/rocksdb/rdb_perf_context.cc @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/rdb_perf_context.h b/storage/rocksdb/rdb_perf_context.h index 2aca3dc3bfd..036c497c2f5 100644 --- a/storage/rocksdb/rdb_perf_context.h +++ b/storage/rocksdb/rdb_perf_context.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ standard header files */ diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc index e7dd0c67a1f..6201c9f0207 100644 --- a/storage/rocksdb/rdb_sst_info.cc +++ b/storage/rocksdb/rdb_sst_info.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ /* For PRIu64 use below: */ #define __STDC_FORMAT_MACROS diff --git a/storage/rocksdb/rdb_sst_info.h b/storage/rocksdb/rdb_sst_info.h index 42f6458e46b..f50645b1eeb 100644 --- a/storage/rocksdb/rdb_sst_info.h +++ b/storage/rocksdb/rdb_sst_info.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once diff --git a/storage/rocksdb/rdb_threads.cc b/storage/rocksdb/rdb_threads.cc index 1349133876f..53286239c4e 100644 --- a/storage/rocksdb/rdb_threads.cc +++ b/storage/rocksdb/rdb_threads.cc @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #ifdef USE_PRAGMA_IMPLEMENTATION #pragma implementation // gcc: Class implementation diff --git a/storage/rocksdb/rdb_threads.h b/storage/rocksdb/rdb_threads.h index 3c2dd680d41..b3331db1738 100644 --- a/storage/rocksdb/rdb_threads.h +++ b/storage/rocksdb/rdb_threads.h @@ -13,7 +13,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once /* C++ standard header files */ diff --git a/storage/rocksdb/rdb_utils.cc b/storage/rocksdb/rdb_utils.cc index bb6a503c656..7d16e7d899d 100644 --- a/storage/rocksdb/rdb_utils.cc +++ b/storage/rocksdb/rdb_utils.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #include <my_global.h> diff --git a/storage/rocksdb/rdb_utils.h b/storage/rocksdb/rdb_utils.h index 3125941ee78..cdc7651e3c4 100644 --- a/storage/rocksdb/rdb_utils.h +++ b/storage/rocksdb/rdb_utils.h @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ #pragma once #include "rdb_mariadb_port.h" diff --git a/storage/rocksdb/unittest/test_properties_collector.cc b/storage/rocksdb/unittest/test_properties_collector.cc index 46a3badc6ee..6870cd20803 100644 --- a/storage/rocksdb/unittest/test_properties_collector.cc +++ b/storage/rocksdb/unittest/test_properties_collector.cc @@ -12,7 +12,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ /* MyRocks header files */ #include "../ha_rocksdb.h" |