summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
Diffstat (limited to 'storage')
-rw-r--r--storage/columnstore/CMakeLists.txt9
-rw-r--r--storage/connect/bsonudf.cpp3
-rw-r--r--storage/connect/ha_connect.cc52
-rw-r--r--storage/connect/jsonudf.cpp3
-rw-r--r--storage/connect/tabrest.cpp3
-rw-r--r--storage/connect/tabutil.cpp4
-rw-r--r--storage/csv/ha_tina.cc1
-rw-r--r--storage/example/ha_example.cc2
-rw-r--r--storage/federatedx/federatedx_io_mysql.cc8
-rw-r--r--storage/innobase/CMakeLists.txt10
-rw-r--r--storage/innobase/btr/btr0btr.cc4
-rw-r--r--storage/innobase/btr/btr0cur.cc3
-rw-r--r--storage/innobase/buf/buf0buf.cc21
-rw-r--r--storage/innobase/buf/buf0dblwr.cc2
-rw-r--r--storage/innobase/buf/buf0dump.cc7
-rw-r--r--storage/innobase/buf/buf0flu.cc18
-rw-r--r--storage/innobase/buf/buf0rea.cc15
-rw-r--r--storage/innobase/bzip2.cmake36
-rw-r--r--storage/innobase/dict/dict0boot.cc6
-rw-r--r--storage/innobase/dict/dict0crea.cc10
-rw-r--r--storage/innobase/dict/dict0dict.cc14
-rw-r--r--storage/innobase/dict/dict0load.cc42
-rw-r--r--storage/innobase/dict/dict0mem.cc2
-rw-r--r--storage/innobase/dict/dict0stats.cc12
-rw-r--r--storage/innobase/fil/fil0crypt.cc15
-rw-r--r--storage/innobase/fil/fil0fil.cc183
-rw-r--r--storage/innobase/fil/fil0pagecompress.cc62
-rw-r--r--storage/innobase/fsp/fsp0file.cc31
-rw-r--r--storage/innobase/fsp/fsp0fsp.cc5
-rw-r--r--storage/innobase/fsp/fsp0space.cc4
-rw-r--r--storage/innobase/handler/ha_innodb.cc242
-rw-r--r--storage/innobase/handler/handler0alter.cc4
-rw-r--r--storage/innobase/handler/i_s.cc4
-rw-r--r--storage/innobase/ibuf/ibuf0ibuf.cc4
-rw-r--r--storage/innobase/include/buf0buf.h30
-rw-r--r--storage/innobase/include/buf0flu.h2
-rw-r--r--storage/innobase/include/buf0rea.h10
-rw-r--r--storage/innobase/include/buf0types.h6
-rw-r--r--storage/innobase/include/dict0boot.h2
-rw-r--r--storage/innobase/include/dict0dict.h7
-rw-r--r--storage/innobase/include/dict0dict.inl14
-rw-r--r--storage/innobase/include/dict0mem.h14
-rw-r--r--storage/innobase/include/fil0crypt.h6
-rw-r--r--storage/innobase/include/fil0fil.h568
-rw-r--r--storage/innobase/include/fil0pagecompress.h9
-rw-r--r--storage/innobase/include/fsp0file.h33
-rw-r--r--storage/innobase/include/fsp0fsp.h45
-rw-r--r--storage/innobase/include/fsp0space.h52
-rw-r--r--storage/innobase/include/fsp0sysspace.h18
-rw-r--r--storage/innobase/include/fsp0types.h25
-rw-r--r--storage/innobase/include/ibuf0ibuf.h2
-rw-r--r--storage/innobase/include/log0log.inl4
-rw-r--r--storage/innobase/include/log0recv.h4
-rw-r--r--storage/innobase/include/mtr0mtr.h18
-rw-r--r--storage/innobase/include/row0merge.h102
-rw-r--r--storage/innobase/include/srv0srv.h4
-rw-r--r--storage/innobase/include/trx0rec.h2
-rw-r--r--storage/innobase/include/trx0trx.h68
-rw-r--r--storage/innobase/include/trx0types.h2
-rw-r--r--storage/innobase/include/univ.i32
-rw-r--r--storage/innobase/include/ut0pool.h5
-rw-r--r--storage/innobase/log/log0recv.cc326
-rw-r--r--storage/innobase/lz4.cmake38
-rw-r--r--storage/innobase/lzma.cmake35
-rw-r--r--storage/innobase/lzo.cmake34
-rw-r--r--storage/innobase/mtr/mtr0mtr.cc5
-rw-r--r--storage/innobase/os/os0file.cc10
-rw-r--r--storage/innobase/row/row0ftsort.cc9
-rw-r--r--storage/innobase/row/row0import.cc92
-rw-r--r--storage/innobase/row/row0ins.cc36
-rw-r--r--storage/innobase/row/row0merge.cc688
-rw-r--r--storage/innobase/snappy.cmake34
-rw-r--r--storage/innobase/srv/srv0srv.cc13
-rw-r--r--storage/innobase/srv/srv0start.cc46
-rw-r--r--storage/innobase/trx/trx0purge.cc4
-rw-r--r--storage/innobase/trx/trx0rec.cc17
-rw-r--r--storage/innobase/trx/trx0roll.cc1
-rw-r--r--storage/innobase/trx/trx0sys.cc6
-rw-r--r--storage/innobase/trx/trx0trx.cc14
-rw-r--r--storage/innobase/ut/ut0ut.cc2
-rw-r--r--storage/maria/aria_chk.c2
-rw-r--r--storage/maria/ma_bitmap.c17
-rw-r--r--storage/maria/ma_control_file.c2
-rw-r--r--storage/maria/ma_ft_update.c2
-rw-r--r--storage/maria/ma_init.c2
-rw-r--r--storage/maria/ma_loghandler.c23
-rw-r--r--storage/maria/ma_open.c6
-rw-r--r--storage/maria/ma_page.c2
-rw-r--r--storage/maria/ma_sort.c36
-rw-r--r--storage/maria/unittest/ma_maria_log_cleanup.c2
-rw-r--r--storage/mroonga/CMakeLists.txt16
-rw-r--r--storage/mroonga/ha_mroonga.cpp6
-rw-r--r--storage/mroonga/lib/mrn_smart_bitmap.cpp2
-rw-r--r--storage/myisam/ft_update.c3
-rw-r--r--storage/myisam/sort.c37
-rw-r--r--storage/myisammrg/ha_myisammrg.cc2
-rw-r--r--storage/oqgraph/cmake/FindJudy.cmake18
-rw-r--r--storage/rocksdb/CMakeLists.txt8
-rw-r--r--storage/rocksdb/build_rocksdb.cmake38
-rw-r--r--storage/rocksdb/ha_rocksdb.cc35
-rw-r--r--storage/rocksdb/ha_rocksdb.h4
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result2
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result41
-rw-r--r--storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test28
-rw-r--r--storage/rocksdb/rdb_datadic.cc26
-rw-r--r--storage/rocksdb/rdb_i_s.cc41
-rw-r--r--storage/rocksdb/rdb_sst_info.cc2
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/bg/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/bg/r/spider_fixes.result21
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/bg/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/handler/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/handler/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes.result26
-rw-r--r--storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result5
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes.test12
-rw-r--r--storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test3
-rw-r--r--storage/spider/mysql-test/spider/include/init_spider.inc8
-rw-r--r--storage/spider/mysql-test/spider/r/error_row_number.result45
-rw-r--r--storage/spider/mysql-test/spider/r/ha.result20
-rw-r--r--storage/spider/mysql-test/spider/r/ha_part.result25
-rw-r--r--storage/spider/mysql-test/spider/r/spider_fixes.result21
-rw-r--r--storage/spider/mysql-test/spider/r/variable_deprecation.result267
-rw-r--r--storage/spider/mysql-test/spider/t/error_row_number.test37
-rw-r--r--storage/spider/mysql-test/spider/t/spider_fixes.test9
-rw-r--r--storage/spider/mysql-test/spider/t/variable_deprecation.test161
-rw-r--r--storage/spider/spd_db_mysql.cc7
-rw-r--r--storage/spider/spd_init_query.h11
-rw-r--r--storage/spider/spd_param.cc310
-rw-r--r--storage/spider/spd_table.cc93
139 files changed, 3027 insertions, 1925 deletions
diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt
index 6669862f038..ebb138c70f0 100644
--- a/storage/columnstore/CMakeLists.txt
+++ b/storage/columnstore/CMakeLists.txt
@@ -5,6 +5,10 @@ if("NO" STREQUAL "${PLUGIN_COLUMNSTORE}")
endif()
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
+IF(NOT PLUGIN_PERFSCHEMA STREQUAL NO)
+ add_definitions(-DHAVE_PSI_INTERFACE=)
+ENDIF()
+
# this does everything, gets the var from the correct scope, appends new
# values, sets in the correct scope
@@ -13,6 +17,11 @@ macro(APPEND_FOR_CPACK V)
set(${V} "${var}${ARGN}" PARENT_SCOPE)
endmacro()
+# don't use compression providers, there are standalone executables below
+GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR
CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
diff --git a/storage/connect/bsonudf.cpp b/storage/connect/bsonudf.cpp
index 618c0168470..d2ddfc5f489 100644
--- a/storage/connect/bsonudf.cpp
+++ b/storage/connect/bsonudf.cpp
@@ -9,6 +9,7 @@
/*********************************************************************************/
#include <my_global.h>
#include <mysqld.h>
+#include <mysqld_error.h>
#include <mysql.h>
#include <sql_error.h>
#include <stdio.h>
@@ -22,7 +23,7 @@
#define MEMFIX 4096
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 7be82db2e30..6d180ac5441 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -516,7 +516,7 @@ void SetWorkSize(size_t)
{
// Changing the session variable value seems to be impossible here
// and should be done in a check function
- push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Work size too big, try setting a smaller value");
} // end of SetWorkSize
@@ -715,7 +715,7 @@ void PushWarning(PGLOBAL g, THD *thd, int level)
Sql_condition::enum_warning_level wlvl;
wlvl= (Sql_condition::enum_warning_level)level;
- push_warning(thd, wlvl, 0, g->Message);
+ push_warning(thd, wlvl, ER_UNKNOWN_ERROR, g->Message);
} else
htrc("%s\n", g->Message);
@@ -2295,7 +2295,7 @@ int ha_connect::MakeRecord(char *buf)
fp->field_name.str,
thd->get_stmt_da()->current_row_for_warning());
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, buf);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
DBUG_PRINT("MakeRecord", ("%s", buf));
rc= 0;
} else if (rc < 0)
@@ -3598,7 +3598,7 @@ int ha_connect::optimize(THD* thd, HA_CHECK_OPT*)
if ((rc= ((PTDBASE)tdbp)->ResetTableOpt(g, dop, dox))) {
if (rc == RC_INFO) {
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} else
rc= HA_ERR_CRASHED_ON_USAGE; // Table must be repaired
@@ -4823,7 +4823,7 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
if (newmode == MODE_ANY) {
if (CloseTable(g)) {
// Make error a warning to avoid crash
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Close
@@ -4905,18 +4905,18 @@ int ha_connect::external_lock(THD *thd, int lock_type)
&& sqlcom != SQLCOM_BEGIN
&& sqlcom != SQLCOM_DROP_TABLE) {
snprintf(g->Message, sizeof(g->Message), "external_lock: unexpected command %d", sqlcom);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (g->Xchk) {
if (!tdbp) {
if (!(tdbp= GetTDB(g))) {
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (!tdbp->GetDef()->Indexable()) {
snprintf(g->Message, sizeof(g->Message), "external_lock: Table %s is not indexable", tdbp->GetName());
// DBUG_RETURN(HA_ERR_INTERNAL_ERROR); causes assert error
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
DBUG_RETURN(0);
} else if (tdbp->GetDef()->Indexable() == 1) {
bool oldsep= ((PCHK)g->Xchk)->oldsep;
@@ -4995,7 +4995,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (tdp->MakeIndex(g, adp, true) == RC_FX) {
// Make it a warning to avoid crash
//push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- // 0, g->Message);
+ // ER_UNKNOWN_ERROR, g->Message);
//rc= 0;
my_message(ER_TOO_MANY_KEYS, g->Message, MYF(0));
rc= HA_ERR_INDEX_CORRUPT;
@@ -5005,7 +5005,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (CheckVirtualIndex(NULL)) {
// Make it a warning to avoid crash
push_warning(thd, Sql_condition::WARN_LEVEL_WARN,
- 0, g->Message);
+ ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Check
@@ -5018,7 +5018,7 @@ int ha_connect::external_lock(THD *thd, int lock_type)
if (CloseTable(g)) {
// This is an error while builing index
// Make it a warning to avoid crash
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
rc= 0;
} // endif Close
@@ -5729,7 +5729,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
topt->type= (src) ? "MYSQL" : (tab) ? "PROXY" : "DOS";
ttp= GetTypeID(topt->type);
snprintf(g->Message, sizeof(g->Message), "No table_type. Was set to %s", topt->type);
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} else if (ttp == TAB_NIY) {
snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", topt->type);
rc= HA_ERR_INTERNAL_ERROR;
@@ -5739,7 +5739,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
if (ttp == TAB_UNDEF) {
ttr= TAB_JSON;
strcpy(g->Message, "No table_type. Was set to JSON");
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} else
ttr= ttp;
@@ -6302,7 +6302,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)",
cnm, typ);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} else {
snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ);
@@ -6317,7 +6317,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
case TYPE_STRING:
if (w) {
snprintf(g->Message, sizeof(g->Message), "Column %s is wide characters", cnm);
- push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, g->Message);
} // endif w
break;
@@ -6344,7 +6344,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd,
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type %d)",
cnm, typ);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} else {
snprintf(g->Message, sizeof(g->Message), "Unsupported SQL type %d", typ);
@@ -6509,7 +6509,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
snprintf(g->Message, sizeof(g->Message), "No table_type. Will be set to %s", options->type);
if (sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (type == TAB_NIY) {
snprintf(g->Message, sizeof(g->Message), "Unsupported table type %s", options->type);
@@ -6558,7 +6558,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
case TAB_OCCUR:
if (options->srcdef) {
strcpy(g->Message, "Cannot check looping reference");
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (options->tabname) {
if (!stricmp(options->tabname, create_info->alias.str) &&
(!options->dbname ||
@@ -6854,7 +6854,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
snprintf(g->Message, sizeof(g->Message), "No file name. Table will use %s", buf);
if (sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/");
} // endif part_info
@@ -6867,12 +6867,12 @@ int ha_connect::create(const char *name, TABLE *table_arg,
else
snprintf(g->Message, sizeof(g->Message), "Error %d creating file %s", errno, fn);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else
::close(h);
if ((type == TAB_FMT || options->readonly) && sqlcom == SQLCOM_CREATE_TABLE)
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Congratulation, you just created a read-only void table!");
} // endif sqlcom
@@ -6918,7 +6918,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
sqlcom == SQLCOM_CREATE_INDEX || sqlcom == SQLCOM_DROP_INDEX))
// (sqlcom == SQLCOM_CREATE_INDEX && part_info) ||
// (sqlcom == SQLCOM_DROP_INDEX && part_info)))
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Unexpected command in create, please contact CONNECT team");
if (part_info && !inward)
@@ -6929,7 +6929,7 @@ int ha_connect::create(const char *name, TABLE *table_arg,
(!IsFileType(type) || FileExists(options->filename, false))) {
if (part_info) {
snprintf(g->Message, sizeof(g->Message), "Data repartition in %s is unchecked", partname);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} else if (sqlcom == SQLCOM_ALTER_TABLE) {
// This is an ALTER to CONNECT from another engine.
// It cannot be accepted because the table data would be modified
@@ -7042,7 +7042,7 @@ bool ha_connect::FileExists(const char *fn, bool bf)
char buf[_MAX_PATH + 20];
snprintf(buf, sizeof(buf), "Error %d for file %s", errno, filename);
- push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, 0, buf);
+ push_warning(table->in_use, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, buf);
return true;
} else
return false;
@@ -7345,7 +7345,7 @@ fin:
DBUG_RETURN(HA_ALTER_ERROR);
} else if (outward) {
if (IsFileType(type))
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"This is an outward table, table data were not modified.");
DBUG_RETURN(HA_ALTER_INPLACE_EXCLUSIVE_LOCK);
@@ -7371,7 +7371,7 @@ bool ha_connect::check_if_incompatible_data(HA_CREATE_INFO *, uint)
{
DBUG_ENTER("ha_connect::check_if_incompatible_data");
// TO DO: really implement and check it.
- push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, 0,
+ push_warning(ha_thd(), Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR,
"Unexpected call to check_if_incompatible_data.");
DBUG_RETURN(COMPATIBLE_DATA_NO);
} // end of check_if_incompatible_data
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index b09838beb97..6f5b0883fe1 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -9,6 +9,7 @@
/*********************************************************************************/
#include <my_global.h>
#include <mysqld.h>
+#include <mysqld_error.h>
#include <mysql.h>
#include <sql_error.h>
#include <m_string.h>
@@ -21,7 +22,7 @@
#define MEMFIX 4096
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/tabrest.cpp b/storage/connect/tabrest.cpp
index c535c21f9da..b38168622e9 100644
--- a/storage/connect/tabrest.cpp
+++ b/storage/connect/tabrest.cpp
@@ -12,6 +12,7 @@
/***********************************************************************/
#include <my_global.h> // All MariaDB stuff
#include <mysqld.h>
+#include <mysqld_error.h>
#include <sql_error.h>
#if !defined(_WIN32) && !defined(_WINDOWS)
#include <sys/types.h>
@@ -37,7 +38,7 @@
#include "tabrest.h"
#if defined(connect_EXPORTS)
-#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, 0, M)
+#define PUSH_WARNING(M) push_warning(current_thd, Sql_condition::WARN_LEVEL_NOTE, ER_UNKNOWN_ERROR, M)
#else
#define PUSH_WARNING(M) htrc(M)
#endif
diff --git a/storage/connect/tabutil.cpp b/storage/connect/tabutil.cpp
index 02908927397..b2ec19ebfd5 100644
--- a/storage/connect/tabutil.cpp
+++ b/storage/connect/tabutil.cpp
@@ -205,7 +205,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
if (v == 'K') {
// Skip this column
snprintf(g->Message, sizeof(g->Message), "Column %s skipped (unsupported type)", colname);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
continue;
} // endif v
@@ -218,7 +218,7 @@ PQRYRES TabColumns(PGLOBAL g, THD *thd, const char *db,
len = zconv;
snprintf(g->Message, sizeof(g->Message), "Column %s converted to varchar(%d)",
colname, len);
- push_warning(thd, Sql_condition::WARN_LEVEL_WARN, 0, g->Message);
+ push_warning(thd, Sql_condition::WARN_LEVEL_WARN, ER_UNKNOWN_ERROR, g->Message);
} // endif v
crp = crp->Next; // Data_Type
diff --git a/storage/csv/ha_tina.cc b/storage/csv/ha_tina.cc
index ec569feec9d..e705ff0e7c0 100644
--- a/storage/csv/ha_tina.cc
+++ b/storage/csv/ha_tina.cc
@@ -1559,6 +1559,7 @@ int ha_tina::repair(THD* thd, HA_CHECK_OPT* check_opt)
current_position= next_position= 0;
/* Read the file row-by-row. If everything is ok, repair is not needed. */
+ thd_inc_error_row(thd);
while (!(rc= find_current_row(buf)))
{
thd_inc_error_row(thd);
diff --git a/storage/example/ha_example.cc b/storage/example/ha_example.cc
index 8f2015070be..c66c33a7818 100644
--- a/storage/example/ha_example.cc
+++ b/storage/example/ha_example.cc
@@ -98,7 +98,7 @@
#pragma implementation // gcc: Class implementation
#endif
-#include <my_config.h>
+#include <my_global.h>
#include <mysql/plugin.h>
#include "ha_example.h"
#include "sql_class.h"
diff --git a/storage/federatedx/federatedx_io_mysql.cc b/storage/federatedx/federatedx_io_mysql.cc
index 5cb8b7efa5b..fc32146b5cd 100644
--- a/storage/federatedx/federatedx_io_mysql.cc
+++ b/storage/federatedx/federatedx_io_mysql.cc
@@ -212,7 +212,7 @@ ulong federatedx_io_mysql::last_savepoint() const
ulong federatedx_io_mysql::actual_savepoint() const
{
SAVEPT *savept= NULL;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::last_savepoint");
while (index)
@@ -286,7 +286,7 @@ ulong federatedx_io_mysql::savepoint_release(ulong sp)
ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
{
SAVEPT *savept;
- uint index;
+ size_t index;
DBUG_ENTER("federatedx_io_mysql::savepoint_release");
DBUG_PRINT("info",("savepoint=%lu", sp));
@@ -321,7 +321,7 @@ ulong federatedx_io_mysql::savepoint_rollback(ulong sp)
void federatedx_io_mysql::savepoint_restrict(ulong sp)
{
SAVEPT *savept;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::savepoint_restrict");
while (index)
@@ -361,7 +361,7 @@ bool federatedx_io_mysql::test_all_restrict() const
{
bool result= FALSE;
SAVEPT *savept;
- uint index= savepoints.elements;
+ size_t index= savepoints.elements;
DBUG_ENTER("federatedx_io_mysql::test_all_restrict");
while (index)
diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt
index d655cf81231..276c22234d6 100644
--- a/storage/innobase/CMakeLists.txt
+++ b/storage/innobase/CMakeLists.txt
@@ -20,19 +20,9 @@
INCLUDE(CheckFunctionExists)
INCLUDE(CheckCSourceCompiles)
INCLUDE(CheckCSourceRuns)
-INCLUDE(lz4.cmake)
-INCLUDE(lzo.cmake)
-INCLUDE(lzma.cmake)
-INCLUDE(bzip2.cmake)
-INCLUDE(snappy.cmake)
INCLUDE(numa)
INCLUDE(TestBigEndian)
-MYSQL_CHECK_LZ4()
-MYSQL_CHECK_LZO()
-MYSQL_CHECK_LZMA()
-MYSQL_CHECK_BZIP2()
-MYSQL_CHECK_SNAPPY()
MYSQL_CHECK_NUMA()
INCLUDE(${MYSQL_CMAKE_SCRIPT_DIR}/compile_flags.cmake)
diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
index 24de98f8590..3c2e97666cb 100644
--- a/storage/innobase/btr/btr0btr.cc
+++ b/storage/innobase/btr/btr0btr.cc
@@ -379,8 +379,8 @@ btr_root_adjust_on_import(
} else {
/* Check that the table flags and the tablespace
flags match. */
- ulint tf = dict_tf_to_fsp_flags(table->flags);
- ulint sf = table->space->flags;
+ uint32_t tf = dict_tf_to_fsp_flags(table->flags);
+ uint32_t sf = table->space->flags;
sf &= ~FSP_FLAGS_MEM_MASK;
tf &= ~FSP_FLAGS_MEM_MASK;
if (fil_space_t::is_flags_equal(tf, sf)
diff --git a/storage/innobase/btr/btr0cur.cc b/storage/innobase/btr/btr0cur.cc
index c6f11aa518f..ba28ba6d33f 100644
--- a/storage/innobase/btr/btr0cur.cc
+++ b/storage/innobase/btr/btr0cur.cc
@@ -6724,7 +6724,6 @@ btr_store_big_rec_extern_fields(
byte* field_ref;
ulint extern_len;
ulint store_len;
- ulint space_id;
ulint i;
mtr_t mtr;
mem_heap_t* heap = NULL;
@@ -6753,7 +6752,6 @@ btr_store_big_rec_extern_fields(
btr_blob_log_check_t redo_log(pcur, btr_mtr, offsets, &rec_block,
&rec, op);
page_zip = buf_block_get_page_zip(rec_block);
- space_id = rec_block->page.id().space();
if (page_zip) {
int err;
@@ -6877,6 +6875,7 @@ alloc_fail:
goto alloc_fail;
}
+ const uint32_t space_id = block->page.id().space();
const uint32_t page_no = block->page.id().page_no();
if (prev_page_no == FIL_NULL) {
diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc
index 81db2147fbb..c6b14d2fc67 100644
--- a/storage/innobase/buf/buf0buf.cc
+++ b/storage/innobase/buf/buf0buf.cc
@@ -563,15 +563,12 @@ bool buf_is_zeroes(span<const byte> buf)
}
/** Check if a page is corrupt.
-@param[in] check_lsn whether the LSN should be checked
-@param[in] read_buf database page
-@param[in] fsp_flags tablespace flags
+@param check_lsn whether FIL_PAGE_LSN should be checked
+@param read_buf database page
+@param fsp_flags contents of FIL_SPACE_FLAGS
@return whether the page is corrupted */
-bool
-buf_page_is_corrupted(
- bool check_lsn,
- const byte* read_buf,
- ulint fsp_flags)
+bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
+ uint32_t fsp_flags)
{
if (fil_space_t::full_crc32(fsp_flags)) {
bool compressed = false, corrupted = false;
@@ -4142,10 +4139,10 @@ buf_print_io(
/** Verify that post encryption checksum match with the calculated checksum.
This function should be called only if tablespace contains crypt data metadata.
-@param[in] page page frame
-@param[in] fsp_flags tablespace flags
-@return true if true if page is encrypted and OK, false otherwise */
-bool buf_page_verify_crypt_checksum(const byte* page, ulint fsp_flags)
+@param page page frame
+@param fsp_flags contents of FSP_SPACE_FLAGS
+@return whether the page is encrypted and valid */
+bool buf_page_verify_crypt_checksum(const byte *page, uint32_t fsp_flags)
{
if (!fil_space_t::full_crc32(fsp_flags)) {
return fil_space_verify_crypt_checksum(
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index c71fd8df068..88e5823e78b 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -363,7 +363,7 @@ void buf_dblwr_t::recover()
if (recv_sys.parse_start_lsn > lsn)
/* Pages written before the checkpoint are not useful for recovery. */
continue;
- const ulint space_id= page_get_space_id(page);
+ const uint32_t space_id= page_get_space_id(page);
const page_id_t page_id(space_id, page_no);
if (recv_sys.scanned_lsn < lsn)
diff --git a/storage/innobase/buf/buf0dump.cc b/storage/innobase/buf/buf0dump.cc
index 05b18de1d5b..93298bc75b7 100644
--- a/storage/innobase/buf/buf0dump.cc
+++ b/storage/innobase/buf/buf0dump.cc
@@ -562,7 +562,7 @@ buf_load()
/* Avoid calling the expensive fil_space_t::get() for each
page within the same tablespace. dump[] is sorted by (space, page),
so all pages from a given tablespace are consecutive. */
- ulint cur_space_id = dump[0].space();
+ uint32_t cur_space_id = dump[0].space();
fil_space_t* space = fil_space_t::get(cur_space_id);
ulint zip_size = space ? space->zip_size() : 0;
@@ -574,10 +574,9 @@ buf_load()
for (i = 0; i < dump_n && !SHUTTING_DOWN(); i++) {
/* space_id for this iteration of the loop */
- const ulint this_space_id = dump[i].space();
+ const uint32_t this_space_id = dump[i].space();
- if (this_space_id == SRV_TMP_SPACE_ID) {
- /* Ignore the innodb_temporary tablespace. */
+ if (this_space_id >= SRV_SPACE_ID_UPPER_BOUND) {
continue;
}
diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc
index cca921a9275..d6c1be59a86 100644
--- a/storage/innobase/buf/buf0flu.cc
+++ b/storage/innobase/buf/buf0flu.cc
@@ -40,11 +40,8 @@ Created 11/11/1995 Heikki Tuuri
#include "log0crypt.h"
#include "srv0mon.h"
#include "fil0pagecompress.h"
-#ifdef HAVE_LZO
-# include "lzo/lzo1x.h"
-#elif defined HAVE_SNAPPY
-# include "snappy-c.h"
-#endif
+#include "lzo/lzo1x.h"
+#include "snappy-c.h"
/** Number of pages flushed via LRU. Protected by buf_pool.mutex.
Also included in buf_flush_page_count. */
@@ -215,7 +212,7 @@ deleting the data file of that tablespace.
The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
@param id tablespace identifier */
-void buf_flush_remove_pages(ulint id)
+void buf_flush_remove_pages(uint32_t id)
{
const page_id_t first(id, 0), end(id + 1, 0);
ut_ad(id);
@@ -575,11 +572,10 @@ static void buf_tmp_reserve_compression_buf(buf_tmp_buffer_t* slot)
/* Both Snappy and LZO compression methods require that the output
buffer be bigger than input buffer. Adjust the allocated size. */
ulint size= srv_page_size;
-#ifdef HAVE_LZO
- size= size + LZO1X_1_15_MEM_COMPRESS;
-#elif defined HAVE_SNAPPY
- size= snappy_max_compressed_length(size);
-#endif
+ if (provider_service_lzo->is_loaded)
+ size= LZO1X_1_15_MEM_COMPRESS;
+ else if (provider_service_snappy->is_loaded)
+ size= snappy_max_compressed_length(size);
slot->comp_buf= static_cast<byte*>(aligned_malloc(size, srv_page_size));
}
diff --git a/storage/innobase/buf/buf0rea.cc b/storage/innobase/buf/buf0rea.cc
index 2f15fa62796..4a2ac88d97c 100644
--- a/storage/innobase/buf/buf0rea.cc
+++ b/storage/innobase/buf/buf0rea.cc
@@ -663,11 +663,9 @@ inline bool fil_space_t::is_freed(uint32_t page)
}
/** Issues read requests for pages which recovery wants to read in.
-@param[in] space_id tablespace id
-@param[in] page_nos array of page numbers to read, with the
-highest page number the last in the array
-@param[in] n number of page numbers in the array */
-void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
+@param space_id tablespace identifier
+@param page_nos page numbers to read, in ascending order */
+void buf_read_recv_pages(uint32_t space_id, st_::span<uint32_t> page_nos)
{
fil_space_t* space = fil_space_t::get(space_id);
@@ -678,7 +676,7 @@ void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
const ulint zip_size = space->zip_size();
- for (ulint i = 0; i < n; i++) {
+ for (ulint i = 0; i < page_nos.size(); i++) {
/* Ignore if the page already present in freed ranges. */
if (space->is_freed(page_nos[i])) {
@@ -720,7 +718,8 @@ void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
}
}
- DBUG_PRINT("ib_buf", ("recovery read (%u pages) for %s", n,
- space->chain.start->name));
+
+ DBUG_PRINT("ib_buf", ("recovery read (%zu pages) for %s",
+ page_nos.size(), space->chain.start->name));
space->release();
}
diff --git a/storage/innobase/bzip2.cmake b/storage/innobase/bzip2.cmake
deleted file mode 100644
index 91dd2bf0fcd..00000000000
--- a/storage/innobase/bzip2.cmake
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. 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 the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_BZIP2 AUTO CACHE STRING
- "Build with bzip2. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_BZIP2)
- IF (WITH_INNODB_BZIP2 STREQUAL "ON" OR WITH_INNODB_BZIP2 STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB2_H)
- CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffCompress "" HAVE_BZLIB2_COMPRESS)
- CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffDecompress "" HAVE_BZLIB2_DECOMPRESS)
-
- IF (HAVE_BZLIB2_COMPRESS AND HAVE_BZLIB2_DECOMPRESS AND HAVE_BZLIB2_H)
- SET(HAVE_INNODB_BZLIB2 TRUE)
- ADD_DEFINITIONS(-DHAVE_BZIP2=1)
- LINK_LIBRARIES(bz2)
- ELSE()
- IF (WITH_INNODB_BZIP2 STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required bzip2 library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_BZIP2 HAVE_INNODB_BZLIB2
- "BZIP2 compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/dict/dict0boot.cc b/storage/innobase/dict/dict0boot.cc
index e57121041d5..5516bce920b 100644
--- a/storage/innobase/dict/dict0boot.cc
+++ b/storage/innobase/dict/dict0boot.cc
@@ -54,7 +54,7 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id) /*!< out: space id
+ uint32_t* space_id) /*!< out: space id
(not assigned if NULL) */
{
ib_id_t id;
@@ -257,8 +257,8 @@ dberr_t dict_boot()
header. */
dict_sys.recover_row_id(mach_read_from_8(dict_hdr + DICT_HDR_ROW_ID));
- if (ulint max_space_id = mach_read_from_4(dict_hdr
- + DICT_HDR_MAX_SPACE_ID)) {
+ if (uint32_t max_space_id
+ = mach_read_from_4(dict_hdr + DICT_HDR_MAX_SPACE_ID)) {
max_space_id--;
fil_assign_new_space_id(&max_space_id);
}
diff --git a/storage/innobase/dict/dict0crea.cc b/storage/innobase/dict/dict0crea.cc
index daf3bc9a664..5cf1f3521b1 100644
--- a/storage/innobase/dict/dict0crea.cc
+++ b/storage/innobase/dict/dict0crea.cc
@@ -348,8 +348,8 @@ dict_build_table_def_step(
dict_table_t* table = node->table;
ut_ad(!table->is_temporary());
ut_ad(!table->space);
- ut_ad(table->space_id == ULINT_UNDEFINED);
- dict_hdr_get_new_id(&table->id, NULL, NULL);
+ ut_ad(table->space_id == UINT32_MAX);
+ dict_hdr_get_new_id(&table->id, nullptr, nullptr);
/* Always set this bit for all new created tables */
DICT_TF2_FLAG_SET(table, DICT_TF2_FTS_AUX_HEX_NAME);
@@ -367,10 +367,10 @@ dict_build_table_def_step(
DBUG_EXECUTE_IF(
"ib_create_table_fail_out_of_space_ids",
- table->space_id = ULINT_UNDEFINED;
+ table->space_id = UINT32_MAX;
);
- if (table->space_id == ULINT_UNDEFINED) {
+ if (table->space_id == UINT32_MAX) {
return DB_ERROR;
}
} else {
@@ -1099,8 +1099,6 @@ dict_create_table_step(
}
if (node->state == TABLE_ADD_TO_CACHE) {
- DBUG_EXECUTE_IF("ib_ddl_crash_during_create", DBUG_SUICIDE(););
-
node->table->can_be_evicted = !node->table->fts;
node->table->add_to_cache();
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 21efb525fa8..e2fb4653852 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -1079,8 +1079,18 @@ dict_table_open_on_name(
if (!(ignore_err & ~DICT_ERR_IGNORE_FK_NOKEY) &&
!table->is_readable() && table->corrupted)
{
- ib::error() << "Table " << table->name
- << " is corrupted. Please drop the table and recreate.";
+ ulint algo = table->space->get_compression_algo();
+ if (algo <= PAGE_ALGORITHM_LAST && !fil_comp_algo_loaded(algo)) {
+ my_printf_error(ER_PROVIDER_NOT_LOADED,
+ "Table %s is compressed with %s, which is not currently loaded. "
+ "Please load the %s provider plugin to open the table",
+ MYF(ME_ERROR_LOG), table->name,
+ page_compression_algorithms[algo], page_compression_algorithms[algo]);
+ } else {
+ my_printf_error(ER_TABLE_CORRUPT,
+ "Table %s is corrupted. Please drop the table and recreate.",
+ MYF(ME_ERROR_LOG), table->name);
+ }
dict_sys.unfreeze();
DBUG_RETURN(nullptr);
}
diff --git a/storage/innobase/dict/dict0load.cc b/storage/innobase/dict/dict0load.cc
index 004b00615e8..010242c8872 100644
--- a/storage/innobase/dict/dict0load.cc
+++ b/storage/innobase/dict/dict0load.cc
@@ -613,11 +613,10 @@ dict_sys_tables_type_valid(ulint type, bool not_redundant)
@param[in] not_redundant whether ROW_FORMAT=REDUNDANT is not used
@return table flags */
static
-ulint
-dict_sys_tables_type_to_tf(ulint type, bool not_redundant)
+uint32_t dict_sys_tables_type_to_tf(uint32_t type, bool not_redundant)
{
ut_ad(dict_sys_tables_type_valid(type, not_redundant));
- ulint flags = not_redundant ? 1 : 0;
+ uint32_t flags = not_redundant ? 1 : 0;
/* ZIP_SSIZE, ATOMIC_BLOBS, DATA_DIR, PAGE_COMPRESSION,
PAGE_COMPRESSION_LEVEL are the same. */
@@ -655,15 +654,14 @@ dict_sys_tables_rec_read(
bool uncommitted,
mtr_t* mtr,
table_id_t* table_id,
- ulint* space_id,
- ulint* n_cols,
- ulint* flags,
- ulint* flags2,
+ uint32_t* space_id,
+ uint32_t* n_cols,
+ uint32_t* flags,
+ uint32_t* flags2,
trx_id_t* trx_id)
{
const byte* field;
ulint len;
- ulint type;
mem_heap_t* heap = nullptr;
field = rec_get_nth_field_old(
@@ -721,7 +719,7 @@ dict_sys_tables_rec_read(
field = rec_get_nth_field_old(
rec, DICT_FLD__SYS_TABLES__TYPE, &len);
ut_a(len == 4);
- type = mach_read_from_4(field);
+ uint32_t type = mach_read_from_4(field);
/* Handle MDEV-12873 InnoDB SYS_TABLES.TYPE incompatibility
for PAGE_COMPRESSED=YES in MariaDB 10.2.2 to 10.2.6.
@@ -812,8 +810,8 @@ dict_sys_tables_rec_read(
if (!dict_sys_tables_type_valid(type, not_redundant)) {
sql_print_error("InnoDB: Table %.*s in InnoDB"
" data dictionary contains invalid flags."
- " SYS_TABLES.TYPE=" ULINTPF
- " SYS_TABLES.N_COLS=" ULINTPF,
+ " SYS_TABLES.TYPE=" UINT32PF
+ " SYS_TABLES.N_COLS=" UINT32PF,
int(rec_get_field_start_offs(rec, 1)), rec,
type, *n_cols);
err_exit:
@@ -843,8 +841,8 @@ err_exit:
sql_print_error("InnoDB: Table %.*s in InnoDB"
" data dictionary"
" contains invalid flags."
- " SYS_TABLES.TYPE=" ULINTPF
- " SYS_TABLES.MIX_LEN=" ULINTPF,
+ " SYS_TABLES.TYPE=" UINT32PF
+ " SYS_TABLES.MIX_LEN=" UINT32PF,
int(rec_get_field_start_offs(rec, 1)),
rec,
type, *flags2);
@@ -880,7 +878,7 @@ was needed and force_recovery is not set.
We also scan the biggest space id, and store it to fil_system. */
void dict_check_tablespaces_and_store_max_id()
{
- ulint max_space_id = 0;
+ uint32_t max_space_id = 0;
btr_pcur_t pcur;
mtr_t mtr;
@@ -895,10 +893,10 @@ void dict_check_tablespaces_and_store_max_id()
rec; rec = dict_getnext_system_low(&pcur, &mtr)) {
ulint len;
table_id_t table_id;
- ulint space_id;
- ulint n_cols;
- ulint flags;
- ulint flags2;
+ uint32_t space_id;
+ uint32_t n_cols;
+ uint32_t flags;
+ uint32_t flags2;
/* If a table record is not useable, ignore it and continue
on to the next record. Error messages were logged. */
@@ -2165,13 +2163,9 @@ const char *dict_load_table_low(mtr_t *mtr, bool uncommitted,
const rec_t *rec, dict_table_t **table)
{
table_id_t table_id;
- ulint space_id;
- ulint n_cols;
- ulint t_num;
- ulint flags;
- ulint flags2;
+ uint32_t space_id, t_num, flags, flags2;
+ ulint n_cols, n_v_col;
trx_id_t trx_id;
- ulint n_v_col;
if (const char* error_text = dict_sys_tables_rec_check(rec)) {
*table = NULL;
diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc
index 54eaa87a850..0da0c5acf0f 100644
--- a/storage/innobase/dict/dict0mem.cc
+++ b/storage/innobase/dict/dict0mem.cc
@@ -162,7 +162,7 @@ dict_table_t *dict_table_t::create(const span<const char> &name,
table->mdl_name.m_name= table->name.m_name;
table->is_system_db= dict_mem_table_is_system(table->name.m_name);
table->space= space;
- table->space_id= space ? space->id : ULINT_UNDEFINED;
+ table->space_id= space ? space->id : UINT32_MAX;
table->n_t_cols= static_cast<unsigned>(n_cols + DATA_N_SYS_COLS) &
dict_index_t::MAX_N_FIELDS;
table->n_v_cols= static_cast<unsigned>(n_v_cols) &
diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc
index dcd604cfb74..5f2d8f27377 100644
--- a/storage/innobase/dict/dict0stats.cc
+++ b/storage/innobase/dict/dict0stats.cc
@@ -3374,6 +3374,11 @@ unlocked_free_and_exit:
}
}
+ ret= trx->bulk_insert_apply();
+ if (ret != DB_SUCCESS) {
+ goto rollback_and_exit;
+ }
+
trx->commit();
goto free_and_exit;
}
@@ -3975,6 +3980,13 @@ dict_stats_update(
return(DB_SUCCESS);
}
+ if (trx_id_t bulk_trx_id = table->bulk_trx_id) {
+ if (trx_sys.find(nullptr, bulk_trx_id, false)) {
+ dict_stats_empty_table(table, false);
+ return DB_SUCCESS_LOCKED_REC;
+ }
+ }
+
switch (stats_upd_option) {
case DICT_STATS_RECALC_PERSISTENT:
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index 7410986c441..b1c4c217c3d 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -744,20 +744,20 @@ static dberr_t fil_space_decrypt_for_non_full_checksum(
/** Decrypt a page.
@param[in] space_id tablespace id
+@param[in] fsp_flags Tablespace flags
@param[in] crypt_data crypt_data
@param[in] tmp_frame Temporary buffer
@param[in] physical_size page size
-@param[in] fsp_flags Tablespace flags
@param[in,out] src_frame Page to decrypt
@retval DB_SUCCESS on success
@retval DB_DECRYPTION_FAILED on error */
dberr_t
fil_space_decrypt(
- ulint space_id,
+ uint32_t space_id,
+ uint32_t fsp_flags,
fil_space_crypt_t* crypt_data,
byte* tmp_frame,
ulint physical_size,
- ulint fsp_flags,
byte* src_frame)
{
if (!crypt_data || !crypt_data->is_encrypted()) {
@@ -792,9 +792,10 @@ fil_space_decrypt(
ut_ad(space->referenced());
- if (DB_SUCCESS != fil_space_decrypt(space->id, space->crypt_data,
+ if (DB_SUCCESS != fil_space_decrypt(space->id, space->flags,
+ space->crypt_data,
tmp_frame, physical_size,
- space->flags, src_frame)) {
+ src_frame)) {
return nullptr;
}
@@ -1365,7 +1366,7 @@ inline fil_space_t *fil_system_t::default_encrypt_next(fil_space_t *space,
mysql_mutex_assert_owner(&mutex);
auto it= space && space->is_in_default_encrypt
- ? sized_ilist<fil_space_t, rotation_list_tag_t>::iterator(space)
+ ? sized_ilist<fil_space_t, default_encrypt_tag_t>::iterator(space)
: default_encrypt_tables.begin();
const auto end= default_encrypt_tables.end();
@@ -1854,7 +1855,7 @@ fil_crypt_rotate_pages(
const key_state_t* key_state,
rotate_thread_t* state)
{
- ulint space_id = state->space->id;
+ const uint32_t space_id = state->space->id;
uint32_t end = std::min(state->offset + uint32_t(state->batch),
state->space->free_limit);
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 89af4e2420f..66b21f6ecbd 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -54,21 +54,18 @@ Created 10/25/1995 Heikki Tuuri
# include <dirent.h>
#endif
+#include "lz4.h"
+#include "lzo/lzo1x.h"
+#include "lzma.h"
+#include "bzlib.h"
+#include "snappy-c.h"
+
ATTRIBUTE_COLD void fil_space_t::set_corrupted() const
{
if (!is_stopping() && !is_corrupted.test_and_set())
sql_print_error("InnoDB: File '%s' is corrupted", chain.start->name);
}
-/** Determine if the space id is a user tablespace id or not.
-@param space_id tablespace identifier
-@return true if it is a user tablespace ID */
-inline bool fil_is_user_tablespace_id(ulint space_id)
-{
- return space_id != TRX_SYS_SPACE && space_id != SRV_TMP_SPACE_ID &&
- !srv_is_undo_tablespace(space_id);
-}
-
/** Try to close a file to adhere to the innodb_open_files limit.
@param print_info whether to diagnose why a file cannot be closed
@return whether a file was closed */
@@ -83,7 +80,7 @@ bool fil_space_t::try_to_close(bool print_info)
case FIL_TYPE_IMPORT:
break;
case FIL_TYPE_TABLESPACE:
- if (!fil_is_user_tablespace_id(space.id))
+ if (is_predefined_tablespace(space.id))
continue;
}
@@ -214,14 +211,11 @@ fil_validate_skip(void)
}
#endif /* UNIV_DEBUG */
-/*******************************************************************//**
-Returns the table space by a given id, NULL if not found.
-It is unsafe to dereference the returned pointer. It is fine to check
-for NULL. */
-fil_space_t*
-fil_space_get_by_id(
-/*================*/
- ulint id) /*!< in: space id */
+/** Look up a tablespace.
+@param tablespace identifier
+@return tablespace
+@retval nullptr if not found */
+fil_space_t *fil_space_get_by_id(uint32_t id)
{
fil_space_t* space;
@@ -242,48 +236,38 @@ or the caller should be in single-threaded crash recovery mode
Normally, fil_space_t::get() should be used instead.
@param[in] id tablespace ID
@return tablespace, or NULL if not found */
-fil_space_t*
-fil_space_get(
- ulint id)
+fil_space_t *fil_space_get(uint32_t id)
{
- mysql_mutex_lock(&fil_system.mutex);
- fil_space_t* space = fil_space_get_by_id(id);
- mysql_mutex_unlock(&fil_system.mutex);
- return(space);
+ mysql_mutex_lock(&fil_system.mutex);
+ fil_space_t *space= fil_space_get_by_id(id);
+ mysql_mutex_unlock(&fil_system.mutex);
+ return space;
}
-/** Validate the compression algorithm for full crc32 format.
-@param[in] space tablespace object
-@return whether the compression algorithm support */
-static bool fil_comp_algo_validate(const fil_space_t* space)
+/** Check if the compression algorithm is loaded
+@param[in] comp_algo ulint compression algorithm
+@return whether the compression algorithm is loaded */
+bool fil_comp_algo_loaded(ulint comp_algo)
{
- if (!space->full_crc32()) {
- return true;
- }
-
- DBUG_EXECUTE_IF("fil_comp_algo_validate_fail",
- return false;);
-
- ulint comp_algo = space->get_compression_algo();
switch (comp_algo) {
case PAGE_UNCOMPRESSED:
case PAGE_ZLIB_ALGORITHM:
-#ifdef HAVE_LZ4
+ return true;
+
case PAGE_LZ4_ALGORITHM:
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+ return provider_service_lz4->is_loaded;
+
case PAGE_LZO_ALGORITHM:
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+ return provider_service_lzo->is_loaded;
+
case PAGE_LZMA_ALGORITHM:
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
+ return provider_service_lzma->is_loaded;
+
case PAGE_BZIP2_ALGORITHM:
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
+ return provider_service_bzip2->is_loaded;
+
case PAGE_SNAPPY_ALGORITHM:
-#endif /* HAVE_SNAPPY */
- return true;
+ return provider_service_snappy->is_loaded;
}
return false;
@@ -382,9 +366,26 @@ static bool fil_node_open_file_low(fil_node_t *node)
return false;
}
+ ulint comp_algo = node->space->get_compression_algo();
+ bool comp_algo_invalid = false;
+
if (node->size);
- else if (!node->read_page0() || !fil_comp_algo_validate(node->space))
+ else if (!node->read_page0() ||
+ // validate compression algorithm for full crc32 format
+ (node->space->full_crc32() &&
+ (comp_algo_invalid = !fil_comp_algo_loaded(comp_algo))))
{
+ if (comp_algo_invalid)
+ {
+ if (comp_algo <= PAGE_ALGORITHM_LAST)
+ ib::warn() << "'" << node->name << "' is compressed with "
+ << page_compression_algorithms[comp_algo]
+ << ", which is not currently loaded";
+ else
+ ib::warn() << "'" << node->name << "' is compressed with "
+ << "invalid algorithm: " << comp_algo;
+ }
+
os_file_close(node->handle);
node->handle= OS_FILE_CLOSED;
return false;
@@ -411,7 +412,7 @@ static bool fil_node_open_file(fil_node_t *node)
{
mysql_mutex_assert_owner(&fil_system.mutex);
ut_ad(!node->is_open());
- ut_ad(fil_is_user_tablespace_id(node->space->id) ||
+ ut_ad(!is_predefined_tablespace(node->space->id) ||
srv_operation == SRV_OPERATION_BACKUP ||
srv_operation == SRV_OPERATION_RESTORE ||
srv_operation == SRV_OPERATION_RESTORE_DELTA);
@@ -861,13 +862,10 @@ fil_space_free_low(
/** Frees a space object from the tablespace memory cache.
Closes the files in the chain but does not delete them.
There must not be any pending i/o's or flushes on the files.
-@param[in] id tablespace identifier
-@param[in] x_latched whether the caller holds X-mode space->latch
+@param id tablespace identifier
+@param x_latched whether the caller holds exclusive fil_space_t::latch
@return true if success */
-bool
-fil_space_free(
- ulint id,
- bool x_latched)
+bool fil_space_free(uint32_t id, bool x_latched)
{
ut_ad(id != TRX_SYS_SPACE);
@@ -915,7 +913,7 @@ fil_space_free(
@param mode encryption mode
@return pointer to created tablespace, to be filled in with add()
@retval nullptr on failure (such as when the same tablespace exists) */
-fil_space_t *fil_space_t::create(ulint id, ulint flags,
+fil_space_t *fil_space_t::create(uint32_t id, uint32_t flags,
fil_type_t purpose,
fil_space_crypt_t *crypt_data,
fil_encryption_t mode)
@@ -1023,18 +1021,13 @@ Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
@return true if assigned, false if not */
-bool
-fil_assign_new_space_id(
-/*====================*/
- ulint* space_id) /*!< in/out: space id */
+bool fil_assign_new_space_id(uint32_t *space_id)
{
- ulint id;
+ uint32_t id = *space_id;
bool success;
mysql_mutex_lock(&fil_system.mutex);
- id = *space_id;
-
if (id < fil_system.max_assigned_id) {
id = fil_system.max_assigned_id;
}
@@ -1060,7 +1053,7 @@ fil_assign_new_space_id(
<< ". To reset the counter to zero"
" you have to dump all your tables and"
" recreate the whole InnoDB installation.";
- *space_id = ULINT_UNDEFINED;
+ *space_id = UINT32_MAX;
}
mysql_mutex_unlock(&fil_system.mutex);
@@ -1093,7 +1086,7 @@ bool fil_space_t::read_page0()
}
/** Look up a tablespace and ensure that its first page has been validated. */
-static fil_space_t *fil_space_get_space(ulint id)
+static fil_space_t *fil_space_get_space(uint32_t id)
{
if (fil_space_t *space= fil_space_get_by_id(id))
if (space->read_page0())
@@ -1101,7 +1094,8 @@ static fil_space_t *fil_space_get_space(ulint id)
return nullptr;
}
-void fil_space_set_recv_size_and_flags(ulint id, uint32_t size, uint32_t flags)
+void fil_space_set_recv_size_and_flags(uint32_t id, uint32_t size,
+ uint32_t flags)
{
ut_ad(id < SRV_SPACE_ID_UPPER_BOUND);
mysql_mutex_lock(&fil_system.mutex);
@@ -1382,10 +1376,7 @@ void fil_space_t::close_all()
/*******************************************************************//**
Sets the max tablespace id counter if the given number is bigger than the
previous value. */
-void
-fil_set_max_space_id_if_bigger(
-/*===========================*/
- ulint max_id) /*!< in: maximum known id */
+void fil_set_max_space_id_if_bigger(uint32_t max_id)
{
ut_a(max_id < SRV_SPACE_ID_UPPER_BOUND);
@@ -1423,7 +1414,7 @@ fil_write_flushed_lsn(
mach_write_to_8(buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION,
lsn);
- ulint fsp_flags = mach_read_from_4(
+ uint32_t fsp_flags = mach_read_from_4(
buf + FSP_HEADER_OFFSET + FSP_SPACE_FLAGS);
if (fil_space_t::full_crc32(fsp_flags)) {
@@ -1443,7 +1434,7 @@ fil_write_flushed_lsn(
@param id tablespace identifier
@return tablespace
@retval nullptr if the tablespace is missing or inaccessible */
-fil_space_t *fil_space_t::get(ulint id)
+fil_space_t *fil_space_t::get(uint32_t id)
{
mysql_mutex_lock(&fil_system.mutex);
fil_space_t *space= fil_space_get_by_id(id);
@@ -1463,7 +1454,7 @@ fil_space_t *fil_space_t::get(ulint id)
@param first_page_no first page number in the file
@param path file path
@param new_path new file path for type=FILE_RENAME */
-inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id,
+inline void mtr_t::log_file_op(mfile_type_t type, uint32_t space_id,
const char *path, const char *new_path)
{
ut_ad((new_path != nullptr) == (type == FILE_RENAME));
@@ -1521,18 +1512,14 @@ inline void mtr_t::log_file_op(mfile_type_t type, ulint space_id,
@param[in] space_id tablespace id
@param[in] name tablespace file name
@param[in,out] mtr mini-transaction */
-static
-void
-fil_name_write(
- ulint space_id,
- const char* name,
- mtr_t* mtr)
+static void fil_name_write(uint32_t space_id, const char *name,
+ mtr_t *mtr)
{
ut_ad(!is_predefined_tablespace(space_id));
mtr->log_file_op(FILE_MODIFY, space_id, name);
}
-fil_space_t *fil_space_t::check_pending_operations(ulint id)
+fil_space_t *fil_space_t::check_pending_operations(uint32_t id)
{
ut_a(!is_system_tablespace(id));
mysql_mutex_lock(&fil_system.mutex);
@@ -1559,7 +1546,7 @@ being_deleted:
return nullptr;
/* Issue a warning every 10.24 seconds, starting after 2.56 seconds */
if ((count & 511) == 128)
- sql_print_warning("InnoDB: Waiting for tablespace " ULINTPF
+ sql_print_warning("InnoDB: Waiting for tablespace " UINT32PF
" to be deleted", id);
std::this_thread::sleep_for(std::chrono::milliseconds(20));
mysql_mutex_lock(&fil_system.mutex);
@@ -1598,7 +1585,7 @@ being_deleted:
/** Close a single-table tablespace on failed IMPORT TABLESPACE.
The tablespace must be cached in the memory cache.
Free all pages used by the tablespace. */
-void fil_close_tablespace(ulint id)
+void fil_close_tablespace(uint32_t id)
{
ut_ad(!is_system_tablespace(id));
fil_space_t* space = fil_space_t::check_pending_operations(id);
@@ -1638,7 +1625,7 @@ void fil_close_tablespace(ulint id)
@param id tablespace identifier
@return detached file handle (to be closed by the caller)
@return OS_FILE_CLOSED if no file existed */
-pfs_os_file_t fil_delete_tablespace(ulint id)
+pfs_os_file_t fil_delete_tablespace(uint32_t id)
{
ut_ad(!is_system_tablespace(id));
pfs_os_file_t handle= OS_FILE_CLOSED;
@@ -1839,10 +1826,10 @@ must be >= FIL_IBD_FILE_INITIAL_SIZE
@retval NULL on error */
fil_space_t*
fil_ibd_create(
- ulint space_id,
+ uint32_t space_id,
const table_name_t name,
const char* path,
- ulint flags,
+ uint32_t flags,
uint32_t size,
fil_encryption_t mode,
uint32_t key_id,
@@ -2015,8 +2002,8 @@ fil_space_t*
fil_ibd_open(
unsigned validate,
fil_type_t purpose,
- ulint id,
- ulint flags,
+ uint32_t id,
+ uint32_t flags,
fil_space_t::name_type name,
const char* path_in,
dberr_t* err)
@@ -2036,7 +2023,7 @@ fil_ibd_open(
/* Table flags can be ULINT_UNDEFINED if
dict_tf_to_fsp_flags_failure is set. */
- if (flags == ULINT_UNDEFINED) {
+ if (flags == UINT32_MAX) {
corrupted:
local_err = DB_CORRUPTION;
func_exit:
@@ -2379,10 +2366,7 @@ of the file in validate_for_recovery().
@param[out] space the tablespace, or NULL on error
@return status of the operation */
enum fil_load_status
-fil_ibd_load(
- ulint space_id,
- const char* filename,
- fil_space_t*& space)
+fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
{
/* If the a space is already in the file system cache with this
space ID, then there is nothing to do. */
@@ -2501,7 +2485,7 @@ tablespace_check:
/* Adjust the memory-based flags that would normally be set by
dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */
- ulint flags = file.flags();
+ uint32_t flags = file.flags();
if (fil_space_t::is_compressed(flags)) {
flags |= page_zip_level
<< FSP_FLAGS_MEM_COMPRESSION_LEVEL;
@@ -2542,7 +2526,7 @@ tablespace_check:
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in,out] space tablespace
@param[in] flags desired tablespace flags */
-void fsp_flags_try_adjust(fil_space_t* space, ulint flags)
+void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags)
{
ut_ad(!srv_read_only_mode);
ut_ad(fil_space_t::is_valid_flags(flags, space->id));
@@ -2592,14 +2576,15 @@ startup, there may be many tablespaces which are not yet in the memory cache.
@param[in] table_flags table flags
@return the tablespace
@retval NULL if no matching tablespace exists in the memory cache */
-fil_space_t *fil_space_for_table_exists_in_mem(ulint id, ulint table_flags)
+fil_space_t *fil_space_for_table_exists_in_mem(uint32_t id,
+ uint32_t table_flags)
{
- const ulint expected_flags = dict_tf_to_fsp_flags(table_flags);
+ const uint32_t expected_flags = dict_tf_to_fsp_flags(table_flags);
mysql_mutex_lock(&fil_system.mutex);
if (fil_space_t* space = fil_space_get_by_id(id)) {
- ulint tf = expected_flags & ~FSP_FLAGS_MEM_MASK;
- ulint sf = space->flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t tf = expected_flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t sf = space->flags & ~FSP_FLAGS_MEM_MASK;
if (!fil_space_t::is_flags_equal(tf, sf)
&& !fil_space_t::is_flags_equal(sf, tf)) {
diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc
index 9961bdf056c..b6971558201 100644
--- a/storage/innobase/fil/fil0pagecompress.cc
+++ b/storage/innobase/fil/fil0pagecompress.cc
@@ -55,21 +55,11 @@ Updated 14/02/2015
#include <fcntl.h>
#endif
#include "row0mysql.h"
-#ifdef HAVE_LZ4
#include "lz4.h"
-#endif
-#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
-#endif
-#ifdef HAVE_LZMA
#include "lzma.h"
-#endif
-#ifdef HAVE_BZIP2
#include "bzlib.h"
-#endif
-#ifdef HAVE_SNAPPY
#include "snappy-c.h"
-#endif
/** Compress a page for the given compression algorithm.
@param[in] buf page to be compressed
@@ -94,6 +84,7 @@ static ulint fil_page_compress_low(
/* fall through */
case PAGE_UNCOMPRESSED:
return 0;
+
case PAGE_ZLIB_ALGORITHM:
{
ulong len = uLong(write_size);
@@ -104,23 +95,15 @@ static ulint fil_page_compress_low(
}
}
break;
-#ifdef HAVE_LZ4
+
case PAGE_LZ4_ALGORITHM:
-# ifdef HAVE_LZ4_COMPRESS_DEFAULT
write_size = LZ4_compress_default(
reinterpret_cast<const char*>(buf),
reinterpret_cast<char*>(out_buf) + header_len,
int(srv_page_size), int(write_size));
-# else
- write_size = LZ4_compress_limitedOutput(
- reinterpret_cast<const char*>(buf),
- reinterpret_cast<char*>(out_buf) + header_len,
- int(srv_page_size), int(write_size));
-# endif
return write_size;
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+
case PAGE_LZO_ALGORITHM: {
lzo_uint len = write_size;
@@ -133,8 +116,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+
case PAGE_LZMA_ALGORITHM: {
size_t out_pos = 0;
@@ -147,9 +129,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
case PAGE_BZIP2_ALGORITHM: {
unsigned len = unsigned(write_size);
if (BZ_OK == BZ2_bzBuffToBuffCompress(
@@ -163,9 +143,7 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
case PAGE_SNAPPY_ALGORITHM: {
size_t len = snappy_max_compressed_length(srv_page_size);
@@ -179,7 +157,6 @@ static ulint fil_page_compress_low(
}
break;
}
-#endif /* HAVE_SNAPPY */
}
return 0;
@@ -195,7 +172,7 @@ static ulint fil_page_compress_low(
static ulint fil_page_compress_for_full_crc32(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
{
@@ -378,7 +355,7 @@ static ulint fil_page_compress_for_non_full_crc32(
ulint fil_page_compress(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
{
@@ -432,7 +409,7 @@ static bool fil_page_decompress_low(
uLong(actual_size))
&& len == srv_page_size);
}
-#ifdef HAVE_LZ4
+
case PAGE_LZ4_ALGORITHM:
return LZ4_decompress_safe(
reinterpret_cast<const char*>(buf) + header_len,
@@ -440,8 +417,7 @@ static bool fil_page_decompress_low(
static_cast<int>(actual_size),
static_cast<int>(srv_page_size)) ==
static_cast<int>(srv_page_size);
-#endif /* HAVE_LZ4 */
-#ifdef HAVE_LZO
+
case PAGE_LZO_ALGORITHM:
{
lzo_uint len_lzo = srv_page_size;
@@ -450,8 +426,7 @@ static bool fil_page_decompress_low(
actual_size, tmp_buf, &len_lzo, NULL)
&& len_lzo == srv_page_size);
}
-#endif /* HAVE_LZO */
-#ifdef HAVE_LZMA
+
case PAGE_LZMA_ALGORITHM:
{
size_t src_pos = 0;
@@ -464,8 +439,7 @@ static bool fil_page_decompress_low(
srv_page_size)
&& dst_pos == srv_page_size;
}
-#endif /* HAVE_LZMA */
-#ifdef HAVE_BZIP2
+
case PAGE_BZIP2_ALGORITHM:
{
uint dst_pos = static_cast<uint>(srv_page_size);
@@ -476,8 +450,7 @@ static bool fil_page_decompress_low(
static_cast<uint>(actual_size), 1, 0)
&& dst_pos == srv_page_size;
}
-#endif /* HAVE_BZIP2 */
-#ifdef HAVE_SNAPPY
+
case PAGE_SNAPPY_ALGORITHM:
{
size_t olen = srv_page_size;
@@ -489,7 +462,6 @@ static bool fil_page_decompress_low(
reinterpret_cast<char*>(tmp_buf), &olen)
&& olen == srv_page_size;
}
-#endif /* HAVE_SNAPPY */
}
return false;
@@ -502,7 +474,8 @@ static bool fil_page_decompress_low(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress_for_full_crc32(byte* tmp_buf, byte* buf, ulint flags)
+static size_t fil_page_decompress_for_full_crc32(byte *tmp_buf, byte *buf,
+ uint32_t flags)
{
ut_ad(fil_space_t::full_crc32(flags));
bool compressed = false;
@@ -547,9 +520,7 @@ ulint fil_page_decompress_for_full_crc32(byte* tmp_buf, byte* buf, ulint flags)
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress_for_non_full_crc32(
- byte* tmp_buf,
- byte* buf)
+static size_t fil_page_decompress_for_non_full_crc32(byte *tmp_buf, byte *buf)
{
ulint header_len;
uint comp_algo;
@@ -600,10 +571,7 @@ ulint fil_page_decompress_for_non_full_crc32(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress(
- byte* tmp_buf,
- byte* buf,
- ulint flags)
+ulint fil_page_decompress(byte *tmp_buf, byte *buf, uint32_t flags)
{
if (fil_space_t::full_crc32(flags)) {
return fil_page_decompress_for_full_crc32(tmp_buf, buf, flags);
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index bc709516b41..9e6b6abcf03 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -303,8 +303,8 @@ Datafile::read_first_page(bool read_only_mode)
+ m_first_page);
m_flags = fsp_header_get_flags(m_first_page);
if (!fil_space_t::is_valid_flags(m_flags, m_space_id)) {
- ulint cflags = fsp_flags_convert_from_101(m_flags);
- if (cflags == ULINT_UNDEFINED) {
+ uint32_t cflags = fsp_flags_convert_from_101(m_flags);
+ if (cflags == UINT32_MAX) {
ib::error()
<< "Invalid flags " << ib::hex(m_flags)
<< " in " << m_filepath;
@@ -341,8 +341,7 @@ in order for this function to validate it.
@param[in] flags The expected tablespace flags.
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
-dberr_t
-Datafile::validate_to_dd(ulint space_id, ulint flags)
+dberr_t Datafile::validate_to_dd(uint32_t space_id, uint32_t flags)
{
dberr_t err;
@@ -432,7 +431,7 @@ Datafile::validate_for_recovery()
}
}
- if (m_space_id == ULINT_UNDEFINED) {
+ if (m_space_id == UINT32_MAX) {
return DB_SUCCESS; /* empty file */
}
@@ -625,15 +624,15 @@ Datafile::find_space_id()
page_size <<= 1) {
/* map[space_id] = count of pages */
typedef std::map<
- ulint,
- ulint,
- std::less<ulint>,
- ut_allocator<std::pair<const ulint, ulint> > >
+ uint32_t,
+ uint32_t,
+ std::less<uint32_t>,
+ ut_allocator<std::pair<const uint32_t, uint32_t> > >
Pages;
Pages verify;
- ulint page_count = 64;
- ulint valid_pages = 0;
+ uint32_t page_count = 64;
+ uint32_t valid_pages = 0;
/* Adjust the number of pages to analyze based on file size */
while ((page_count * page_size) > file_size) {
@@ -647,14 +646,14 @@ Datafile::find_space_id()
byte* page = static_cast<byte*>(
aligned_malloc(page_size, page_size));
- ulint fsp_flags;
+ uint32_t fsp_flags;
/* provide dummy value if the first os_file_read() fails */
switch (srv_checksum_algorithm) {
case SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32:
case SRV_CHECKSUM_ALGORITHM_FULL_CRC32:
fsp_flags = 1U << FSP_FLAGS_FCRC32_POS_MARKER
| FSP_FLAGS_FCRC32_PAGE_SSIZE()
- | innodb_compression_algorithm
+ | uint(innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
break;
default:
@@ -694,7 +693,7 @@ Datafile::find_space_id()
if (noncompressed_ok || compressed_ok) {
- ulint space_id = mach_read_from_4(page
+ uint32_t space_id = mach_read_from_4(page
+ FIL_PAGE_SPACE_ID);
if (space_id > 0) {
@@ -772,14 +771,14 @@ Datafile::restore_from_doublewrite()
return(true);
}
- ulint flags = mach_read_from_4(
+ uint32_t flags = mach_read_from_4(
FSP_HEADER_OFFSET + FSP_SPACE_FLAGS + page);
if (!fil_space_t::is_valid_flags(flags, m_space_id)) {
flags = fsp_flags_convert_from_101(flags);
/* recv_dblwr_t::validate_page() inside find_page()
checked this already. */
- ut_ad(flags != ULINT_UNDEFINED);
+ ut_ad(flags != UINT32_MAX);
/* The flags on the page should be converted later. */
}
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc
index 12e9a6913ba..74dbf207947 100644
--- a/storage/innobase/fsp/fsp0fsp.cc
+++ b/storage/innobase/fsp/fsp0fsp.cc
@@ -1516,7 +1516,7 @@ static
fseg_inode_t*
fseg_inode_try_get(
const fseg_header_t* header,
- ulint space,
+ uint32_t space,
ulint zip_size,
mtr_t* mtr,
buf_block_t** block,
@@ -2250,13 +2250,12 @@ fseg_alloc_free_page_general(
dberr_t* err) /*!< out: error code */
{
fseg_inode_t* inode;
- ulint space_id;
fil_space_t* space;
buf_block_t* iblock;
buf_block_t* block;
uint32_t n_reserved;
- space_id = page_get_space_id(page_align(seg_header));
+ const uint32_t space_id = page_get_space_id(page_align(seg_header));
space = mtr->x_lock_space(space_id);
inode = fseg_inode_try_get(seg_header, space_id, space->zip_size(),
mtr, &iblock, err);
diff --git a/storage/innobase/fsp/fsp0space.cc b/storage/innobase/fsp/fsp0space.cc
index b069250ff9f..6bdf9fcc4d8 100644
--- a/storage/innobase/fsp/fsp0space.cc
+++ b/storage/innobase/fsp/fsp0space.cc
@@ -59,7 +59,7 @@ Tablespace::shutdown()
m_files.clear();
ut_free(m_path);
m_path = NULL;
- m_space_id = ULINT_UNDEFINED;
+ m_space_id = UINT32_MAX;
}
/** Note that the data file was found.
@@ -118,7 +118,7 @@ Tablespace::open_or_create(bool is_temp)
/* Create the tablespace entry for the multi-file
tablespace in the tablespace manager. */
- ulint fsp_flags = 0;
+ uint32_t fsp_flags;
switch (srv_checksum_algorithm) {
case SRV_CHECKSUM_ALGORITHM_FULL_CRC32:
diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
index 9b81aa9307c..853a303e925 100644
--- a/storage/innobase/handler/ha_innodb.cc
+++ b/storage/innobase/handler/ha_innodb.cc
@@ -79,7 +79,6 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "dict0load.h"
#include "btr0defragment.h"
#include "dict0crea.h"
-#include "dict0dict.h"
#include "dict0stats.h"
#include "dict0stats_bg.h"
#include "fil0fil.h"
@@ -94,9 +93,9 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "mtr0mtr.h"
#include "os0file.h"
#include "page0zip.h"
-#include "rem0types.h"
#include "row0import.h"
#include "row0ins.h"
+#include "row0log.h"
#include "row0merge.h"
#include "row0mysql.h"
#include "row0quiesce.h"
@@ -114,6 +113,12 @@ this program; if not, write to the Free Software Foundation, Inc.,
#include "ut0mem.h"
#include "row0ext.h"
+#include "lz4.h"
+#include "lzo/lzo1x.h"
+#include "lzma.h"
+#include "bzlib.h"
+#include "snappy-c.h"
+
#include <limits>
#define thd_get_trx_isolation(X) ((enum_tx_isolation)thd_tx_isolation(X))
@@ -852,11 +857,6 @@ innodb_compression_algorithm_validate(
for update function */
struct st_mysql_value* value); /*!< in: incoming string */
-static ibool innodb_have_lzo=IF_LZO(1, 0);
-static ibool innodb_have_lz4=IF_LZ4(1, 0);
-static ibool innodb_have_lzma=IF_LZMA(1, 0);
-static ibool innodb_have_bzip2=IF_BZIP2(1, 0);
-static ibool innodb_have_snappy=IF_SNAPPY(1, 0);
static ibool innodb_have_punch_hole=IF_PUNCH_HOLE(1, 0);
static
@@ -1044,11 +1044,11 @@ static SHOW_VAR innodb_status_variables[]= {
&export_vars.innodb_pages_encrypted, SHOW_LONGLONG},
{"num_pages_decrypted",
&export_vars.innodb_pages_decrypted, SHOW_LONGLONG},
- {"have_lz4", &innodb_have_lz4, SHOW_BOOL},
- {"have_lzo", &innodb_have_lzo, SHOW_BOOL},
- {"have_lzma", &innodb_have_lzma, SHOW_BOOL},
- {"have_bzip2", &innodb_have_bzip2, SHOW_BOOL},
- {"have_snappy", &innodb_have_snappy, SHOW_BOOL},
+ {"have_lz4", &(provider_service_lz4->is_loaded), SHOW_BOOL},
+ {"have_lzo", &(provider_service_lzo->is_loaded), SHOW_BOOL},
+ {"have_lzma", &(provider_service_lzma->is_loaded), SHOW_BOOL},
+ {"have_bzip2", &(provider_service_bzip2->is_loaded), SHOW_BOOL},
+ {"have_snappy", &(provider_service_snappy->is_loaded), SHOW_BOOL},
{"have_punch_hole", &innodb_have_punch_hole, SHOW_BOOL},
/* Defragmentation */
@@ -1777,16 +1777,11 @@ If correct, set the associated page_size_shift which is the power of 2
for this page size.
@param[in] page_size Page Size to evaluate
@return an associated page_size_shift if valid, 0 if invalid. */
-inline
-ulong
-innodb_page_size_validate(
- ulong page_size)
+inline uint32_t innodb_page_size_validate(ulong page_size)
{
- ulong n;
-
DBUG_ENTER("innodb_page_size_validate");
- for (n = UNIV_PAGE_SIZE_SHIFT_MIN;
+ for (uint32_t n = UNIV_PAGE_SIZE_SHIFT_MIN;
n <= UNIV_PAGE_SIZE_SHIFT_MAX;
n++) {
if (page_size == static_cast<ulong>(1 << n)) {
@@ -3764,23 +3759,34 @@ static const char* ha_innobase_exts[] = {
@retval 0 if no system-versioned data was affected by the transaction */
static ulonglong innodb_prepare_commit_versioned(THD* thd, ulonglong *trx_id)
{
- if (const trx_t* trx = thd_to_trx(thd)) {
- *trx_id = trx->id;
-
- for (const auto& t : trx->mod_tables) {
- if (t.second.is_versioned()) {
- DBUG_ASSERT(t.first->versioned_by_id());
- DBUG_ASSERT(trx->rsegs.m_redo.rseg);
+ if (trx_t *trx= thd_to_trx(thd))
+ {
+ *trx_id= trx->id;
+ bool versioned= false;
- return trx_sys.get_new_trx_id();
- }
- }
+ for (auto &t : trx->mod_tables)
+ {
+ if (t.second.is_versioned())
+ {
+ DBUG_ASSERT(t.first->versioned_by_id());
+ DBUG_ASSERT(trx->rsegs.m_redo.rseg);
+ versioned= true;
+ if (!trx->bulk_insert)
+ break;
+ }
+ if (t.second.is_bulk_insert())
+ {
+ ut_ad(trx->bulk_insert);
+ if (t.second.write_bulk(t.first, trx))
+ return ULONGLONG_MAX;
+ }
+ }
- return 0;
- }
+ return versioned ? trx_sys.get_new_trx_id() : 0;
+ }
- *trx_id = 0;
- return 0;
+ *trx_id= 0;
+ return 0;
}
/** Initialize and normalize innodb_buffer_pool_size. */
@@ -3796,6 +3802,25 @@ static void innodb_buffer_pool_size_init()
innobase_buffer_pool_size = srv_buf_pool_size;
}
+
+static bool
+compression_algorithm_is_not_loaded(ulong compression_algorithm, myf flags)
+{
+ bool is_loaded[PAGE_ALGORITHM_LAST+1]= { 1, 1, provider_service_lz4->is_loaded,
+ provider_service_lzo->is_loaded, provider_service_lzma->is_loaded,
+ provider_service_bzip2->is_loaded, provider_service_snappy->is_loaded };
+
+ DBUG_ASSERT(compression_algorithm <= PAGE_ALGORITHM_LAST);
+
+ if (is_loaded[compression_algorithm])
+ return 0;
+
+ my_printf_error(HA_ERR_UNSUPPORTED, "InnoDB: compression algorithm %s (%u)"
+ " is not available. Please, load the corresponding provider plugin.", flags,
+ page_compression_algorithms[compression_algorithm], compression_algorithm);
+ return 1;
+}
+
/** Initialize, validate and normalize the InnoDB startup parameters.
@return failure code
@retval 0 on success
@@ -3831,50 +3856,8 @@ static int innodb_init_params()
DBUG_RETURN(HA_ERR_INITIALIZATION);
}
-#ifndef HAVE_LZ4
- if (innodb_compression_algorithm == PAGE_LZ4_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblz4 is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_LZO
- if (innodb_compression_algorithm == PAGE_LZO_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzo is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_LZMA
- if (innodb_compression_algorithm == PAGE_LZMA_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzma is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_BZIP2
- if (innodb_compression_algorithm == PAGE_BZIP2_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libbz2 is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
-
-#ifndef HAVE_SNAPPY
- if (innodb_compression_algorithm == PAGE_SNAPPY_ALGORITHM) {
- sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libsnappy is not installed. \n",
- innodb_compression_algorithm);
- DBUG_RETURN(HA_ERR_INITIALIZATION);
- }
-#endif
+ if (compression_algorithm_is_not_loaded(innodb_compression_algorithm, ME_ERROR_LOG))
+ DBUG_RETURN(HA_ERR_INITIALIZATION);
if ((srv_encrypt_tables || srv_encrypt_log
|| innodb_encrypt_temporary_tables)
@@ -4594,9 +4577,6 @@ innobase_commit(
if (commit_trx
|| (!thd_test_options(thd, OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) {
- DBUG_EXECUTE_IF("crash_innodb_before_commit",
- DBUG_SUICIDE(););
-
/* Run the fast part of commit if we did not already. */
if (!trx->active_commit_ordered) {
innobase_commit_ordered_2(trx, thd);
@@ -4631,6 +4611,10 @@ innobase_commit(
SQL statement */
trx_mark_sql_stat_end(trx);
+ if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) {
+ trx_rollback_for_mysql(trx);
+ DBUG_RETURN(1);
+ }
}
/* Reset the number AUTO-INC rows required */
@@ -10883,9 +10867,6 @@ err_col:
ut_ad(dict_sys.sys_tables_exist());
err = row_create_table_for_mysql(table, m_trx);
-
- DBUG_EXECUTE_IF("ib_crash_during_create_for_encryption",
- DBUG_SUICIDE(););
}
switch (err) {
@@ -15667,6 +15648,7 @@ ha_innobase::extra(
row_ins_duplicate_error_in_clust() will acquire a
shared lock instead of an exclusive lock. */
stmt_boundary:
+ trx->bulk_insert_apply();
trx->end_bulk_insert(*m_prebuilt->table);
trx->bulk_insert = false;
break;
@@ -15687,6 +15669,9 @@ ha_innobase::extra(
if (trx->is_bulk_insert()) {
/* Allow a subsequent INSERT into an empty table
if !unique_checks && !foreign_key_checks. */
+ if (dberr_t err = trx->bulk_insert_apply()) {
+ return err;
+ }
break;
}
goto stmt_boundary;
@@ -15800,6 +15785,12 @@ ha_innobase::start_stmt(
if (!trx->bulk_insert) {
break;
}
+
+ /* Trigger could've initiated another stmt.
+ So apply all bulk operation and mark as
+ end bulk insert for all tables */
+ trx->bulk_insert_apply();
+ trx->end_bulk_insert();
trx->bulk_insert = false;
trx->last_sql_stat_start.least_undo_no = trx->undo_no;
}
@@ -17001,6 +16992,10 @@ innobase_xa_prepare(
SQL statement */
trx_mark_sql_stat_end(trx);
+ if (UNIV_UNLIKELY(trx->error_state != DB_SUCCESS)) {
+ trx_rollback_for_mysql(trx);
+ return 1;
+ }
}
if (thd_sql_command(thd) != SQLCOM_XA_PREPARE
@@ -18865,10 +18860,23 @@ static MYSQL_SYSVAR_ULONG(purge_batch_size, srv_purge_batch_size,
1, /* Minimum value */
5000, 0); /* Maximum value */
+extern void srv_update_purge_thread_count(uint n);
+
+static
+void
+innodb_purge_threads_update(THD*, struct st_mysql_sys_var*, void*, const void*save )
+{
+ srv_update_purge_thread_count(*static_cast<const uint*>(save));
+}
+
static MYSQL_SYSVAR_UINT(purge_threads, srv_n_purge_threads,
- PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
+ PLUGIN_VAR_OPCMDARG,
"Number of tasks for purging transaction history",
- NULL, NULL, 4, 1, innodb_purge_threads_MAX, 0);
+ NULL, innodb_purge_threads_update,
+ 4, /* Default setting */
+ 1, /* Minimum value */
+ innodb_purge_threads_MAX, /* Maximum value */
+ 0);
static MYSQL_SYSVAR_UINT(fast_shutdown, srv_fast_shutdown,
PLUGIN_VAR_OPCMDARG,
@@ -19368,7 +19376,7 @@ static MYSQL_SYSVAR_STR(undo_directory, srv_undo_dir,
"Directory where undo tablespace files live, this path can be absolute.",
NULL, NULL, NULL);
-static MYSQL_SYSVAR_ULONG(undo_tablespaces, srv_undo_tablespaces,
+static MYSQL_SYSVAR_UINT(undo_tablespaces, srv_undo_tablespaces,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of undo tablespaces to use.",
NULL, NULL,
@@ -19621,7 +19629,7 @@ static MYSQL_SYSVAR_BOOL(force_primary_key,
"Do not allow creating a table without primary key (off by default)",
NULL, NULL, FALSE);
-static const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
+const char *page_compression_algorithms[]= { "none", "zlib", "lz4", "lzo", "lzma", "bzip2", "snappy", 0 };
static TYPELIB page_compression_algorithms_typelib=
{
array_elements(page_compression_algorithms) - 1, 0,
@@ -20922,70 +20930,14 @@ innodb_compression_algorithm_validate(
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
- ulong compression_algorithm;
DBUG_ENTER("innobase_compression_algorithm_validate");
if (check_sysvar_enum(thd, var, save, value)) {
DBUG_RETURN(1);
}
- compression_algorithm = *reinterpret_cast<ulong*>(save);
- (void)compression_algorithm;
-
-#ifndef HAVE_LZ4
- if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblz4 is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_LZO
- if (compression_algorithm == PAGE_LZO_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzo is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_LZMA
- if (compression_algorithm == PAGE_LZMA_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: liblzma is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_BZIP2
- if (compression_algorithm == PAGE_BZIP2_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libbz2 is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
-
-#ifndef HAVE_SNAPPY
- if (compression_algorithm == PAGE_SNAPPY_ALGORITHM) {
- push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
- HA_ERR_UNSUPPORTED,
- "InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
- "InnoDB: libsnappy is not installed. \n",
- compression_algorithm);
- DBUG_RETURN(1);
- }
-#endif
+ if (compression_algorithm_is_not_loaded(*(ulong*)save, ME_WARNING))
+ DBUG_RETURN(1);
DBUG_RETURN(0);
}
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index fbb640e7c62..1e11265b5ce 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -10648,8 +10648,8 @@ commit_cache_norebuild(
space->flags
|= FSP_FLAGS_MASK_PAGE_COMPRESSION;
} else if (!space->is_compressed()) {
- space->flags
- |= innodb_compression_algorithm
+ space->flags |= static_cast<uint32_t>(
+ innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
}
mysql_mutex_unlock(&fil_system.mutex);
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index 063462a12b9..0379443e81d 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -6655,8 +6655,8 @@ i_s_dict_fill_tablespaces_encryption(
fields[TABLESPACES_ENCRYPTION_NAME]->set_notnull();
} else if (srv_is_undo_tablespace(space->id)) {
char undo_name[sizeof "innodb_undo000"];
- snprintf(undo_name, sizeof(undo_name),
- "innodb_undo%03zu",space->id);
+ snprintf(undo_name, sizeof undo_name,
+ "innodb_undo%03" PRIu32, space->id);
OK(fields[TABLESPACES_ENCRYPTION_NAME]->store(
undo_name, strlen(undo_name),
system_charset_info));
diff --git a/storage/innobase/ibuf/ibuf0ibuf.cc b/storage/innobase/ibuf/ibuf0ibuf.cc
index 6c15571a305..783e882562f 100644
--- a/storage/innobase/ibuf/ibuf0ibuf.cc
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc
@@ -2338,7 +2338,7 @@ static void ibuf_read_merge_pages(const uint32_t* space_ids,
const uint32_t* page_nos, ulint n_stored)
{
for (ulint i = 0; i < n_stored; i++) {
- const ulint space_id = space_ids[i];
+ const uint32_t space_id = space_ids[i];
fil_space_t* s = fil_space_t::get(space_id);
if (!s) {
tablespace_deleted:
@@ -4428,7 +4428,7 @@ reset_bit:
/** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead.
@param[in] space missing or to-be-discarded tablespace */
-void ibuf_delete_for_discarded_space(ulint space)
+void ibuf_delete_for_discarded_space(uint32_t space)
{
btr_pcur_t pcur;
const rec_t* ibuf_rec;
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
index 87236415150..5b1c5c98e0b 100644
--- a/storage/innobase/include/buf0buf.h
+++ b/storage/innobase/include/buf0buf.h
@@ -321,16 +321,13 @@ buf_block_get_modify_clock(
bool buf_is_zeroes(st_::span<const byte> buf);
/** Check if a page is corrupt.
-@param[in] check_lsn whether the LSN should be checked
-@param[in] read_buf database page
-@param[in] fsp_flags tablespace flags
+@param check_lsn whether FIL_PAGE_LSN should be checked
+@param read_buf database page
+@param fsp_flags contents of FIL_SPACE_FLAGS
@return whether the page is corrupted */
-bool
-buf_page_is_corrupted(
- bool check_lsn,
- const byte* read_buf,
- ulint fsp_flags)
- MY_ATTRIBUTE((warn_unused_result));
+bool buf_page_is_corrupted(bool check_lsn, const byte *read_buf,
+ uint32_t fsp_flags)
+ MY_ATTRIBUTE((warn_unused_result));
/** Read the key version from the page. In full crc32 format,
key version is stored at {0-3th} bytes. In other format, it is
@@ -338,7 +335,8 @@ stored in 26th position.
@param[in] read_buf database page
@param[in] fsp_flags tablespace flags
@return key version of the page. */
-inline uint32_t buf_page_get_key_version(const byte* read_buf, ulint fsp_flags)
+inline uint32_t buf_page_get_key_version(const byte* read_buf,
+ uint32_t fsp_flags)
{
static_assert(FIL_PAGE_FCRC32_KEY_VERSION == 0, "compatibility");
return fil_space_t::full_crc32(fsp_flags)
@@ -353,7 +351,7 @@ stored in page type.
@param[in] read_buf database page
@param[in] fsp_flags tablespace flags
@return true if page is compressed. */
-inline bool buf_page_is_compressed(const byte* read_buf, ulint fsp_flags)
+inline bool buf_page_is_compressed(const byte* read_buf, uint32_t fsp_flags)
{
uint16_t page_type= fil_page_get_type(read_buf);
return fil_space_t::full_crc32(fsp_flags)
@@ -456,12 +454,10 @@ buf_pool_size_align(
/** Verify that post encryption checksum match with the calculated checksum.
This function should be called only if tablespace contains crypt data metadata.
-@param[in] page page frame
-@param[in] fsp_flags tablespace flags
-@return true if page is encrypted and OK, false otherwise */
-bool buf_page_verify_crypt_checksum(
- const byte* page,
- ulint fsp_flags);
+@param page page frame
+@param fsp_flags contents of FSP_SPACE_FLAGS
+@return whether the page is encrypted and valid */
+bool buf_page_verify_crypt_checksum(const byte *page, uint32_t fsp_flags);
/** Calculate a ROW_FORMAT=COMPRESSED page checksum and update the page.
@param[in,out] page page to update
diff --git a/storage/innobase/include/buf0flu.h b/storage/innobase/include/buf0flu.h
index c07ff679a80..665fd1115e7 100644
--- a/storage/innobase/include/buf0flu.h
+++ b/storage/innobase/include/buf0flu.h
@@ -46,7 +46,7 @@ deleting the data file of that tablespace.
The pages still remain a part of LRU and are evicted from
the list as they age towards the tail of the LRU.
@param id tablespace identifier */
-void buf_flush_remove_pages(ulint id);
+void buf_flush_remove_pages(uint32_t id);
/*******************************************************************//**
Relocates a buffer control block on the flush_list.
diff --git a/storage/innobase/include/buf0rea.h b/storage/innobase/include/buf0rea.h
index 8d6b28194dc..986a792b97e 100644
--- a/storage/innobase/include/buf0rea.h
+++ b/storage/innobase/include/buf0rea.h
@@ -101,12 +101,10 @@ which could result in a deadlock if the OS does not support asynchronous io.
ulint
buf_read_ahead_linear(const page_id_t page_id, ulint zip_size, bool ibuf);
-/** Issues read requests for pages which recovery wants to read in.
-@param[in] space_id tablespace id
-@param[in] page_nos array of page numbers to read, with the
-highest page number the last in the array
-@param[in] n number of page numbers in the array */
-void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n);
+/** Issue read requests for pages that need to be recovered.
+@param space_id tablespace identifier
+@param page_nos page numbers to read, in ascending order */
+void buf_read_recv_pages(uint32_t space_id, st_::span<uint32_t> page_nos);
/** @name Modes used in read-ahead @{ */
/** read only pages belonging to the insert buffer tree */
diff --git a/storage/innobase/include/buf0types.h b/storage/innobase/include/buf0types.h
index c69c07d66e1..6c13f5ee308 100644
--- a/storage/innobase/include/buf0types.h
+++ b/storage/innobase/include/buf0types.h
@@ -90,9 +90,9 @@ class page_id_t
{
public:
/** Constructor from (space, page_no).
- @param[in] space tablespace id
- @param[in] page_no page number */
- constexpr page_id_t(ulint space, uint32_t page_no) :
+ @param space tablespace id
+ @param page_no page number */
+ constexpr page_id_t(uint32_t space, uint32_t page_no) :
m_id(uint64_t{space} << 32 | page_no) {}
constexpr page_id_t(uint64_t id) : m_id(id) {}
diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h
index 3e14e0ace69..a65287476ef 100644
--- a/storage/innobase/include/dict0boot.h
+++ b/storage/innobase/include/dict0boot.h
@@ -42,7 +42,7 @@ dict_hdr_get_new_id(
(not assigned if NULL) */
index_id_t* index_id, /*!< out: index id
(not assigned if NULL) */
- ulint* space_id); /*!< out: space id
+ uint32_t* space_id); /*!< out: space id
(not assigned if NULL) */
/** Update dict_sys.row_id in the dictionary header file page. */
void dict_hdr_flush_row_id(row_id_t id);
diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h
index e54a138cc02..f70e50f5d48 100644
--- a/storage/innobase/include/dict0dict.h
+++ b/storage/innobase/include/dict0dict.h
@@ -847,11 +847,8 @@ fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
@return tablespace flags (fil_space_t::flags) */
-UNIV_INLINE
-ulint
-dict_tf_to_fsp_flags(ulint table_flags)
- MY_ATTRIBUTE((const));
-
+inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags)
+ MY_ATTRIBUTE((const));
/** Extract the ROW_FORMAT=COMPRESSED page size from table flags.
@param[in] flags flags
diff --git a/storage/innobase/include/dict0dict.inl b/storage/innobase/include/dict0dict.inl
index a210c839020..4cc3eae96ab 100644
--- a/storage/innobase/include/dict0dict.inl
+++ b/storage/innobase/include/dict0dict.inl
@@ -618,19 +618,16 @@ fil_space_t::flags | 0 | 0 | 1 | 1
==================================================================
@param[in] table_flags dict_table_t::flags
@return tablespace flags (fil_space_t::flags) */
-UNIV_INLINE
-ulint
-dict_tf_to_fsp_flags(ulint table_flags)
+inline uint32_t dict_tf_to_fsp_flags(unsigned table_flags)
{
- ulint fsp_flags;
- ulint page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
+ uint32_t fsp_flags;
+ uint32_t page_compression_level = DICT_TF_GET_PAGE_COMPRESSION_LEVEL(
table_flags);
ut_ad((DICT_TF_GET_PAGE_COMPRESSION(table_flags) == 0)
== (page_compression_level == 0));
- DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure",
- return(ULINT_UNDEFINED););
+ DBUG_EXECUTE_IF("dict_tf_to_fsp_flags_failure", return UINT32_MAX;);
/* No ROW_FORMAT=COMPRESSED for innodb_checksum_algorithm=full_crc32 */
if ((srv_checksum_algorithm == SRV_CHECKSUM_ALGORITHM_STRICT_FULL_CRC32
@@ -641,7 +638,8 @@ dict_tf_to_fsp_flags(ulint table_flags)
| FSP_FLAGS_FCRC32_PAGE_SSIZE();
if (page_compression_level) {
- fsp_flags |= innodb_compression_algorithm
+ fsp_flags |= static_cast<uint32_t>(
+ innodb_compression_algorithm)
<< FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
}
} else {
diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h
index 111f0efbe0b..83987789bb5 100644
--- a/storage/innobase/include/dict0mem.h
+++ b/storage/innobase/include/dict0mem.h
@@ -112,7 +112,7 @@ are described in fsp0fsp.h. */
/** This bitmask is used in SYS_TABLES.N_COLS to set and test whether
the Compact page format is used, i.e ROW_FORMAT != REDUNDANT */
-#define DICT_N_COLS_COMPACT 0x80000000UL
+constexpr uint32_t DICT_N_COLS_COMPACT= 1U << 31;
/** Width of the COMPACT flag */
#define DICT_TF_WIDTH_COMPACT 1
@@ -2090,7 +2090,7 @@ public:
/** The tablespace of the table */
fil_space_t* space;
/** Tablespace ID */
- ulint space_id;
+ uint32_t space_id;
/** Stores information about:
1 row format (redundant or compact),
@@ -2448,6 +2448,16 @@ public:
static dict_table_t *create(const span<const char> &name, fil_space_t *space,
ulint n_cols, ulint n_v_cols, ulint flags,
ulint flags2);
+
+ /** Check whether the table has any spatial indexes */
+ bool has_spatial_index() const
+ {
+ for (auto i= UT_LIST_GET_FIRST(indexes);
+ (i= UT_LIST_GET_NEXT(indexes, i)) != nullptr; )
+ if (i->is_spatial())
+ return true;
+ return false;
+ }
};
inline void dict_index_t::set_modified(mtr_t& mtr) const
diff --git a/storage/innobase/include/fil0crypt.h b/storage/innobase/include/fil0crypt.h
index 26272761f43..f43965cd165 100644
--- a/storage/innobase/include/fil0crypt.h
+++ b/storage/innobase/include/fil0crypt.h
@@ -291,20 +291,20 @@ byte* fil_space_encrypt(
/** Decrypt a page.
@param]in] space_id space id
+@param[in] fsp_flags Tablespace flags
@param[in] crypt_data crypt_data
@param[in] tmp_frame Temporary buffer
@param[in] physical_size page size
-@param[in] fsp_flags Tablespace flags
@param[in,out] src_frame Page to decrypt
@retval DB_SUCCESS on success
@retval DB_DECRYPTION_FAILED on error */
dberr_t
fil_space_decrypt(
- ulint space_id,
+ uint32_t space_id,
+ uint32_t fsp_flags,
fil_space_crypt_t* crypt_data,
byte* tmp_frame,
ulint physical_size,
- ulint fsp_flags,
byte* src_frame);
/******************************************************************
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index 7837020fec4..65198f78988 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -42,7 +42,7 @@ Created 10/25/1995 Heikki Tuuri
#include <mutex>
struct unflushed_spaces_tag_t;
-struct rotation_list_tag_t;
+struct default_encrypt_tag_t;
struct space_list_tag_t;
struct named_spaces_tag_t;
@@ -81,14 +81,14 @@ enum srv_flush_t
extern ulong srv_file_flush_method;
/** Undo tablespaces starts with space_id. */
-extern ulint srv_undo_space_id_start;
+extern uint32_t srv_undo_space_id_start;
/** The number of UNDO tablespaces that are open and ready to use. */
-extern ulint srv_undo_tablespaces_open;
+extern uint32_t srv_undo_tablespaces_open;
/** Check whether given space id is undo tablespace id
@param[in] space_id space id to check
@return true if it is undo tablespace else false. */
-inline bool srv_is_undo_tablespace(ulint space_id)
+inline bool srv_is_undo_tablespace(uint32_t space_id)
{
return srv_undo_space_id_start > 0 &&
space_id >= srv_undo_space_id_start &&
@@ -335,7 +335,7 @@ enum fil_encryption_t
};
struct fil_space_t final : ilist_node<unflushed_spaces_tag_t>,
- ilist_node<rotation_list_tag_t>,
+ ilist_node<default_encrypt_tag_t>,
ilist_node<space_list_tag_t>,
ilist_node<named_spaces_tag_t>
#else
@@ -351,8 +351,6 @@ struct fil_space_t final
latch.destroy();
}
- ulint id; /*!< space id */
-
/** fil_system.spaces chain node */
fil_space_t *hash;
lsn_t max_lsn;
@@ -362,6 +360,8 @@ struct fil_space_t final
Protected by log_sys.mutex.
If and only if this is nonzero, the
tablespace will be in named_spaces. */
+ /** tablespace identifier */
+ uint32_t id;
/** whether undo tablespace truncation is in progress */
bool is_being_truncated;
fil_type_t purpose;/*!< purpose */
@@ -530,7 +530,7 @@ public:
@param id tablespace identifier
@return tablespace
@retval nullptr if no tablespace was found */
- static fil_space_t *check_pending_operations(ulint id);
+ static fil_space_t *check_pending_operations(uint32_t id);
private:
MY_ATTRIBUTE((warn_unused_result))
@@ -675,92 +675,78 @@ public:
freed_ranges.clear();
}
#endif /* !UNIV_INNOCHECKSUM */
- /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
- check fsp0types.h to more info about flags. */
- ulint flags;
-
- /** Determine if full_crc32 is used for a data file
- @param[in] flags tablespace flags (FSP_SPACE_FLAGS)
- @return whether the full_crc32 algorithm is active */
- static bool full_crc32(ulint flags) {
- return flags & FSP_FLAGS_FCRC32_MASK_MARKER;
- }
- /** Determine if full_crc32 is used along with compression */
- static bool is_full_crc32_compressed(ulint flags)
+ /** FSP_SPACE_FLAGS and FSP_FLAGS_MEM_ flags;
+ check fsp0types.h to more info about flags. */
+ uint32_t flags;
+
+ /** Determine if full_crc32 is used for a data file
+ @param[in] flags tablespace flags (FSP_SPACE_FLAGS)
+ @return whether the full_crc32 algorithm is active */
+ static bool full_crc32(uint32_t flags)
+ { return flags & FSP_FLAGS_FCRC32_MASK_MARKER; }
+ /** @return whether innodb_checksum_algorithm=full_crc32 is active */
+ bool full_crc32() const { return full_crc32(flags); }
+ /** Determine if full_crc32 is used along with PAGE_COMPRESSED */
+ static bool is_full_crc32_compressed(uint32_t flags)
{
- if (full_crc32(flags))
- {
- ulint algo= FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags);
- DBUG_ASSERT(algo <= PAGE_ALGORITHM_LAST);
- return algo > 0;
+ if (!full_crc32(flags))
+ return false;
+ auto algo= FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags);
+ DBUG_ASSERT(algo <= PAGE_ALGORITHM_LAST);
+ return algo != 0;
+ }
+ /** Determine the logical page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the logical page size
+ @retval 0 if the flags are invalid */
+ static unsigned logical_size(uint32_t flags)
+ {
+ switch (full_crc32(flags)
+ ? FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags)
+ : FSP_FLAGS_GET_PAGE_SSIZE(flags)) {
+ case 3: return 4096;
+ case 4: return 8192;
+ case 5: return full_crc32(flags) ? 16384 : 0;
+ case 0: return full_crc32(flags) ? 0 : 16384;
+ case 6: return 32768;
+ case 7: return 65536;
+ default: return 0;
}
-
- return false;
}
- /** @return whether innodb_checksum_algorithm=full_crc32 is active */
- bool full_crc32() const { return full_crc32(flags); }
- /** Determine the logical page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the logical page size
- @retval 0 if the flags are invalid */
- static unsigned logical_size(ulint flags) {
-
- ulint page_ssize = 0;
-
- if (full_crc32(flags)) {
- page_ssize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
- } else {
- page_ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- }
-
- switch (page_ssize) {
- case 3: return 4096;
- case 4: return 8192;
- case 5:
- { ut_ad(full_crc32(flags)); return 16384; }
- case 0:
- { ut_ad(!full_crc32(flags)); return 16384; }
- case 6: return 32768;
- case 7: return 65536;
- default: return 0;
- }
- }
- /** Determine the ROW_FORMAT=COMPRESSED page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the ROW_FORMAT=COMPRESSED page size
- @retval 0 if ROW_FORMAT=COMPRESSED is not used */
- static unsigned zip_size(ulint flags) {
-
- if (full_crc32(flags)) {
- return 0;
- }
+ /** Determine the ROW_FORMAT=COMPRESSED page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the ROW_FORMAT=COMPRESSED page size
+ @retval 0 if ROW_FORMAT=COMPRESSED is not used */
+ static unsigned zip_size(uint32_t flags)
+ {
+ if (full_crc32(flags))
+ return 0;
+ const uint32_t zip_ssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ return zip_ssize ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize : 0;
+ }
+ /** Determine the physical page size.
+ @param flags tablespace flags (FSP_SPACE_FLAGS)
+ @return the physical page size */
+ static unsigned physical_size(uint32_t flags)
+ {
+ if (full_crc32(flags))
+ return logical_size(flags);
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- return zip_ssize
- ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize : 0;
- }
- /** Determine the physical page size.
- @param flags tablespace flags (FSP_FLAGS)
- @return the physical page size */
- static unsigned physical_size(ulint flags) {
+ const uint32_t zip_ssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ return zip_ssize
+ ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize
+ : unsigned(srv_page_size);
+ }
- if (full_crc32(flags)) {
- return logical_size(flags);
- }
+ /** @return the ROW_FORMAT=COMPRESSED page size
+ @retval 0 if ROW_FORMAT=COMPRESSED is not used */
+ unsigned zip_size() const { return zip_size(flags); }
+ /** @return the physical page size */
+ unsigned physical_size() const { return physical_size(flags); }
- ulint zip_ssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- return zip_ssize
- ? (UNIV_ZIP_SIZE_MIN >> 1) << zip_ssize
- : unsigned(srv_page_size);
- }
- /** @return the ROW_FORMAT=COMPRESSED page size
- @retval 0 if ROW_FORMAT=COMPRESSED is not used */
- unsigned zip_size() const { return zip_size(flags); }
- /** @return the physical page size */
- unsigned physical_size() const { return physical_size(flags); }
- /** Check whether the compression enabled in tablespace.
+ /** Check whether PAGE_COMPRESSED is enabled.
@param[in] flags tablespace flags */
- static bool is_compressed(ulint flags)
+ static bool is_compressed(uint32_t flags)
{
return is_full_crc32_compressed(flags) ||
FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
@@ -768,187 +754,151 @@ public:
/** @return whether the compression enabled for the tablespace. */
bool is_compressed() const { return is_compressed(flags); }
- /** Get the compression algorithm for full crc32 format.
- @param[in] flags tablespace flags
- @return algorithm type of tablespace */
- static ulint get_compression_algo(ulint flags)
- {
- return full_crc32(flags)
- ? FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags)
- : 0;
- }
- /** @return the page_compressed algorithm
- @retval 0 if not page_compressed */
- ulint get_compression_algo() const {
- return fil_space_t::get_compression_algo(flags);
- }
- /** Determine if the page_compressed page contains an extra byte
- for exact compressed stream length
- @param[in] flags tablespace flags
- @return whether the extra byte is needed */
- static bool full_crc32_page_compressed_len(ulint flags)
- {
- DBUG_ASSERT(full_crc32(flags));
- switch (get_compression_algo(flags)) {
- case PAGE_LZ4_ALGORITHM:
- case PAGE_LZO_ALGORITHM:
- case PAGE_SNAPPY_ALGORITHM:
- return true;
- }
- return false;
- }
-
- /** Whether the full checksum matches with non full checksum flags.
- @param[in] flags flags present
- @param[in] expected expected flags
- @return true if it is equivalent */
- static bool is_flags_full_crc32_equal(ulint flags, ulint expected)
- {
- ut_ad(full_crc32(flags));
- ulint fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
-
- if (full_crc32(expected)) {
- /* The data file may have been created with a
- different innodb_compression_algorithm. But
- we only support one innodb_page_size for all files. */
- return fcrc32_psize
- == FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
- }
-
- ulint non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(expected);
-
- if (!non_fcrc32_psize) {
- if (fcrc32_psize != 5) {
- return false;
- }
- } else if (fcrc32_psize != non_fcrc32_psize) {
- return false;
- }
-
- return true;
- }
- /** Whether old tablespace flags match full_crc32 flags.
- @param[in] flags flags present
- @param[in] expected expected flags
- @return true if it is equivalent */
- static bool is_flags_non_full_crc32_equal(ulint flags, ulint expected)
- {
- ut_ad(!full_crc32(flags));
-
- if (!full_crc32(expected)) {
- return false;
- }
-
- ulint non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- ulint fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(
- expected);
-
- if (!non_fcrc32_psize) {
- if (fcrc32_psize != 5) {
- return false;
- }
- } else if (fcrc32_psize != non_fcrc32_psize) {
- return false;
- }
-
- return true;
- }
- /** Whether both fsp flags are equivalent */
- static bool is_flags_equal(ulint flags, ulint expected)
- {
- if (!((flags ^ expected) & ~(1U << FSP_FLAGS_POS_RESERVED))) {
- return true;
- }
-
- return full_crc32(flags)
- ? is_flags_full_crc32_equal(flags, expected)
- : is_flags_non_full_crc32_equal(flags, expected);
- }
- /** Validate the tablespace flags for full crc32 format.
- @param[in] flags the content of FSP_SPACE_FLAGS
- @return whether the flags are correct in full crc32 format */
- static bool is_fcrc32_valid_flags(ulint flags)
- {
- ut_ad(flags & FSP_FLAGS_FCRC32_MASK_MARKER);
- const ulint page_ssize = physical_size(flags);
- if (page_ssize < 3 || page_ssize & 8) {
- return false;
- }
-
- flags >>= FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
-
- return flags <= PAGE_ALGORITHM_LAST;
- }
- /** Validate the tablespace flags.
- @param[in] flags content of FSP_SPACE_FLAGS
- @param[in] is_ibd whether this is an .ibd file
- (not system tablespace)
- @return whether the flags are correct. */
- static bool is_valid_flags(ulint flags, bool is_ibd)
- {
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
- return false;);
-
- if (full_crc32(flags)) {
- return is_fcrc32_valid_flags(flags);
- }
+ /** Get the compression algorithm for full crc32 format.
+ @param flags contents of FSP_SPACE_FLAGS
+ @return PAGE_COMPRESSED algorithm of full_crc32 tablespace
+ @retval 0 if not PAGE_COMPRESSED or not full_crc32 */
+ static unsigned get_compression_algo(uint32_t flags)
+ {
+ return full_crc32(flags)
+ ? FSP_FLAGS_FCRC32_GET_COMPRESSED_ALGO(flags)
+ : 0;
+ }
+ /** @return the page_compressed algorithm
+ @retval 0 if not page_compressed */
+ unsigned get_compression_algo() const { return get_compression_algo(flags); }
+ /** Determine if the page_compressed page contains an extra byte
+ for exact compressed stream length
+ @param flags contents of FSP_SPACE_FLAGS
+ @return whether the extra byte is needed */
+ static bool full_crc32_page_compressed_len(uint32_t flags)
+ {
+ DBUG_ASSERT(full_crc32(flags));
+ switch (get_compression_algo(flags)) {
+ case PAGE_LZ4_ALGORITHM:
+ case PAGE_LZO_ALGORITHM:
+ case PAGE_SNAPPY_ALGORITHM:
+ return true;
+ }
+ return false;
+ }
- if (flags == 0) {
- return true;
- }
+ /** Whether the full checksum matches with non full checksum flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param expected expected flags
+ @return true if it is equivalent */
+ static bool is_flags_full_crc32_equal(uint32_t flags, uint32_t expected)
+ {
+ ut_ad(full_crc32(flags));
+ uint32_t fcrc32_psize= FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(flags);
+
+ if (full_crc32(expected))
+ /* The data file may have been created with a
+ different innodb_compression_algorithm. But
+ we only support one innodb_page_size for all files. */
+ return fcrc32_psize == FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
+
+ uint32_t non_fcrc32_psize = FSP_FLAGS_GET_PAGE_SSIZE(expected);
+ if (!non_fcrc32_psize)
+ return fcrc32_psize == 5;
+ return fcrc32_psize == non_fcrc32_psize;
+ }
- if (flags & ~FSP_FLAGS_MASK) {
- return false;
- }
+ /** Whether old tablespace flags match full_crc32 flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param expected expected flags
+ @return true if it is equivalent */
+ static bool is_flags_non_full_crc32_equal(uint32_t flags, uint32_t expected)
+ {
+ ut_ad(!full_crc32(flags));
+ if (!full_crc32(expected))
+ return false;
- if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE
- | FSP_FLAGS_MASK_ATOMIC_BLOBS))
- == FSP_FLAGS_MASK_ATOMIC_BLOBS) {
- /* If the "atomic blobs" flag (indicating
- ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
- is set, then the "post Antelope"
- (ROW_FORMAT!=REDUNDANT) flag must also be set. */
- return false;
- }
+ uint32_t non_fcrc32_psize= FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ uint32_t fcrc32_psize = FSP_FLAGS_FCRC32_GET_PAGE_SSIZE(expected);
- /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
- of MySQL 5.6 and MariaDB 10.0, which we ignore.
- In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
- bits 10..14 would be nonzero 0bsssaa where sss is
- nonzero PAGE_SSIZE (3, 4, 6, or 7)
- and aa is ATOMIC_WRITES (not 0b11). */
- if (FSP_FLAGS_GET_RESERVED(flags) & ~1U) {
- return false;
- }
+ if (!non_fcrc32_psize)
+ return fcrc32_psize == 5;
+ return fcrc32_psize == non_fcrc32_psize;
+ }
- const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE(flags);
- if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
- /* the page_size is not between 4k and 64k;
- 16k should be encoded as 0, not 5 */
- return false;
- }
+ /** Whether both fsp flags are equivalent */
+ static bool is_flags_equal(uint32_t flags, uint32_t expected)
+ {
+ if (!((flags ^ expected) & ~(1U << FSP_FLAGS_POS_RESERVED)))
+ return true;
+ return full_crc32(flags)
+ ? is_flags_full_crc32_equal(flags, expected)
+ : is_flags_non_full_crc32_equal(flags, expected);
+ }
- const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
- if (zssize == 0) {
- /* not ROW_FORMAT=COMPRESSED */
- } else if (zssize > (ssize ? ssize : 5)) {
- /* Invalid KEY_BLOCK_SIZE */
- return false;
- } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
- | FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
- /* both these flags should be set for
- ROW_FORMAT=COMPRESSED */
- return false;
- }
+ /** Validate the tablespace flags for full crc32 format.
+ @param flags contents of FSP_SPACE_FLAGS
+ @return whether the flags are correct in full crc32 format */
+ static bool is_fcrc32_valid_flags(uint32_t flags)
+ {
+ ut_ad(flags & FSP_FLAGS_FCRC32_MASK_MARKER);
+ const ulint page_ssize= physical_size(flags);
+ if (page_ssize < 3 || page_ssize & 8)
+ return false;
+ flags >>= FSP_FLAGS_FCRC32_POS_COMPRESSED_ALGO;
+ return flags <= PAGE_ALGORITHM_LAST;
+ }
+ /** Validate the tablespace flags.
+ @param flags contents of FSP_SPACE_FLAGS
+ @param is_ibd whether this is an .ibd file (not system tablespace)
+ @return whether the flags are correct */
+ static bool is_valid_flags(uint32_t flags, bool is_ibd)
+ {
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return false;);
+ if (full_crc32(flags))
+ return is_fcrc32_valid_flags(flags);
- /* The flags do look valid. But, avoid misinterpreting
- buggy MariaDB 10.1 format flags for
- PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL={0,2,3}
- as valid-looking PAGE_SSIZE if this is known to be
- an .ibd file and we are using the default innodb_page_size=16k. */
- return(ssize == 0 || !is_ibd
- || srv_page_size != UNIV_PAGE_SIZE_ORIG);
- }
+ if (flags == 0)
+ return true;
+ if (~FSP_FLAGS_MASK & flags)
+ return false;
+
+ if (FSP_FLAGS_MASK_ATOMIC_BLOBS ==
+ (flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS)))
+ /* If the "atomic blobs" flag (indicating
+ ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag is set, then the
+ ROW_FORMAT!=REDUNDANT flag must also be set. */
+ return false;
+
+ /* Bits 10..14 should be 0b0000d where d is the DATA_DIR flag
+ of MySQL 5.6 and MariaDB 10.0, which we ignore.
+ In the buggy FSP_SPACE_FLAGS written by MariaDB 10.1.0 to 10.1.20,
+ bits 10..14 would be nonzero 0bsssaa where sss is
+ nonzero PAGE_SSIZE (3, 4, 6, or 7)
+ and aa is ATOMIC_WRITES (not 0b11). */
+ if (FSP_FLAGS_GET_RESERVED(flags) & ~1U)
+ return false;
+
+ const uint32_t ssize= FSP_FLAGS_GET_PAGE_SSIZE(flags);
+ if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8)
+ /* the page_size is not between 4k and 64k;
+ 16k should be encoded as 0, not 5 */
+ return false;
+
+ const uint32_t zssize= FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ if (zssize == 0)
+ /* not ROW_FORMAT=COMPRESSED */;
+ else if (zssize > (ssize ? ssize : 5))
+ /* Invalid KEY_BLOCK_SIZE */
+ return false;
+ else if (~flags &
+ (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
+ /* both these flags must set for ROW_FORMAT=COMPRESSED */
+ return false;
+
+ /* The flags do look valid. But, avoid misinterpreting
+ buggy MariaDB 10.1 format flags for
+ PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL={0,2,3}
+ as valid-looking PAGE_SSIZE if this is known to be
+ an .ibd file and we are using the default innodb_page_size=16k. */
+ return(ssize == 0 || !is_ibd || srv_page_size != UNIV_PAGE_SIZE_ORIG);
+ }
#ifndef UNIV_INNOCHECKSUM
MY_ATTRIBUTE((warn_unused_result))
@@ -960,7 +910,7 @@ public:
@param mode encryption mode
@return pointer to created tablespace, to be filled in with add()
@retval nullptr on failure (such as when the same tablespace exists) */
- static fil_space_t *create(ulint id, ulint flags,
+ static fil_space_t *create(uint32_t id, uint32_t flags,
fil_type_t purpose, fil_space_crypt_t *crypt_data,
fil_encryption_t mode= FIL_ENCRYPTION_DEFAULT);
@@ -969,7 +919,7 @@ public:
@param id tablespace identifier
@return tablespace
@retval nullptr if the tablespace is missing or inaccessible */
- static fil_space_t *get(ulint id);
+ static fil_space_t *get(uint32_t id);
/** Add/remove the free page in the freed ranges list.
@param[in] offset page number to be added
@@ -1417,14 +1367,12 @@ or the caller should be in single-threaded crash recovery mode
Normally, fil_space_t::get() should be used instead.
@param[in] id tablespace ID
@return tablespace, or NULL if not found */
-fil_space_t*
-fil_space_get(
- ulint id)
- MY_ATTRIBUTE((warn_unused_result));
+fil_space_t *fil_space_get(uint32_t id)
+ MY_ATTRIBUTE((warn_unused_result));
-/** The tablespace memory cache; also the totality of logs (the log
-data space) is stored here; below we talk about tablespaces */
-struct fil_system_t {
+/** The tablespace memory cache */
+struct fil_system_t
+{
/**
Constructor.
@@ -1483,12 +1431,8 @@ public:
ulint n_open;
/** last time we noted n_open exceeding the limit; protected by mutex */
time_t n_open_exceeded_time;
- ulint max_assigned_id;/*!< maximum space id in the existing
- tables, or assigned during the time
- mysqld has been up; at an InnoDB
- startup we scan the data dictionary
- and set here the maximum of the
- space id's of the tables there */
+ /** maximum persistent tablespace id that has ever been assigned */
+ uint32_t max_assigned_id;
/** nonzero if fil_node_open_file_low() should avoid moving the tablespace
to the end of space_list, for FIFO policy of try_to_close() */
ulint freeze_space_list;
@@ -1501,13 +1445,13 @@ public:
the latest redo log checkpoint.
Protected only by log_sys.mutex. */
- /** List of all file spaces need key rotation */
- ilist<fil_space_t, rotation_list_tag_t> default_encrypt_tables;
+ /** list of all ENCRYPTED=DEFAULT tablespaces that need
+ to be converted to the current value of innodb_encrypt_tables */
+ ilist<fil_space_t, default_encrypt_tag_t> default_encrypt_tables;
- bool space_id_reuse_warned;
- /*!< whether fil_space_t::create()
- has issued a warning about
- potential space_id reuse */
+ /** whether fil_space_t::create() has issued a warning about
+ potential space_id reuse */
+ bool space_id_reuse_warned;
/** Return the next tablespace from default_encrypt_tables list.
@param space previous tablespace (nullptr to start from the start)
@@ -1629,36 +1573,27 @@ Assigns a new space id for a new single-table tablespace. This works simply by
incrementing the global counter. If 4 billion id's is not enough, we may need
to recycle id's.
@return true if assigned, false if not */
-bool
-fil_assign_new_space_id(
-/*====================*/
- ulint* space_id); /*!< in/out: space id */
+bool fil_assign_new_space_id(uint32_t *space_id);
/** Frees a space object from the tablespace memory cache.
Closes the files in the chain but does not delete them.
There must not be any pending i/o's or flushes on the files.
-@param[in] id tablespace identifier
-@param[in] x_latched whether the caller holds X-mode space->latch
+@param id tablespace identifier
+@param x_latched whether the caller holds exclusive fil_space_t::latch
@return true if success */
-bool
-fil_space_free(
- ulint id,
- bool x_latched);
+bool fil_space_free(uint32_t id, bool x_latched);
/** Set the recovered size of a tablespace in pages.
@param id tablespace ID
@param size recovered size in pages
@param flags tablespace flags */
-void fil_space_set_recv_size_and_flags(ulint id, uint32_t size,
+void fil_space_set_recv_size_and_flags(uint32_t id, uint32_t size,
uint32_t flags);
/*******************************************************************//**
Sets the max tablespace id counter if the given number is bigger than the
previous value. */
-void
-fil_set_max_space_id_if_bigger(
-/*===========================*/
- ulint max_id);/*!< in: maximum known id */
+void fil_set_max_space_id_if_bigger(uint32_t max_id);
/** Write the flushed LSN to the page header of the first page in the
system tablespace.
@@ -1674,12 +1609,12 @@ MY_ATTRIBUTE((warn_unused_result))
@param id tablespace identifier
@return detached file handle (to be closed by the caller)
@return OS_FILE_CLOSED if no file existed */
-pfs_os_file_t fil_delete_tablespace(ulint id);
+pfs_os_file_t fil_delete_tablespace(uint32_t id);
/** Close a single-table tablespace on failed IMPORT TABLESPACE.
The tablespace must be cached in the memory cache.
Free all pages used by the tablespace. */
-void fil_close_tablespace(ulint id);
+void fil_close_tablespace(uint32_t id);
/*******************************************************************//**
Allocates and builds a file name from a path, a table or tablespace name
@@ -1709,10 +1644,10 @@ must be >= FIL_IBD_FILE_INITIAL_SIZE
@retval NULL on error */
fil_space_t*
fil_ibd_create(
- ulint space_id,
+ uint32_t space_id,
const table_name_t name,
const char* path,
- ulint flags,
+ uint32_t flags,
uint32_t size,
fil_encryption_t mode,
uint32_t key_id,
@@ -1723,7 +1658,7 @@ fil_ibd_create(
(Typically when upgrading from MariaDB 10.1.0..10.1.20.)
@param[in,out] space tablespace
@param[in] flags desired tablespace flags */
-void fsp_flags_try_adjust(fil_space_t* space, ulint flags);
+void fsp_flags_try_adjust(fil_space_t *space, uint32_t flags);
/********************************************************************//**
Tries to open a single-table tablespace and optionally checks the space id is
@@ -1756,8 +1691,8 @@ fil_space_t*
fil_ibd_open(
unsigned validate,
fil_type_t purpose,
- ulint id,
- ulint flags,
+ uint32_t id,
+ uint32_t flags,
fil_space_t::name_type name,
const char* path_in,
dberr_t* err = NULL)
@@ -1782,12 +1717,8 @@ enum fil_load_status {
@param[out] space the tablespace, or NULL on error
@return status of the operation */
enum fil_load_status
-fil_ibd_load(
- ulint space_id,
- const char* filename,
- fil_space_t*& space)
- MY_ATTRIBUTE((warn_unused_result));
-
+fil_ibd_load(uint32_t space_id, const char *filename, fil_space_t *&space)
+ MY_ATTRIBUTE((warn_unused_result));
/** Determine if a matching tablespace exists in the InnoDB tablespace
memory cache. Note that if we have not done a crash recovery at the database
@@ -1796,7 +1727,8 @@ startup, there may be many tablespaces which are not yet in the memory cache.
@param[in] table_flags table flags
@return the tablespace
@retval NULL if no matching tablespace exists in the memory cache */
-fil_space_t *fil_space_for_table_exists_in_mem(ulint id, ulint table_flags);
+fil_space_t *fil_space_for_table_exists_in_mem(uint32_t id,
+ uint32_t table_flags);
/** Try to extend a tablespace if it is smaller than the specified size.
@param[in,out] space tablespace
@@ -1827,12 +1759,11 @@ fil_delete_file(
/*============*/
const char* path); /*!< in: filepath of the ibd tablespace */
-/*******************************************************************//**
-Returns the table space by a given id, NULL if not found. */
-fil_space_t*
-fil_space_get_by_id(
-/*================*/
- ulint id); /*!< in: space id */
+/** Look up a tablespace.
+@param tablespace identifier
+@return tablespace
+@retval nullptr if not found */
+fil_space_t *fil_space_get_by_id(uint32_t id);
/** Note that a non-predefined persistent tablespace has been modified
by redo log.
@@ -1871,6 +1802,9 @@ inline bool fil_names_write_if_was_clean(fil_space_t* space)
return(was_clean);
}
+
+bool fil_comp_algo_loaded(ulint comp_algo);
+
/** On a log checkpoint, reset fil_names_dirty_and_write() flags
and write out FILE_MODIFY and FILE_CHECKPOINT if needed.
@param[in] lsn checkpoint LSN
diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h
index a22867ad56a..2927da3c2fb 100644
--- a/storage/innobase/include/fil0pagecompress.h
+++ b/storage/innobase/include/fil0pagecompress.h
@@ -40,7 +40,7 @@ Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com
ulint fil_page_compress(
const byte* buf,
byte* out_buf,
- ulint flags,
+ uint32_t flags,
ulint block_size,
bool encrypted)
MY_ATTRIBUTE((nonnull, warn_unused_result));
@@ -52,9 +52,6 @@ ulint fil_page_compress(
@return size of the compressed data
@retval 0 if decompression failed
@retval srv_page_size if the page was not compressed */
-ulint fil_page_decompress(
- byte* tmp_buf,
- byte* buf,
- ulint flags)
- MY_ATTRIBUTE((nonnull, warn_unused_result));
+ulint fil_page_decompress(byte *tmp_buf, byte *buf, uint32_t flags)
+ MY_ATTRIBUTE((nonnull, warn_unused_result));
#endif
diff --git a/storage/innobase/include/fsp0file.h b/storage/innobase/include/fsp0file.h
index 8c11d61c5aa..9dfb3cc7561 100644
--- a/storage/innobase/include/fsp0file.h
+++ b/storage/innobase/include/fsp0file.h
@@ -56,7 +56,7 @@ public:
m_size(),
m_order(),
m_type(SRV_NOT_RAW),
- m_space_id(ULINT_UNDEFINED),
+ m_space_id(UINT32_MAX),
m_flags(),
m_exists(),
m_is_valid(),
@@ -67,7 +67,7 @@ public:
/* No op */
}
- Datafile(ulint flags, uint32_t size, ulint order)
+ Datafile(uint32_t flags, uint32_t size, ulint order)
:
m_filepath(),
m_filename(),
@@ -76,7 +76,7 @@ public:
m_size(size),
m_order(order),
m_type(SRV_NOT_RAW),
- m_space_id(ULINT_UNDEFINED),
+ m_space_id(UINT32_MAX),
m_flags(flags),
m_exists(),
m_is_valid(),
@@ -154,7 +154,7 @@ public:
}
/** Initialize the tablespace flags */
- void init(ulint flags) { m_flags= flags; }
+ void init(uint32_t flags) { m_flags= flags; }
/** Release the resources. */
virtual void shutdown();
@@ -198,7 +198,7 @@ public:
@param[in] flags The expected tablespace flags.
@retval DB_SUCCESS if tablespace is valid, DB_ERROR if not.
m_is_valid is also set true on success, else false. */
- dberr_t validate_to_dd(ulint space_id, ulint flags)
+ dberr_t validate_to_dd(uint32_t space_id, uint32_t flags)
MY_ATTRIBUTE((warn_unused_result));
/** Validates this datafile for the purpose of recovery.
@@ -254,24 +254,15 @@ public:
/** Get Datafile::m_space_id.
@return m_space_id */
- ulint space_id() const
- {
- return(m_space_id);
- }
+ uint32_t space_id() const { return m_space_id; }
/** Get Datafile::m_flags.
@return m_flags */
- ulint flags() const
- {
- return(m_flags);
- }
+ uint32_t flags() const { return m_flags; }
/**
@return true if m_handle is open, false if not */
- bool is_open() const
- {
- return(m_handle != OS_FILE_CLOSED);
- }
+ bool is_open() const { return m_handle != OS_FILE_CLOSED; }
/** Get Datafile::m_is_valid.
@return m_is_valid */
@@ -324,9 +315,9 @@ public:
@return the first data page */
const byte* get_first_page() const { return(m_first_page); }
- void set_space_id(ulint space_id) { m_space_id= space_id; }
+ void set_space_id(uint32_t space_id) { m_space_id= space_id; }
- void set_flags(ulint flags) { m_flags = flags; }
+ void set_flags(uint32_t flags) { m_flags = flags; }
private:
/** Free the filepath buffer. */
void free_filepath();
@@ -425,12 +416,12 @@ private:
/** Tablespace ID. Contained in the datafile header.
If this is a system tablespace, FSP_SPACE_ID is only valid
in the first datafile. */
- ulint m_space_id;
+ uint32_t m_space_id;
/** Tablespace flags. Contained in the datafile header.
If this is a system tablespace, FSP_SPACE_FLAGS are only valid
in the first datafile. */
- ulint m_flags;
+ uint32_t m_flags;
/** true if file already existed on startup */
bool m_exists;
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h
index 7b66e58e488..52334056353 100644
--- a/storage/innobase/include/fsp0fsp.h
+++ b/storage/innobase/include/fsp0fsp.h
@@ -590,14 +590,11 @@ fseg_print(
/** Convert FSP_SPACE_FLAGS from the buggy MariaDB 10.1.0..10.1.20 format.
@param[in] flags the contents of FSP_SPACE_FLAGS
@return the flags corrected from the buggy MariaDB 10.1 format
-@retval ULINT_UNDEFINED if the flags are not in the buggy 10.1 format */
+@retval UINT32_MAX if the flags are not in the buggy 10.1 format */
MY_ATTRIBUTE((warn_unused_result, const))
-UNIV_INLINE
-ulint
-fsp_flags_convert_from_101(ulint flags)
+inline uint32_t fsp_flags_convert_from_101(uint32_t flags)
{
- DBUG_EXECUTE_IF("fsp_flags_is_valid_failure",
- return(ULINT_UNDEFINED););
+ DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return UINT32_MAX;);
if (flags == 0 || fil_space_t::full_crc32(flags)) {
return(flags);
}
@@ -606,7 +603,7 @@ fsp_flags_convert_from_101(ulint flags)
/* The most significant FSP_SPACE_FLAGS bit that was ever set
by MariaDB 10.1.0 to 10.1.20 was bit 17 (misplaced DATA_DIR flag).
The flags must be less than 1<<18 in order to be valid. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS))
@@ -615,7 +612,7 @@ fsp_flags_convert_from_101(ulint flags)
ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag
is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag
must also be set. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
/* Bits 6..10 denote compression in MariaDB 10.1.0 to 10.1.20.
@@ -644,19 +641,19 @@ fsp_flags_convert_from_101(ulint flags)
invalid (COMPRESSION_LEVEL=3 but COMPRESSION=0)
+0b00000: innodb_page_size=16k (looks like COMPRESSION=0)
??? Could actually be compressed; see PAGE_SSIZE below */
- const ulint level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
+ const uint32_t level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101(
flags);
if (FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) != (level != 0)
|| level > 9) {
/* The compression flags are not in the buggy MariaDB
10.1 format. */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
if (!(~flags & FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101)) {
/* The ATOMIC_WRITES flags cannot be 0b11.
(The bits 11..12 should actually never be 0b11,
because in MySQL they would be SHARED|TEMPORARY.) */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
/* Bits 13..16 are the wrong position for PAGE_SSIZE, and they
@@ -671,23 +668,23 @@ fsp_flags_convert_from_101(ulint flags)
will be properly rejected by older MariaDB 10.1.x because they
would read as PAGE_SSIZE>=8 which is not valid. */
- const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
+ const uint32_t ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags);
if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) {
/* the page_size is not between 4k and 64k;
16k should be encoded as 0, not 5 */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
- const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
+ const uint32_t zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags);
if (zssize == 0) {
/* not ROW_FORMAT=COMPRESSED */
} else if (zssize > (ssize ? ssize : 5)) {
/* invalid KEY_BLOCK_SIZE */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
} else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE
| FSP_FLAGS_MASK_ATOMIC_BLOBS)) {
/* both these flags should be set for
ROW_FORMAT=COMPRESSED */
- return(ULINT_UNDEFINED);
+ return UINT32_MAX;
}
flags = ((flags & 0x3f) | ssize << FSP_FLAGS_POS_PAGE_SSIZE
@@ -702,19 +699,11 @@ fsp_flags_convert_from_101(ulint flags)
@param[in] actual flags read from FSP_SPACE_FLAGS
@return whether the flags match */
MY_ATTRIBUTE((warn_unused_result))
-UNIV_INLINE
-bool
-fsp_flags_match(ulint expected, ulint actual)
+inline bool fsp_flags_match(uint32_t expected, uint32_t actual)
{
- expected &= ~FSP_FLAGS_MEM_MASK;
- ut_ad(fil_space_t::is_valid_flags(expected, false));
-
- if (actual == expected) {
- return(true);
- }
-
- actual = fsp_flags_convert_from_101(actual);
- return(actual == expected);
+ expected&= ~FSP_FLAGS_MEM_MASK;
+ ut_ad(fil_space_t::is_valid_flags(expected, false));
+ return actual == expected || fsp_flags_convert_from_101(actual) == expected;
}
/** Determine the descriptor index within a descriptor page.
diff --git a/storage/innobase/include/fsp0space.h b/storage/innobase/include/fsp0space.h
index ed65af52bc8..a2bb46d3125 100644
--- a/storage/innobase/include/fsp0space.h
+++ b/storage/innobase/include/fsp0space.h
@@ -47,22 +47,13 @@ public:
/** Data file iterator */
typedef files_t::const_iterator const_iterator;
- Tablespace()
- :
- m_files(),
- m_space_id(ULINT_UNDEFINED),
- m_path(),
- m_flags(),
- m_ignore_read_only(false)
- {
- /* No op */
- }
+ Tablespace() {}
virtual ~Tablespace()
{
shutdown();
ut_ad(m_files.empty());
- ut_ad(m_space_id == ULINT_UNDEFINED);
+ ut_ad(m_space_id == UINT32_MAX);
}
// Disable copying
@@ -104,22 +95,19 @@ public:
/** Set the space id of the tablespace
@param[in] space_id tablespace ID to set */
- void set_space_id(ulint space_id)
+ void set_space_id(uint32_t space_id)
{
- ut_ad(m_space_id == ULINT_UNDEFINED);
+ ut_ad(m_space_id == UINT32_MAX);
m_space_id = space_id;
}
/** Get the space id of the tablespace
@return m_space_id space id of the tablespace */
- ulint space_id() const
- {
- return(m_space_id);
- }
+ uint32_t space_id() const { return m_space_id; }
/** Set the tablespace flags
@param[in] fsp_flags tablespace flags */
- void set_flags(ulint fsp_flags)
+ void set_flags(uint32_t fsp_flags)
{
ut_ad(fil_space_t::is_valid_flags(fsp_flags, false));
m_flags = fsp_flags;
@@ -127,24 +115,15 @@ public:
/** Get the tablespace flags
@return m_flags tablespace flags */
- ulint flags() const
- {
- return(m_flags);
- }
+ uint32_t flags() const { return m_flags; }
/** Get the tablespace encryption mode
@return m_mode tablespace encryption mode */
- fil_encryption_t encryption_mode() const
- {
- return (m_mode);
- }
+ fil_encryption_t encryption_mode() const { return m_mode; }
/** Get the tablespace encryption key_id
@return m_key_id tablespace encryption key_id */
- uint32_t key_id() const
- {
- return (m_key_id);
- }
+ uint32_t key_id() const { return m_key_id; }
/** Set Ignore Read Only Status for tablespace.
@param[in] read_only_status read only status indicator */
@@ -210,24 +189,21 @@ private:
@param[in] file data file object */
void file_found(Datafile& file);
- /* DATA MEMBERS */
-
/** Tablespace ID */
- ulint m_space_id;
+ uint32_t m_space_id = UINT32_MAX;
+ /** Tablespace flags */
+ uint32_t m_flags = UINT32_MAX;
- /** Path where tablespace files will reside, not including a filename.*/
+ /** Path where tablespace files will reside, excluding a filename */
char* m_path;
- /** Tablespace flags */
- ulint m_flags;
-
/** Encryption mode and key_id */
fil_encryption_t m_mode;
uint32_t m_key_id;
protected:
/** Ignore server read only configuration for this tablespace. */
- bool m_ignore_read_only;
+ bool m_ignore_read_only = false;
};
#endif /* fsp0space_h */
diff --git a/storage/innobase/include/fsp0sysspace.h b/storage/innobase/include/fsp0sysspace.h
index 2e0a395f71c..b6bdadd3501 100644
--- a/storage/innobase/include/fsp0sysspace.h
+++ b/storage/innobase/include/fsp0sysspace.h
@@ -1,6 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 2016, 2021, 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
@@ -266,24 +267,15 @@ extern SysTablespace srv_tmp_space;
/** Check if the space_id is for a system-tablespace (shared + temp).
@param[in] id Space ID to check
@return true if id is a system tablespace, false if not. */
-UNIV_INLINE
-bool
-is_system_tablespace(ulint id)
+inline bool is_system_tablespace(uint32_t id)
{
- return(id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID);
+ return id == TRX_SYS_SPACE || id == SRV_TMP_SPACE_ID;
}
/** Check if predefined shared tablespace.
@return true if predefined shared tablespace */
-UNIV_INLINE
-bool
-is_predefined_tablespace(
- ulint id)
+inline bool is_predefined_tablespace(uint32_t id)
{
- ut_ad(srv_sys_space.space_id() == TRX_SYS_SPACE);
- ut_ad(TRX_SYS_SPACE == 0);
- return(id == TRX_SYS_SPACE
- || id == SRV_TMP_SPACE_ID
- || srv_is_undo_tablespace(id));
+ return is_system_tablespace(id) || srv_is_undo_tablespace(id);
}
#endif /* fsp0sysspace_h */
diff --git a/storage/innobase/include/fsp0types.h b/storage/innobase/include/fsp0types.h
index 1912c31b744..9a23e840380 100644
--- a/storage/innobase/include/fsp0types.h
+++ b/storage/innobase/include/fsp0types.h
@@ -25,25 +25,24 @@ Created May 26, 2009 Vasil Dimov
*******************************************************/
#pragma once
-#include <cstddef>
+#include "ut0byte.h"
-/** The fil_space_t::id of the redo log. All persistent tablespaces
-have a smaller fil_space_t::id. */
-static constexpr size_t SRV_SPACE_ID_UPPER_BOUND= 0xFFFFFFF0;
+/** All persistent tablespaces have a smaller fil_space_t::id than this. */
+constexpr uint32_t SRV_SPACE_ID_UPPER_BOUND= 0xFFFFFFF0U;
/** The fil_space_t::id of the innodb_temporary tablespace. */
-#define SRV_TMP_SPACE_ID 0xFFFFFFFEU
-
-#include "ut0byte.h"
+constexpr uint32_t SRV_TMP_SPACE_ID= 0xFFFFFFFEU;
/* Possible values of innodb_compression_algorithm */
-#define PAGE_UNCOMPRESSED 0
-#define PAGE_ZLIB_ALGORITHM 1
-#define PAGE_LZ4_ALGORITHM 2
-#define PAGE_LZO_ALGORITHM 3
-#define PAGE_LZMA_ALGORITHM 4
+#define PAGE_UNCOMPRESSED 0
+#define PAGE_ZLIB_ALGORITHM 1
+#define PAGE_LZ4_ALGORITHM 2
+#define PAGE_LZO_ALGORITHM 3
+#define PAGE_LZMA_ALGORITHM 4
#define PAGE_BZIP2_ALGORITHM 5
#define PAGE_SNAPPY_ALGORITHM 6
-#define PAGE_ALGORITHM_LAST PAGE_SNAPPY_ALGORITHM
+#define PAGE_ALGORITHM_LAST PAGE_SNAPPY_ALGORITHM
+
+extern const char *page_compression_algorithms[];
/** @name Flags for inserting records in order
If records are inserted in order, there are the following
diff --git a/storage/innobase/include/ibuf0ibuf.h b/storage/innobase/include/ibuf0ibuf.h
index e38515f0402..c246b2ef513 100644
--- a/storage/innobase/include/ibuf0ibuf.h
+++ b/storage/innobase/include/ibuf0ibuf.h
@@ -365,7 +365,7 @@ dberr_t ibuf_merge_or_delete_for_page(buf_block_t *block,
/** Delete all change buffer entries for a tablespace,
in DISCARD TABLESPACE, IMPORT TABLESPACE, or read-ahead.
@param[in] space missing or to-be-discarded tablespace */
-void ibuf_delete_for_discarded_space(ulint space);
+void ibuf_delete_for_discarded_space(uint32_t space);
/** Contract the change buffer by reading pages to the buffer pool.
@return a lower limit for the combined size in bytes of entries which
diff --git a/storage/innobase/include/log0log.inl b/storage/innobase/include/log0log.inl
index c29c0bfa55f..73434737925 100644
--- a/storage/innobase/include/log0log.inl
+++ b/storage/innobase/include/log0log.inl
@@ -184,8 +184,8 @@ log_block_convert_lsn_to_no(
lsn_t lsn) /*!< in: lsn of a byte within the block */
{
return(((ulint) (lsn / OS_FILE_LOG_BLOCK_SIZE) &
- DBUG_EVALUATE_IF("innodb_small_log_block_no_limit",
- 0xFUL, 0x3FFFFFFFUL)) + 1);
+ (DBUG_IF("innodb_small_log_block_no_limit")
+ ? 0xFUL : 0x3FFFFFFFUL)) + 1);
}
/** Calculate the CRC-32C checksum of a log block.
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index b1c09cfa2bc..6c47c135526 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -88,13 +88,13 @@ void recv_sys_justify_left_parsing_buf();
@param[in] len length of name, in bytes
@param[in] new_name new file name (NULL if not rename)
@param[in] new_len length of new_name, in bytes (0 if NULL) */
-extern void (*log_file_op)(ulint space_id, int type,
+extern void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
/** Report an operation which does INIT_PAGE for page0 during backup.
@param space_id tablespace identifier */
-extern void (*first_page_init)(ulint space_id);
+extern void (*first_page_init)(uint32_t space_id);
/** Stored redo log record */
struct log_rec_t
diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h
index 1b7455c046b..ffc9b85193f 100644
--- a/storage/innobase/include/mtr0mtr.h
+++ b/storage/innobase/include/mtr0mtr.h
@@ -260,10 +260,10 @@ struct mtr_t {
(needed for generating a FILE_MODIFY record)
@param[in] space_id user or system tablespace ID
@return the tablespace */
- fil_space_t* set_named_space_id(ulint space_id)
+ fil_space_t* set_named_space_id(uint32_t space_id)
{
ut_ad(!m_user_space_id);
- ut_d(m_user_space_id = static_cast<uint32_t>(space_id));
+ ut_d(m_user_space_id = space_id);
if (!space_id) {
return fil_system.sys_space;
} else {
@@ -281,7 +281,7 @@ struct mtr_t {
void set_named_space(fil_space_t* space)
{
ut_ad(!m_user_space_id);
- ut_d(m_user_space_id = static_cast<uint32_t>(space->id));
+ ut_d(m_user_space_id = space->id);
if (space->id) {
m_user_space = space;
}
@@ -292,7 +292,7 @@ struct mtr_t {
(needed for generating a FILE_MODIFY record)
@param[in] space tablespace
@return whether the mini-transaction is associated with the space */
- bool is_named_space(ulint space) const;
+ bool is_named_space(uint32_t space) const;
/** Check the tablespace associated with the mini-transaction
(needed for generating a FILE_MODIFY record)
@param[in] space tablespace
@@ -300,10 +300,10 @@ struct mtr_t {
bool is_named_space(const fil_space_t* space) const;
#endif /* UNIV_DEBUG */
- /** Acquire a tablespace X-latch.
- @param[in] space_id tablespace ID
- @return the tablespace object (never NULL) */
- fil_space_t* x_lock_space(ulint space_id);
+ /** Acquire a tablespace X-latch.
+ @param space_id tablespace ID
+ @return the tablespace object (never NULL) */
+ fil_space_t *x_lock_space(uint32_t space_id);
/** Acquire a shared rw-latch. */
void s_lock(
@@ -667,7 +667,7 @@ public:
@param space_id tablespace identifier
@param path file path
@param new_path new file path for type=FILE_RENAME */
- inline void log_file_op(mfile_type_t type, ulint space_id,
+ inline void log_file_op(mfile_type_t type, uint32_t space_id,
const char *path,
const char *new_path= nullptr);
diff --git a/storage/innobase/include/row0merge.h b/storage/innobase/include/row0merge.h
index 52096d48313..9d1d55545ac 100644
--- a/storage/innobase/include/row0merge.h
+++ b/storage/innobase/include/row0merge.h
@@ -24,8 +24,7 @@ Index build routines using a merge sort
Created 13/06/2005 Jan Lindstrom
*******************************************************/
-#ifndef row0merge_h
-#define row0merge_h
+#pragma once
#include "que0types.h"
#include "trx0types.h"
@@ -36,7 +35,8 @@ Created 13/06/2005 Jan Lindstrom
#include "row0mysql.h"
#include "lock0types.h"
#include "srv0srv.h"
-#include "ut0stage.h"
+
+class ut_stage_alter_t;
/* Reserve free space from every block for key_version */
#define ROW_MERGE_RESERVE_SIZE 4
@@ -273,15 +273,16 @@ row_merge_build_indexes(
const col_collations* col_collate)
MY_ATTRIBUTE((warn_unused_result));
-/********************************************************************//**
-Write a buffer to a block. */
-void
-row_merge_buf_write(
-/*================*/
- const row_merge_buf_t* buf, /*!< in: sorted buffer */
- const merge_file_t* of, /*!< in: output file */
- row_merge_block_t* block) /*!< out: buffer for writing to file */
- MY_ATTRIBUTE((nonnull));
+/** Write a buffer to a block.
+@param buf sorted buffer
+@param block buffer for writing to file
+@param blob_file blob file handle for doing bulk insert operation */
+dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
+#ifndef DBUG_OFF
+ const merge_file_t *of, /*!< output file */
+#endif
+ row_merge_block_t *block,
+ merge_file_t *blob_file= nullptr);
/********************************************************************//**
Sort a buffer. */
@@ -416,4 +417,79 @@ row_merge_read_rec(
row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
ulint space) /*!< in: space id */
MY_ATTRIBUTE((warn_unused_result));
-#endif /* row0merge.h */
+
+/** Buffer for bulk insert */
+class row_merge_bulk_t
+{
+ /** Buffer for each index in the table. main memory
+ buffer for sorting the index */
+ row_merge_buf_t *m_merge_buf;
+ /** Block for IO operation */
+ row_merge_block_t *m_block= nullptr;
+ /** File to store the buffer and used for merge sort */
+ merge_file_t *m_merge_files= nullptr;
+ /** Temporary file to be used for merge sort */
+ pfs_os_file_t m_tmpfd;
+ /** Allocate memory for merge file data structure */
+ ut_allocator<row_merge_block_t> m_alloc;
+ /** Storage for description for the m_alloc */
+ ut_new_pfx_t m_block_pfx;
+ /** Temporary file to store the blob */
+ merge_file_t m_blob_file;
+ /** Storage for description for the crypt_block */
+ ut_new_pfx_t m_crypt_pfx;
+ /** Block for encryption */
+ row_merge_block_t *m_crypt_block= nullptr;
+public:
+ /** Constructor.
+ Create all merge files, merge buffer for all the table indexes
+ expect fts indexes.
+ Create a merge block which is used to write IO operation
+ @param table table which undergoes bulk insert operation */
+ row_merge_bulk_t(dict_table_t *table);
+
+ /** Destructor.
+ Remove all merge files, merge buffer for all table indexes. */
+ ~row_merge_bulk_t();
+
+ /** Remove all buffer for the table indexes */
+ void remove_all_bulk_buffer();
+
+ /** Clean the merge buffer for the given index number */
+ void clean_bulk_buffer(ulint index_no);
+
+ /** Create the temporary file for the given index number
+ @retval true if temporary file creation went well */
+ bool create_tmp_file(ulint index_no);
+
+ /** Write the merge buffer to the tmp file for the given
+ index number.
+ @param index_no buffer to be written for the index */
+ dberr_t write_to_tmp_file(ulint index_no);
+
+ /** Add the tuple to the merge buffer for the given index.
+ If the buffer ran out of memory then write the buffer into
+ the temporary file and do insert the tuple again.
+ @param row tuple to be inserted
+ @param ind index to be buffered
+ @param trx bulk transaction */
+ dberr_t bulk_insert_buffered(const dtuple_t &row, const dict_index_t &ind,
+ trx_t *trx);
+
+ /** Do bulk insert operation into the index tree from
+ buffer or merge file if exists
+ @param index_no index to be inserted
+ @param trx bulk transaction */
+ dberr_t write_to_index(ulint index_no, trx_t *trx);
+
+ /** Do bulk insert for the buffered insert for the table.
+ @param table table which undergoes for bulk insert operation
+ @param trx bulk transaction */
+ dberr_t write_to_table(dict_table_t *table, trx_t *trx);
+
+ /** Allocate block for writing the buffer into disk */
+ dberr_t alloc_block();
+
+ /** Init temporary files for each index */
+ void init_tmp_file();
+};
diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
index ad892ac9ae9..4cd77b08a60 100644
--- a/storage/innobase/include/srv0srv.h
+++ b/storage/innobase/include/srv0srv.h
@@ -254,12 +254,12 @@ extern bool srv_was_started;
extern char* srv_undo_dir;
/** Number of undo tablespaces to use. */
-extern ulong srv_undo_tablespaces;
+extern uint srv_undo_tablespaces;
/** The number of UNDO tablespaces that are active (hosting some rollback
segment). It is quite possible that some of the tablespaces doesn't host
any of the rollback-segment based on configuration used. */
-extern ulint srv_undo_tablespaces_active;
+extern uint32_t srv_undo_tablespaces_active;
/** Maximum size of undo tablespace. */
extern unsigned long long srv_max_undo_log_size;
diff --git a/storage/innobase/include/trx0rec.h b/storage/innobase/include/trx0rec.h
index 58ec5ab1707..bb348d7ef8b 100644
--- a/storage/innobase/include/trx0rec.h
+++ b/storage/innobase/include/trx0rec.h
@@ -173,7 +173,7 @@ trx_undo_report_row_operation(
const rec_offs* offsets, /*!< in: rec_get_offsets(rec) */
roll_ptr_t* roll_ptr) /*!< out: DB_ROLL_PTR to the
undo log record */
- MY_ATTRIBUTE((nonnull(1,2,8), warn_unused_result));
+ MY_ATTRIBUTE((nonnull(1,2), warn_unused_result));
/** status bit used for trx_undo_prev_version_build() */
diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h
index ad941b89691..0450be89cfb 100644
--- a/storage/innobase/include/trx0trx.h
+++ b/storage/innobase/include/trx0trx.h
@@ -36,6 +36,7 @@ Created 3/26/1996 Heikki Tuuri
#include "fts0fts.h"
#include "read0types.h"
#include "ilist.h"
+#include "row0merge.h"
#include <vector>
@@ -433,6 +434,11 @@ class trx_mod_table_time_t
/** Whether the modified table is a FTS auxiliary table */
bool fts_aux_table= false;
#endif /* UNIV_DEBUG */
+
+ /** Buffer to store insert opertion */
+ row_merge_bulk_t *bulk_store= nullptr;
+
+ friend struct trx_t;
public:
/** Constructor
@param rows number of modified rows so far */
@@ -466,8 +472,14 @@ public:
first_versioned= BULK;
}
- /** Notify the start of a bulk insert operation */
- void start_bulk_insert() { first|= BULK; }
+ /** Notify the start of a bulk insert operation
+ @param table table to do bulk operation */
+ void start_bulk_insert(dict_table_t *table)
+ {
+ first|= BULK;
+ if (!table->is_temporary())
+ bulk_store= new row_merge_bulk_t(table);
+ }
/** Notify the end of a bulk insert operation */
void end_bulk_insert() { first&= ~BULK; }
@@ -493,6 +505,33 @@ public:
bool is_aux_table() const { return fts_aux_table; }
#endif /* UNIV_DEBUG */
+
+ /** @return the first undo record that modified the table */
+ undo_no_t get_first() const
+ {
+ ut_ad(valid());
+ return LIMIT & first;
+ }
+
+ /** Add the tuple to the transaction bulk buffer for the given index.
+ @param entry tuple to be inserted
+ @param index bulk insert for the index
+ @param trx transaction */
+ dberr_t bulk_insert_buffered(const dtuple_t &entry,
+ const dict_index_t &index, trx_t *trx)
+ {
+ return bulk_store->bulk_insert_buffered(entry, index, trx);
+ }
+
+ /** Do bulk insert operation present in the buffered operation
+ @return DB_SUCCESS or error code */
+ dberr_t write_bulk(dict_table_t *table, trx_t *trx);
+
+ /** @return whether the buffer storage exist */
+ bool bulk_buffer_exist() const
+ {
+ return bulk_store && is_bulk_insert();
+ }
};
/** Collection of persistent tables and their first modification
@@ -1110,7 +1149,32 @@ public:
return false;
}
+ /** @return logical modification time of a table only
+ if the table has bulk buffer exist in the transaction */
+ trx_mod_table_time_t *check_bulk_buffer(dict_table_t *table)
+ {
+ if (UNIV_LIKELY(!bulk_insert))
+ return nullptr;
+ ut_ad(!check_unique_secondary);
+ ut_ad(!check_foreigns);
+ auto it= mod_tables.find(table);
+ if (it == mod_tables.end() || !it->second.bulk_buffer_exist())
+ return nullptr;
+ return &it->second;
+ }
+
+ /** Do the bulk insert for the buffered insert operation
+ for the transaction.
+ @return DB_SUCCESS or error code */
+ dberr_t bulk_insert_apply()
+ {
+ return UNIV_UNLIKELY(bulk_insert) ? bulk_insert_apply_low(): DB_SUCCESS;
+ }
+
private:
+ /** Apply the buffered bulk inserts. */
+ dberr_t bulk_insert_apply_low();
+
/** Assign a rollback segment for modifying temporary tables.
@return the assigned rollback segment */
trx_rseg_t *assign_temp_rseg();
diff --git a/storage/innobase/include/trx0types.h b/storage/innobase/include/trx0types.h
index 07c1c6a756b..d6ce902977c 100644
--- a/storage/innobase/include/trx0types.h
+++ b/storage/innobase/include/trx0types.h
@@ -38,7 +38,7 @@ the terminating NUL character. */
static const ulint TRX_ID_MAX_LEN = 17;
/** Space id of the transaction system page (the system tablespace) */
-static const ulint TRX_SYS_SPACE = 0;
+static constexpr uint32_t TRX_SYS_SPACE= 0;
/** Page number of the transaction system page */
#define TRX_SYS_PAGE_NO FSP_TRX_SYS_PAGE_NO
diff --git a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
index c5f62f6cf57..7ff8eb56068 100644
--- a/storage/innobase/include/univ.i
+++ b/storage/innobase/include/univ.i
@@ -206,36 +206,6 @@ management to ensure correct alignment for doubles etc. */
========================
*/
-#ifdef HAVE_LZO
-#define IF_LZO(A,B) A
-#else
-#define IF_LZO(A,B) B
-#endif
-
-#ifdef HAVE_LZ4
-#define IF_LZ4(A,B) A
-#else
-#define IF_LZ4(A,B) B
-#endif
-
-#ifdef HAVE_LZMA
-#define IF_LZMA(A,B) A
-#else
-#define IF_LZMA(A,B) B
-#endif
-
-#ifdef HAVE_BZIP2
-#define IF_BZIP2(A,B) A
-#else
-#define IF_BZIP2(A,B) B
-#endif
-
-#ifdef HAVE_SNAPPY
-#define IF_SNAPPY(A,B) A
-#else
-#define IF_SNAPPY(A,B) B
-#endif
-
#if defined (HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE) || defined(_WIN32)
#define IF_PUNCH_HOLE(A,B) A
#else
@@ -505,7 +475,7 @@ it is read or written. */
#include "ut0lst.h"
#include "ut0ut.h"
-extern ulong srv_page_size_shift;
+extern uint32_t srv_page_size_shift;
extern ulong srv_page_size;
/* Dimension of spatial object we support so far. It has its root in
diff --git a/storage/innobase/include/ut0pool.h b/storage/innobase/include/ut0pool.h
index 63628cc169f..aa0cfb9e060 100644
--- a/storage/innobase/include/ut0pool.h
+++ b/storage/innobase/include/ut0pool.h
@@ -304,12 +304,9 @@ private:
pool = UT_NEW_NOKEY(PoolType(m_size));
if (pool != NULL) {
-
- ut_ad(n_pools <= m_pools.size());
-
m_pools.push_back(pool);
- ib::info() << "Number of pools: "
+ ib::info() << "Number of transaction pools: "
<< m_pools.size();
added = true;
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index b0651d8b8da..deda40fd924 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -608,10 +608,10 @@ struct file_name_t {
/** Map of dirty tablespaces during recovery */
typedef std::map<
- ulint,
+ uint32_t,
file_name_t,
- std::less<ulint>,
- ut_allocator<std::pair<const ulint, file_name_t> > > recv_spaces_t;
+ std::less<uint32_t>,
+ ut_allocator<std::pair<const uint32_t, file_name_t> > > recv_spaces_t;
static recv_spaces_t recv_spaces;
@@ -1033,11 +1033,11 @@ fail:
@param[in] len length of name, in bytes
@param[in] new_name new file name (NULL if not rename)
@param[in] new_len length of new_name, in bytes (0 if NULL) */
-void (*log_file_op)(ulint space_id, int type,
+void (*log_file_op)(uint32_t space_id, int type,
const byte* name, ulint len,
const byte* new_name, ulint new_len);
-void (*first_page_init)(ulint space_id);
+void (*first_page_init)(uint32_t space_id);
/** Information about initializing page contents during redo log processing.
FIXME: Rely on recv_sys.pages! */
@@ -1301,10 +1301,15 @@ same_space:
f.name = fname.name;
f.status = file_name_t::NORMAL;
} else {
- ib::error() << "Tablespace " << space_id
- << " has been found in two places: '"
- << f.name << "' and '" << name << "'."
- " You must delete one of them.";
+ sql_print_error("InnoDB: Tablespace " UINT32PF
+ " has been found"
+ " in two places:"
+ " '%.*s' and '%s'."
+ " You must delete"
+ " one of them.",
+ space_id,
+ int(f.name.size()),
+ f.name.data(), name);
recv_sys.set_corrupt_fs();
}
break;
@@ -1327,10 +1332,12 @@ same_space:
Enable some more diagnostics when
forcing recovery. */
- ib::info()
- << "At LSN: " << recv_sys.recovered_lsn
- << ": unable to open file " << name
- << " for tablespace " << space_id;
+ sql_print_information(
+ "InnoDB: At LSN: " LSN_PF
+ ": unable to open file %s"
+ " for tablespace " UINT32PF,
+ recv_sys.recovered_lsn,
+ name, space_id);
}
break;
@@ -1634,10 +1641,11 @@ fail:
}
if (recv_sys.report(time(NULL))) {
- ib::info() << "Read redo log up to LSN=" << *start_lsn;
- service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
- "Read redo log up to LSN=" LSN_PF,
- *start_lsn);
+ sql_print_information("InnoDB: Read redo log up to LSN="
+ LSN_PF, *start_lsn);
+ service_manager_extend_timeout(
+ INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "Read redo log up to LSN=" LSN_PF, *start_lsn);
}
if (*start_lsn != end_lsn) {
@@ -1708,9 +1716,9 @@ static bool redo_file_sizes_are_correct()
if (it == paths.end())
return true;
- ib::error() << "Log file " << *it << " is of different size "
- << get_size(*it) << " bytes than other log files " << size
- << " bytes!";
+ sql_print_error("InnoDB: Log file %.*s is of different size " UINT64PF
+ " bytes than other log files " UINT64PF " bytes!",
+ int(it->size()), it->data(), get_size(*it), size);
return false;
}
@@ -1889,13 +1897,11 @@ static dberr_t recv_log_recover_10_4()
ulint cksum = log_block_get_checksum(buf);
if (UNIV_UNLIKELY(crc != cksum)) {
- ib::error() << "Invalid log block checksum."
- << " block: "
- << log_block_get_hdr_no(buf)
- << " checkpoint no: "
- << log_block_get_checkpoint_no(buf)
- << " expected: " << crc
- << " found: " << cksum;
+ sql_print_error("InnoDB: Invalid log block checksum."
+ " block: " ULINTPF " checkpoint no: " ULINTPF
+ " expected: " ULINTPF " found: " ULINTPF,
+ log_block_get_hdr_no(buf),
+ log_block_get_checkpoint_no(buf), crc, cksum);
return DB_CORRUPTION;
}
@@ -2023,7 +2029,7 @@ recv_find_max_checkpoint(ulint* max_field)
if (*max_field == 0) {
/* Before 10.2.2, we could get here during database
- initialization if we created an LOG_FILE_NAME file that
+ initialization if we created an ib_logfile0 file that
was filled with zeroes, and were killed. After
10.2.2, we would reject such a file already earlier,
when checking the file header. */
@@ -2235,17 +2241,19 @@ loop:
goto eom_found;
if (UNIV_LIKELY((*l & 0x70) != RESERVED));
else if (srv_force_recovery)
- ib::warn() << "Ignoring unknown log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring unknown log record at LSN " LSN_PF,
+ recovered_lsn);
else
{
malformed:
- ib::error() << "Malformed log record;"
- " set innodb_force_recovery=1 to ignore.";
+ sql_print_error("InnoDB: Malformed log record;"
+ " set innodb_force_recovery=1 to ignore.");
corrupted:
const size_t trailing_bytes= std::min<size_t>(100, size_t(end - l));
- ib::info() << "Dump from the start of the mini-transaction (LSN="
- << start_lsn << ") to "
- << trailing_bytes << " bytes after the record:";
+ sql_print_information("InnoDB: Dump from the start of the"
+ " mini-transaction (LSN=" LSN_PF ") to %zu"
+ " bytes after the record:",
+ start_lsn, trailing_bytes);
ut_print_buf(stderr, log, l - log + trailing_bytes);
putc('\n', stderr);
found_corrupt_log= true;
@@ -2262,7 +2270,7 @@ corrupted:
const uint32_t addlen= mlog_decode_varint(l);
if (UNIV_UNLIKELY(addlen == MLOG_DECODE_ERROR))
{
- ib::error() << "Corrupted record length";
+ sql_print_error("InnoDB: Corrupted record length");
goto corrupted;
}
rlen= addlen + 15;
@@ -2326,7 +2334,8 @@ record_corrupted:
/* FREE_PAGE,INIT_PAGE cannot be with same_page flag */
if (!srv_force_recovery)
goto malformed;
- ib::warn() << "Ignoring malformed log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring malformed log record at LSN "
+ LSN_PF, recovered_lsn);
last_offset= 1; /* the next record must not be same_page */
continue;
}
@@ -2339,12 +2348,13 @@ record_corrupted:
page_id_corrupted:
if (!srv_force_recovery)
{
- ib::error() << "Corrupted page identifier at " << recovered_lsn
- << "; set innodb_force_recovery=1 to ignore the record.";
+ sql_print_error("InnoDB: Corrupted page identifier at " LSN_PF
+ "; set innodb_force_recovery=1 to ignore the record.",
+ recovered_lsn);
goto corrupted;
}
- ib::warn() << "Ignoring corrupted page identifier at LSN "
- << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring corrupted page identifier at LSN "
+ LSN_PF, recovered_lsn);
continue;
}
space_id= mlog_decode_varint(l);
@@ -2605,7 +2615,8 @@ same_page:
default:
if (!srv_force_recovery)
goto malformed;
- ib::warn() << "Ignoring malformed log record at LSN " << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring malformed log record at LSN "
+ LSN_PF, recovered_lsn);
continue;
case FILE_DELETE:
case FILE_MODIFY:
@@ -2615,13 +2626,13 @@ same_page:
file_rec_error:
if (!srv_force_recovery)
{
- ib::error() << "Corrupted file-level record;"
- " set innodb_force_recovery=1 to ignore.";
+ sql_print_error("InnoDB: Corrupted file-level record;"
+ " set innodb_force_recovery=1 to ignore.");
goto corrupted;
}
- ib::warn() << "Ignoring corrupted file-level record at LSN "
- << recovered_lsn;
+ sql_print_warning("InnoDB: Ignoring corrupted file-level record"
+ " at LSN " LSN_PF, recovered_lsn);
continue;
}
/* fall through */
@@ -2778,12 +2789,13 @@ static buf_block_t *recv_recover_page(buf_block_t *block, mtr_t &mtr,
if (skipped_after_init) {
skipped_after_init = false;
ut_ad(end_lsn == page_lsn);
- if (end_lsn != page_lsn)
- ib::warn()
- << "The last skipped log record LSN "
- << end_lsn
- << " is not equal to page LSN "
- << page_lsn;
+ if (end_lsn != page_lsn) {
+ sql_print_warning(
+ "InnoDB: The last skipped log record"
+ " LSN " LSN_PF
+ " is not equal to page LSN " LSN_PF,
+ end_lsn, page_lsn);
+ }
}
end_lsn = l->lsn;
@@ -2930,10 +2942,12 @@ done:
ut_ad(!block || !recv_sys.pages.empty());
if (recv_sys.report(now)) {
- const ulint n = recv_sys.pages.size();
- ib::info() << "To recover: " << n << " pages from log";
- service_manager_extend_timeout(
- INNODB_EXTEND_TIMEOUT_INTERVAL, "To recover: " ULINTPF " pages from log", n);
+ const size_t n = recv_sys.pages.size();
+ sql_print_information("InnoDB: To recover: %zu pages from log",
+ n);
+ service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL,
+ "To recover: %zu pages"
+ " from log", n);
}
return block;
@@ -3061,7 +3075,7 @@ static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i)
if (p != page_nos)
{
mysql_mutex_unlock(&recv_sys.mutex);
- buf_read_recv_pages(page_id.space(), page_nos, ulint(p - page_nos));
+ buf_read_recv_pages(page_id.space(), {page_nos, p});
mysql_mutex_lock(&recv_sys.mutex);
}
}
@@ -3257,8 +3271,8 @@ void recv_sys_t::apply(bool last_batch)
const char *msg= last_batch
? "Starting final batch to recover "
: "Starting a batch to recover ";
- const ulint n= pages.size();
- ib::info() << msg << n << " pages from redo log.";
+ const size_t n= pages.size();
+ sql_print_information("InnoDB: %s %zu pages from redo log.", msg, n);
sd_notifyf(0, "STATUS=%s" ULINTPF " pages from redo log", msg, n);
apply_log_recs= true;
@@ -3380,7 +3394,8 @@ next_free_block:
continue;
}
if (is_corrupt_fs() && !srv_force_recovery)
- ib::info() << "Set innodb_force_recovery=1 to ignore corrupted pages.";
+ sql_print_information("InnoDB: Set innodb_force_recovery=1"
+ " to ignore corrupted pages.");
mysql_mutex_unlock(&mutex);
return;
}
@@ -3625,14 +3640,18 @@ static bool recv_scan_log_recs(
recv_needed_recovery = true;
if (srv_read_only_mode) {
- ib::warn() << "innodb_read_only"
- " prevents crash recovery";
+ sql_print_warning(
+ "InnoDB: innodb_read_only"
+ " prevents crash recovery");
return(true);
}
- ib::info() << "Starting crash recovery from"
- " checkpoint LSN=" << checkpoint_lsn
- << "," << recv_sys.scanned_lsn;
+ sql_print_information("InnoDB: Starting"
+ " crash recovery from"
+ " checkpoint LSN=" LSN_PF
+ "," LSN_PF,
+ checkpoint_lsn,
+ recv_sys.scanned_lsn);
}
/* We were able to find more log data: add it to the
@@ -3646,15 +3665,17 @@ static bool recv_scan_log_recs(
if (recv_sys.len + 4 * OS_FILE_LOG_BLOCK_SIZE
>= recv_parsing_buf_size) {
- ib::error() << "Log parsing buffer overflow."
- " Recovery may have failed!";
+ sql_print_error("InnoDB: Log parsing buffer"
+ " overflow."
+ " Recovery may have failed!");
recv_sys.set_corrupt_log();
if (!srv_force_recovery) {
- ib::error()
- << "Set innodb_force_recovery"
- " to ignore this error.";
+ sql_print_information(
+ "InnoDB: Set"
+ " innodb_force_recovery"
+ " to ignore this error.");
return(true);
}
} else if (!recv_sys.is_corrupt_log()) {
@@ -3801,29 +3822,38 @@ recv_init_missing_space(dberr_t err, const recv_spaces_t::const_iterator& i)
case SRV_OPERATION_RESTORE:
case SRV_OPERATION_RESTORE_EXPORT:
if (i->second.name.find("/#sql") != std::string::npos) {
- ib::warn() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << " when"
- " restoring a (partial?) backup. All redo log"
- " for this file will be ignored!";
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s when"
+ " restoring a (partial?) backup."
+ " All redo log"
+ " for this file will be ignored!",
+ i->first, int(i->second.name.size()),
+ i->second.name.data());
}
return(err);
}
if (srv_force_recovery == 0) {
- ib::error() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << ".";
+ sql_print_error("InnoDB: Tablespace " UINT32PF " was not"
+ " found at %.*s.", i->first,
+ int(i->second.name.size()),
+ i->second.name.data());
if (err == DB_SUCCESS) {
- ib::error() << "Set innodb_force_recovery=1 to"
+ sql_print_information(
+ "InnoDB: Set innodb_force_recovery=1 to"
" ignore this and to permanently lose"
- " all changes to the tablespace.";
+ " all changes to the tablespace.");
err = DB_TABLESPACE_NOT_FOUND;
}
} else {
- ib::warn() << "Tablespace " << i->first << " was not"
- " found at " << i->second.name << ", and"
- " innodb_force_recovery was set. All redo log"
- " for this tablespace will be ignored!";
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s"
+ ", and innodb_force_recovery was set."
+ " All redo log for this tablespace"
+ " will be ignored!",
+ i->first, int(i->second.name.size()),
+ i->second.name.data());
}
return(err);
@@ -3846,7 +3876,7 @@ recv_validate_tablespace(bool rescan, bool& missing_tablespace)
for (recv_sys_t::map::iterator p = recv_sys.pages.begin();
p != recv_sys.pages.end();) {
ut_ad(!p->second.log.empty());
- const ulint space = p->first.space();
+ const uint32_t space = p->first.space();
if (is_predefined_tablespace(space)) {
next:
p++;
@@ -3898,20 +3928,25 @@ func_exit:
missing_tablespace = true;
- if (srv_force_recovery > 0) {
- ib::warn() << "Tablespace " << rs.first
- <<" was not found at " << rs.second.name
- <<", and innodb_force_recovery was set."
- <<" All redo log for this tablespace"
- <<" will be ignored!";
+ if (srv_force_recovery) {
+ sql_print_warning("InnoDB: Tablespace " UINT32PF
+ " was not found at %.*s,"
+ " and innodb_force_recovery was set."
+ " All redo log for this tablespace"
+ " will be ignored!",
+ rs.first, int(rs.second.name.size()),
+ rs.second.name.data());
continue;
}
if (!rescan) {
- ib::info() << "Tablespace " << rs.first
- << " was not found at '"
- << rs.second.name << "', but there"
- <<" were no modifications either.";
+ sql_print_information("InnoDB: Tablespace " UINT32PF
+ " was not found at '%.*s',"
+ " but there were"
+ " no modifications either.",
+ rs.first,
+ int(rs.second.name.size()),
+ rs.second.name.data());
}
}
@@ -3960,9 +3995,10 @@ recv_init_crash_recovery_spaces(bool rescan, bool& missing_tablespace)
std::move(rs.second.freed_ranges));
}
} else if (rs.second.name == "") {
- ib::error() << "Missing FILE_CREATE, FILE_DELETE"
- " or FILE_MODIFY before FILE_CHECKPOINT"
- " for tablespace " << rs.first;
+ sql_print_error("InnoDB: Missing FILE_CREATE,"
+ " FILE_DELETE or FILE_MODIFY"
+ " before FILE_CHECKPOINT"
+ " for tablespace " UINT32PF, rs.first);
recv_sys.set_corrupt_log();
return(DB_CORRUPTION);
} else {
@@ -4019,18 +4055,19 @@ static dberr_t recv_rename_files()
only be possible if the recovery of both files was deferred
(no valid page 0 is contained in either file). We shall not
rename the file, just rename the metadata. */
- ib::info() << "Renaming tablespace metadata " << id
- << " from '" << old << "' to '" << r.second
- << "' that is also associated with tablespace "
- << other->id;
+ sql_print_information("InnoDB: Renaming tablespace metadata " UINT32PF
+ " from '%s' to '%s' that is also associated"
+ " with tablespace " UINT32PF,
+ id, old, new_name, other->id);
space->chain.start->name= mem_strdup(new_name);
ut_free(old);
}
else if (!os_file_status(new_name, &exists, &ftype) || exists)
{
- ib::error() << "Cannot replay rename of tablespace " << id
- << " from '" << old << "' to '" << r.second <<
- (exists ? "' because the target file exists" : "'");
+ sql_print_error("InnoDB: Cannot replay rename of tablespace " UINT32PF
+ " from '%s' to '%s'%s",
+ id, old, new_name, exists ?
+ " because the target file exists" : "");
err= DB_TABLESPACE_EXISTS;
}
else
@@ -4038,8 +4075,8 @@ static dberr_t recv_rename_files()
mysql_mutex_unlock(&fil_system.mutex);
err= space->rename(new_name, false);
if (err != DB_SUCCESS)
- ib::error() << "Cannot replay rename of tablespace " << id
- << " to '" << r.second << "': " << err;
+ sql_print_error("InnoDB: Cannot replay rename of tablespace "
+ UINT32PF " to '%s: %s", new_name, ut_strerr(err));
goto done;
}
mysql_mutex_unlock(&fil_system.mutex);
@@ -4080,9 +4117,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
ut_d(mysql_mutex_unlock(&buf_pool.flush_list_mutex));
if (srv_force_recovery >= SRV_FORCE_NO_LOG_REDO) {
-
- ib::info() << "innodb_force_recovery=6 skips redo log apply";
-
+ sql_print_information("InnoDB: innodb_force_recovery=6"
+ " skips redo log apply");
return(DB_SUCCESS);
}
@@ -4093,7 +4129,6 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
err = recv_find_max_checkpoint(&max_cp_field);
if (err != DB_SUCCESS) {
-
recv_sys.recovered_lsn = log_sys.get_lsn();
mysql_mutex_unlock(&log_sys.mutex);
return(err);
@@ -4154,7 +4189,8 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
if (recv_sys.is_corrupt_log() && !srv_force_recovery) {
mysql_mutex_unlock(&log_sys.mutex);
- ib::warn() << "Log scan aborted at LSN " << contiguous_lsn;
+ sql_print_warning("InnoDB: Log scan aborted at LSN " LSN_PF,
+ contiguous_lsn);
return(DB_ERROR);
}
@@ -4162,13 +4198,11 @@ recv_recovery_from_checkpoint_start(lsn_t flush_lsn)
lsn_t scan_lsn = log_sys.log.scanned_lsn;
if (!srv_read_only_mode && scan_lsn != checkpoint_lsn) {
mysql_mutex_unlock(&log_sys.mutex);
- ib::error err;
- err << "Missing FILE_CHECKPOINT";
- if (end_lsn) {
- err << " at " << end_lsn;
- }
- err << " between the checkpoint " << checkpoint_lsn
- << " and the end " << scan_lsn << ".";
+ sql_print_error("InnoDB: Missing FILE_CHECKPOINT"
+ " at " LSN_PF
+ " between the checkpoint " LSN_PF
+ " and the end " LSN_PF ".",
+ end_lsn, checkpoint_lsn, scan_lsn);
return(DB_ERROR);
}
@@ -4198,29 +4232,26 @@ completed:
ut_ad(!srv_log_file_created);
if (checkpoint_lsn + sizeof_checkpoint < flush_lsn) {
- ib::warn()
- << "Are you sure you are using the right "
- << LOG_FILE_NAME
- << " to start up the database? Log sequence "
- "number in the "
- << LOG_FILE_NAME << " is " << checkpoint_lsn
- << ", less than the log sequence number in "
- "the first system tablespace file header, "
- << flush_lsn << ".";
+ sql_print_warning("InnoDB: Are you sure you are using"
+ " the right ib_logfile0"
+ " to start up the database?"
+ " The checkpoint is " LSN_PF
+ ", less than the"
+ " log sequence number " LSN_PF
+ " in the system tablespace.",
+ checkpoint_lsn, flush_lsn);
}
if (!recv_needed_recovery) {
-
- ib::info()
- << "The log sequence number " << flush_lsn
- << " in the system tablespace does not match"
- " the log sequence number "
- << checkpoint_lsn << " in the "
- << LOG_FILE_NAME << "!";
+ sql_print_information(
+ "InnoDB: The log sequence number " LSN_PF
+ " in the system tablespace does not match"
+ " the log checkpoint " LSN_PF
+ " in ib_logfile0!", flush_lsn, checkpoint_lsn);
if (srv_read_only_mode) {
- ib::error() << "innodb_read_only"
- " prevents crash recovery";
+ sql_print_error("InnoDB: innodb_read_only"
+ " prevents crash recovery");
mysql_mutex_unlock(&log_sys.mutex);
return(DB_READ_ONLY);
}
@@ -4310,21 +4341,20 @@ completed:
&& (log_sys.log.scanned_lsn < checkpoint_lsn
|| log_sys.log.scanned_lsn < recv_max_page_lsn)) {
- ib::error() << "We scanned the log up to "
- << log_sys.log.scanned_lsn
- << ". A checkpoint was at " << checkpoint_lsn << " and"
- " the maximum LSN on a database page was "
- << recv_max_page_lsn << ". It is possible that the"
- " database is now corrupt!";
+ sql_print_error("InnoDB: We scanned the log up to " LSN_PF "."
+ " A checkpoint was at " LSN_PF
+ " and the maximum LSN on a database page was "
+ LSN_PF ". It is possible that the"
+ " database is now corrupt!",
+ log_sys.log.scanned_lsn, checkpoint_lsn,
+ recv_max_page_lsn);
}
if (recv_sys.recovered_lsn < checkpoint_lsn) {
mysql_mutex_unlock(&log_sys.mutex);
-
- ib::error() << "Recovered only to lsn:"
- << recv_sys.recovered_lsn
- << " checkpoint_lsn: " << checkpoint_lsn;
-
+ sql_print_error("InnoDB: Recovered only to lsn: " LSN_PF
+ " checkpoint_lsn: " LSN_PF,
+ recv_sys.recovered_lsn, checkpoint_lsn);
return(DB_ERROR);
}
@@ -4385,11 +4415,11 @@ bool recv_dblwr_t::validate_page(const page_id_t page_id,
{
if (page_id.page_no() == 0)
{
- ulint flags= fsp_header_get_flags(page);
+ uint32_t flags= fsp_header_get_flags(page);
if (!fil_space_t::is_valid_flags(flags, page_id.space()))
{
- ulint cflags= fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED)
+ uint32_t cflags= fsp_flags_convert_from_101(flags);
+ if (cflags == UINT32_MAX)
{
ib::warn() << "Ignoring a doublewrite copy of page " << page_id
<< "due to invalid flags " << ib::hex(flags);
diff --git a/storage/innobase/lz4.cmake b/storage/innobase/lz4.cmake
deleted file mode 100644
index a908dd3b73e..00000000000
--- a/storage/innobase/lz4.cmake
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. 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 the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZ4 AUTO CACHE STRING
- "Build with lz4. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZ4)
- IF (WITH_INNODB_LZ4 STREQUAL "ON" OR WITH_INNODB_LZ4 STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lz4.h HAVE_LZ4_H)
- CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_limitedOutput "" HAVE_LZ4_SHARED_LIB)
- CHECK_LIBRARY_EXISTS(lz4 LZ4_compress_default "" HAVE_LZ4_COMPRESS_DEFAULT)
-
- IF (HAVE_LZ4_SHARED_LIB AND HAVE_LZ4_H)
- SET(HAVE_INNODB_LZ4 TRUE)
- ADD_DEFINITIONS(-DHAVE_LZ4=1)
- IF (HAVE_LZ4_COMPRESS_DEFAULT)
- ADD_DEFINITIONS(-DHAVE_LZ4_COMPRESS_DEFAULT=1)
- ENDIF()
- LINK_LIBRARIES(lz4)
- ELSE()
- IF (WITH_INNODB_LZ4 STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lz4 library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZ4 HAVE_INNODB_LZ4 "LZ4 compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/lzma.cmake b/storage/innobase/lzma.cmake
deleted file mode 100644
index 3060139c27c..00000000000
--- a/storage/innobase/lzma.cmake
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. 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 the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZMA AUTO CACHE STRING
- "Build with lzma. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZMA)
- IF (WITH_INNODB_LZMA STREQUAL "ON" OR WITH_INNODB_LZMA STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lzma.h HAVE_LZMA_H)
- CHECK_LIBRARY_EXISTS(lzma lzma_stream_buffer_decode "" HAVE_LZMA_DECODE)
- CHECK_LIBRARY_EXISTS(lzma lzma_easy_buffer_encode "" HAVE_LZMA_ENCODE)
-
- IF (HAVE_LZMA_DECODE AND HAVE_LZMA_ENCODE AND HAVE_LZMA_H)
- SET(HAVE_INNODB_LZMA TRUE)
- ADD_DEFINITIONS(-DHAVE_LZMA=1)
- LINK_LIBRARIES(lzma)
- ELSE()
- IF (WITH_INNODB_LZMA STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lzma library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZMA HAVE_INNODB_LZMA "LZMA compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/lzo.cmake b/storage/innobase/lzo.cmake
deleted file mode 100644
index ca2de6ab1c5..00000000000
--- a/storage/innobase/lzo.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2014, SkySQL Ab. 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 the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_LZO AUTO CACHE STRING
- "Build with lzo. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_LZO)
- IF (WITH_INNODB_LZO STREQUAL "ON" OR WITH_INNODB_LZO STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
- CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB)
-
- IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H)
- SET(HAVE_INNODB_LZO TRUE)
- ADD_DEFINITIONS(-DHAVE_LZO=1)
- LINK_LIBRARIES(lzo2)
- ELSE()
- IF (WITH_INNODB_LZO STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required lzo library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_LZO HAVE_INNODB_LZO "LZO compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc
index 6f4a4ab9353..4626957b55d 100644
--- a/storage/innobase/mtr/mtr0mtr.cc
+++ b/storage/innobase/mtr/mtr0mtr.cc
@@ -477,7 +477,7 @@ void mtr_t::commit_files(lsn_t checkpoint_lsn)
@param[in] space tablespace
@return whether the mini-transaction is associated with the space */
bool
-mtr_t::is_named_space(ulint space) const
+mtr_t::is_named_space(uint32_t space) const
{
ut_ad(!m_user_space || m_user_space->id != TRX_SYS_SPACE);
return !is_logged() || m_user_space_id == space ||
@@ -499,8 +499,7 @@ bool mtr_t::is_named_space(const fil_space_t* space) const
/** Acquire a tablespace X-latch.
@param[in] space_id tablespace ID
@return the tablespace object (never NULL) */
-fil_space_t*
-mtr_t::x_lock_space(ulint space_id)
+fil_space_t *mtr_t::x_lock_space(uint32_t space_id)
{
fil_space_t* space;
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index 44783f72972..5cbf5803577 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -4105,14 +4105,14 @@ corrupted:
FSP_HEADER_OFFSET + FSP_SPACE_ID + page, 4)
? ULINT_UNDEFINED
: mach_read_from_4(FIL_PAGE_SPACE_ID + page);
- ulint flags= fsp_header_get_flags(page);
+ uint32_t flags= fsp_header_get_flags(page);
const uint32_t size= fsp_header_get_field(page, FSP_SIZE);
const uint32_t free_limit= fsp_header_get_field(page, FSP_FREE_LIMIT);
const uint32_t free_len= flst_get_len(FSP_HEADER_OFFSET + FSP_FREE + page);
if (!fil_space_t::is_valid_flags(flags, space->id))
{
- ulint cflags= fsp_flags_convert_from_101(flags);
- if (cflags == ULINT_UNDEFINED)
+ uint32_t cflags= fsp_flags_convert_from_101(flags);
+ if (cflags == UINT32_MAX)
{
invalid:
ib::error() << "Expected tablespace flags "
@@ -4122,8 +4122,8 @@ invalid:
goto corrupted;
}
- ulint cf= cflags & ~FSP_FLAGS_MEM_MASK;
- ulint sf= space->flags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t cf= cflags & ~FSP_FLAGS_MEM_MASK;
+ uint32_t sf= space->flags & ~FSP_FLAGS_MEM_MASK;
if (!fil_space_t::is_flags_equal(cf, sf) &&
!fil_space_t::is_flags_equal(sf, cf))
diff --git a/storage/innobase/row/row0ftsort.cc b/storage/innobase/row/row0ftsort.cc
index cc8844c3bd4..86e9662439a 100644
--- a/storage/innobase/row/row0ftsort.cc
+++ b/storage/innobase/row/row0ftsort.cc
@@ -875,7 +875,9 @@ loop:
if (t_ctx.rows_added[t_ctx.buf_used] && !processed) {
row_merge_buf_sort(buf[t_ctx.buf_used], NULL);
row_merge_buf_write(buf[t_ctx.buf_used],
+#ifndef DBUG_OFF
merge_file[t_ctx.buf_used],
+#endif
block[t_ctx.buf_used]);
if (!row_merge_write(merge_file[t_ctx.buf_used]->fd,
@@ -941,8 +943,11 @@ exit:
for (i = 0; i < FTS_NUM_AUX_INDEX; i++) {
if (t_ctx.rows_added[i]) {
row_merge_buf_sort(buf[i], NULL);
- row_merge_buf_write(
- buf[i], merge_file[i], block[i]);
+ row_merge_buf_write(buf[i],
+#ifndef DBUG_OFF
+ merge_file[i],
+#endif
+ block[i]);
/* Write to temp file, only if records have
been flushed to temp file before (offset > 0):
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 590f9d73990..65c17a4e4b1 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -41,12 +41,8 @@ Created 2012-02-08 by Sunny Bains.
#include "fil0pagecompress.h"
#include "trx0undo.h"
#include "lock0lock.h"
-#ifdef HAVE_LZO
#include "lzo/lzo1x.h"
-#endif
-#ifdef HAVE_SNAPPY
#include "snappy-c.h"
-#endif
#include "scope.h"
@@ -83,9 +79,9 @@ struct row_index_t {
in the exporting server */
byte* m_name; /*!< Index name */
- ulint m_space; /*!< Space where it is placed */
+ uint32_t m_space; /*!< Space where it is placed */
- ulint m_page_no; /*!< Root page number */
+ uint32_t m_page_no; /*!< Root page number */
ulint m_type; /*!< Index type */
@@ -406,14 +402,14 @@ class AbstractCallback
public:
/** Constructor
@param trx covering transaction */
- AbstractCallback(trx_t* trx, ulint space_id)
+ AbstractCallback(trx_t* trx, uint32_t space_id)
:
m_zip_size(0),
m_trx(trx),
m_space(space_id),
m_xdes(),
- m_xdes_page_no(ULINT_UNDEFINED),
- m_space_flags(ULINT_UNDEFINED) UNIV_NOTHROW { }
+ m_xdes_page_no(UINT32_MAX),
+ m_space_flags(UINT32_MAX) UNIV_NOTHROW { }
/** Free any extent descriptor instance */
virtual ~AbstractCallback()
@@ -436,10 +432,7 @@ public:
}
/** @return the tablespace flags */
- ulint get_space_flags() const
- {
- return(m_space_flags);
- }
+ uint32_t get_space_flags() const { return m_space_flags; }
/**
Set the name of the physical file and the file handle that is used
@@ -470,7 +463,7 @@ public:
virtual dberr_t operator()(buf_block_t* block) UNIV_NOTHROW = 0;
/** @return the tablespace identifier */
- ulint get_space_id() const { return m_space; }
+ uint32_t get_space_id() const { return m_space; }
bool is_interrupted() const { return trx_is_interrupted(m_trx); }
@@ -513,7 +506,7 @@ protected:
@param page page contents
@return DB_SUCCESS or error code. */
dberr_t set_current_xdes(
- ulint page_no,
+ uint32_t page_no,
const page_t* page) UNIV_NOTHROW
{
m_xdes_page_no = page_no;
@@ -578,19 +571,16 @@ protected:
trx_t* m_trx;
/** Space id of the file being iterated over. */
- ulint m_space;
-
- /** Current size of the space in pages */
- ulint m_size;
+ uint32_t m_space;
/** Current extent descriptor page */
xdes_t* m_xdes;
/** Physical page offset in the file of the extent descriptor */
- ulint m_xdes_page_no;
+ uint32_t m_xdes_page_no;
/** Flags value read from the header page */
- ulint m_space_flags;
+ uint32_t m_space_flags;
};
/** Determine the page size to use for traversing the tablespace
@@ -606,8 +596,8 @@ AbstractCallback::init(
m_space_flags = fsp_header_get_flags(page);
if (!fil_space_t::is_valid_flags(m_space_flags, true)) {
- ulint cflags = fsp_flags_convert_from_101(m_space_flags);
- if (cflags == ULINT_UNDEFINED) {
+ uint32_t cflags = fsp_flags_convert_from_101(m_space_flags);
+ if (cflags == UINT32_MAX) {
return(DB_CORRUPTION);
}
m_space_flags = cflags;
@@ -636,8 +626,7 @@ AbstractCallback::init(
return(DB_CORRUPTION);
}
- m_size = mach_read_from_4(page + FSP_SIZE);
- if (m_space == ULINT_UNDEFINED) {
+ if (m_space == UINT32_MAX) {
m_space = mach_read_from_4(FSP_HEADER_OFFSET + FSP_SPACE_ID
+ page);
}
@@ -671,13 +660,13 @@ struct FetchIndexRootPages : public AbstractCallback {
/** Index information gathered from the .ibd file. */
struct Index {
- Index(index_id_t id, ulint page_no)
+ Index(index_id_t id, uint32_t page_no)
:
m_id(id),
m_page_no(page_no) { }
index_id_t m_id; /*!< Index id */
- ulint m_page_no; /*!< Root page number */
+ uint32_t m_page_no; /*!< Root page number */
};
/** Constructor
@@ -685,7 +674,7 @@ struct FetchIndexRootPages : public AbstractCallback {
@param table table definition in server .*/
FetchIndexRootPages(const dict_table_t* table, trx_t* trx)
:
- AbstractCallback(trx, ULINT_UNDEFINED),
+ AbstractCallback(trx, UINT32_MAX),
m_table(table), m_index(0, 0) UNIV_NOTHROW { }
/** Destructor */
@@ -730,7 +719,7 @@ dberr_t FetchIndexRootPages::operator()(buf_block_t* block) UNIV_NOTHROW
m_index.m_page_no = block->page.id().page_no();
/* Check that the tablespace flags match the table flags. */
- ulint expected = dict_tf_to_fsp_flags(m_table->flags);
+ const uint32_t expected = dict_tf_to_fsp_flags(m_table->flags);
if (!fsp_flags_match(expected, m_space_flags)) {
ib_errf(m_trx->mysql_thd, IB_LOG_LEVEL_ERROR,
ER_TABLE_SCHEMA_MISMATCH,
@@ -847,7 +836,7 @@ public:
@param cfg config of table being imported.
@param space_id tablespace identifier
@param trx transaction covering the import */
- PageConverter(row_import* cfg, ulint space_id, trx_t* trx)
+ PageConverter(row_import* cfg, uint32_t space_id, trx_t* trx)
:
AbstractCallback(trx, space_id),
m_cfg(cfg),
@@ -1419,7 +1408,7 @@ row_import::set_root_by_name() UNIV_NOTHROW
/* We've already checked that it exists. */
ut_a(index != 0);
- index->page = static_cast<uint32_t>(cfg_index->m_page_no);
+ index->page = cfg_index->m_page_no;
}
}
@@ -1476,8 +1465,7 @@ row_import::set_root_by_heuristic() UNIV_NOTHROW
cfg_index[i].m_srv_index = index;
- index->page = static_cast<uint32_t>(
- cfg_index[i++].m_page_no);
+ index->page = cfg_index[i++].m_page_no;
}
}
@@ -3010,8 +2998,8 @@ row_import_read_meta_data(
/* decrypt and decompress page if needed */
static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
- size_t space_flags, span<byte> page,
- size_t space_id, byte *page_compress_buf)
+ uint32_t space_flags, span<byte> page,
+ uint32_t space_id, byte *page_compress_buf)
{
auto *data= page.data();
@@ -3020,8 +3008,8 @@ static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
if (!buf_page_verify_crypt_checksum(data, space_flags))
return DB_CORRUPTION;
- if (dberr_t err= fil_space_decrypt(space_id, space_crypt, data,
- page.size(), space_flags, data))
+ if (dberr_t err= fil_space_decrypt(space_id, space_flags, space_crypt,
+ data, page.size(), data))
return err;
}
@@ -3054,13 +3042,11 @@ static dberr_t decrypt_decompress(fil_space_crypt_t *space_crypt,
static size_t get_buf_size()
{
- return srv_page_size
-#ifdef HAVE_LZO
- + LZO1X_1_15_MEM_COMPRESS
-#elif defined HAVE_SNAPPY
- + snappy_max_compressed_length(srv_page_size)
-#endif
- ;
+ return srv_page_size + (
+ provider_service_lzo->is_loaded ? LZO1X_1_15_MEM_COMPRESS :
+ provider_service_snappy->is_loaded ? snappy_max_compressed_length(srv_page_size) :
+ 0
+ );
}
/* find, parse instant metadata, performing variaous checks,
@@ -3110,7 +3096,7 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
if (!fil_space_t::is_valid_flags(space_flags, true))
{
auto cflags= fsp_flags_convert_from_101(space_flags);
- if (cflags == ULINT_UNDEFINED)
+ if (cflags == UINT32_MAX)
{
ib::error() << "Invalid FSP_SPACE_FLAGS=" << ib::hex(space_flags);
return DB_CORRUPTION;
@@ -3728,12 +3714,8 @@ page_corrupted:
if (!buf_page_verify_crypt_checksum(readptr, m_space_flags))
goto page_corrupted;
- if (ENCRYPTION_KEY_NOT_ENCRYPTED ==
- buf_page_get_key_version(readptr, m_space_flags))
- goto page_corrupted;
-
- if ((err= fil_space_decrypt(get_space_id(), iter.crypt_data, readptr, size,
- m_space_flags, readptr)))
+ if ((err= fil_space_decrypt(get_space_id(), m_space_flags, iter.crypt_data,
+ readptr, size, readptr)))
goto func_exit;
}
@@ -3776,7 +3758,7 @@ static dberr_t fil_iterate(
return DB_OUT_OF_MEMORY;
}
- ulint actual_space_id = 0;
+ uint32_t actual_space_id = 0;
const bool full_crc32 = fil_space_t::full_crc32(
callback.get_space_flags());
@@ -3903,9 +3885,9 @@ page_corrupted:
if ((err = fil_space_decrypt(
actual_space_id,
+ callback.get_space_flags(),
iter.crypt_data, dst,
callback.physical_size(),
- callback.get_space_flags(),
src))) {
goto func_exit;
}
@@ -4448,11 +4430,9 @@ row_import_for_mysql(
we will not be writing any redo log for it before we have invoked
fil_space_t::set_imported() to declare it a persistent tablespace. */
- ulint fsp_flags = dict_tf_to_fsp_flags(table->flags);
-
table->space = fil_ibd_open(
2, FIL_TYPE_IMPORT, table->space_id,
- fsp_flags, name, filepath, &err);
+ dict_tf_to_fsp_flags(table->flags), name, filepath, &err);
ut_ad((table->space == NULL) == (err != DB_SUCCESS));
DBUG_EXECUTE_IF("ib_import_open_tablespace_failure",
diff --git a/storage/innobase/row/row0ins.cc b/storage/innobase/row/row0ins.cc
index 9b1d9a8b57f..427fdedee60 100644
--- a/storage/innobase/row/row0ins.cc
+++ b/storage/innobase/row/row0ins.cc
@@ -2642,19 +2642,25 @@ commit_exit:
&& !index->table->skip_alter_undo
&& !index->table->n_rec_locks
&& !index->table->is_active_ddl()
+ && !index->table->has_spatial_index()
&& !trx->is_wsrep() /* FIXME: MDEV-24623 */
&& !thd_is_slave(trx->mysql_thd) /* FIXME: MDEV-24622 */) {
DEBUG_SYNC_C("empty_root_page_insert");
+ trx->bulk_insert = true;
+
if (!index->table->is_temporary()) {
err = lock_table(index->table, NULL, LOCK_X, thr);
if (err != DB_SUCCESS) {
trx->error_state = err;
+ trx->bulk_insert = false;
goto commit_exit;
}
if (index->table->n_rec_locks) {
+avoid_bulk:
+ trx->bulk_insert = false;
goto skip_bulk_insert;
}
@@ -2669,9 +2675,20 @@ commit_exit:
#else /* BTR_CUR_HASH_ADAPT */
index->table->bulk_trx_id = trx->id;
#endif /* BTR_CUR_HASH_ADAPT */
- }
- trx->bulk_insert = true;
+ /* Write TRX_UNDO_EMPTY undo log and
+ start buffering the insert operation */
+ err = trx_undo_report_row_operation(
+ thr, index, entry,
+ nullptr, 0, nullptr, nullptr,
+ nullptr);
+
+ if (err != DB_SUCCESS) {
+ goto avoid_bulk;
+ }
+
+ goto commit_exit;
+ }
}
skip_bulk_insert:
@@ -3193,7 +3210,7 @@ row_ins_sec_index_entry(
bool check_foreign) /*!< in: true if check
foreign table is needed, false otherwise */
{
- dberr_t err;
+ dberr_t err = DB_SUCCESS;
mem_heap_t* offsets_heap;
mem_heap_t* heap;
trx_id_t trx_id = 0;
@@ -3270,13 +3287,24 @@ row_ins_index_entry(
dtuple_t* entry, /*!< in/out: index entry to insert */
que_thr_t* thr) /*!< in: query thread */
{
- ut_ad(thr_get_trx(thr)->id || index->table->no_rollback()
+ trx_t* trx = thr_get_trx(thr);
+
+ ut_ad(trx->id || index->table->no_rollback()
|| index->table->is_temporary());
DBUG_EXECUTE_IF("row_ins_index_entry_timeout", {
DBUG_SET("-d,row_ins_index_entry_timeout");
return(DB_LOCK_WAIT);});
+ if (index->is_btree()) {
+ if (auto t= trx->check_bulk_buffer(index->table)) {
+ /* MDEV-25036 FIXME: check also foreign key
+ constraints */
+ ut_ad(!trx->check_foreigns);
+ return t->bulk_insert_buffered(*entry, *index, trx);
+ }
+ }
+
if (index->is_primary()) {
return row_ins_clust_index_entry(index, entry, thr, 0);
} else {
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index 8914021d09d..7683c4dbedc 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -257,9 +257,18 @@ public:
@param[in] row_buf row_buf the sorted data tuples,
or NULL if fd, block will be used instead
@param[in,out] btr_bulk btr bulk instance
+@param[in] table_total_rows total rows of old table
+@param[in] pct_progress total progress percent untill now
+@param[in] pct_cost current progress percent
+@param[in] crypt_block buffer for encryption or NULL
+@param[in] space space id
@param[in,out] stage performance schema accounting object, used by
ALTER TABLE. If not NULL stage->begin_phase_insert() will be called initially
and then stage->inc() will be called for each record that is processed.
+@param[in] blob_file To read big column field data from
+ the given blob file. It is
+ applicable only for bulk insert
+ operation
@return DB_SUCCESS or error number */
static MY_ATTRIBUTE((warn_unused_result))
dberr_t
@@ -270,14 +279,13 @@ row_merge_insert_index_tuples(
row_merge_block_t* block,
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
- const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const double pct_progress, /*!< in: total progress
- percent until now */
- const double pct_cost, /*!< in: current progress percent
- */
- row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
- ulint space, /*!< in: space id */
- ut_stage_alter_t* stage = NULL);
+ const ib_uint64_t table_total_rows,
+ double pct_progress,
+ double pct_cost,
+ row_merge_block_t* crypt_block,
+ ulint space,
+ ut_stage_alter_t* stage= nullptr,
+ merge_file_t* blob_file= nullptr);
/******************************************************//**
Encode an index record. */
@@ -315,35 +323,23 @@ row_merge_buf_encode(
*b += size;
}
-/******************************************************//**
-Allocate a sort buffer.
-@return own: sort buffer */
static MY_ATTRIBUTE((malloc, nonnull))
row_merge_buf_t*
row_merge_buf_create_low(
-/*=====================*/
- mem_heap_t* heap, /*!< in: heap where allocated */
- dict_index_t* index, /*!< in: secondary index */
- ulint max_tuples, /*!< in: maximum number of
- data tuples */
- ulint buf_size) /*!< in: size of the buffer,
- in bytes */
+ row_merge_buf_t *buf, mem_heap_t *heap, dict_index_t *index)
{
- row_merge_buf_t* buf;
-
- ut_ad(max_tuples > 0);
-
- ut_ad(max_tuples <= srv_sort_buf_size);
-
- buf = static_cast<row_merge_buf_t*>(mem_heap_zalloc(heap, buf_size));
- buf->heap = heap;
- buf->index = index;
- buf->max_tuples = max_tuples;
- buf->tuples = static_cast<mtuple_t*>(
- ut_malloc_nokey(2 * max_tuples * sizeof *buf->tuples));
- buf->tmp_tuples = buf->tuples + max_tuples;
-
- return(buf);
+ ulint max_tuples = srv_sort_buf_size
+ / std::max<ulint>(1, dict_index_get_min_size(index));
+ ut_ad(max_tuples > 0);
+ ut_ad(max_tuples <= srv_sort_buf_size);
+
+ buf->heap = heap;
+ buf->index = index;
+ buf->max_tuples = max_tuples;
+ buf->tuples = static_cast<mtuple_t*>(
+ ut_malloc_nokey(2 * max_tuples * sizeof *buf->tuples));
+ buf->tmp_tuples = buf->tuples + max_tuples;
+ return(buf);
}
/******************************************************//**
@@ -355,18 +351,16 @@ row_merge_buf_create(
dict_index_t* index) /*!< in: secondary index */
{
row_merge_buf_t* buf;
- ulint max_tuples;
ulint buf_size;
mem_heap_t* heap;
- max_tuples = srv_sort_buf_size
- / std::max<ulint>(1, dict_index_get_min_size(index));
-
buf_size = (sizeof *buf);
heap = mem_heap_create(buf_size);
- buf = row_merge_buf_create_low(heap, index, max_tuples, buf_size);
+ buf = static_cast<row_merge_buf_t*>(
+ mem_heap_zalloc(heap, buf_size));
+ row_merge_buf_create_low(buf, heap, index);
return(buf);
}
@@ -459,6 +453,68 @@ row_merge_buf_redundant_convert(
dfield_set_data(field, buf, len);
}
+/** Insert the tuple into bulk buffer insert operation
+@param buf merge buffer for the index operation
+@param table bulk insert operation for the table
+@param row tuple to be inserted
+@return number of rows inserted */
+static ulint row_merge_bulk_buf_add(row_merge_buf_t* buf,
+ const dict_table_t &table,
+ const dtuple_t &row)
+{
+ if (buf->n_tuples >= buf->max_tuples)
+ return 0;
+
+ const dict_index_t *index= buf->index;
+ ulint n_fields= dict_index_get_n_fields(index);
+ mtuple_t *entry= &buf->tuples[buf->n_tuples];
+ ulint data_size= 0;
+ ulint extra_size= UT_BITS_IN_BYTES(unsigned(index->n_nullable));
+ dfield_t *field= entry->fields= static_cast<dfield_t*>(
+ mem_heap_alloc(buf->heap, n_fields * sizeof *entry->fields));
+ const dict_field_t *ifield= dict_index_get_nth_field(index, 0);
+
+ for (ulint i = 0; i < n_fields; i++, field++, ifield++)
+ {
+ dfield_copy(field, &row.fields[i]);
+ ulint len= dfield_get_len(field);
+ const dict_col_t* const col= ifield->col;
+
+ if (dfield_is_null(field))
+ continue;
+
+ ulint fixed_len= ifield->fixed_len;
+
+ if (fixed_len);
+ else if (len < 128 || (!DATA_BIG_COL(col)))
+ extra_size++;
+ else
+ extra_size += 2;
+ data_size += len;
+ }
+
+ /* Add to the total size of the record in row_merge_block_t
+ the encoded length of extra_size and the extra bytes (extra_size).
+ See row_merge_buf_write() for the variable-length encoding
+ of extra_size. */
+ data_size += (extra_size + 1) + ((extra_size + 1) >= 0x80);
+
+ /* Reserve bytes for the end marker of row_merge_block_t. */
+ if (buf->total_size + data_size >= srv_sort_buf_size)
+ return 0;
+
+ buf->total_size += data_size;
+ buf->n_tuples++;
+
+ field= entry->fields;
+
+ do
+ dfield_dup(field++, buf->heap);
+ while (--n_fields);
+
+ return 1;
+}
+
/** Insert a data tuple into a sort buffer.
@param[in,out] buf sort buffer
@param[in] fts_index fts index to be created
@@ -991,25 +1047,135 @@ row_merge_buf_sort(
buf->tuples, buf->tmp_tuples, 0, buf->n_tuples);
}
-/******************************************************//**
-Write a buffer to a block. */
-void
-row_merge_buf_write(
-/*================*/
- const row_merge_buf_t* buf, /*!< in: sorted buffer */
- const merge_file_t* of UNIV_UNUSED,
- /*!< in: output file */
- row_merge_block_t* block) /*!< out: buffer for writing to file */
+/** Write the blob field data to temporary file and fill the offset,
+length in the field data
+@param field tuple field
+@param blob_file file to store the blob data
+@param heap heap to store the blob offset and length
+@return DB_SUCCESS if successful */
+static dberr_t row_merge_write_blob_to_tmp_file(
+ dfield_t *field, merge_file_t *blob_file,mem_heap_t **heap)
+{
+ if (blob_file->fd == OS_FILE_CLOSED)
+ {
+ blob_file->fd= row_merge_file_create_low(nullptr);
+ if (blob_file->fd == OS_FILE_CLOSED)
+ return DB_OUT_OF_MEMORY;
+ }
+ uint64_t val= blob_file->offset;
+ uint32_t len= field->len;
+ dberr_t err= os_file_write(
+ IORequestWrite, "(bulk insert)", blob_file->fd,
+ field->data, blob_file->offset * srv_page_size, len);
+
+ if (err != DB_SUCCESS)
+ return err;
+
+ byte *data= static_cast<byte*>
+ (mem_heap_alloc(*heap, BTR_EXTERN_FIELD_REF_SIZE));
+
+ /* Write zeroes for first 8 bytes */
+ memset(data, 0, 8);
+ /* Write offset for next 8 bytes */
+ mach_write_to_8(data + 8, val);
+ /* Write length of the blob in 4 bytes */
+ mach_write_to_4(data + 16, len);
+ blob_file->offset+= field->len;
+ blob_file->n_rec++;
+ dfield_set_data(field, data, BTR_EXTERN_FIELD_REF_SIZE);
+ dfield_set_ext(field);
+ return err;
+}
+
+/** This function is invoked when tuple size is greater than
+innodb_sort_buffer_size. Basically it recreates the tuple
+by writing the blob field to the temporary file.
+@param entry index fields to be encode the blob
+@param blob_file file to store the blob data
+@param heap heap to store the blob offset and blob length
+@return tuple which fits into sort_buffer_size */
+static dtuple_t* row_merge_buf_large_tuple(const dtuple_t &entry,
+ merge_file_t *blob_file,
+ mem_heap_t **heap)
+{
+ if (!*heap)
+ *heap= mem_heap_create(DTUPLE_EST_ALLOC(entry.n_fields));
+
+ dtuple_t *tuple= dtuple_copy(&entry, *heap);
+ for (ulint i= 0; i < tuple->n_fields; i++)
+ {
+ dfield_t *field= &tuple->fields[i];
+ if (dfield_is_null(field) || field->len <= 2000)
+ continue;
+
+ dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap);
+ if (err != DB_SUCCESS)
+ return nullptr;
+ }
+
+ return tuple;
+}
+
+
+/** Write the field data whose length is more than 2000 bytes
+into blob temporary file and write offset, length into the
+tuple field
+@param entry index fields to be encode the blob
+@param n_fields number of fields in the entry
+@param heap heap to store the blob offset and blob length
+@param blob_file file to store the blob data */
+static dberr_t row_merge_buf_blob(const mtuple_t *entry, ulint n_fields,
+ mem_heap_t **heap, merge_file_t *blob_file)
+{
+
+ if (!*heap)
+ *heap= mem_heap_create(100);
+
+ for (ulint i= 0; i < n_fields; i++)
+ {
+ dfield_t *field= &entry->fields[i];
+ if (dfield_is_null(field) || field->len <= 2000)
+ continue;
+
+ dberr_t err= row_merge_write_blob_to_tmp_file(field, blob_file, heap);
+ if (err != DB_SUCCESS)
+ return err;
+ }
+
+ return DB_SUCCESS;
+}
+
+/** Write a buffer to a block.
+@param buf sorted buffer
+@param block buffer for writing to file
+@param blob_file blob file handle for doing bulk insert operation */
+dberr_t row_merge_buf_write(const row_merge_buf_t *buf,
+#ifndef DBUG_OFF
+ const merge_file_t *of, /*!< output file */
+#endif
+ row_merge_block_t *block,
+ merge_file_t *blob_file)
{
const dict_index_t* index = buf->index;
ulint n_fields= dict_index_get_n_fields(index);
byte* b = &block[0];
+ mem_heap_t* blob_heap = nullptr;
+ dberr_t err = DB_SUCCESS;
DBUG_ENTER("row_merge_buf_write");
for (ulint i = 0; i < buf->n_tuples; i++) {
const mtuple_t* entry = &buf->tuples[i];
+ if (blob_file) {
+ ut_ad(buf->index->is_primary());
+ err = row_merge_buf_blob(
+ entry, n_fields, &blob_heap, blob_file);
+ if (err != DB_SUCCESS) {
+ goto func_exit;
+ }
+ }
+
row_merge_buf_encode(&b, index, entry, n_fields);
ut_ad(b < &block[srv_sort_buf_size]);
@@ -1022,7 +1188,7 @@ row_merge_buf_write(
/* Write an "end-of-chunk" marker. */
ut_a(b < &block[srv_sort_buf_size]);
- ut_a(b == &block[0] + buf->total_size);
+ ut_a(b == &block[0] + buf->total_size || blob_file);
*b++ = 0;
#ifdef HAVE_valgrind
/* The rest of the block is uninitialized. Initialize it
@@ -1032,7 +1198,12 @@ row_merge_buf_write(
DBUG_LOG("ib_merge_sort",
"write " << reinterpret_cast<const void*>(b) << ','
<< of->fd << ',' << of->offset << " EOF");
- DBUG_VOID_RETURN;
+func_exit:
+ if (blob_heap) {
+ mem_heap_free(blob_heap);
+ }
+
+ DBUG_RETURN(err);
}
/******************************************************//**
@@ -2696,7 +2867,11 @@ write_buffers:
ut_ad(file->n_rec > 0);
- row_merge_buf_write(buf, file, block);
+ row_merge_buf_write(buf,
+#ifndef DBUG_OFF
+ file,
+#endif
+ block);
if (!row_merge_write(
file->fd, file->offset++,
@@ -3372,7 +3547,7 @@ row_merge_sort(
*/
#ifndef __sun__
/* Progress report only for "normal" indexes. */
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_init(trx->mysql_thd, 1);
}
#endif /* __sun__ */
@@ -3389,7 +3564,7 @@ row_merge_sort(
show processlist progress field */
/* Progress report only for "normal" indexes. */
#ifndef __sun__
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_report(trx->mysql_thd, file->offset - num_runs, file->offset);
}
#endif /* __sun__ */
@@ -3419,7 +3594,7 @@ row_merge_sort(
/* Progress report only for "normal" indexes. */
#ifndef __sun__
- if (!(dup->index->type & DICT_FTS)) {
+ if (dup && !(dup->index->type & DICT_FTS)) {
thd_progress_end(trx->mysql_thd);
}
#endif /* __sun__ */
@@ -3427,6 +3602,39 @@ row_merge_sort(
DBUG_RETURN(error);
}
+/** Copy the blob from the given blob file and store it
+in field data for the tuple
+@param tuple tuple to be inserted
+@param heap heap to allocate the memory for the blob storage
+@param blob_file file to handle blob data */
+static dberr_t row_merge_copy_blob_from_file(dtuple_t *tuple, mem_heap_t *heap,
+ merge_file_t *blob_file)
+{
+ for (ulint i = 0; i < dtuple_get_n_fields(tuple); i++)
+ {
+ dfield_t *field= dtuple_get_nth_field(tuple, i);
+ const byte *field_data= static_cast<byte*>(dfield_get_data(field));
+ ulint field_len= dfield_get_len(field);
+ if (!dfield_is_ext(field))
+ continue;
+
+ ut_a(field_len >= BTR_EXTERN_FIELD_REF_SIZE);
+ ut_ad(!dfield_is_null(field));
+
+ ut_ad(mach_read_from_8(field_data) == 0);
+ uint64_t offset= mach_read_from_8(field_data + 8);
+ uint32_t len= mach_read_from_4(field_data + 16);
+
+ byte *data= (byte*) mem_heap_alloc(heap, len);
+ if (dberr_t err= os_file_read(IORequestRead, blob_file->fd, data,
+ offset, len, nullptr))
+ return err;
+ dfield_set_data(field, data, len);
+ }
+
+ return DB_SUCCESS;
+}
+
/** Copy externally stored columns to the data tuple.
@param[in] mrec record containing BLOB pointers,
or NULL to use tuple instead
@@ -3512,18 +3720,6 @@ row_merge_mtuple_to_dtuple(
dtuple->n_fields * sizeof *mtuple->fields);
}
-/** Insert sorted data tuples to the index.
-@param[in] index index to be inserted
-@param[in] old_table old table
-@param[in] fd file descriptor
-@param[in,out] block file buffer
-@param[in] row_buf row_buf the sorted data tuples,
-or NULL if fd, block will be used instead
-@param[in,out] btr_bulk btr bulk instance
-@param[in,out] stage performance schema accounting object, used by
-ALTER TABLE. If not NULL stage->begin_phase_insert() will be called initially
-and then stage->inc() will be called for each record that is processed.
-@return DB_SUCCESS or error number */
static MY_ATTRIBUTE((warn_unused_result))
dberr_t
row_merge_insert_index_tuples(
@@ -3533,14 +3729,13 @@ row_merge_insert_index_tuples(
row_merge_block_t* block,
const row_merge_buf_t* row_buf,
BtrBulk* btr_bulk,
- const ib_uint64_t table_total_rows, /*!< in: total rows of old table */
- const double pct_progress, /*!< in: total progress
- percent until now */
- const double pct_cost, /*!< in: current progress percent
- */
- row_merge_block_t* crypt_block, /*!< in: crypt buf or NULL */
- ulint space, /*!< in: space id */
- ut_stage_alter_t* stage)
+ const ib_uint64_t table_total_rows,
+ double pct_progress,
+ double pct_cost,
+ row_merge_block_t* crypt_block,
+ ulint space,
+ ut_stage_alter_t* stage,
+ merge_file_t* blob_file)
{
const byte* b;
mem_heap_t* heap;
@@ -3651,7 +3846,16 @@ row_merge_insert_index_tuples(
}
}
- if (dict_index_is_clust(index) && dtuple_get_n_ext(dtuple)) {
+ ut_ad(!dtuple_get_n_ext(dtuple) || index->is_primary());
+
+ if (!dtuple_get_n_ext(dtuple)) {
+ } else if (blob_file) {
+ error = row_merge_copy_blob_from_file(
+ dtuple, tuple_heap, blob_file);
+ if (error != DB_SUCCESS) {
+ break;
+ }
+ } else {
/* Off-page columns can be fetched safely
when concurrent modifications to the table
are disabled. (Purge can process delete-marked
@@ -3668,7 +3872,8 @@ row_merge_insert_index_tuples(
row_merge_read_clustered_index() scan
will go through row_log_table_apply(). */
row_merge_copy_blobs(
- mrec, offsets, old_table->space->zip_size(),
+ mrec, offsets,
+ old_table->space->zip_size(),
dtuple, tuple_heap);
}
@@ -4856,6 +5061,337 @@ func_exit:
clust_index->lock.x_unlock();
}
- DBUG_EXECUTE_IF("ib_index_crash_after_bulk_load", DBUG_SUICIDE(););
DBUG_RETURN(error);
}
+
+dberr_t row_merge_bulk_t::alloc_block()
+{
+ if (m_block)
+ return DB_SUCCESS;
+ m_block= m_alloc.allocate_large_dontdump(
+ 3 * srv_sort_buf_size, &m_block_pfx);
+ if (m_block == nullptr)
+ return DB_OUT_OF_MEMORY;
+
+ m_crypt_pfx.m_size= 0;
+ TRASH_ALLOC(&m_crypt_pfx, sizeof m_crypt_pfx);
+ if (log_tmp_is_encrypted())
+ {
+ m_crypt_block= static_cast<row_merge_block_t*>(
+ m_alloc.allocate_large(3 * srv_sort_buf_size, &m_crypt_pfx));
+ if (!m_crypt_block)
+ return DB_OUT_OF_MEMORY;
+ }
+ return DB_SUCCESS;
+}
+
+row_merge_bulk_t::row_merge_bulk_t(dict_table_t *table)
+{
+ ulint n_index= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ n_index++;
+ }
+
+ m_merge_buf= static_cast<row_merge_buf_t*>(
+ ut_zalloc_nokey(n_index * sizeof *m_merge_buf));
+
+ ulint i= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ mem_heap_t *heap= mem_heap_create(100);
+ row_merge_buf_create_low(&m_merge_buf[i], heap, index);
+ i++;
+ }
+
+ m_tmpfd= OS_FILE_CLOSED;
+ m_blob_file.fd= OS_FILE_CLOSED;
+ m_blob_file.offset= 0;
+ m_blob_file.n_rec= 0;
+}
+
+row_merge_bulk_t::~row_merge_bulk_t()
+{
+ ulint i= 0;
+ dict_table_t *table= m_merge_buf[0].index->table;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ row_merge_buf_free(&m_merge_buf[i]);
+ if (m_merge_files)
+ row_merge_file_destroy(&m_merge_files[i]);
+ i++;
+ }
+
+ row_merge_file_destroy_low(m_tmpfd);
+
+ row_merge_file_destroy(&m_blob_file);
+
+ ut_free(m_merge_buf);
+
+ ut_free(m_merge_files);
+
+ if (m_block)
+ m_alloc.deallocate_large(m_block, &m_block_pfx);
+
+ if (m_crypt_block)
+ m_alloc.deallocate_large(m_crypt_block, &m_crypt_pfx);
+}
+
+void row_merge_bulk_t::init_tmp_file()
+{
+ if (m_merge_files)
+ return;
+
+ ulint n_index= 0;
+ dict_table_t *table= m_merge_buf[0].index->table;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+ n_index++;
+ }
+
+ m_merge_files= static_cast<merge_file_t*>(
+ ut_malloc_nokey(n_index * sizeof *m_merge_files));
+
+ for (ulint i= 0; i < n_index; i++)
+ {
+ m_merge_files[i].fd= OS_FILE_CLOSED;
+ m_merge_files[i].offset= 0;
+ m_merge_files[i].n_rec= 0;
+ }
+}
+
+void row_merge_bulk_t::clean_bulk_buffer(ulint index_no)
+{
+ mem_heap_empty(m_merge_buf[index_no].heap);
+ m_merge_buf[index_no].total_size = m_merge_buf[index_no].n_tuples = 0;
+}
+
+bool row_merge_bulk_t::create_tmp_file(ulint index_no)
+{
+ return row_merge_file_create_if_needed(
+ &m_merge_files[index_no], &m_tmpfd,
+ m_merge_buf[index_no].n_tuples, NULL);
+}
+
+dberr_t row_merge_bulk_t::write_to_tmp_file(ulint index_no)
+{
+ if (!create_tmp_file(index_no))
+ return DB_OUT_OF_MEMORY;
+ merge_file_t *file= &m_merge_files[index_no];
+ row_merge_buf_t *buf= &m_merge_buf[index_no];
+
+ alloc_block();
+
+ if (dberr_t err= row_merge_buf_write(buf,
+#ifndef DBUG_OFF
+ file,
+#endif
+ m_block,
+ index_no == 0 ? &m_blob_file : nullptr))
+ return err;
+
+ if (!row_merge_write(file->fd, file->offset++,
+ m_block, m_crypt_block,
+ buf->index->table->space->id))
+ return DB_TEMP_FILE_WRITE_FAIL;
+ MEM_UNDEFINED(&m_block[0], srv_sort_buf_size);
+ return DB_SUCCESS;
+}
+
+dberr_t row_merge_bulk_t::bulk_insert_buffered(const dtuple_t &row,
+ const dict_index_t &ind,
+ trx_t *trx)
+{
+ dberr_t err= DB_SUCCESS;
+ ulint i= 0;
+ mem_heap_t *large_tuple_heap= nullptr;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(ind.table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ if (index != &ind)
+ {
+ i++;
+ continue;
+ }
+ row_merge_buf_t *buf= &m_merge_buf[i];
+add_to_buf:
+ if (row_merge_bulk_buf_add(buf, *ind.table, row))
+ {
+ i++;
+ goto func_exit;
+ }
+
+ if (buf->n_tuples == 0)
+ {
+ /* Tuple data size is greater than srv_sort_buf_size */
+ dtuple_t *big_tuple= row_merge_buf_large_tuple(
+ row, &m_blob_file, &large_tuple_heap);
+ if (row_merge_bulk_buf_add(buf, *ind.table, *big_tuple))
+ {
+ i++;
+ goto func_exit;
+ }
+ }
+
+ if (index->is_unique())
+ {
+ row_merge_dup_t dup{index, nullptr, nullptr, 0};
+ row_merge_buf_sort(buf, &dup);
+ if (dup.n_dup)
+ {
+ trx->error_info= index;
+ err= DB_DUPLICATE_KEY;
+ goto func_exit;
+ }
+ }
+ else
+ row_merge_buf_sort(buf, NULL);
+ init_tmp_file();
+ merge_file_t *file= &m_merge_files[i];
+ file->n_rec+= buf->n_tuples;
+ err= write_to_tmp_file(i);
+ if (err != DB_SUCCESS)
+ {
+ trx->error_info= index;
+ goto func_exit;
+ }
+ clean_bulk_buffer(i);
+ buf= &m_merge_buf[i];
+ goto add_to_buf;
+ }
+
+func_exit:
+ if (large_tuple_heap)
+ mem_heap_free(large_tuple_heap);
+ return err;
+}
+
+dberr_t row_merge_bulk_t::write_to_index(ulint index_no, trx_t *trx)
+{
+ dberr_t err= DB_SUCCESS;
+ row_merge_buf_t buf= m_merge_buf[index_no];
+ merge_file_t *file= m_merge_files ?
+ &m_merge_files[index_no] : nullptr;
+ dict_index_t *index= buf.index;
+ dict_table_t *table= index->table;
+ BtrBulk btr_bulk(index, trx);
+ row_merge_dup_t dup = {index, nullptr, nullptr, 0};
+
+ if (buf.n_tuples)
+ {
+ if (dict_index_is_unique(index))
+ {
+ row_merge_buf_sort(&buf, &dup);
+ if (dup.n_dup)
+ {
+ err= DB_DUPLICATE_KEY;
+ goto func_exit;
+ }
+ }
+ else row_merge_buf_sort(&buf, NULL);
+ if (file && file->fd != OS_FILE_CLOSED)
+ {
+ file->n_rec+= buf.n_tuples;
+ err= write_to_tmp_file(index_no);
+ if (err!= DB_SUCCESS)
+ goto func_exit;
+ }
+ else
+ {
+ /* Data got fit in merge buffer. */
+ err= row_merge_insert_index_tuples(
+ index, table, OS_FILE_CLOSED, nullptr,
+ &buf, &btr_bulk, 0, 0, 0, nullptr, table->space_id, nullptr,
+ m_blob_file.fd == OS_FILE_CLOSED ? nullptr : &m_blob_file);
+ goto func_exit;
+ }
+ }
+
+ err= row_merge_sort(trx, &dup, file,
+ m_block, &m_tmpfd, true, 0, 0,
+ m_crypt_block, table->space_id, nullptr);
+ if (err != DB_SUCCESS)
+ goto func_exit;
+
+ err= row_merge_insert_index_tuples(
+ index, table, file->fd, m_block, nullptr,
+ &btr_bulk, 0, 0, 0, m_crypt_block, table->space_id,
+ nullptr, &m_blob_file);
+
+func_exit:
+ if (err != DB_SUCCESS)
+ trx->error_info= index;
+ err= btr_bulk.finish(err);
+ return err;
+}
+
+dberr_t row_merge_bulk_t::write_to_table(dict_table_t *table, trx_t *trx)
+{
+ ulint i= 0;
+ for (dict_index_t *index= UT_LIST_GET_FIRST(table->indexes);
+ index; index= UT_LIST_GET_NEXT(indexes, index))
+ {
+ if (!index->is_btree())
+ continue;
+
+ dberr_t err= write_to_index(i, trx);
+ if (err != DB_SUCCESS)
+ return err;
+ i++;
+ }
+
+ return DB_SUCCESS;
+}
+
+dberr_t trx_mod_table_time_t::write_bulk(dict_table_t *table, trx_t *trx)
+{
+ if (!bulk_store)
+ return DB_SUCCESS;
+ dberr_t err= bulk_store->write_to_table(table, trx);
+ delete bulk_store;
+ bulk_store= nullptr;
+ return err;
+}
+
+dberr_t trx_t::bulk_insert_apply_low()
+{
+ ut_ad(bulk_insert);
+ ut_ad(!check_unique_secondary);
+ ut_ad(!check_foreigns);
+ dberr_t err;
+ for (auto& t : mod_tables)
+ if (t.second.is_bulk_insert())
+ if ((err= t.second.write_bulk(t.first, this)) != DB_SUCCESS)
+ goto bulk_rollback;
+ return DB_SUCCESS;
+bulk_rollback:
+ undo_no_t low_limit= UINT64_MAX;
+ for (auto& t : mod_tables)
+ {
+ if (t.second.is_bulk_insert())
+ {
+ if (t.second.get_first() < low_limit)
+ low_limit= t.second.get_first();
+ delete t.second.bulk_store;
+ }
+ }
+ trx_savept_t bulk_save{low_limit};
+ rollback(&bulk_save);
+ return err;
+}
diff --git a/storage/innobase/snappy.cmake b/storage/innobase/snappy.cmake
deleted file mode 100644
index 3a2d828ee5c..00000000000
--- a/storage/innobase/snappy.cmake
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright (C) 2015, MariaDB Corporation. 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 the Free Software
-# Foundation; version 2 of the License.
-#
-# This program is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License along with
-# this program; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA
-
-SET(WITH_INNODB_SNAPPY AUTO CACHE STRING
- "Build with snappy. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
-
-MACRO (MYSQL_CHECK_SNAPPY)
- IF (WITH_INNODB_SNAPPY STREQUAL "ON" OR WITH_INNODB_SNAPPY STREQUAL "AUTO")
- CHECK_INCLUDE_FILES(snappy-c.h HAVE_SNAPPY_H)
- CHECK_LIBRARY_EXISTS(snappy snappy_uncompress "" HAVE_SNAPPY_SHARED_LIB)
-
- IF(HAVE_SNAPPY_SHARED_LIB AND HAVE_SNAPPY_H)
- SET(HAVE_INNODB_SNAPPY TRUE)
- ADD_DEFINITIONS(-DHAVE_SNAPPY=1)
- LINK_LIBRARIES(snappy)
- ELSE()
- IF (WITH_INNODB_SNAPPY STREQUAL "ON")
- MESSAGE(FATAL_ERROR "Required snappy library is not found")
- ENDIF()
- ENDIF()
- ENDIF()
- ADD_FEATURE_INFO(INNODB_SNAPPY HAVE_INNODB_SNAPPY "Snappy compression in the InnoDB storage engine")
-ENDMACRO()
diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc
index bbf6e05cf00..af14ff3c149 100644
--- a/storage/innobase/srv/srv0srv.cc
+++ b/storage/innobase/srv/srv0srv.cc
@@ -97,15 +97,15 @@ char* srv_data_home;
char* srv_undo_dir;
/** The number of tablespaces to use for rollback segments. */
-ulong srv_undo_tablespaces;
+uint srv_undo_tablespaces;
/** The number of UNDO tablespaces that are open and ready to use. */
-ulint srv_undo_tablespaces_open;
+uint32_t srv_undo_tablespaces_open;
/** The number of UNDO tablespaces that are active (hosting some rollback
segment). It is quite possible that some of the tablespaces doesn't host
any of the rollback-segment based on configuration used. */
-ulint srv_undo_tablespaces_active;
+uint32_t srv_undo_tablespaces_active;
/** Rate at which UNDO records should be purged. */
ulong srv_purge_rseg_truncate_frequency;
@@ -162,7 +162,7 @@ uint srv_flush_log_at_timeout;
/** innodb_page_size */
ulong srv_page_size;
/** log2 of innodb_page_size; @see innodb_init_params() */
-ulong srv_page_size_shift;
+uint32_t srv_page_size_shift;
/** innodb_log_write_ahead_size */
ulong srv_log_write_ahead_size;
@@ -1653,7 +1653,8 @@ std::mutex purge_thread_count_mtx;
void srv_update_purge_thread_count(uint n)
{
std::lock_guard<std::mutex> lk(purge_thread_count_mtx);
- purge_create_background_thds(n);
+ ut_ad(n > 0);
+ ut_ad(n <= innodb_purge_threads_MAX);
srv_n_purge_threads = n;
srv_purge_thread_count_changed = 1;
}
@@ -1896,7 +1897,7 @@ static void purge_coordinator_callback(void*)
void srv_init_purge_tasks()
{
- purge_create_background_thds(srv_n_purge_threads);
+ purge_create_background_thds(innodb_purge_threads_MAX);
purge_coordinator_timer= srv_thread_pool->create_timer
(purge_coordinator_callback, nullptr);
}
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 8b29af5c083..e4249b595d8 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -112,7 +112,7 @@ ibool srv_start_raw_disk_in_use;
uint srv_n_file_io_threads;
/** UNDO tablespaces starts with space id. */
-ulint srv_undo_space_id_start;
+uint32_t srv_undo_space_id_start;
/** TRUE if the server is being started, before rolling back any
incomplete transactions */
@@ -462,7 +462,7 @@ static dberr_t srv_validate_undo_tablespaces()
}
/** @return the number of active undo tablespaces (except system tablespace) */
-static ulint trx_rseg_get_n_undo_tablespaces()
+static uint32_t trx_rseg_get_n_undo_tablespaces()
{
std::set<uint32_t> space_ids;
mtr_t mtr;
@@ -474,7 +474,7 @@ static ulint trx_rseg_get_n_undo_tablespaces()
if (uint32_t space= trx_sysf_rseg_get_space(sys_header, rseg_id))
space_ids.insert(space);
mtr.commit();
- return space_ids.size();
+ return static_cast<uint32_t>(space_ids.size());
}
/** Open an undo tablespace.
@@ -483,11 +483,12 @@ static ulint trx_rseg_get_n_undo_tablespaces()
@param[in] i undo tablespace count
@return undo tablespace identifier
@retval 0 on failure */
-static ulint srv_undo_tablespace_open(bool create, const char* name, ulint i)
+static uint32_t srv_undo_tablespace_open(bool create, const char *name,
+ uint32_t i)
{
bool success;
- ulint space_id= 0;
- ulint fsp_flags= 0;
+ uint32_t space_id= 0;
+ uint32_t fsp_flags= 0;
if (create)
{
@@ -644,20 +645,21 @@ srv_check_undo_redo_logs_exists()
return(DB_SUCCESS);
}
-static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
+static dberr_t srv_all_undo_tablespaces_open(bool create_new_db,
+ uint32_t n_undo)
{
/* Open all the undo tablespaces that are currently in use. If we
fail to open any of these it is a fatal error. The tablespace ids
should be contiguous. It is a fatal error because they are required
for recovery and are referenced by the UNDO logs (a.k.a RBS). */
- ulint prev_id= create_new_db ? srv_undo_space_id_start - 1 : 0;
+ uint32_t prev_id= create_new_db ? srv_undo_space_id_start - 1 : 0;
- for (ulint i= 0; i < n_undo; ++i)
+ for (uint32_t i= 0; i < n_undo; ++i)
{
char name[OS_FILE_MAX_PATH];
- snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dir, i + 1);
- ulint space_id= srv_undo_tablespace_open(create_new_db, name, i);
+ snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i + 1);
+ uint32_t space_id= srv_undo_tablespace_open(create_new_db, name, i);
if (!space_id)
{
if (!create_new_db)
@@ -682,11 +684,11 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
not in use and therefore not required by recovery. We only check
that there are no gaps. */
- for (ulint i= prev_id + 1; i < srv_undo_space_id_start + TRX_SYS_N_RSEGS;
+ for (uint32_t i= prev_id + 1; i < srv_undo_space_id_start + TRX_SYS_N_RSEGS;
++i)
{
char name[OS_FILE_MAX_PATH];
- snprintf(name, sizeof name, "%s/undo%03zu", srv_undo_dir, i);
+ snprintf(name, sizeof name, "%s/undo%03u", srv_undo_dir, i);
if (!srv_undo_tablespace_open(create_new_db, name, i))
break;
++srv_undo_tablespaces_open;
@@ -698,8 +700,7 @@ static dberr_t srv_all_undo_tablespaces_open(bool create_new_db, ulint n_undo)
/** Open the configured number of dedicated undo tablespaces.
@param[in] create_new_db whether the database is being initialized
@return DB_SUCCESS or error code */
-dberr_t
-srv_undo_tablespaces_init(bool create_new_db)
+dberr_t srv_undo_tablespaces_init(bool create_new_db)
{
srv_undo_tablespaces_open= 0;
@@ -735,8 +736,8 @@ srv_undo_tablespaces_init(bool create_new_db)
already exist. */
srv_undo_tablespaces_active= srv_undo_tablespaces;
- ulint n_undo= (create_new_db || srv_operation == SRV_OPERATION_BACKUP ||
- srv_operation == SRV_OPERATION_RESTORE_DELTA)
+ uint32_t n_undo= (create_new_db || srv_operation == SRV_OPERATION_BACKUP ||
+ srv_operation == SRV_OPERATION_RESTORE_DELTA)
? srv_undo_tablespaces : TRX_SYS_N_RSEGS;
if (dberr_t err= srv_all_undo_tablespaces_open(create_new_db, n_undo))
@@ -750,7 +751,7 @@ srv_undo_tablespaces_init(bool create_new_db)
if (create_new_db)
{
mtr_t mtr;
- for (ulint i= 0; i < srv_undo_tablespaces; ++i)
+ for (uint32_t i= 0; i < srv_undo_tablespaces; ++i)
{
mtr.start();
dberr_t err= fsp_header_init(fil_space_get(srv_undo_space_id_start + i),
@@ -1516,8 +1517,9 @@ file_checked:
fil_system.space_id_reuse_warned = false;
if (!srv_read_only_mode) {
- const ulint flags = FSP_FLAGS_PAGE_SSIZE();
- for (ulint id = 0; id <= srv_undo_tablespaces; id++) {
+ const uint32_t flags = FSP_FLAGS_PAGE_SSIZE();
+ for (uint32_t id = 0; id <= srv_undo_tablespaces;
+ id++) {
if (fil_space_t* space = fil_space_get(id)) {
fsp_flags_try_adjust(space, flags);
}
@@ -2065,6 +2067,10 @@ void innodb_shutdown()
}
srv_tmp_space.shutdown();
+ if (srv_stats.pages_page_compression_error)
+ ib::warn() << "Page compression errors: "
+ << srv_stats.pages_page_compression_error;
+
if (srv_was_started && srv_print_verbose_log) {
ib::info() << "Shutdown completed; log sequence number "
<< srv_shutdown_lsn
diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc
index 625d3223bdc..7d52894051d 100644
--- a/storage/innobase/trx/trx0purge.cc
+++ b/storage/innobase/trx/trx0purge.cc
@@ -653,11 +653,11 @@ TRANSACTIONAL_TARGET static void trx_purge_truncate_history()
{
const ulint threshold=
ulint(srv_max_undo_log_size >> srv_page_size_shift);
- for (ulint i= purge_sys.truncate.last
+ for (uint32_t i= purge_sys.truncate.last
? purge_sys.truncate.last->id - srv_undo_space_id_start : 0,
j= i;; )
{
- const auto space_id= srv_undo_space_id_start + i;
+ const uint32_t space_id= srv_undo_space_id_start + i;
ut_ad(srv_is_undo_tablespace(space_id));
fil_space_t *space= fil_space_get(space_id);
ut_a(UT_LIST_GET_LEN(space->chain) == 1);
diff --git a/storage/innobase/trx/trx0rec.cc b/storage/innobase/trx/trx0rec.cc
index dc24f083d05..e70516a2d2d 100644
--- a/storage/innobase/trx/trx0rec.cc
+++ b/storage/innobase/trx/trx0rec.cc
@@ -1758,8 +1758,7 @@ TRANSACTIONAL_TARGET ATTRIBUTE_NOINLINE
/** @return whether the transaction holds an exclusive lock on a table */
static bool trx_has_lock_x(const trx_t &trx, dict_table_t& table)
{
- if (table.is_temporary())
- return true;
+ ut_ad(!table.is_temporary());
uint32_t n;
@@ -1860,9 +1859,17 @@ trx_undo_report_row_operation(
ut_ad(que_node_get_type(thr->run_node) == QUE_NODE_INSERT);
ut_ad(trx->bulk_insert);
return DB_SUCCESS;
- } else if (m.second && trx->bulk_insert
- && trx_has_lock_x(*trx, *index->table)) {
- m.first->second.start_bulk_insert();
+ } else if (!m.second || !trx->bulk_insert) {
+ bulk = false;
+ } else if (index->table->is_temporary()) {
+ } else if (trx_has_lock_x(*trx, *index->table)
+ && index->table->bulk_trx_id == trx->id) {
+ m.first->second.start_bulk_insert(index->table);
+
+ if (dberr_t err = m.first->second.bulk_insert_buffered(
+ *clust_entry, *index, trx)) {
+ return err;
+ }
} else {
bulk = false;
}
diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc
index 59c9a319330..45dc78b4440 100644
--- a/storage/innobase/trx/trx0roll.cc
+++ b/storage/innobase/trx/trx0roll.cc
@@ -59,7 +59,6 @@ const trx_t* trx_roll_crash_recv_trx;
@retval false if the rollback was aborted by shutdown */
inline bool trx_t::rollback_finish()
{
- mod_tables.clear();
apply_online_log= false;
if (UNIV_LIKELY(error_state == DB_SUCCESS))
{
diff --git a/storage/innobase/trx/trx0sys.cc b/storage/innobase/trx/trx0sys.cc
index d344f3a0c83..ee27e8f51c1 100644
--- a/storage/innobase/trx/trx0sys.cc
+++ b/storage/innobase/trx/trx0sys.cc
@@ -212,7 +212,7 @@ TPOOL_SUPPRESS_TSAN size_t trx_sys_t::history_size_approx() const
@param space_id system or undo tablespace id
@return pointer to new rollback segment
@retval nullptr on failure */
-static trx_rseg_t *trx_rseg_create(ulint space_id)
+static trx_rseg_t *trx_rseg_create(uint32_t space_id)
{
trx_rseg_t *rseg= nullptr;
mtr_t mtr;
@@ -273,11 +273,11 @@ bool trx_sys_create_rsegs()
in the system tablespace. */
ut_a(srv_available_undo_logs > 0);
- for (ulint i = 0; srv_available_undo_logs < TRX_SYS_N_RSEGS;
+ for (uint32_t i = 0; srv_available_undo_logs < TRX_SYS_N_RSEGS;
i++, srv_available_undo_logs++) {
/* Tablespace 0 is the system tablespace.
Dedicated undo log tablespaces start from 1. */
- ulint space = srv_undo_tablespaces > 0
+ uint32_t space = srv_undo_tablespaces > 0
? (i % srv_undo_tablespaces)
+ srv_undo_space_id_start
: TRX_SYS_SPACE;
diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc
index 45292fc1d0b..b15741d88ff 100644
--- a/storage/innobase/trx/trx0trx.cc
+++ b/storage/innobase/trx/trx0trx.cc
@@ -1393,6 +1393,10 @@ void trx_t::commit_cleanup()
ut_ad(!dict_operation);
ut_ad(!was_dict_operation);
+ if (is_bulk_insert())
+ for (auto &t : mod_tables)
+ delete t.second.bulk_store;
+
mutex.wr_lock();
state= TRX_STATE_NOT_STARTED;
mod_tables.clear();
@@ -1484,8 +1488,11 @@ void trx_t::commit()
ut_d(was_dict_operation= dict_operation);
dict_operation= false;
commit_persist();
+#ifdef UNIV_DEBUG
+ if (!was_dict_operation)
+ for (const auto &p : mod_tables) ut_ad(!p.second.is_dropped());
+#endif /* UNIV_DEBUG */
ut_d(was_dict_operation= false);
- ut_d(for (const auto &p : mod_tables) ut_ad(!p.second.is_dropped()));
commit_cleanup();
}
@@ -1653,6 +1660,9 @@ trx_mark_sql_stat_end(
}
if (trx->is_bulk_insert()) {
+ /* MDEV-25036 FIXME: we support buffered
+ insert only for the first insert statement */
+ trx->error_state = trx->bulk_insert_apply();
/* Allow a subsequent INSERT into an empty table
if !unique_checks && !foreign_key_checks. */
return;
@@ -1864,8 +1874,6 @@ trx_prepare(
lsn_t lsn = trx_prepare_low(trx);
- DBUG_EXECUTE_IF("ib_trx_crash_during_xa_prepare_step", DBUG_SUICIDE(););
-
ut_a(trx->state == TRX_STATE_ACTIVE);
{
TMTrxGuard tg{*trx};
diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc
index 9c214e65bbd..545c54fde66 100644
--- a/storage/innobase/ut/ut0ut.cc
+++ b/storage/innobase/ut/ut0ut.cc
@@ -446,7 +446,7 @@ ut_strerr(
case DB_FTS_TOO_MANY_WORDS_IN_PHRASE:
return("Too many words in a FTS phrase or proximity search");
case DB_DECRYPTION_FAILED:
- return("Table is encrypted but decrypt failed.");
+ return("Table is compressed or encrypted but uncompress or decrypt failed.");
case DB_IO_PARTIAL_FAILED:
return("Partial IO failed");
case DB_COMPUTE_VALUE_FAILED:
diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c
index 266b11d99f5..7d5598f06b5 100644
--- a/storage/maria/aria_chk.c
+++ b/storage/maria/aria_chk.c
@@ -1592,7 +1592,7 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name)
}
compile_time_assert((MY_UUID_STRING_LENGTH + 1) <= sizeof(buff));
buff[MY_UUID_STRING_LENGTH]= 0;
- my_uuid2str(share->base.uuid, buff);
+ my_uuid2str(share->base.uuid, buff, 1);
printf("UUID: %s\n", buff);
if (ma_control_file_inited() &&
memcmp(share->base.uuid, maria_uuid, MY_UUID_SIZE))
diff --git a/storage/maria/ma_bitmap.c b/storage/maria/ma_bitmap.c
index 23135ff00a9..61fe4f9d080 100644
--- a/storage/maria/ma_bitmap.c
+++ b/storage/maria/ma_bitmap.c
@@ -661,7 +661,7 @@ static void _ma_bitmap_unpin_all(MARIA_SHARE *share)
dynamic_array_ptr(&bitmap->pinned_pages, 0));
MARIA_PINNED_PAGE *pinned_page= page_link + bitmap->pinned_pages.elements;
DBUG_ENTER("_ma_bitmap_unpin_all");
- DBUG_PRINT("info", ("pinned: %u", bitmap->pinned_pages.elements));
+ DBUG_PRINT("info", ("pinned: %zu", bitmap->pinned_pages.elements));
while (pinned_page-- != page_link)
pagecache_unlock_by_link(share->pagecache, pinned_page->link,
pinned_page->unlock, PAGECACHE_UNPIN,
@@ -1735,7 +1735,7 @@ static my_bool find_head(MARIA_HA *info, uint length, uint position)
1 error
*/
-static my_bool find_tail(MARIA_HA *info, uint length, uint position)
+static my_bool find_tail(MARIA_HA *info, uint length, size_t position)
{
MARIA_FILE_BITMAP *bitmap= &info->s->bitmap;
MARIA_BITMAP_BLOCK *block;
@@ -1816,7 +1816,7 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
uint full_page_size= FULL_PAGE_SIZE(info->s);
ulong pages;
uint rest_length, used;
- uint UNINIT_VAR(first_block_pos);
+ size_t UNINIT_VAR(first_block_pos);
MARIA_BITMAP_BLOCK *first_block= 0;
DBUG_ENTER("find_blob");
DBUG_PRINT("enter", ("length: %lu", length));
@@ -1866,7 +1866,8 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
DBUG_RETURN(1);
first_block= dynamic_element(&info->bitmap_blocks, first_block_pos,
MARIA_BITMAP_BLOCK*);
- first_block->sub_blocks= info->bitmap_blocks.elements - first_block_pos;
+ first_block->sub_blocks= (uint)(info->bitmap_blocks.elements
+ - first_block_pos);
DBUG_RETURN(0);
}
@@ -1887,7 +1888,7 @@ static my_bool find_blob(MARIA_HA *info, ulong length)
static my_bool allocate_blobs(MARIA_HA *info, MARIA_ROW *row)
{
ulong *length, *end;
- uint elements;
+ size_t elements;
/*
Reserve size for:
head block
@@ -1901,7 +1902,7 @@ static my_bool allocate_blobs(MARIA_HA *info, MARIA_ROW *row)
if (*length && find_blob(info, *length))
return 1;
}
- row->extents_count= (info->bitmap_blocks.elements - elements);
+ row->extents_count= (uint)(info->bitmap_blocks.elements - elements);
return 0;
}
@@ -2174,7 +2175,7 @@ end:
MARIA_BITMAP_BLOCK*);
blocks->block->sub_blocks= ELEMENTS_RESERVED_FOR_MAIN_PART - position;
/* First block's page_count is for all blocks */
- blocks->count= info->bitmap_blocks.elements - position;
+ blocks->count= (uint)(info->bitmap_blocks.elements - position);
res= 0;
abort:
@@ -2275,7 +2276,7 @@ end:
MARIA_BITMAP_BLOCK*);
blocks->block->sub_blocks= ELEMENTS_RESERVED_FOR_MAIN_PART - position;
/* First block's page_count is for all blocks */
- blocks->count= info->bitmap_blocks.elements - position;
+ blocks->count= (uint)(info->bitmap_blocks.elements - position);
res= 0;
abort:
diff --git a/storage/maria/ma_control_file.c b/storage/maria/ma_control_file.c
index a6daa8bef24..21befb70bd9 100644
--- a/storage/maria/ma_control_file.c
+++ b/storage/maria/ma_control_file.c
@@ -705,7 +705,7 @@ my_bool print_aria_log_control()
checkpoint_lsn= lsn_korr(buffer + new_cf_create_time_size +
CF_LSN_OFFSET);
logno= uint4korr(buffer + new_cf_create_time_size + CF_FILENO_OFFSET);
- my_uuid2str(buffer + CF_UUID_OFFSET, uuid_str);
+ my_uuid2str(buffer + CF_UUID_OFFSET, uuid_str, 1);
uuid_str[MY_UUID_STRING_LENGTH]= 0;
printf("Block size: %u\n", uint2korr(buffer + CF_BLOCKSIZE_OFFSET));
diff --git a/storage/maria/ma_ft_update.c b/storage/maria/ma_ft_update.c
index 8e1bf397c86..b048a8a2c5a 100644
--- a/storage/maria/ma_ft_update.c
+++ b/storage/maria/ma_ft_update.c
@@ -320,7 +320,7 @@ my_bool _ma_ft_convert_to_ft2(MARIA_HA *info, MARIA_KEY *key)
/* we'll generate one pageful at once, and insert the rest one-by-one */
/* calculating the length of this page ...*/
length=(keyinfo->block_length-2) / keyinfo->keylength;
- set_if_smaller(length, da->elements);
+ set_if_smaller(length, (uint)da->elements);
length=length * keyinfo->keylength;
get_key_full_length_rdonly(key_length, key->data);
diff --git a/storage/maria/ma_init.c b/storage/maria/ma_init.c
index 029ce4b9128..14c4c9963f1 100644
--- a/storage/maria/ma_init.c
+++ b/storage/maria/ma_init.c
@@ -140,7 +140,7 @@ my_bool maria_upgrade()
We start by renaming all log files, so that if we get a crash
we will continue from where we left.
*/
- uint i;
+ size_t i;
MY_DIR *dir= my_dir(maria_data_root, MYF(MY_WME));
if (!dir)
DBUG_RETURN(1);
diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c
index 4f6193a05a7..6572ff8e140 100644
--- a/storage/maria/ma_loghandler.c
+++ b/storage/maria/ma_loghandler.c
@@ -1342,7 +1342,7 @@ struct st_file_counter
static void translog_mark_file_unfinished(uint32 file)
{
- int place, i;
+ ssize_t place, i;
struct st_file_counter fc, *fc_ptr;
DBUG_ENTER("translog_mark_file_unfinished");
@@ -1375,7 +1375,7 @@ static void translog_mark_file_unfinished(uint32 file)
goto end;
}
- if (place == (int)log_descriptor.unfinished_files.elements)
+ if (place == (ssize_t)log_descriptor.unfinished_files.elements)
{
insert_dynamic(&log_descriptor.unfinished_files, (uchar*) &fc);
DBUG_PRINT("info", ("The last element inserted"));
@@ -3502,7 +3502,7 @@ my_bool translog_walk_filenames(const char *directory,
const char *))
{
MY_DIR *dirp;
- uint i;
+ size_t i;
my_bool rc= FALSE;
/* Finds and removes transaction log files */
@@ -5625,8 +5625,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
TRANSLOG_ADDRESS horizon;
struct st_buffer_cursor cursor;
int rc= 0;
- uint i, chunk2_page, full_pages;
- uint curr_group= 0;
+ size_t i, curr_group= 0;
+ uint chunk2_page, full_pages;
translog_size_t record_rest, first_page, chunk3_pages, chunk0_pages= 1;
translog_size_t done= 0;
struct st_translog_group_descriptor group;
@@ -5892,11 +5892,11 @@ translog_write_variable_record_mgroup(LSN *lsn,
DBUG_ASSERT(cursor.buffs.unlck_ptr == cursor.buffs.wrt_ptr);
rc= translog_advance_pointer(pages_to_skip + (int)(chunk0_pages - 1),
- record_rest + header_fixed_part +
- (groups.elements -
+ (uint16)(record_rest + header_fixed_part +
+ ((uint)groups.elements -
((page_capacity -
header_fixed_part) / (7 + 1)) *
- (chunk0_pages - 1)) * (7 + 1),
+ (chunk0_pages - 1)) * (7 + 1)),
&cursor.buffs);
buffer_of_last_lsn= log_descriptor.bc.buffer;
translog_unlock();
@@ -5984,7 +5984,7 @@ translog_write_variable_record_mgroup(LSN *lsn,
header_length);
do
{
- int limit;
+ size_t limit;
if (new_page_before_chunk0 &&
translog_chaser_page_next(&horizon, &cursor))
{
@@ -6026,9 +6026,8 @@ translog_write_variable_record_mgroup(LSN *lsn,
*/
limit= (groups_per_page < groups.elements - curr_group ?
groups_per_page : groups.elements - curr_group);
- DBUG_PRINT("info", ("Groups: %u curr: %u limit: %u",
- (uint) groups.elements, (uint) curr_group,
- (uint) limit));
+ DBUG_PRINT("info", ("Groups: %zu curr: %zu limit: %zu",
+ groups.elements, curr_group, limit));
if (chunk0_pages == 1)
{
diff --git a/storage/maria/ma_open.c b/storage/maria/ma_open.c
index d642f1a7194..2d9174b4380 100644
--- a/storage/maria/ma_open.c
+++ b/storage/maria/ma_open.c
@@ -156,8 +156,7 @@ static MARIA_HA *maria_clone_internal(MARIA_SHARE *share,
info.lock_type= F_WRLCK;
_ma_set_data_pagecache_callbacks(&info.dfile, share);
- my_bitmap_init(&info.changed_fields, changed_fields_bitmap,
- share->base.fields, 0);
+ my_bitmap_init(&info.changed_fields, changed_fields_bitmap, share->base.fields);
if ((*share->init)(&info))
goto err;
@@ -1026,7 +1025,8 @@ MARIA_HA *maria_open(const char *name, int mode, uint open_flags,
MARIA_STATE_HISTORY_CLOSED *history;
if ((history= (MARIA_STATE_HISTORY_CLOSED *)
my_hash_search(&maria_stored_state,
- (uchar*) &share->state.create_rename_lsn, 0)))
+ (uchar*) &share->state.create_rename_lsn,
+ sizeof(share->state.create_rename_lsn))))
{
/*
Move history from hash to share. This is safe to do as we
diff --git a/storage/maria/ma_page.c b/storage/maria/ma_page.c
index 25db0e8acec..5881456a69a 100644
--- a/storage/maria/ma_page.c
+++ b/storage/maria/ma_page.c
@@ -119,7 +119,7 @@ my_bool _ma_fetch_keypage(MARIA_PAGE *page, MARIA_HA *info,
PAGECACHE_LOCK_READ_UNLOCK);
page_link.changed= 0;
push_dynamic(&info->pinned_pages, (void*) &page_link);
- page->link_offset= info->pinned_pages.elements-1;
+ page->link_offset= (uint)info->pinned_pages.elements-1;
}
if (tmp == info->buff)
diff --git a/storage/maria/ma_sort.c b/storage/maria/ma_sort.c
index b9d6fffda86..f02a7a81020 100644
--- a/storage/maria/ma_sort.c
+++ b/storage/maria/ma_sort.c
@@ -50,7 +50,7 @@ extern void print_error(const char *fmt,...);
static ha_rows find_all_keys(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- DYNAMIC_ARRAY *buffpek,uint *maxbuffer,
+ DYNAMIC_ARRAY *buffpek,size_t *maxbuffer,
IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions);
static int write_keys(MARIA_SORT_PARAM *info,uchar **sort_keys,
@@ -61,7 +61,7 @@ static int write_index(MARIA_SORT_PARAM *info, uchar **sort_keys,
ha_keys count);
static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- BUFFPEK *buffpek, uint *maxbuffer,
+ BUFFPEK *buffpek, size_t *maxbuffer,
IO_CACHE *t_file);
static my_off_t read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
@@ -69,7 +69,7 @@ static int merge_buffers(MARIA_SORT_PARAM *info, ha_keys keys,
IO_CACHE *from_file, IO_CACHE *to_file,
uchar **sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb);
-static int merge_index(MARIA_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, uint,
+static int merge_index(MARIA_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, size_t,
IO_CACHE *);
static int flush_maria_ft_buf(MARIA_SORT_PARAM *info);
@@ -126,8 +126,8 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
size_t sortbuff_size)
{
int error;
- uint sort_length, maxbuffer;
- size_t memavl, old_memavl;
+ uint sort_length;
+ size_t memavl, old_memavl, maxbuffer;
DYNAMIC_ARRAY buffpek;
ha_rows records, UNINIT_VAR(keys);
uchar **sort_keys;
@@ -165,7 +165,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (records / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (records / keys)+1);
}
else
{
@@ -173,7 +173,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
All keys can't fit in memory.
Calculate how many keys + buffers we can keep in memory
*/
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -190,7 +190,7 @@ int _ma_create_index_by_sort(MARIA_SORT_PARAM *info, my_bool no_messages,
goto err;
}
}
- while ((maxbuffer= (uint) (records/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (records/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= ((uchar**)
@@ -310,7 +310,7 @@ err:
static ha_rows find_all_keys(MARIA_SORT_PARAM *info, ha_rows keys,
uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
- uint *maxbuffer, IO_CACHE *tempfile,
+ size_t *maxbuffer, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions)
{
int error;
@@ -371,7 +371,7 @@ static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
longlong sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
- uint maxbuffer;
+ size_t maxbuffer;
uchar **sort_keys= NULL;
DBUG_ENTER("_ma_thr_find_all_keys_exec");
DBUG_PRINT("enter", ("master: %d", sort_param->master));
@@ -406,11 +406,11 @@ static my_bool _ma_thr_find_all_keys_exec(MARIA_SORT_PARAM* sort_param)
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -622,7 +622,7 @@ int _ma_thr_write_keys(MARIA_SORT_PARAM *sort_param)
if (sinfo->buffpek.elements)
{
- uint maxbuffer=sinfo->buffpek.elements-1;
+ size_t maxbuffer=sinfo->buffpek.elements-1;
if (!mergebuf)
{
length=(size_t)param->sort_buffer_length;
@@ -838,9 +838,9 @@ static int write_index(MARIA_SORT_PARAM *info, register uchar **sort_keys,
static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys, BUFFPEK *buffpek,
- uint *maxbuffer, IO_CACHE *t_file)
+ size_t *maxbuffer, IO_CACHE *t_file)
{
- uint tmp, merges, max_merges;
+ size_t tmp, merges, max_merges;
IO_CACHE t_file2, *from_file, *to_file, *temp;
BUFFPEK *lastbuff;
DBUG_ENTER("merge_many_buff");
@@ -866,7 +866,7 @@ static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
from_file= t_file ; to_file= &t_file2;
while (*maxbuffer >= MERGEBUFF2)
{
- uint i;
+ size_t i;
reinit_io_cache(from_file,READ_CACHE,0L,0,0);
reinit_io_cache(to_file,WRITE_CACHE,0L,0,0);
lastbuff=buffpek;
@@ -884,7 +884,7 @@ static int merge_many_buff(MARIA_SORT_PARAM *info, ha_keys keys,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
- *maxbuffer= (uint) (lastbuff-buffpek)-1;
+ *maxbuffer= (size_t) (lastbuff-buffpek)-1;
if (info->sort_info->param->max_stage != 1) /* If not parallel */
_ma_report_progress(info->sort_info->param, merges++, max_merges);
}
@@ -1140,7 +1140,7 @@ err:
static int
merge_index(MARIA_SORT_PARAM *info, ha_keys keys, uchar **sort_keys,
- BUFFPEK *buffpek, uint maxbuffer, IO_CACHE *tempfile)
+ BUFFPEK *buffpek, size_t maxbuffer, IO_CACHE *tempfile)
{
DBUG_ENTER("merge_index");
if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
diff --git a/storage/maria/unittest/ma_maria_log_cleanup.c b/storage/maria/unittest/ma_maria_log_cleanup.c
index 0d75fdbf95c..a4d0609f686 100644
--- a/storage/maria/unittest/ma_maria_log_cleanup.c
+++ b/storage/maria/unittest/ma_maria_log_cleanup.c
@@ -21,7 +21,7 @@
my_bool maria_log_remove(const char *testdir)
{
MY_DIR *dirp;
- uint i;
+ size_t i;
MY_STAT stat_buff;
char file_name[FN_REFLEN];
diff --git a/storage/mroonga/CMakeLists.txt b/storage/mroonga/CMakeLists.txt
index c048b214658..bea0eecc8b7 100644
--- a/storage/mroonga/CMakeLists.txt
+++ b/storage/mroonga/CMakeLists.txt
@@ -110,19 +110,9 @@ if(MRN_GROONGA_BUNDLED)
set(GROONGA_NORMALIZER_MYSQL_EMBED ON)
endif()
- file(READ "${MRN_BUNDLED_GROONGA_DIR}/bundled_lz4_version"
- MRN_BUNDLED_LZ4_VERSION)
- string(STRIP
- "${MRN_BUNDLED_LZ4_VERSION}"
- MRN_BUNDLED_LZ4_VERSION)
- set(MRN_BUNDLED_LZ4_DIR
- "${MRN_BUNDLED_GROONGA_DIR}/vendor/lz4-${MRN_BUNDLED_LZ4_VERSION}")
- if(EXISTS ${MRN_BUNDLED_LZ4_DIR})
- set(GRN_WITH_BUNDLED_LZ4 ON)
- set(GRN_WITH_LZ4 "yes")
- else()
- set(GRN_WITH_LZ4 "no")
- endif()
+ set(GRN_WITH_LZ4 "yes")
+ set(LIBLZ4_FOUND TRUE)
+ set(LZ4_LIBS "" CACHE STRING "" FORCE)
add_subdirectory("${MRN_BUNDLED_GROONGA_RELATIVE_DIR}")
else()
diff --git a/storage/mroonga/ha_mroonga.cpp b/storage/mroonga/ha_mroonga.cpp
index baf6de6c302..f7cb81fee66 100644
--- a/storage/mroonga/ha_mroonga.cpp
+++ b/storage/mroonga/ha_mroonga.cpp
@@ -4926,7 +4926,7 @@ int ha_mroonga::open(const char *name,
DBUG_RETURN(error);
thr_lock_data_init(&share->lock,&thr_lock_data,NULL);
- if (bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields, false))
+ if (my_bitmap_init(&multiple_column_key_bitmap, NULL, table->s->fields))
{
mrn_free_share(share);
share = NULL;
@@ -4942,7 +4942,7 @@ int ha_mroonga::open(const char *name,
if (error)
{
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
mrn_free_share(share);
share = NULL;
}
@@ -5009,7 +5009,7 @@ int ha_mroonga::close()
{
error = add_wrap_hton(share->table_name, share->hton);
}
- bitmap_free(&multiple_column_key_bitmap);
+ my_bitmap_free(&multiple_column_key_bitmap);
if (share->use_count == 1) {
mrn_free_long_term_share(share->long_term_share);
}
diff --git a/storage/mroonga/lib/mrn_smart_bitmap.cpp b/storage/mroonga/lib/mrn_smart_bitmap.cpp
index f8fd4f727bb..cdedeb677cd 100644
--- a/storage/mroonga/lib/mrn_smart_bitmap.cpp
+++ b/storage/mroonga/lib/mrn_smart_bitmap.cpp
@@ -26,7 +26,7 @@ namespace mrn {
SmartBitmap::~SmartBitmap() {
if (bitmap_) {
- bitmap_free(bitmap_);
+ my_bitmap_free(bitmap_);
}
}
diff --git a/storage/myisam/ft_update.c b/storage/myisam/ft_update.c
index 0c97a926746..157e5423168 100644
--- a/storage/myisam/ft_update.c
+++ b/storage/myisam/ft_update.c
@@ -301,7 +301,8 @@ uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key)
DYNAMIC_ARRAY *da=info->ft1_to_ft2;
MI_KEYDEF *keyinfo=&info->s->ft2_keyinfo;
uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
- uint length, key_length;
+ size_t length;
+ uint key_length;
DBUG_ENTER("_mi_ft_convert_to_ft2");
/* we'll generate one pageful at once, and insert the rest one-by-one */
diff --git a/storage/myisam/sort.c b/storage/myisam/sort.c
index fe0c0f8f02e..198e669bbb4 100644
--- a/storage/myisam/sort.c
+++ b/storage/myisam/sort.c
@@ -47,7 +47,7 @@ extern void print_error(const char *fmt,...);
static ha_rows find_all_keys(MI_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys,
- DYNAMIC_ARRAY *buffpek,uint *maxbuffer,
+ DYNAMIC_ARRAY *buffpek, size_t *maxbuffer,
IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions);
static int write_keys(MI_SORT_PARAM *info,uchar **sort_keys,
@@ -58,7 +58,7 @@ static int write_index(MI_SORT_PARAM *info,uchar * *sort_keys,
ha_keys count);
static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
uchar * *sort_keys,
- BUFFPEK *buffpek, uint *maxbuffer,
+ BUFFPEK *buffpek, size_t *maxbuffer,
IO_CACHE *t_file);
static my_off_t read_to_buffer(IO_CACHE *fromfile,BUFFPEK *buffpek,
uint sort_length);
@@ -66,7 +66,7 @@ static int merge_buffers(MI_SORT_PARAM *info, ha_keys keys,
IO_CACHE *from_file, IO_CACHE *to_file,
uchar * *sort_keys, BUFFPEK *lastbuff,
BUFFPEK *Fb, BUFFPEK *Tb);
-static int merge_index(MI_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, uint,
+static int merge_index(MI_SORT_PARAM *,ha_keys,uchar **,BUFFPEK *, size_t,
IO_CACHE *);
static int flush_ft_buf(MI_SORT_PARAM *info);
@@ -124,7 +124,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
ulonglong sortbuff_size)
{
int error;
- uint sort_length, maxbuffer;
+ uint sort_length;
+ size_t maxbuffer;
ulonglong memavl, old_memavl;
DYNAMIC_ARRAY buffpek;
ha_rows records, UNINIT_VAR(keys);
@@ -161,7 +162,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (records / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (records / keys)+1);
}
else
{
@@ -169,7 +170,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
All keys can't fit in memory.
Calculate how many keys + buffers we can keep in memory
*/
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
@@ -186,7 +187,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
goto err;
}
}
- while ((maxbuffer= (uint) (records/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (records/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= ((uchar **)
@@ -298,7 +299,7 @@ err:
static ha_rows find_all_keys(MI_SORT_PARAM *info, ha_rows keys,
uchar **sort_keys, DYNAMIC_ARRAY *buffpek,
- uint *maxbuffer, IO_CACHE *tempfile,
+ size_t *maxbuffer, IO_CACHE *tempfile,
IO_CACHE *tempfile_for_exceptions)
{
int error;
@@ -349,7 +350,7 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
ulonglong memavl, old_memavl, sortbuff_size;
ha_keys UNINIT_VAR(keys), idx;
uint sort_length;
- uint maxbuffer;
+ size_t maxbuffer;
uchar **sort_keys= NULL;
int error= 0;
DBUG_ENTER("thr_find_all_keys");
@@ -386,18 +387,18 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
will be allocated when needed.
*/
keys= memavl / (sort_length+sizeof(char*));
- maxbuffer= (uint) MY_MIN((ulonglong) 1000, (idx / keys)+1);
+ maxbuffer= (size_t) MY_MIN((ulonglong) 1000, (idx / keys)+1);
}
else
{
- uint maxbuffer_org;
+ size_t maxbuffer_org;
do
{
maxbuffer_org= maxbuffer;
if (memavl < sizeof(BUFFPEK)*maxbuffer ||
(keys=(memavl-sizeof(BUFFPEK)*maxbuffer)/
(sort_length+sizeof(char*))) <= 1 ||
- keys < (uint) maxbuffer)
+ keys < maxbuffer)
{
mi_check_print_error(sort_param->sort_info->param,
"myisam_sort_buffer_size is too small. Current myisam_sort_buffer_size: %llu rows: %llu sort_length: %u",
@@ -405,7 +406,7 @@ static my_bool thr_find_all_keys_exec(MI_SORT_PARAM *sort_param)
DBUG_RETURN(TRUE);
}
}
- while ((maxbuffer= (uint) (idx/(keys-1)+1)) != maxbuffer_org);
+ while ((maxbuffer= (size_t) (idx/(keys-1)+1)) != maxbuffer_org);
}
if ((sort_keys= (uchar**) my_malloc(PSI_INSTRUMENT_ME,
(size_t)(keys * (sort_length + sizeof(char*)) +
@@ -604,7 +605,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param)
if (sinfo->buffpek.elements)
{
- uint maxbuffer=sinfo->buffpek.elements-1;
+ size_t maxbuffer=sinfo->buffpek.elements-1;
if (!mergebuf)
{
length=param->sort_buffer_length;
@@ -806,9 +807,9 @@ static int write_index(MI_SORT_PARAM *info, register uchar **sort_keys,
static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
uchar **sort_keys, BUFFPEK *buffpek,
- uint *maxbuffer, IO_CACHE *t_file)
+ size_t *maxbuffer, IO_CACHE *t_file)
{
- register uint i;
+ register size_t i;
IO_CACHE t_file2, *from_file, *to_file, *temp;
BUFFPEK *lastbuff;
DBUG_ENTER("merge_many_buff");
@@ -838,7 +839,7 @@ static int merge_many_buff(MI_SORT_PARAM *info, ha_keys keys,
if (flush_io_cache(to_file))
break; /* purecov: inspected */
temp=from_file; from_file=to_file; to_file=temp;
- *maxbuffer= (uint) (lastbuff-buffpek)-1;
+ *maxbuffer= (size_t) (lastbuff-buffpek)-1;
}
cleanup:
close_cached_file(to_file); /* This holds old result */
@@ -1099,7 +1100,7 @@ err:
static int
merge_index(MI_SORT_PARAM *info, ha_keys keys, uchar **sort_keys,
- BUFFPEK *buffpek, uint maxbuffer, IO_CACHE *tempfile)
+ BUFFPEK *buffpek, size_t maxbuffer, IO_CACHE *tempfile)
{
DBUG_ENTER("merge_index");
if (merge_buffers(info,keys,tempfile,(IO_CACHE*) 0,sort_keys,buffpek,buffpek,
diff --git a/storage/myisammrg/ha_myisammrg.cc b/storage/myisammrg/ha_myisammrg.cc
index 70a4d6aa284..d37636abab7 100644
--- a/storage/myisammrg/ha_myisammrg.cc
+++ b/storage/myisammrg/ha_myisammrg.cc
@@ -121,7 +121,7 @@ ha_myisammrg::ha_myisammrg(handlerton *hton, TABLE_SHARE *table_arg)
:handler(hton, table_arg), file(0), is_cloned(0)
{
init_sql_alloc(rg_key_memory_children, &children_mem_root,
- FN_REFLEN + ALLOC_ROOT_MIN_BLOCK_SIZE, 0, MYF(0));
+ FN_REFLEN, 0, MYF(0));
}
diff --git a/storage/oqgraph/cmake/FindJudy.cmake b/storage/oqgraph/cmake/FindJudy.cmake
index d9ecfdc4a4f..37aed8b631c 100644
--- a/storage/oqgraph/cmake/FindJudy.cmake
+++ b/storage/oqgraph/cmake/FindJudy.cmake
@@ -16,7 +16,7 @@
# Once done this will define
#
# Judy_FOUND - system has Judy
-# Judy_INCLUDE_DIR - the Judy include directory
+# Judy_INCLUDE_DIRS - the Judy include directory
# Judy_LIBRARIES - Link these to use Judy
# Judy_DEFINITIONS - Compiler switches required for using Judy
@@ -24,21 +24,21 @@ IF(MSVC)
# For now, assume Judy built according to the above instructions
if (NOT "$ENV{JUDY_ROOT}" STREQUAL "")
# Avoid passing backslashes to _Boost_FIND_LIBRARY due to macro re-parsing.
- string(REPLACE "\\" "/" Judy_INCLUDE_DIR_search $ENV{JUDY_ROOT}/src)
+ string(REPLACE "\\" "/" Judy_INCLUDE_DIRS_search $ENV{JUDY_ROOT}/src)
string(REPLACE "\\" "/" Judy_LIBRARIES_search $ENV{JUDY_ROOT}/src)
endif()
ELSE(MSVC)
- IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FIND_QUIETLY TRUE)
- ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
ENDIF(MSVC)
-FIND_PATH(Judy_INCLUDE_DIR Judy.h PATHS ${Judy_INCLUDE_DIR_search})
+FIND_PATH(Judy_INCLUDE_DIRS Judy.h PATHS ${Judy_INCLUDE_DIRS_search})
FIND_LIBRARY(Judy_LIBRARIES Judy PATHS ${Judy_LIBRARIES_search})
-IF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+IF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FOUND TRUE)
-ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ELSE (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
SET(Judy_FOUND FALSE)
if (MSVC)
MESSAGE(STATUS "How to build Judy on Windows:")
@@ -51,7 +51,7 @@ ELSE (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
MESSAGE(STATUS "3. Execute the command: 'build'")
MESSAGE(STATUS "4. Rerun this cmake with the environment variable: 'set JUDY_ROOT=x:\\path\\to\\judy'")
endif(MSVC)
-ENDIF (Judy_INCLUDE_DIR AND Judy_LIBRARIES)
+ENDIF (Judy_INCLUDE_DIRS AND Judy_LIBRARIES)
IF (Judy_FOUND)
IF (NOT Judy_FIND_QUIETLY)
@@ -63,5 +63,5 @@ ELSE (Judy_FOUND)
ENDIF (Judy_FIND_REQUIRED)
ENDIF (Judy_FOUND)
-MARK_AS_ADVANCED(Judy_INCLUDE_DIR Judy_LIBRARIES)
+MARK_AS_ADVANCED(Judy_INCLUDE_DIRS Judy_LIBRARIES)
diff --git a/storage/rocksdb/CMakeLists.txt b/storage/rocksdb/CMakeLists.txt
index 9d1c13e11cd..d3f7ca90889 100644
--- a/storage/rocksdb/CMakeLists.txt
+++ b/storage/rocksdb/CMakeLists.txt
@@ -141,8 +141,12 @@ else()
SET(ATOMIC_EXTRA_LIBS)
endif()
+# don't use compression providers, there are standalone executables below
+GET_PROPERTY(dirs DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
+LIST(REMOVE_ITEM dirs ${CMAKE_SOURCE_DIR}/include/providers)
+SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES "${dirs}")
+
MYSQL_ADD_PLUGIN(rocksdb ${ROCKSDB_SE_SOURCES} MODULE_ONLY STORAGE_ENGINE
- MODULE_OUTPUT_NAME ha_rocksdb
LINK_LIBRARIES ${ATOMIC_EXTRA_LIBS}
COMPONENT rocksdb-engine)
@@ -151,8 +155,6 @@ IF(NOT TARGET rocksdb)
RETURN()
ENDIF()
-
-
CHECK_CXX_SOURCE_COMPILES("
#if defined(_MSC_VER) && !defined(__thread)
#define __thread __declspec(thread)
diff --git a/storage/rocksdb/build_rocksdb.cmake b/storage/rocksdb/build_rocksdb.cmake
index fd23b7ba470..29b2d83a759 100644
--- a/storage/rocksdb/build_rocksdb.cmake
+++ b/storage/rocksdb/build_rocksdb.cmake
@@ -35,48 +35,48 @@ endif()
# Optional compression libraries.
include(CheckFunctionExists)
-macro(check_lib package var)
- STRING(TOUPPER ${package} PACKAGE_NAME)
+macro(check_lib package)
SET(WITH_ROCKSDB_${package} AUTO CACHE STRING
"Build RocksDB with ${package} compression. Possible values are 'ON', 'OFF', 'AUTO' and default is 'AUTO'")
+ STRING(TOUPPER ${package} var)
IF (NOT ${WITH_ROCKSDB_${package}} STREQUAL "OFF")
FIND_PACKAGE(${package} QUIET)
- SET(HAVE_ROCKSDB_${PACKAGE_NAME} TRUE)
- IF (${${PACKAGE_NAME}_FOUND})
- IF(${ARGC} GREATER 2)
+ SET(HAVE_ROCKSDB_${package} TRUE)
+ IF (${${package}_FOUND})
+ IF(${ARGC} GREATER 1)
SET(CMAKE_REQUIRED_LIBRARIES ${${var}_LIBRARIES})
- CHECK_FUNCTION_EXISTS(${ARGV2} ${var}_VALID)
+ CHECK_FUNCTION_EXISTS(${ARGV1} ${package}_VALID)
UNSET(CMAKE_REQUIRED_LIBRARIES)
ELSE()
- SET(${var}_VALID TRUE)
+ SET(${package}_VALID TRUE)
ENDIF()
ENDIF()
ENDIF()
- ADD_FEATURE_INFO(ROCKSDB_${PACKAGE_NAME} HAVE_ROCKSDB_${PACKAGE_NAME} "${package} Compression in the RocksDB storage engine")
+ ADD_FEATURE_INFO(ROCKSDB_${package} HAVE_ROCKSDB_${package} "${package} Compression in the RocksDB storage engine")
- IF(${${var}_VALID})
- MESSAGE_ONCE(rocksdb_${var} "Found ${package}: ${${var}_LIBRARIES}")
- add_definitions(-D${PACKAGE_NAME})
+ IF(${${package}_VALID})
+ MESSAGE_ONCE(rocksdb_${package} "Found ${package}: ${${var}_LIBRARIES}")
+ add_definitions(-D${var})
include_directories(${${var}_INCLUDE_DIR})
list(APPEND THIRDPARTY_LIBS ${${var}_LIBRARIES})
- ELSEIF(${${PACKAGE_NAME}_FOUND})
- MESSAGE_ONCE(rocksdb_${var} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV2}]")
+ ELSEIF(${${package}_FOUND})
+ MESSAGE_ONCE(rocksdb_${package} "Found unusable ${package}: ${${var}_LIBRARIES} [${ARGV1}]")
ELSE()
- MESSAGE_ONCE(rocksdb_${var} "Could NOT find ${package}")
+ MESSAGE_ONCE(rocksdb_${package} "Could NOT find ${package}")
ENDIF()
- IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${PACKAGE_NAME}_FOUND})
+ IF (${WITH_ROCKSDB_${package}} STREQUAL "ON" AND NOT ${${package}_FOUND})
MESSAGE(FATAL_ERROR
"${package} library was not found, but WITH_ROCKSDB_${package} option is ON.\
Either set WITH_ROCKSDB_${package} to OFF, or make sure ${package} is installed")
endif()
endmacro()
-check_lib(LZ4 LZ4)
-check_lib(BZip2 BZIP2)
-check_lib(snappy snappy) # rocksdb/cmake/modules/Findsnappy.cmake violates the convention
-check_lib(ZSTD ZSTD ZDICT_trainFromBuffer)
+check_lib(LZ4)
+check_lib(BZip2)
+check_lib(Snappy)
+check_lib(ZSTD ZDICT_trainFromBuffer)
add_definitions(-DZLIB)
list(APPEND THIRDPARTY_LIBS ${ZLIB_LIBRARY})
diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc
index d11e9a5f681..1168427a458 100644
--- a/storage/rocksdb/ha_rocksdb.cc
+++ b/storage/rocksdb/ha_rocksdb.cc
@@ -704,7 +704,7 @@ static int rmdir_force(const char *dir) {
if (!dir_info)
return 1;
- for (uint i = 0; i < dir_info->number_of_files; i++) {
+ for (size_t i = 0; i < dir_info->number_of_files; i++) {
FILEINFO *file = dir_info->dir_entry + i;
strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
@@ -5216,9 +5216,6 @@ static rocksdb::Status check_rocksdb_options_compatibility(
return status;
}
-bool prevent_myrocks_loading= false;
-
-
static int rocksdb_check_version(handlerton *hton,
const char *path,
const LEX_CUSTRING *version,
@@ -5239,14 +5236,6 @@ static int rocksdb_init_func(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- {
- my_error(ER_INTERNAL_ERROR, MYF(0),
- "Loading MyRocks plugin after it has been unloaded is not "
- "supported. Please restart mariadbd");
- DBUG_RETURN(1);
- }
-
if (rocksdb_ignore_datadic_errors)
{
sql_print_information(
@@ -5821,8 +5810,6 @@ static int rocksdb_init_func(void *const p) {
static int rocksdb_done_func(void *const p) {
DBUG_ENTER_FUNC();
- int error = 0;
-
// signal the drop index thread to stop
rdb_drop_idx_thread.signal(true);
@@ -5866,12 +5853,6 @@ static int rocksdb_done_func(void *const p) {
"RocksDB: Couldn't stop the manual compaction thread: (errno=%d)", err);
}
- if (rdb_open_tables.count()) {
- // Looks like we are getting unloaded and yet we have some open tables
- // left behind.
- error = 1;
- }
-
rdb_open_tables.free();
/*
destructors for static objects can be called at _exit(),
@@ -5923,7 +5904,7 @@ static int rocksdb_done_func(void *const p) {
MariaDB: don't clear rocksdb_db_options and rocksdb_tbl_options.
MyRocks' plugin variables refer to them.
- The plugin cannot be loaded again (see prevent_myrocks_loading) but plugin
+ The plugin cannot be loaded again but plugin
variables are processed before myrocks::rocksdb_init_func is invoked, so
they must point to valid memory.
*/
@@ -5938,12 +5919,12 @@ static int rocksdb_done_func(void *const p) {
my_error_unregister(HA_ERR_ROCKSDB_FIRST, HA_ERR_ROCKSDB_LAST);
/*
- Prevent loading the plugin after it has been loaded and then unloaded. This
- doesn't work currently.
+ returning non-zero status from the plugin deinit function will prevent
+ the server from unloading the plugin. it will only be marked unusable.
+ This is needed here, because RocksDB cannot be fully unloaded
+ and reloaded (see sql_plugin.cc near STB_GNU_UNIQUE).
*/
- prevent_myrocks_loading= true;
-
- DBUG_RETURN(error);
+ DBUG_RETURN(1);
}
static inline void rocksdb_smart_seek(bool seek_backward,
@@ -10833,7 +10814,7 @@ int ha_rocksdb::index_end() {
release_scan_iterator();
- bitmap_free(&m_lookup_bitmap);
+ my_bitmap_free(&m_lookup_bitmap);
active_index = MAX_KEY;
in_range_check_pushed_down = FALSE;
diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h
index 63279bc1b62..63bf7ffd602 100644
--- a/storage/rocksdb/ha_rocksdb.h
+++ b/storage/rocksdb/ha_rocksdb.h
@@ -397,7 +397,7 @@ class ha_rocksdb : public my_core::handler {
current lookup to be covered. If the bitmap field is null, that means this
index does not cover the current lookup for any record.
*/
- MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, nullptr, 0, 0};
+ MY_BITMAP m_lookup_bitmap = {nullptr, nullptr, 0, 0};
int alloc_key_buffers(const TABLE *const table_arg,
const Rdb_tbl_def *const tbl_def_arg,
@@ -1062,8 +1062,6 @@ std::string rdb_corruption_marker_file_name();
const int MYROCKS_MARIADB_PLUGIN_MATURITY_LEVEL= MariaDB_PLUGIN_MATURITY_STABLE;
-extern bool prevent_myrocks_loading;
-
extern uint32_t rocksdb_ignore_datadic_errors;
void sql_print_verbose_info(const char *format, ...);
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
index b3df869a0a7..a3a138555ee 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_not_null.result
@@ -1455,7 +1455,7 @@ pk INT AUTO_INCREMENT PRIMARY KEY,
c DECIMAL NOT NULL DEFAULT 1.1
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c' at row 1
+Note 1265 Data truncated for column 'c' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
pk int(11) NO PRI NULL auto_increment
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
index f0cd1a7e8b3..f0d377890c5 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/col_opt_null.result
@@ -1246,7 +1246,7 @@ c2 DECIMAL NULL DEFAULT 1.1,
pk INT AUTO_INCREMENT PRIMARY KEY
) ENGINE=rocksdb;
Warnings:
-Note 1265 Data truncated for column 'c2' at row 1
+Note 1265 Data truncated for column 'c2' at row 0
SHOW COLUMNS IN t1;
Field Type Null Key Default Extra
c decimal(10,0) YES NULL
diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
index 6d6cb1db54e..a8e42a4e2b2 100644
--- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
+++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_plugin.result
@@ -10,26 +10,35 @@ connection default;
UNINSTALL SONAME 'ha_rocksdb';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
+Warning 1620 Plugin is busy and will be uninstalled on shutdown
SELECT ENGINE, SUPPORT FROM INFORMATION_SCHEMA.ENGINES WHERE ENGINE='ROCKSDB';
ENGINE SUPPORT
ROCKSDB NO
disconnect con1;
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
#
# MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
#
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
-#
-# There are two possible scenarios:
-# ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
-# global variables are in the state that doesn't allow it to be
-# initialized back (this is what MDEV-15686 is about). This is handled
-# by intentionally returning an error from rocksdb_init_func.
-#
-# The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
-# and so it will be now loaded as if it happens for the first time.
-INSTALL SONAME 'ha_rocksdb';
-# Whatever happened on the previous step, restore things to the way they
-# were at testcase start.
-UNINSTALL SONAME 'ha_rocksdb';
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+ERROR HY000: Plugin 'rocksdb' already installed
+select engine, support from information_schema.engines where engine='rocksdb';
+engine support
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
+plugin_name plugin_status
+ROCKSDB INACTIVE
diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
index 0cf56c0cbd5..8f30d7c42b6 100644
--- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
+++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_plugin.test
@@ -31,29 +31,15 @@ disconnect con1;
let $wait_condition= SELECT VARIABLE_VALUE=1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME='Threads_cached';
--source include/wait_condition.inc
---echo #
---echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
---echo #
-call mtr.add_suppression("Plugin 'ROCKSDB.*' init function returned error.");
-call mtr.add_suppression("Plugin 'ROCKSDB.*' registration as a INFORMATION SCHEMA failed.");
-call mtr.add_suppression("Plugin 'ROCKSDB' registration as a STORAGE ENGINE failed");
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
--echo #
---echo # There are two possible scenarios:
-
---echo # ha_rocksdb.{dll,so} is still loaded into mysqld's address space. Its
---echo # global variables are in the state that doesn't allow it to be
---echo # initialized back (this is what MDEV-15686 is about). This is handled
---echo # by intentionally returning an error from rocksdb_init_func.
+--echo # MDEV-15686: Loading MyRocks plugin back after it has been unloaded causes a crash
--echo #
---echo # The second case is when ha_rocksdb.{ddl,so} has been fully unloaded
---echo # and so it will be now loaded as if it happens for the first time.
-
---error 0,ER_INTERNAL_ERROR
-INSTALL SONAME 'ha_rocksdb';
---echo # Whatever happened on the previous step, restore things to the way they
---echo # were at testcase start.
---error 0,ER_SP_DOES_NOT_EXIST
-UNINSTALL SONAME 'ha_rocksdb';
+--error ER_PLUGIN_INSTALLED
+INSTALL PLUGIN rocksdb SONAME 'ha_rocksdb';
+select engine, support from information_schema.engines where engine='rocksdb';
+select plugin_name,plugin_status from information_schema.plugins where plugin_name='rocksdb';
diff --git a/storage/rocksdb/rdb_datadic.cc b/storage/rocksdb/rdb_datadic.cc
index 939fb085c4f..9e7983dc634 100644
--- a/storage/rocksdb/rdb_datadic.cc
+++ b/storage/rocksdb/rdb_datadic.cc
@@ -1102,12 +1102,12 @@ size_t Rdb_key_def::get_unpack_header_size(char tag) {
*/
void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
DBUG_ASSERT(map->bitmap == nullptr);
- bitmap_init(map, nullptr, MAX_REF_PARTS, false);
+ my_bitmap_init(map, nullptr, MAX_REF_PARTS);
uint curr_bitmap_pos = 0;
// Indicates which columns in the read set might be covered.
MY_BITMAP maybe_covered_bitmap;
- bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits, false);
+ my_bitmap_init(&maybe_covered_bitmap, nullptr, table->read_set->n_bits);
for (uint i = 0; i < m_key_parts; i++) {
if (table_has_hidden_pk(table) && i + 1 == m_key_parts) {
@@ -1135,8 +1135,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
}
curr_bitmap_pos++;
} else {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1144,8 +1144,8 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// know this lookup will never be covered.
default:
if (bitmap_is_set(table->read_set, field->field_index)) {
- bitmap_free(&maybe_covered_bitmap);
- bitmap_free(map);
+ my_bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(map);
return;
}
break;
@@ -1155,9 +1155,9 @@ void Rdb_key_def::get_lookup_bitmap(const TABLE *table, MY_BITMAP *map) const {
// If there are columns which are not covered in the read set, the lookup
// can't be covered.
if (!bitmap_cmp(table->read_set, &maybe_covered_bitmap)) {
- bitmap_free(map);
+ my_bitmap_free(map);
}
- bitmap_free(&maybe_covered_bitmap);
+ my_bitmap_free(&maybe_covered_bitmap);
}
/*
@@ -1187,7 +1187,7 @@ bool Rdb_key_def::covers_lookup(const rocksdb::Slice *const unpack_info,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -1356,7 +1356,7 @@ uint Rdb_key_def::pack_record(const TABLE *const tbl, uchar *const pack_buffer,
MY_BITMAP covered_bitmap;
my_bitmap_map covered_bits;
uint curr_bitmap_pos = 0;
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
for (uint i = 0; i < n_key_parts; i++) {
// Fill hidden pk id into the last key part for secondary keys for tables
@@ -1661,7 +1661,7 @@ int Rdb_key_def::unpack_record(TABLE *const table, uchar *const buf,
bool has_covered_bitmap =
has_unpack_info && (unpack_header[0] == RDB_UNPACK_COVERED_DATA_TAG);
if (has_covered_bitmap) {
- bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS, false);
+ my_bitmap_init(&covered_bitmap, &covered_bits, MAX_REF_PARTS);
covered_bits = rdb_netbuf_to_uint16((const uchar *)unpack_header +
sizeof(RDB_UNPACK_COVERED_DATA_TAG) +
RDB_UNPACK_COVERED_DATA_LEN_SIZE);
@@ -3852,7 +3852,7 @@ bool Rdb_validate_tbls::scan_for_frms(const std::string &datadir,
/* Scan through the files in the directory */
struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Find .frm files that are not temp files (those that contain '#sql') */
const char *ext = strrchr(file_info->name, '.');
if (ext != nullptr && strstr(file_info->name, tmp_file_prefix) == nullptr &&
@@ -3897,7 +3897,7 @@ bool Rdb_validate_tbls::compare_to_actual_tables(const std::string &datadir,
}
file_info = dir_info->dir_entry;
- for (uint ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii = 0; ii < dir_info->number_of_files; ii++, file_info++) {
/* Ignore files/dirs starting with '.' */
if (file_info->name[0] == '.') continue;
diff --git a/storage/rocksdb/rdb_i_s.cc b/storage/rocksdb/rdb_i_s.cc
index 5350ec3bce9..a3d284dfa64 100644
--- a/storage/rocksdb/rdb_i_s.cc
+++ b/storage/rocksdb/rdb_i_s.cc
@@ -145,9 +145,6 @@ static int rdb_i_s_cfstats_fill_table(
static int rdb_i_s_cfstats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -241,9 +238,6 @@ static int rdb_i_s_dbstats_fill_table(
static int rdb_i_s_dbstats_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -344,8 +338,6 @@ static int rdb_i_s_perf_context_fill_table(
static int rdb_i_s_perf_context_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -413,9 +405,6 @@ static int rdb_i_s_perf_context_global_fill_table(
static int rdb_i_s_perf_context_global_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1045,9 +1034,6 @@ static int rdb_i_s_ddl_fill_table(my_core::THD *const thd,
static int rdb_i_s_ddl_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
my_core::ST_SCHEMA_TABLE *schema;
DBUG_ASSERT(p != nullptr);
@@ -1063,9 +1049,6 @@ static int rdb_i_s_ddl_init(void *const p) {
static int rdb_i_s_cfoptions_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1081,9 +1064,6 @@ static int rdb_i_s_cfoptions_init(void *const p) {
static int rdb_i_s_global_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1101,9 +1081,6 @@ static int rdb_i_s_compact_stats_init(void *p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
schema = reinterpret_cast<my_core::ST_SCHEMA_TABLE *>(p);
@@ -1438,9 +1415,6 @@ static int rdb_i_s_index_file_map_fill_table(
static int rdb_i_s_index_file_map_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1523,9 +1497,6 @@ static int rdb_i_s_lock_info_fill_table(
static int rdb_i_s_lock_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1651,9 +1622,6 @@ static int rdb_i_s_trx_info_fill_table(
static int rdb_i_s_trx_info_init(void *const p) {
DBUG_ENTER_FUNC();
- if (prevent_myrocks_loading)
- DBUG_RETURN(1);
-
DBUG_ASSERT(p != nullptr);
my_core::ST_SCHEMA_TABLE *schema;
@@ -1781,7 +1749,8 @@ static int rdb_i_s_deadlock_info_init(void *const p) {
static int rdb_i_s_deinit(void *p MY_ATTRIBUTE((__unused__))) {
DBUG_ENTER_FUNC();
- DBUG_RETURN(0);
+ /* see the comment at the end of rocksdb_done_func() */
+ DBUG_RETURN(1);
}
static struct st_mysql_information_schema rdb_i_s_info = {
@@ -1955,7 +1924,7 @@ struct st_maria_plugin rdb_i_s_lock_info = {
"RocksDB lock information",
PLUGIN_LICENSE_GPL,
rdb_i_s_lock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1971,7 +1940,7 @@ struct st_maria_plugin rdb_i_s_trx_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_trx_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
@@ -1987,7 +1956,7 @@ struct st_maria_plugin rdb_i_s_deadlock_info = {
"RocksDB transaction information",
PLUGIN_LICENSE_GPL,
rdb_i_s_deadlock_info_init,
- nullptr,
+ rdb_i_s_deinit,
0x0001, /* version number (0.1) */
nullptr, /* status variables */
nullptr, /* system variables */
diff --git a/storage/rocksdb/rdb_sst_info.cc b/storage/rocksdb/rdb_sst_info.cc
index 45ae89c1bd4..ae3938c3918 100644
--- a/storage/rocksdb/rdb_sst_info.cc
+++ b/storage/rocksdb/rdb_sst_info.cc
@@ -542,7 +542,7 @@ void Rdb_sst_info::init(const rocksdb::DB *const db) {
// Scan through the files in the directory
const struct fileinfo *file_info = dir_info->dir_entry;
- for (uint ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
+ for (size_t ii= 0; ii < dir_info->number_of_files; ii++, file_info++) {
// find any files ending with m_suffix ...
const std::string name = file_info->name;
const size_t pos = name.find(m_suffix);
diff --git a/storage/spider/mysql-test/spider/bg/r/ha.result b/storage/spider/mysql-test/spider/bg/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/bg/r/ha.result
+++ b/storage/spider/mysql-test/spider/bg/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/bg/r/ha_part.result b/storage/spider/mysql-test/spider/bg/r/ha_part.result
index 315f37298bc..39fa2655892 100644
--- a/storage/spider/mysql-test/spider/bg/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/bg/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
index aa734573a1a..484ef1a00bd 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -190,6 +194,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
index b793346df4b..d4b05f75660 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -188,6 +192,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
10000
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
index 1db31ca9f95..a6a7588b014 100644
--- a/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/bg/r/spider_fixes.result
@@ -297,10 +297,16 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
@@ -413,6 +419,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +451,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +485,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
index 9f7ada052ed..b222f494ba1 100644
--- a/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/bg/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/handler/r/ha.result b/storage/spider/mysql-test/spider/handler/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/handler/r/ha.result
+++ b/storage/spider/mysql-test/spider/handler/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/handler/r/ha_part.result b/storage/spider/mysql-test/spider/handler/r/ha_part.result
index 315f37298bc..39fa2655892 100644
--- a/storage/spider/mysql-test/spider/handler/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
index 9a8a59153f0..abe543fe193 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes.result
@@ -36,6 +36,10 @@ SELECT 1;
3.1
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -206,6 +210,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
46
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
index f8747cff5ea..6c3a1802f1d 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider3_fixes_part.result
@@ -34,6 +34,10 @@ SELECT 1;
1
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1, t2;
@@ -204,6 +208,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t2;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
index c171167a1b7..aa7d2ea40c1 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes.result
@@ -297,15 +297,25 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
auto_increment
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -399,6 +409,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
42
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
@@ -417,6 +428,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -445,10 +460,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -470,6 +494,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
index c99c02071b6..249f39520c2 100644
--- a/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
+++ b/storage/spider/mysql-test/spider/handler/r/spider_fixes_part.result
@@ -109,6 +109,10 @@ a b c
2.26
auto_increment with partition
connection master_1;
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
connection slave1_1;
connection master_1;
DROP TABLE IF EXISTS t1;
@@ -202,6 +206,7 @@ LAST_INSERT_ID()
SELECT MAX(id) FROM t1;
MAX(id)
26
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
connection slave1_1;
SELECT id FROM t1 ORDER BY id;
id
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
index 64d3b657ae8..30d22a6a16f 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes.test
@@ -97,6 +97,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -222,6 +224,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
index bcd85f42b81..e9c9c194e5c 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider3_fixes_part.test
@@ -131,6 +131,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -256,6 +258,7 @@ if ($HAVE_PARTITION)
INSERT INTO t2 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t2;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
index 9f7ada052ed..5a3c1d1c893 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes.test
@@ -1049,6 +1049,8 @@ if ($USE_CHILD_GROUP2)
}
}
--connection master_1
+SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1120,6 +1122,7 @@ SELECT MAX(id) FROM t1;
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -1172,6 +1175,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1202,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1216,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1237,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
index e6c4456edcb..22ba6102405 100644
--- a/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
+++ b/storage/spider/mysql-test/spider/handler/t/spider_fixes_part.test
@@ -485,6 +485,8 @@ if ($HAVE_PARTITION)
}
}
--connection master_1
+ SET @original_spider_auto_increment_mode = @@SESSION.spider_auto_increment_mode;
+ SET SESSION spider_auto_increment_mode = -1;
if ($USE_REPLICATION)
{
save_master_pos;
@@ -556,6 +558,7 @@ if ($HAVE_PARTITION)
INSERT INTO t1 (id) VALUES (1000);
SELECT LAST_INSERT_ID();
SELECT MAX(id) FROM t1;
+ SET SESSION spider_auto_increment_mode = @original_spider_auto_increment_mode;
if ($USE_REPLICATION)
{
save_master_pos;
diff --git a/storage/spider/mysql-test/spider/include/init_spider.inc b/storage/spider/mysql-test/spider/include/init_spider.inc
index 6a22ffcc1fd..b3fb4df239b 100644
--- a/storage/spider/mysql-test/spider/include/init_spider.inc
+++ b/storage/spider/mysql-test/spider/include/init_spider.inc
@@ -149,13 +149,7 @@ if (!$VERSION_COMPILE_OS_WIN)
}
}
-let $SERVER_NAME=
- `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 2), '-', -1)`;
-if (`SELECT IF('$SERVER_NAME' REGEXP '^[0-9]+\$', 1, 0)`)
-{
- let $SERVER_NAME=
- `SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(version(), '-', 3), '-', -1)`;
-}
+let $SERVER_NAME=MariaDB;
let $SERVER_MAJOR_VERSION=
`SELECT SUBSTRING_INDEX(version(), '.', 1)`;
let $SERVER_MINOR_VERSION=
diff --git a/storage/spider/mysql-test/spider/r/error_row_number.result b/storage/spider/mysql-test/spider/r/error_row_number.result
new file mode 100644
index 00000000000..cc2b54878a0
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/error_row_number.result
@@ -0,0 +1,45 @@
+#
+# MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection child2_1;
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+connection master_1;
+create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+insert into spd values (1),(2),(1);
+ERROR 23000: Duplicate entry '1' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+update spd set id = id + 10;
+ERROR 23000: Duplicate entry '13' for key 'PRIMARY'
+get diagnostics condition 1 @n = row_number;
+select @n;
+@n
+0
+drop table spd;
+connection child2_1;
+drop database auto_test_remote;
+connection master_1;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/r/ha.result b/storage/spider/mysql-test/spider/r/ha.result
index f8833c229ef..3c37c2d51f0 100644
--- a/storage/spider/mysql-test/spider/r/ha.result
+++ b/storage/spider/mysql-test/spider/r/ha.result
@@ -62,6 +62,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -117,6 +121,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 2"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -130,6 +138,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2",
database "auto_test_remote auto_test_remote2", lst "0 1"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -162,6 +174,10 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -213,6 +229,10 @@ ALTER TABLE ta_l
CONNECTION='host "localhost", user "root", password "",
msi "5", mkd "2", alc "1",
database "auto_test_remote auto_test_remote2", lst "1 0"';
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/r/ha_part.result b/storage/spider/mysql-test/spider/r/ha_part.result
index d70d62404c0..d191cab37cd 100644
--- a/storage/spider/mysql-test/spider/r/ha_part.result
+++ b/storage/spider/mysql-test/spider/r/ha_part.result
@@ -62,6 +62,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -122,6 +127,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 2"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -140,6 +150,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "0 1"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
@@ -171,6 +186,11 @@ b CHAR(1),
c DATETIME,
PRIMARY KEY(a)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_HA_AS_P_2_1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
INSERT INTO ta_l2 (a, b, c) VALUES
(1, 'a', '2008-08-01 10:21:39'),
(2, 'b', '2000-01-01 00:00:00'),
@@ -230,6 +250,11 @@ PARTITION pt1 COMMENT='srv "s_2_1 s_2_2", tbl "ta_r ta_r3",
PARTITION pt2 COMMENT='srv "s_2_1 s_2_3", tbl "ta_r2 ta_r4",
priority "1000001", lst "1 0"'
);
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
SELECT db_name, table_name, link_id, link_status FROM mysql.spider_tables
ORDER BY db_name, table_name, link_id;
db_name table_name link_id link_status
diff --git a/storage/spider/mysql-test/spider/r/spider_fixes.result b/storage/spider/mysql-test/spider/r/spider_fixes.result
index b2a2fad5238..3b9d939393a 100644
--- a/storage/spider/mysql-test/spider/r/spider_fixes.result
+++ b/storage/spider/mysql-test/spider/r/spider_fixes.result
@@ -297,10 +297,16 @@ CREATE TABLE t1 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK1
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
CREATE TABLE t2 (
id int(11) NOT NULL,
PRIMARY KEY (id)
) MASTER_1_ENGINE MASTER_1_CHARSET MASTER_1_COMMENT_LOCK2
+Warnings:
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
+Warning 138 The high availability feature of Spider has been deprecated and will be removed in a future release
LOCK TABLES t1 READ, t2 READ;
UNLOCK TABLES;
@@ -413,6 +419,10 @@ connection master_1;
read only
connection master_1;
+SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+SET SESSION spider_read_only_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -441,10 +451,19 @@ DELETE FROM t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
TRUNCATE t1;
ERROR HY000: Table 'auto_test_local.t1' is read only
+SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
2.27
error mode
connection master_1;
+SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+SET SESSION spider_error_read_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
+SET SESSION spider_error_write_mode = -1;
+Warnings:
+Warning 138 The option value -1 (use table value) is deprecated and will be removed in a future release
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (
id int(11) NOT NULL,
@@ -466,6 +485,8 @@ Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
TRUNCATE t1;
Warnings:
Error 1146 Table 'auto_test_remote.ter1_1' doesn't exist
+SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
3.0
is null
diff --git a/storage/spider/mysql-test/spider/r/variable_deprecation.result b/storage/spider/mysql-test/spider/r/variable_deprecation.result
new file mode 100644
index 00000000000..cc267f7d363
--- /dev/null
+++ b/storage/spider/mysql-test/spider/r/variable_deprecation.result
@@ -0,0 +1,267 @@
+#
+# MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+#
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
+connection master_1;
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+# MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler = 3;
+Warnings:
+Warning 1287 '@@spider_use_handler' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_use_handler";
+Variable_name Value
+spider_use_handler 3
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='uhd "3"';
+Warnings:
+Warning 1287 The table parameter 'uhd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='use_handler "3"';
+Warnings:
+Warning 1287 The table parameter 'use_handler' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+Warnings:
+Warning 1287 '@@spider_internal_offset' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_offset";
+Variable_name Value
+spider_internal_offset 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ios "1"';
+Warnings:
+Warning 1287 The table parameter 'ios' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_offset "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_offset' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28005 Deprecate Spider plugin variables regarding UDFs
+SET GLOBAL spider_udf_ds_bulk_insert_rows = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_bulk_insert_rows' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_bulk_insert_rows";
+Variable_name Value
+spider_udf_ds_bulk_insert_rows -1
+SET spider_udf_ds_table_loop_mode = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_table_loop_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_table_loop_mode";
+Variable_name Value
+spider_udf_ds_table_loop_mode 1
+SET spider_udf_ds_use_real_table = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ds_use_real_table' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ds_use_real_table";
+Variable_name Value
+spider_udf_ds_use_real_table 1
+SET GLOBAL spider_udf_ct_bulk_insert_interval = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ct_bulk_insert_interval' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_interval";
+Variable_name Value
+spider_udf_ct_bulk_insert_interval 1
+SET GLOBAL spider_udf_ct_bulk_insert_rows = 1;
+Warnings:
+Warning 1287 '@@spider_udf_ct_bulk_insert_rows' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows";
+Variable_name Value
+spider_udf_ct_bulk_insert_rows 1
+# MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+Warnings:
+Warning 1287 '@@spider_internal_limit' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_internal_limit";
+Variable_name Value
+spider_internal_limit 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ilm "1"';
+Warnings:
+Warning 1287 The table parameter 'ilm' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='internal_limit "1"';
+Warnings:
+Warning 1287 The table parameter 'internal_limit' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+Warnings:
+Warning 1287 '@@spider_xa_register_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+Variable_name Value
+spider_xa_register_mode 0
+# MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_sts' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_sts";
+Variable_name Value
+spider_store_last_sts 0
+SET GLOBAL spider_store_last_crd = 0;
+Warnings:
+Warning 1287 '@@spider_store_last_crd' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_store_last_crd";
+Variable_name Value
+spider_store_last_crd 0
+SET GLOBAL spider_load_sts_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_sts_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+Variable_name Value
+spider_load_sts_at_startup 0
+SET GLOBAL spider_load_crd_at_startup = 0;
+Warnings:
+Warning 1287 '@@spider_load_crd_at_startup' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+Variable_name Value
+spider_load_crd_at_startup 0
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+Warnings:
+Warning 1287 '@@spider_crd_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_mode";
+Variable_name Value
+spider_crd_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cmd "3"';
+Warnings:
+Warning 1287 The table parameter 'cmd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'crd_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_sts_mode = 1;
+Warnings:
+Warning 1287 '@@spider_sts_mode' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_sts_mode";
+Variable_name Value
+spider_sts_mode 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='smd "3"';
+Warnings:
+Warning 1287 The table parameter 'smd' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='sts_mode "3"';
+Warnings:
+Warning 1287 The table parameter 'sts_mode' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+Warnings:
+Warning 1287 '@@spider_crd_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_type";
+Variable_name Value
+spider_crd_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='ctp "1"';
+Warnings:
+Warning 1287 The table parameter 'ctp' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_type "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_crd_weight = 1;
+Warnings:
+Warning 1287 '@@spider_crd_weight' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_crd_weight";
+Variable_name Value
+spider_crd_weight 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='cwg "1"';
+Warnings:
+Warning 1287 The table parameter 'cwg' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='crd_weight "1"';
+Warnings:
+Warning 1287 The table parameter 'crd_weight' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+Warnings:
+Warning 1287 '@@spider_buffer_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_buffer_size";
+Variable_name Value
+spider_buffer_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='bfz "1"';
+Warnings:
+Warning 1287 The table parameter 'bfz' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='buffer_size "1"';
+Warnings:
+Warning 1287 The table parameter 'buffer_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+Warnings:
+Warning 1287 '@@spider_init_sql_alloc_size' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+Variable_name Value
+spider_init_sql_alloc_size 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='isa "1"';
+Warnings:
+Warning 1287 The table parameter 'isa' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='init_sql_alloc_size "1"';
+Warnings:
+Warning 1287 The table parameter 'init_sql_alloc_size' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+Variable_name Value
+spider_semi_table_lock 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stl "1"';
+Warnings:
+Warning 1287 The table parameter 'stl' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock "1"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+SET spider_semi_table_lock_connection = 0;
+Warnings:
+Warning 1287 '@@spider_semi_table_lock_connection' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+Variable_name Value
+spider_semi_table_lock_connection 0
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='stc "0"';
+Warnings:
+Warning 1287 The table parameter 'stc' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='semi_table_lock_connection "0"';
+Warnings:
+Warning 1287 The table parameter 'semi_table_lock_connection' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+# MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+Warnings:
+Warning 1287 '@@spider_bka_table_name_type' is deprecated and will be removed in a future release
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+Variable_name Value
+spider_bka_table_name_type 1
+CREATE TABLE tbl_a (a INT) ENGINE=Spider COMMENT='btt "1"';
+Warnings:
+Warning 1287 The table parameter 'btt' is deprecated and will be removed in a future release
+CREATE TABLE tbl_b (a INT) ENGINE=Spider COMMENT='bka_table_name_type "1"';
+Warnings:
+Warning 1287 The table parameter 'bka_table_name_type' is deprecated and will be removed in a future release
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+DROP DATABASE auto_test_local;
+for master_1
+for child2
+child2_1
+child2_2
+child2_3
+for child3
+child3_1
+child3_2
+child3_3
diff --git a/storage/spider/mysql-test/spider/t/error_row_number.test b/storage/spider/mysql-test/spider/t/error_row_number.test
new file mode 100644
index 00000000000..408e739656a
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/error_row_number.test
@@ -0,0 +1,37 @@
+--echo #
+--echo # MDEV-26693 ROW_NUMBER is wrong upon INSERT or UPDATE on Spider table
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection child2_1
+create database auto_test_remote;
+use auto_test_remote;
+create table ta_r (id int primary key);
+
+--connection master_1
+evalp create table spd (id int primary key) $MASTER_1_ENGINE $MASTER_1_CHARSET $MASTER_1_COMMENT_2_1;
+
+--error ER_DUP_ENTRY
+insert into spd values (1),(2),(1);
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+delete from spd;
+insert into spd values (1),(2),(3),(13);
+--error ER_DUP_ENTRY
+update spd set id = id + 10;
+get diagnostics condition 1 @n = row_number;
+select @n;
+
+drop table spd;
+--connection child2_1
+drop database auto_test_remote;
+--connection master_1
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
diff --git a/storage/spider/mysql-test/spider/t/spider_fixes.test b/storage/spider/mysql-test/spider/t/spider_fixes.test
index 56e143060e6..47bc225d614 100644
--- a/storage/spider/mysql-test/spider/t/spider_fixes.test
+++ b/storage/spider/mysql-test/spider/t/spider_fixes.test
@@ -1172,6 +1172,8 @@ let $MASTER_1_ENGINE_IS_SPIDER=
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_read_only_mode = @@SESSION.spider_read_only_mode;
+ SET SESSION spider_read_only_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1197,6 +1199,7 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
DELETE FROM t1;
--error 12518
TRUNCATE t1;
+ SET SESSION spider_read_only_mode = @original_spider_read_only_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
@@ -1210,6 +1213,10 @@ if (!$MASTER_1_ENGINE_IS_SPIDER)
if ($MASTER_1_ENGINE_IS_SPIDER)
{
--connection master_1
+ SET @original_spider_error_read_mode = @@SESSION.spider_error_read_mode;
+ SET @original_spider_error_write_mode = @@SESSION.spider_error_write_mode;
+ SET SESSION spider_error_read_mode = -1;
+ SET SESSION spider_error_write_mode = -1;
--disable_warnings
DROP TABLE IF EXISTS t1;
--enable_warnings
@@ -1227,6 +1234,8 @@ if ($MASTER_1_ENGINE_IS_SPIDER)
INSERT INTO t1 (id) VALUES (1);
DELETE FROM t1;
TRUNCATE t1;
+ SET SESSION spider_error_read_mode = @original_spider_error_read_mode;
+ SET SESSION spider_error_write_mode = @original_spider_error_write_mode;
}
if (!$MASTER_1_ENGINE_IS_SPIDER)
{
diff --git a/storage/spider/mysql-test/spider/t/variable_deprecation.test b/storage/spider/mysql-test/spider/t/variable_deprecation.test
new file mode 100644
index 00000000000..1521a60b7cb
--- /dev/null
+++ b/storage/spider/mysql-test/spider/t/variable_deprecation.test
@@ -0,0 +1,161 @@
+--echo #
+--echo # MDEV-27228 Deprecate Spider plugin variables that result in excessive tweak
+--echo #
+
+--disable_query_log
+--disable_result_log
+--source test_init.inc
+--enable_result_log
+--enable_query_log
+
+--connection master_1
+CREATE DATABASE auto_test_local;
+USE auto_test_local;
+
+--echo # MDEV-27923 Deprecate spider_use_handler
+SET spider_use_handler = 3;
+SHOW VARIABLES LIKE "spider_use_handler";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='uhd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='use_handler "3"';
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28297 Deprecate spider_internal_offset
+SET spider_internal_offset = 1;
+SHOW VARIABLES LIKE "spider_internal_offset";
+
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ios "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_offset "1"';
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28005 Deprecate Spider plugin variables regarding UDFs
+SET GLOBAL spider_udf_ds_bulk_insert_rows = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_bulk_insert_rows";
+
+SET spider_udf_ds_table_loop_mode = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_table_loop_mode";
+
+SET spider_udf_ds_use_real_table = 1;
+SHOW VARIABLES LIKE "spider_udf_ds_use_real_table";
+
+SET GLOBAL spider_udf_ct_bulk_insert_interval = 1;
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_interval";
+
+SET GLOBAL spider_udf_ct_bulk_insert_rows = 1;
+SHOW VARIABLES LIKE "spider_udf_ct_bulk_insert_rows";
+
+--echo # MDEV-27981 Deprecate spider_internal_limit
+SET spider_internal_limit = 1;
+SHOW VARIABLES LIKE "spider_internal_limit";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ilm "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='internal_limit "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28244 Deprecate spider_xa_register_mode
+SET spider_xa_register_mode = 0;
+SHOW VARIABLES LIKE "spider_xa_register_mode";
+
+--echo # MDEV-28007 Deprecate Spider plugin variables regarding statistics persistence
+SET GLOBAL spider_store_last_sts = 0;
+SHOW VARIABLES LIKE "spider_store_last_sts";
+
+SET GLOBAL spider_store_last_crd = 0;
+SHOW VARIABLES LIKE "spider_store_last_crd";
+
+SET GLOBAL spider_load_sts_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_sts_at_startup";
+
+SET GLOBAL spider_load_crd_at_startup = 0;
+SHOW VARIABLES LIKE "spider_load_crd_at_startup";
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28008 Deprecate spider_crd_mode and spider_sts_mode
+SET spider_crd_mode = 1;
+SHOW VARIABLES LIKE "spider_crd_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cmd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_sts_mode = 1;
+SHOW VARIABLES LIKE "spider_sts_mode";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='smd "3"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='sts_mode "3"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28010 Deprecate spider_crd_type and spider_crd_weight
+SET spider_crd_type = 1;
+SHOW VARIABLES LIKE "spider_crd_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='ctp "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_crd_weight = 1;
+SHOW VARIABLES LIKE "spider_crd_weight";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='cwg "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='crd_weight "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28560 Deprecate spider_buffer_size
+SET spider_buffer_size = 1;
+SHOW VARIABLES LIKE "spider_buffer_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='bfz "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='buffer_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-27926 Deprecate spider_init_sql_alloc_size
+SET spider_init_sql_alloc_size = 1;
+SHOW VARIABLES LIKE "spider_init_sql_alloc_size";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='isa "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='init_sql_alloc_size "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28829 Deprecate spider_semi_table_lock and spider_semi_table_lock_connection
+SET spider_semi_table_lock = 1;
+SHOW VARIABLES LIKE "spider_semi_table_lock";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stl "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+SET spider_semi_table_lock_connection = 0;
+SHOW VARIABLES LIKE "spider_semi_table_lock_connection";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='stc "0"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='semi_table_lock_connection "0"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+--echo # MDEV-28795 Deprecate spider_bka_table_name_type
+SET spider_bka_table_name_type = 1;
+SHOW VARIABLES LIKE "spider_bka_table_name_type";
+eval CREATE TABLE tbl_a (a INT) $MASTER_1_ENGINE COMMENT='btt "1"';
+eval CREATE TABLE tbl_b (a INT) $MASTER_1_ENGINE COMMENT='bka_table_name_type "1"';
+
+DROP TABLE tbl_a;
+DROP TABLE tbl_b;
+
+DROP DATABASE auto_test_local;
+
+--disable_query_log
+--disable_result_log
+--source test_deinit.inc
+--enable_result_log
+--enable_query_log
diff --git a/storage/spider/spd_db_mysql.cc b/storage/spider/spd_db_mysql.cc
index f16b1584d58..8d426f85118 100644
--- a/storage/spider/spd_db_mysql.cc
+++ b/storage/spider/spd_db_mysql.cc
@@ -1968,8 +1968,11 @@ int spider_db_mbase::connect(
conn->tgt_ssl_cert_length |
conn->tgt_ssl_key_length
) {
- mysql_ssl_set(db_conn, conn->tgt_ssl_key, conn->tgt_ssl_cert,
- conn->tgt_ssl_ca, conn->tgt_ssl_capath, conn->tgt_ssl_cipher);
+ mysql_options(db_conn, MYSQL_OPT_SSL_KEY, conn->tgt_ssl_key);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CERT, conn->tgt_ssl_cert);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CA, conn->tgt_ssl_ca);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CAPATH, conn->tgt_ssl_capath);
+ mysql_options(db_conn, MYSQL_OPT_SSL_CIPHER, conn->tgt_ssl_cipher);
if (conn->tgt_ssl_vsc)
{
my_bool verify_flg = TRUE;
diff --git a/storage/spider/spd_init_query.h b/storage/spider/spd_init_query.h
index 19b04d50b82..0dcbcd50230 100644
--- a/storage/spider/spd_init_query.h
+++ b/storage/spider/spd_init_query.h
@@ -224,12 +224,7 @@ static LEX_STRING spider_init_queries[] = {
{C_STRING_WITH_LEN(
"create procedure mysql.spider_fix_system_tables()"
"begin"
- " select substring_index(substring_index(version(), '-', 2), '-', -1)"
- " into @server_name;"
- " if @server_name regexp '^[0-9]+$' then"
- " select substring_index(substring_index(version(), '-', 3), '-', -1)"
- " into @server_name;"
- " end if;"
+ " select 'MariaDB' into @server_name;"
" select substring_index(version(), '.', 1)"
" into @server_major_version;"
" select substring_index(substring_index(version(), '.', 2), '.', -1)"
@@ -548,7 +543,7 @@ static LEX_STRING spider_init_queries[] = {
" @server_major_version > 10 or"
" ("
" @server_major_version = 10 and"
- " @server_minor_version >= 7"
+ " @server_minor_version >= 8"
" )"
" )"
" then"
@@ -808,7 +803,7 @@ static LEX_STRING spider_init_queries[] = {
" @server_major_version > 10 or"
" ("
" @server_major_version = 10 and"
- " @server_minor_version >= 7"
+ " @server_minor_version >= 8"
" )"
" )"
" then"
diff --git a/storage/spider/spd_param.cc b/storage/spider/spd_param.cc
index b23877ca92a..1c9bc10d9c3 100644
--- a/storage/spider/spd_param.cc
+++ b/storage/spider/spd_param.cc
@@ -174,6 +174,34 @@ static MYSQL_SYSVAR_BOOL(
TRUE
);
+static void spider_var_deprecated_int(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ int val= *static_cast<const int *>(save);
+ *static_cast<int *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
+static void spider_var_deprecated_longlong(THD *thd, st_mysql_sys_var *,
+ void *var_ptr, const void *save)
+{
+ longlong val= *static_cast<const longlong *>(save);
+ *static_cast<longlong *>(var_ptr)= val;
+ if (val == -1)
+ {
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
+ HA_ERR_UNSUPPORTED,
+ "The option value -1 (use table value) is deprecated "
+ "and will be removed in a future release");
+ }
+}
+
my_bool spider_param_support_xa()
{
DBUG_ENTER("spider_param_support_xa");
@@ -255,8 +283,8 @@ static MYSQL_SYSVAR_INT(
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Use table charset for remote access",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -432,7 +460,7 @@ uint spider_param_force_commit(
*/
static MYSQL_THDVAR_UINT(
xa_register_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of XA transaction register into system table", /* comment */
NULL, /* check */
NULL, /* update */
@@ -455,11 +483,11 @@ uint spider_param_xa_register_mode(
*/
static MYSQL_THDVAR_LONGLONG(
internal_offset, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal offset", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -480,11 +508,11 @@ longlong spider_param_internal_offset(
*/
static MYSQL_THDVAR_LONGLONG(
internal_limit, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Internal limit", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -508,8 +536,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of rows at a select", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -534,8 +562,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use offset and limit parameter in SQL for split_read parameter.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -559,8 +587,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limit value for semi_split_read", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_longlong, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -582,11 +610,11 @@ longlong spider_param_semi_split_read_limit(
*/
static MYSQL_THDVAR_INT(
init_sql_alloc_size, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Initial sql string alloc size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1024, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -611,8 +639,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Reset sql string alloc after execute", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -664,8 +692,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Sprit read mode for multi range", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 100, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -689,8 +717,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Max columns for order by", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 32767, /* def */
-1, /* min */
32767, /* max */
0 /* blk */
@@ -777,11 +805,11 @@ static int spider_param_semi_table_lock_check(
*/
static MYSQL_THDVAR_INT(
semi_table_lock, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Table lock during execute a sql", /* comment */
&spider_param_semi_table_lock_check, /* check */
NULL, /* update */
- 1, /* def */
+ 0, /* def */
0, /* min */
1, /* max */
0 /* blk */
@@ -842,11 +870,11 @@ static int spider_param_semi_table_lock_connection_check(
*/
static MYSQL_THDVAR_INT(
semi_table_lock_connection, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use different connection if semi_table_lock is enabled", /* comment */
&spider_param_semi_table_lock_connection_check, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -894,8 +922,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Lock for select with update", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -983,8 +1011,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk insert size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1012,8 +1040,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of bulk updating and deleting", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1037,8 +1065,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Bulk update size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1059,11 +1087,11 @@ int spider_param_bulk_update_size(
*/
static MYSQL_THDVAR_INT(
buffer_size, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Buffer size", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 16000, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1088,8 +1116,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1114,8 +1142,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute optimize to remote server with local", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1263,8 +1291,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of connecting to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 6, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1290,8 +1318,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of receiving data from remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1317,8 +1345,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Wait timeout of sending data to remote server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 600, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1348,8 +1376,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The retrieval result from a remote server is acquired by acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 3, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1373,8 +1401,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of records in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1024, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1398,8 +1426,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"The limitation of memory size in a page when acquisition one by one", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 10485760, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1424,8 +1452,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use low memory mode when SQL(SELECT) internally issued to a remote server is executed and get a result list", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1451,8 +1479,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The mode of using columns at select clause", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -1480,8 +1508,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of background search", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1506,8 +1534,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1532,8 +1560,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records when background search is used", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 100, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1559,8 +1587,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of first read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1585,8 +1613,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Number of second read records", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -1611,8 +1639,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of cardinality confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 51, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1636,11 +1664,11 @@ double spider_param_crd_interval(
*/
static MYSQL_THDVAR_INT(
crd_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of cardinality confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -1668,8 +1696,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Cardinality synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1693,11 +1721,11 @@ int spider_param_crd_sync(
*/
static MYSQL_THDVAR_INT(
crd_type, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Type of cardinality calculation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1718,11 +1746,11 @@ int spider_param_crd_type(
*/
static MYSQL_THDVAR_INT(
crd_weight, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Weight coefficient to calculate effectiveness of index from cardinality of column.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1749,8 +1777,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of cardinality confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1776,8 +1804,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Interval of table state confirmation.(second)", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 10, /* def */
-1, /* min */
2147483647, /* max */
0 /* blk */
@@ -1800,11 +1828,11 @@ double spider_param_sts_interval(
*/
static MYSQL_THDVAR_INT(
sts_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Mode of table state confirmation.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1832,8 +1860,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Table state synchronization in partitioned table.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1861,8 +1889,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of table state confirmation at background.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 2, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -1937,8 +1965,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of auto increment.", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2030,8 +2058,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Execute \"REPLACE\" and \"INSERT IGNORE\" on remote server and avoid duplicate check on local server", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2097,7 +2125,7 @@ uint spider_param_udf_table_mon_mutex_count()
*/
static MYSQL_THDVAR_LONGLONG(
udf_ds_bulk_insert_rows, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Number of rows for bulk inserting", /* comment */
NULL, /* check */
NULL, /* update */
@@ -2124,7 +2152,7 @@ longlong spider_param_udf_ds_bulk_insert_rows(
*/
static MYSQL_THDVAR_INT(
udf_ds_table_loop_mode, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Table loop mode if the number of tables in table list are less than the number of result sets", /* comment */
NULL, /* check */
NULL, /* update */
@@ -2457,8 +2485,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Mode of BKA for Spider", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
2, /* max */
0 /* blk */
@@ -2481,7 +2509,7 @@ static int spider_udf_ct_bulk_insert_interval;
static MYSQL_SYSVAR_INT(
udf_ct_bulk_insert_interval,
spider_udf_ct_bulk_insert_interval,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"The interval time between bulk insert and next bulk insert at coping",
NULL,
NULL,
@@ -2507,7 +2535,7 @@ static longlong spider_udf_ct_bulk_insert_rows;
static MYSQL_SYSVAR_LONGLONG(
udf_ct_bulk_insert_rows,
spider_udf_ct_bulk_insert_rows,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"The number of rows inserted with bulk insert of one time at coping",
NULL,
NULL,
@@ -2680,11 +2708,11 @@ int spider_param_use_hs_write(
*/
static MYSQL_THDVAR_INT(
use_handler, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use handler for reading", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2709,8 +2737,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2735,8 +2763,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Write error mode if error", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2761,8 +2789,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip generating internal default condition", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2789,8 +2817,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Skip parallel search by specific conditions", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
3, /* max */
0 /* blk */
@@ -2815,8 +2843,8 @@ static MYSQL_THDVAR_LONGLONG(
PLUGIN_VAR_RQCMDARG, /* opt */
"Send 'ORDER BY' and 'LIMIT' to remote server directly", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 9223372036854775807LL, /* def */
-1, /* min */
9223372036854775807LL, /* max */
0 /* blk */
@@ -2841,8 +2869,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read only", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -2895,7 +2923,7 @@ int spider_param_bulk_access_free(
*/
static MYSQL_THDVAR_INT(
udf_ds_use_real_table, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"Use real table for temporary table list", /* comment */
NULL, /* check */
NULL, /* update */
@@ -3090,8 +3118,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Read casually if it is possible", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
63, /* max */
0 /* blk */
@@ -3133,8 +3161,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"The type of delete_all_rows", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -3156,11 +3184,11 @@ int spider_param_delete_all_rows_type(
*/
static MYSQL_THDVAR_INT(
bka_table_name_type, /* name */
- PLUGIN_VAR_RQCMDARG, /* opt */
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED, /* opt */
"The type of temporary table name for bka", /* comment */
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 0, /* def */
-1, /* min */
1, /* max */
0 /* blk */
@@ -3208,11 +3236,11 @@ static int spider_store_last_sts;
static MYSQL_SYSVAR_INT(
store_last_sts,
spider_store_last_sts,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last sts result into system table",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3235,11 +3263,11 @@ static int spider_store_last_crd;
static MYSQL_SYSVAR_INT(
store_last_crd,
spider_store_last_crd,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Store last crd result into system table",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3262,11 +3290,11 @@ static int spider_load_sts_at_startup;
static MYSQL_SYSVAR_INT(
load_sts_at_startup,
spider_load_sts_at_startup,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load sts from system table at startup",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3289,11 +3317,11 @@ static int spider_load_crd_at_startup;
static MYSQL_SYSVAR_INT(
load_crd_at_startup,
spider_load_crd_at_startup,
- PLUGIN_VAR_RQCMDARG,
+ PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_DEPRECATED,
"Load crd from system table at startup",
NULL,
- NULL,
- -1,
+ spider_var_deprecated_int,
+ 1,
-1,
1,
0
@@ -3462,8 +3490,8 @@ static MYSQL_THDVAR_INT(
PLUGIN_VAR_RQCMDARG, /* opt */
"Use columns in select clause strictly for group by clause",
NULL, /* check */
- NULL, /* update */
- -1, /* def */
+ spider_var_deprecated_int, /* update */
+ 1, /* def */
-1, /* min */
1, /* max */
0 /* blk */
diff --git a/storage/spider/spd_table.cc b/storage/spider/spd_table.cc
index 4265494a63c..4fb3b6c1e40 100644
--- a/storage/spider/spd_table.cc
+++ b/storage/spider/spd_table.cc
@@ -1833,30 +1833,41 @@ int st_spider_param_string_parse::print_param_error()
}
#define SPIDER_PARAM_STR_LENS(name) name ## _lengths
#define SPIDER_PARAM_STR_CHARLEN(name) name ## _charlen
-#define SPIDER_PARAM_STR_LIST(title_name, param_name) \
- if (!strncasecmp(tmp_ptr, title_name, title_length)) \
- { \
- DBUG_PRINT("info",("spider " title_name " start")); \
- if (!share->param_name) \
- { \
- if ((tmp_ptr2 = spider_get_string_between_quote( \
- start_ptr, FALSE))) \
- { \
- share->SPIDER_PARAM_STR_CHARLEN(param_name) = strlen(tmp_ptr2); \
- if ((error_num = spider_create_string_list( \
- &share->param_name, \
- &share->SPIDER_PARAM_STR_LENS(param_name), \
- &share->SPIDER_PARAM_STR_LEN(param_name), \
- tmp_ptr2, \
- share->SPIDER_PARAM_STR_CHARLEN(param_name), \
- &connect_string_parse))) \
- goto error; \
- } else { \
- error_num = connect_string_parse.print_param_error(); \
- goto error; \
- } \
- } \
- break; \
+#define SPIDER_PARAM_STR_LIST(title_name, param_name) \
+ if (!strncasecmp(tmp_ptr, title_name, title_length)) \
+ { \
+ DBUG_PRINT("info", ("spider " title_name " start")); \
+ if (!share->param_name) \
+ { \
+ if ((tmp_ptr2= spider_get_string_between_quote(start_ptr, FALSE))) \
+ { \
+ share->SPIDER_PARAM_STR_CHARLEN(param_name)= strlen(tmp_ptr2); \
+ if ((error_num= spider_create_string_list( \
+ &share->param_name, \
+ &share->SPIDER_PARAM_STR_LENS(param_name), \
+ &share->SPIDER_PARAM_STR_LEN(param_name), tmp_ptr2, \
+ share->SPIDER_PARAM_STR_CHARLEN(param_name), \
+ &connect_string_parse))) \
+ { \
+ goto error; \
+ } \
+ THD *thd= current_thd; \
+ if (share->SPIDER_PARAM_STR_LEN(param_name) > 1 && create_table) \
+ { \
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
+ HA_ERR_UNSUPPORTED, \
+ "The high availability feature of Spider " \
+ "has been deprecated " \
+ "and will be removed in a future release"); \
+ } \
+ } \
+ else \
+ { \
+ error_num= connect_string_parse.print_param_error(); \
+ goto error; \
+ } \
+ } \
+ break; \
}
#define SPIDER_PARAM_HINT(title_name, param_name, check_length, max_size, append_method) \
if (!strncasecmp(tmp_ptr, title_name, check_length)) \
@@ -2060,6 +2071,16 @@ int st_spider_param_string_parse::print_param_error()
} \
break; \
}
+#define SPIDER_PARAM_DEPRECATED_WARNING(title_name) \
+ if (!strncasecmp(tmp_ptr, title_name, title_length) && create_table) \
+ { \
+ THD *thd= current_thd; \
+ push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
+ ER_WARN_DEPRECATED_SYNTAX, \
+ "The table parameter '%s' is deprecated and will be " \
+ "removed in a future release", \
+ title_name); \
+ }
int spider_parse_connect_info(
SPIDER_SHARE *share,
@@ -2308,6 +2329,7 @@ int spider_parse_connect_info(
#ifdef HA_CAN_BULK_ACCESS
SPIDER_PARAM_INT_WITH_MAX("baf", bulk_access_free, 0, 1);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("bfz");
SPIDER_PARAM_INT("bfz", buffer_size, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bfr", bgs_first_read, 0);
@@ -2317,6 +2339,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_STR("bke", bka_engine);
SPIDER_PARAM_INT_WITH_MAX("bkm", bka_mode, 0, 2);
SPIDER_PARAM_INT("bsz", bulk_size, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("btt");
SPIDER_PARAM_LONG_LIST_WITH_MAX("btt", bka_table_name_types,
0, 1);
SPIDER_PARAM_INT_WITH_MAX("bum", bulk_update_mode, 0, 2);
@@ -2325,6 +2348,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("cbm", crd_bg_mode, 0, 2);
#endif
SPIDER_PARAM_DOUBLE("civ", crd_interval, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("cmd");
SPIDER_PARAM_INT_WITH_MAX("cmd", crd_mode, 0, 3);
SPIDER_PARAM_INT_WITH_MAX("csr", casual_read, 0, 63);
#ifdef WITH_PARTITION_STORAGE_ENGINE
@@ -2332,7 +2356,9 @@ int spider_parse_connect_info(
#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("cto", connect_timeouts, 0,
2147483647);
+ SPIDER_PARAM_DEPRECATED_WARNING("ctp");
SPIDER_PARAM_INT_WITH_MAX("ctp", crd_type, 0, 2);
+ SPIDER_PARAM_DEPRECATED_WARNING("cwg");
SPIDER_PARAM_DOUBLE("cwg", crd_weight, 1);
SPIDER_PARAM_INT_WITH_MAX("dat", delete_all_rows_type, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("ddi", direct_dup_insert, 0, 1);
@@ -2362,8 +2388,11 @@ int spider_parse_connect_info(
"hwr", hs_write_to_reads, 0, 1);
SPIDER_PARAM_STR_LIST("hws", hs_write_socks);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("isa");
SPIDER_PARAM_INT("isa", init_sql_alloc_size, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("ilm");
SPIDER_PARAM_LONGLONG("ilm", internal_limit, 0);
+ SPIDER_PARAM_DEPRECATED_WARNING("ios");
SPIDER_PARAM_LONGLONG("ios", internal_offset, 0);
SPIDER_PARAM_INT_WITH_MAX("iom", internal_optimize, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("iol", internal_optimize_local, 0, 1);
@@ -2416,6 +2445,7 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("slc", store_last_crd, 0, 1);
SPIDER_PARAM_INT_WITH_MAX("slm", selupd_lock_mode, 0, 2);
SPIDER_PARAM_INT_WITH_MAX("sls", store_last_sts, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("smd");
SPIDER_PARAM_INT_WITH_MAX("smd", sts_mode, 1, 2);
SPIDER_PARAM_LONGLONG("smr", static_mean_rec_length, 0);
SPIDER_PARAM_LONGLONG("spr", split_read, 0);
@@ -2429,12 +2459,15 @@ int spider_parse_connect_info(
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("ssy", sts_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("stc");
SPIDER_PARAM_INT_WITH_MAX("stc", semi_table_lock_conn, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("stl");
SPIDER_PARAM_INT_WITH_MAX("stl", semi_table_lock, 0, 1);
SPIDER_PARAM_LONGLONG("srs", static_records_for_status, 0);
SPIDER_PARAM_LONG_LIST_WITH_MAX("svc", tgt_ssl_vscs, 0, 1);
SPIDER_PARAM_STR_LIST("tbl", tgt_table_names);
SPIDER_PARAM_INT_WITH_MAX("tcm", table_count_mode, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("uhd");
SPIDER_PARAM_LONG_LIST_WITH_MAX("uhd", use_handlers, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONG_LIST_WITH_MAX(
@@ -2477,14 +2510,17 @@ int spider_parse_connect_info(
case 8:
SPIDER_PARAM_STR_LIST("database", tgt_dbs);
SPIDER_PARAM_STR_LIST("password", tgt_passwords);
+ SPIDER_PARAM_DEPRECATED_WARNING("sts_mode");
SPIDER_PARAM_INT_WITH_MAX("sts_mode", sts_mode, 1, 2);
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("sts_sync", sts_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_mode");
SPIDER_PARAM_INT_WITH_MAX("crd_mode", crd_mode, 0, 3);
#ifdef WITH_PARTITION_STORAGE_ENGINE
SPIDER_PARAM_INT_WITH_MAX("crd_sync", crd_sync, 0, 2);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_type");
SPIDER_PARAM_INT_WITH_MAX("crd_type", crd_type, 0, 2);
SPIDER_PARAM_LONGLONG("priority", priority, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
@@ -2502,6 +2538,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 10:
+ SPIDER_PARAM_DEPRECATED_WARNING("crd_weight");
SPIDER_PARAM_DOUBLE("crd_weight", crd_weight, 1);
SPIDER_PARAM_LONGLONG("split_read", split_read, 0);
SPIDER_PARAM_INT_WITH_MAX("quick_mode", quick_mode, 0, 3);
@@ -2518,11 +2555,13 @@ int spider_parse_connect_info(
SPIDER_PARAM_INT_WITH_MAX("sts_bg_mode", sts_bg_mode, 0, 2);
#endif
SPIDER_PARAM_LONG_LIST_WITH_MAX("link_status", link_statuses, 0, 3);
+ SPIDER_PARAM_DEPRECATED_WARNING("use_handler");
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_handler", use_handlers, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONG_LIST_WITH_MAX("use_hs_read", use_hs_reads, 0, 1);
#endif
SPIDER_PARAM_INT_WITH_MAX("casual_read", casual_read, 0, 63);
+ SPIDER_PARAM_DEPRECATED_WARNING("buffer_size");
SPIDER_PARAM_INT("buffer_size", buffer_size, 0);
error_num = connect_string_parse.print_param_error();
goto error;
@@ -2549,6 +2588,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 14:
+ SPIDER_PARAM_DEPRECATED_WARNING("internal_limit");
SPIDER_PARAM_LONGLONG("internal_limit", internal_limit, 0);
#ifndef WITHOUT_SPIDER_BG_SEARCH
SPIDER_PARAM_LONGLONG("bgs_first_read", bgs_first_read, 0);
@@ -2566,8 +2606,10 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 15:
+ SPIDER_PARAM_DEPRECATED_WARNING("internal_offset");
SPIDER_PARAM_LONGLONG("internal_offset", internal_offset, 0);
SPIDER_PARAM_INT_WITH_MAX("reset_sql_alloc", reset_sql_alloc, 0, 1);
+ SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock");
SPIDER_PARAM_INT_WITH_MAX("semi_table_lock", semi_table_lock, 0, 1);
SPIDER_PARAM_LONGLONG("quick_page_byte", quick_page_byte, 0);
SPIDER_PARAM_LONGLONG("quick_page_size", quick_page_size, 0);
@@ -2652,12 +2694,14 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 19:
+ SPIDER_PARAM_DEPRECATED_WARNING("init_sql_alloc_size");
SPIDER_PARAM_INT("init_sql_alloc_size", init_sql_alloc_size, 0);
SPIDER_PARAM_INT_WITH_MAX(
"auto_increment_mode", auto_increment_mode, 0, 3);
#if defined(HS_HAS_SQLCOM) && defined(HAVE_HANDLERSOCKET)
SPIDER_PARAM_LONGLONG("hs_result_free_size", hs_result_free_size, 0);
#endif
+ SPIDER_PARAM_DEPRECATED_WARNING("bka_table_name_type");
SPIDER_PARAM_LONG_LIST_WITH_MAX("bka_table_name_type",
bka_table_name_types, 0, 1);
SPIDER_PARAM_INT_WITH_MAX(
@@ -2706,6 +2750,7 @@ int spider_parse_connect_info(
error_num = connect_string_parse.print_param_error();
goto error;
case 26:
+ SPIDER_PARAM_DEPRECATED_WARNING("semi_table_lock_connection");
SPIDER_PARAM_INT_WITH_MAX(
"semi_table_lock_connection", semi_table_lock_conn, 0, 1);
error_num = connect_string_parse.print_param_error();