summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2019-02-21 14:40:52 +0100
committerOleksandr Byelkin <sanja@mariadb.com>2019-02-21 14:40:52 +0100
commit93ac7ae70ff000353538f732899b421a3f2ea7ce (patch)
tree819b5ca057d80b42699de219c982b7924857c406
parent4932aba921755cfbc351b92c67068a5c48d3922b (diff)
parenta40de1bdeb218d66d5cc737758a4bab1b06f255d (diff)
downloadmariadb-git-93ac7ae70ff000353538f732899b421a3f2ea7ce.tar.gz
Merge branch '10.3' into 10.4
-rw-r--r--CMakeLists.txt12
-rw-r--r--client/mysqlbinlog.cc23
-rw-r--r--client/mysqltest.cc66
-rw-r--r--cmake/aws_sdk.cmake4
-rw-r--r--cmake/build_configurations/mysql_release.cmake1
-rw-r--r--cmake/readline.cmake2
-rw-r--r--cmake/submodules.cmake12
-rw-r--r--config.h.cmake6
-rw-r--r--configure.cmake2
-rwxr-xr-xdebian/autobake-deb.sh27
-rw-r--r--extra/mariabackup/backup_copy.cc13
-rw-r--r--extra/mariabackup/xtrabackup.cc44
-rw-r--r--include/my_sys.h5
-rw-r--r--include/my_valgrind.h4
-rw-r--r--include/mysql.h2
-rw-r--r--include/mysql.h.pp2
m---------libmariadb0
-rw-r--r--mysql-test/include/check-testcase.test1
-rw-r--r--mysql-test/include/mtr_check.sql1
-rw-r--r--mysql-test/main/alter_table.result49
-rw-r--r--mysql-test/main/alter_table.test17
-rw-r--r--mysql-test/main/alter_table_errors.result6
-rw-r--r--mysql-test/main/alter_table_errors.test10
-rw-r--r--mysql-test/main/check.result7
-rw-r--r--mysql-test/main/check.test9
-rw-r--r--mysql-test/main/check_constraint.result2
-rw-r--r--mysql-test/main/check_constraint.test1
-rw-r--r--mysql-test/main/check_constraint_innodb.result9
-rw-r--r--mysql-test/main/check_constraint_innodb.test14
-rw-r--r--mysql-test/main/disabled.def1
-rw-r--r--mysql-test/main/error_simulation.result5
-rw-r--r--mysql-test/main/error_simulation.test7
-rw-r--r--mysql-test/main/func_misc.result8
-rw-r--r--mysql-test/main/func_misc.test8
-rw-r--r--mysql-test/main/gis.test1
-rw-r--r--mysql-test/main/gis2.result2
-rw-r--r--mysql-test/main/mysql.result26
-rw-r--r--mysql-test/main/mysql.test22
-rw-r--r--mysql-test/main/mysqlbinlog_row_minimal.result122
-rw-r--r--mysql-test/main/mysqlbinlog_row_minimal.test41
-rw-r--r--mysql-test/main/row-checksum-old.result16
-rw-r--r--mysql-test/main/row-checksum.result16
-rw-r--r--mysql-test/main/row-checksum.test17
-rw-r--r--mysql-test/main/subselect2.result22
-rw-r--r--mysql-test/main/subselect2.test20
-rw-r--r--mysql-test/main/subselect_mat.result16
-rw-r--r--mysql-test/main/subselect_mat.test13
-rw-r--r--mysql-test/main/subselect_sj2_mat.result4
-rw-r--r--mysql-test/main/subselect_sj2_mat.test2
-rw-r--r--mysql-test/suite/archive/partition_archive.result4
-rw-r--r--mysql-test/suite/archive/partition_archive.test3
-rw-r--r--mysql-test/suite/binlog/r/binlog_base64_flag.result19
-rw-r--r--mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result24
-rw-r--r--mysql-test/suite/binlog/t/binlog_base64_flag.test22
-rw-r--r--mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test46
-rw-r--r--mysql-test/suite/encryption/r/innodb-encryption-alter.result4
-rw-r--r--mysql-test/suite/encryption/t/innodb-encryption-alter.test2
-rw-r--r--mysql-test/suite/encryption/t/innodb-spatial-index.test2
-rw-r--r--mysql-test/suite/funcs_1/r/is_routines_embedded.result6
-rw-r--r--mysql-test/suite/galera/r/galera_defaults.result3
-rw-r--r--mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes/galera_3nodes.cnf1
-rw-r--r--mysql-test/suite/galera_3nodes/include/have_mariabackup.inc4
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_garbd.result4
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result4
-rw-r--r--mysql-test/suite/galera_3nodes/suite.pm9
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_garbd.test16
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test2
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test14
-rw-r--r--mysql-test/suite/gcol/inc/gcol_column_def_options.inc1
-rw-r--r--mysql-test/suite/gcol/inc/gcol_keys.inc1
-rw-r--r--mysql-test/suite/gcol/r/gcol_keys_innodb.result2
-rw-r--r--mysql-test/suite/gcol/r/innodb_virtual_fk.result4
-rw-r--r--mysql-test/suite/gcol/t/innodb_virtual_fk.test2
-rw-r--r--mysql-test/suite/innodb/r/add_constraint.result2
-rw-r--r--mysql-test/suite/innodb/r/alter_foreign_crash.result2
-rw-r--r--mysql-test/suite/innodb/r/alter_varchar_change.result9
-rw-r--r--mysql-test/suite/innodb/r/foreign_key.result57
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk-warnings.result24
-rw-r--r--mysql-test/suite/innodb/r/innodb-fk.result6
-rw-r--r--mysql-test/suite/innodb/r/innodb-index-online.result2
-rw-r--r--mysql-test/suite/innodb/r/innodb-index.result10
-rw-r--r--mysql-test/suite/innodb/r/innodb_force_recovery.result8
-rw-r--r--mysql-test/suite/innodb/r/instant_varchar_enlarge.result9
-rw-r--r--mysql-test/suite/innodb/r/undo_truncate_recover.result1
-rw-r--r--mysql-test/suite/innodb/t/add_constraint.test1
-rw-r--r--mysql-test/suite/innodb/t/alter_varchar_change.test7
-rw-r--r--mysql-test/suite/innodb/t/foreign_key.test52
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk-warnings.test18
-rw-r--r--mysql-test/suite/innodb/t/innodb-fk.test2
-rw-r--r--mysql-test/suite/innodb/t/innodb-index-online.test1
-rw-r--r--mysql-test/suite/innodb/t/innodb-index.test5
-rw-r--r--mysql-test/suite/innodb/t/innodb-page_compression_tables.test4
-rw-r--r--mysql-test/suite/innodb/t/innodb_force_recovery.test4
-rw-r--r--mysql-test/suite/innodb/t/instant_varchar_enlarge.test8
-rw-r--r--mysql-test/suite/innodb/t/undo_truncate_recover.test6
-rw-r--r--mysql-test/suite/innodb_gis/r/alter_spatial_index.result2
-rw-r--r--mysql-test/suite/innodb_gis/r/point_basic.result14
-rw-r--r--mysql-test/suite/innodb_gis/t/point_basic.test6
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_compressed.test2
-rw-r--r--mysql-test/suite/mariabackup/encrypted_page_corruption.test2
-rw-r--r--mysql-test/suite/mariabackup/incremental_rocksdb.opt1
-rw-r--r--mysql-test/suite/mariabackup/incremental_rocksdb.result19
-rw-r--r--mysql-test/suite/mariabackup/incremental_rocksdb.test38
-rw-r--r--mysql-test/suite/mariabackup/log_checksum_mismatch.test2
-rw-r--r--mysql-test/suite/mariabackup/unencrypted_page_compressed.test2
-rw-r--r--mysql-test/suite/perfschema/r/dml_setup_instruments.result4
-rw-r--r--mysql-test/suite/perfschema/t/dml_setup_instruments.test5
-rw-r--r--mysql-test/suite/plugins/t/audit_null.test2
-rw-r--r--mysql-test/suite/rpl/r/rpl_set_statement.test0
-rw-r--r--mysql-test/suite/sys_vars/r/all_vars.result1
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled1236
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled697
-rw-r--r--mysql-test/suite/sys_vars/r/sysvars_wsrep.result14
-rw-r--r--mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result2
-rw-r--r--mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test1
-rw-r--r--mysql-test/suite/vcol/inc/vcol_keys.inc1
-rw-r--r--mysql-test/suite/vcol/r/vcol_keys_innodb.result2
-rw-r--r--mysys/mf_iocache2.c61
-rw-r--r--mysys/my_delete.c61
-rw-r--r--mysys/my_file.c7
-rw-r--r--mysys/my_malloc.c1
-rw-r--r--plugin/aws_key_management/CMakeLists.txt2
-rw-r--r--plugin/wsrep_info/mysql-test/wsrep_info/suite.pm2
-rw-r--r--scripts/mysql_install_db.sh24
-rw-r--r--scripts/wsrep_sst_mariabackup.sh6
-rw-r--r--scripts/wsrep_sst_rsync.sh2
-rw-r--r--sql-common/client.c30
-rw-r--r--sql/field.cc4
-rw-r--r--sql/item.cc18
-rw-r--r--sql/item_func.cc2
-rw-r--r--sql/item_func.h4
-rw-r--r--sql/log.cc6
-rw-r--r--sql/log_event.cc386
-rw-r--r--sql/log_event.h24
-rw-r--r--sql/log_event_old.cc17
-rw-r--r--sql/partition_info.cc2
-rw-r--r--sql/rpl_tblmap.cc20
-rw-r--r--sql/rpl_tblmap.h10
-rw-r--r--sql/sql_binlog.cc91
-rw-r--r--sql/sql_class.cc23
-rw-r--r--sql/sql_class.h2
-rw-r--r--sql/sql_lex.cc3
-rw-r--r--sql/sql_lex.h4
-rw-r--r--sql/sql_repl.cc6
-rw-r--r--sql/sql_select.cc21
-rw-r--r--sql/sql_table.cc150
-rw-r--r--sql/sql_yacc.yy19
-rw-r--r--sql/sql_yacc_ora.yy19
-rw-r--r--sql/sys_vars.cc13
-rw-r--r--sql/table.cc2
-rw-r--r--sql/table.h12
-rw-r--r--sql/wsrep_mysqld.cc1
-rw-r--r--sql/wsrep_mysqld.h1
-rw-r--r--sql/wsrep_mysqld_c.h30
-rw-r--r--storage/connect/ha_connect.cc45
-rw-r--r--storage/connect/jsonudf.cpp48
-rw-r--r--storage/connect/jsonudf.h5
-rw-r--r--storage/connect/mysql-test/connect/r/jdbc_postgresql.result2
-rw-r--r--storage/connect/mysql-test/connect/r/part_table.result4
-rw-r--r--storage/connect/mysql-test/connect/t/part_table.test2
-rw-r--r--storage/connect/tabext.cpp43
-rw-r--r--storage/connect/tabext.h5
-rw-r--r--storage/connect/tabjdbc.cpp89
-rw-r--r--storage/connect/tabjson.cpp46
-rw-r--r--storage/connect/tabjson.h2
-rw-r--r--storage/connect/tabxml.cpp279
-rw-r--r--storage/connect/tabxml.h1
-rw-r--r--storage/innobase/dict/dict0dict.cc49
-rw-r--r--storage/innobase/handler/handler0alter.cc107
-rw-r--r--storage/innobase/handler/i_s.cc87
-rw-r--r--storage/innobase/include/trx0rseg.h4
-rw-r--r--storage/innobase/log/log0recv.cc2
-rw-r--r--storage/innobase/row/row0mysql.cc3
-rw-r--r--storage/innobase/row/row0sel.cc43
-rw-r--r--storage/innobase/srv/srv0start.cc6
-rw-r--r--storage/maria/ma_delete.c2
-rw-r--r--storage/maria/ma_write.c3
-rw-r--r--storage/maria/maria_def.h4
-rw-r--r--storage/tokudb/PerconaFT/COPYING.APACHEv2174
-rw-r--r--storage/tokudb/PerconaFT/README.md5
-rw-r--r--storage/tokudb/PerconaFT/ft/txn/txn_manager.h4
-rw-r--r--storage/tokudb/PerconaFT/locktree/concurrent_tree.cc14
-rw-r--r--storage/tokudb/PerconaFT/locktree/concurrent_tree.h14
-rw-r--r--storage/tokudb/PerconaFT/locktree/keyrange.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/keyrange.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/lock_request.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/locktree.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/manager.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/range_buffer.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/range_buffer.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/treenode.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/treenode.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/txnid_set.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/txnid_set.h13
-rw-r--r--storage/tokudb/PerconaFT/locktree/wfg.cc13
-rw-r--r--storage/tokudb/PerconaFT/locktree/wfg.h13
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc12
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_instr_mysql.h11
-rw-r--r--storage/tokudb/PerconaFT/portability/toku_pthread.h78
-rw-r--r--storage/tokudb/PerconaFT/util/growable_array.h13
-rw-r--r--storage/tokudb/PerconaFT/util/omt.cc2261
-rw-r--r--storage/tokudb/PerconaFT/util/omt.h13
-rw-r--r--storage/tokudb/ha_tokudb.cc10
-rw-r--r--storage/tokudb/hatoku_hton.cc4
-rw-r--r--storage/tokudb/hatoku_hton.h1
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result2
-rw-r--r--storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test13
-rw-r--r--storage/tokudb/tokudb_background.cc4
-rw-r--r--storage/tokudb/tokudb_sysvars.cc14
-rw-r--r--storage/tokudb/tokudb_sysvars.h4
-rw-r--r--support-files/mysql.server.sh6
-rw-r--r--unittest/mysys/thr_template.c4
-rw-r--r--unittest/sql/mf_iocache-t.cc70
-rw-r--r--win/packaging/heidisql.cmake2
217 files changed, 6121 insertions, 1985 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d1ed3f3e4de..2bcce7ac4f2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -251,8 +251,14 @@ ENDIF()
MY_CHECK_AND_SET_COMPILER_FLAG(-ggdb3 DEBUG)
-OPTION(ENABLED_LOCAL_INFILE
- "If we should should enable LOAD DATA LOCAL by default" ${IF_WIN})
+SET(ENABLED_LOCAL_INFILE "AUTO" CACHE STRING "If we should should enable LOAD DATA LOCAL by default (OFF/ON/AUTO)")
+IF (ENABLED_LOCAL_INFILE MATCHES "^(0|FALSE)$")
+ SET(ENABLED_LOCAL_INFILE OFF)
+ELSEIF(ENABLED_LOCAL_INFILE MATCHES "^(1|TRUE)$")
+ SET(ENABLED_LOCAL_INFILE ON)
+ELSEIF (NOT ENABLED_LOCAL_INFILE MATCHES "^(ON|OFF|AUTO)$")
+ MESSAGE(FATAL_ERROR "ENABLED_LOCAL_INFILE must be one of OFF, ON, AUTO")
+ENDIF()
# Set DBUG_OFF and other optional release-only flags for non-debug project types
FOREACH(BUILD_TYPE RELEASE RELWITHDEBINFO MINSIZEREL)
@@ -506,5 +512,5 @@ ENDIF()
IF(NON_DISTRIBUTABLE_WARNING)
MESSAGE(WARNING "
-You have linked MariaDB with GPLv3 libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with Free Software Foundation.")
+You have linked MariaDB with ${NON_DISTRIBUTABLE_WARNING} libraries! You may not distribute the resulting binary. If you do, you will put yourself into a legal problem with the Free Software Foundation.")
ENDIF()
diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc
index a5995e103ef..114e7e8d38e 100644
--- a/client/mysqlbinlog.cc
+++ b/client/mysqlbinlog.cc
@@ -83,6 +83,7 @@ ulong mysqld_net_retry_count = 10L;
ulong open_files_limit;
ulong opt_binlog_rows_event_max_size;
ulonglong test_flags = 0;
+ulong opt_binlog_rows_event_max_encoded_size= MAX_MAX_ALLOWED_PACKET;
static uint opt_protocol= 0;
static FILE *result_file;
static char *result_file_name= 0;
@@ -849,8 +850,14 @@ write_event_header_and_base64(Log_event *ev, FILE *result_file,
DBUG_ENTER("write_event_header_and_base64");
/* Write header and base64 output to cache */
- if (ev->print_header(head, print_event_info, FALSE) ||
- ev->print_base64(body, print_event_info, FALSE))
+ if (ev->print_header(head, print_event_info, FALSE))
+ DBUG_RETURN(ERROR_STOP);
+
+ DBUG_ASSERT(print_event_info->base64_output_mode == BASE64_OUTPUT_ALWAYS);
+
+ if (ev->print_base64(body, print_event_info,
+ print_event_info->base64_output_mode !=
+ BASE64_OUTPUT_DECODE_ROWS))
DBUG_RETURN(ERROR_STOP);
/* Read data from cache and write to result file */
@@ -886,12 +893,13 @@ static bool print_base64(PRINT_EVENT_INFO *print_event_info, Log_event *ev)
type_str);
return 1;
}
+
return ev->print(result_file, print_event_info);
}
static bool print_row_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
- ulong table_id, bool is_stmt_end)
+ ulonglong table_id, bool is_stmt_end)
{
Table_map_log_event *ignored_map=
print_event_info->m_table_map_ignored.get_table(table_id);
@@ -1760,6 +1768,15 @@ that may lead to an endless loop.",
"This value must be a multiple of 256.",
&opt_binlog_rows_event_max_size, &opt_binlog_rows_event_max_size, 0,
GET_ULONG, REQUIRED_ARG, UINT_MAX, 256, ULONG_MAX, 0, 256, 0},
+#ifndef DBUG_OFF
+ {"debug-binlog-row-event-max-encoded-size", 0,
+ "The maximum size of base64-encoded rows-event in one BINLOG pseudo-query "
+ "instance. When the computed actual size exceeds the limit "
+ "the BINLOG's argument string is fragmented in two.",
+ &opt_binlog_rows_event_max_encoded_size,
+ &opt_binlog_rows_event_max_encoded_size, 0,
+ GET_ULONG, REQUIRED_ARG, UINT_MAX/4, 256, ULONG_MAX, 0, 256, 0},
+#endif
{"verify-binlog-checksum", 'c', "Verify checksum binlog events.",
(uchar**) &opt_verify_binlog_checksum, (uchar**) &opt_verify_binlog_checksum,
0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
diff --git a/client/mysqltest.cc b/client/mysqltest.cc
index 184121e12c0..cd7e82f34e5 100644
--- a/client/mysqltest.cc
+++ b/client/mysqltest.cc
@@ -4018,63 +4018,6 @@ void do_mkdir(struct st_command *command)
}
-/*
- Remove directory recursively.
-*/
-static int rmtree(const char *dir)
-{
- char path[FN_REFLEN];
- char sep[]={ FN_LIBCHAR, 0 };
- int err=0;
-
- MY_DIR *dir_info= my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT));
- if (!dir_info)
- return 1;
-
- for (uint i= 0; i < dir_info->number_of_files; i++)
- {
- FILEINFO *file= dir_info->dir_entry + i;
- /* Skip "." and ".." */
- if (!strcmp(file->name, ".") || !strcmp(file->name, ".."))
- continue;
-
- strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
-
- if (!MY_S_ISDIR(file->mystat->st_mode))
- {
- err= my_delete(path, 0);
-#ifdef _WIN32
- /*
- On Windows, check and possible reset readonly attribute.
- my_delete(), or DeleteFile does not remove theses files.
- */
- if (err)
- {
- DWORD attr= GetFileAttributes(path);
- if (attr != INVALID_FILE_ATTRIBUTES &&
- (attr & FILE_ATTRIBUTE_READONLY))
- {
- SetFileAttributes(path, attr &~ FILE_ATTRIBUTE_READONLY);
- err= my_delete(path, 0);
- }
- }
-#endif
- }
- else
- err= rmtree(path);
-
- if(err)
- break;
- }
-
- my_dirend(dir_info);
-
- if (!err)
- err= rmdir(dir);
-
- return err;
-}
-
/*
SYNOPSIS
@@ -4102,7 +4045,7 @@ void do_rmdir(struct st_command *command)
DBUG_VOID_RETURN;
DBUG_PRINT("info", ("removing directory: %s", ds_dirname.str));
- if (rmtree(ds_dirname.str))
+ if (my_rmtree(ds_dirname.str, MYF(0)))
handle_command_error(command, 1, errno);
dynstr_free(&ds_dirname);
@@ -6106,7 +6049,6 @@ void do_connect(struct st_command *command)
#endif
if (opt_compress || con_compress)
mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS);
- mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME,
csname?csname: charset_info->csname);
if (opt_charsets_dir)
@@ -6190,6 +6132,11 @@ void do_connect(struct st_command *command)
if (con_slot == next_con)
next_con++; /* if we used the next_con slot, advance the pointer */
}
+ else // Failed to connect. Free the memory.
+ {
+ mysql_close(con_slot->mysql);
+ con_slot->mysql= NULL;
+ }
dynstr_free(&ds_connection_name);
dynstr_free(&ds_host);
@@ -9291,7 +9238,6 @@ int main(int argc, char **argv)
(void *) &opt_connect_timeout);
if (opt_compress)
mysql_options(con->mysql,MYSQL_OPT_COMPRESS,NullS);
- mysql_options(con->mysql, MYSQL_OPT_LOCAL_INFILE, 0);
mysql_options(con->mysql, MYSQL_SET_CHARSET_NAME,
charset_info->csname);
if (opt_charsets_dir)
diff --git a/cmake/aws_sdk.cmake b/cmake/aws_sdk.cmake
index 975a3fa6888..92e1e78ad3f 100644
--- a/cmake/aws_sdk.cmake
+++ b/cmake/aws_sdk.cmake
@@ -9,6 +9,9 @@ FUNCTION (CHECK_AWS_SDK RETVAL REASON)
IF(NOT AWS_SDK_EXTERNAL_PROJECT)
SKIP_AWS_SDK("AWS_SDK_EXTERNAL_PROJECT is not ON")
ENDIF()
+ IF(NOT NOT_FOR_DISTRIBUTION)
+ SKIP_AWS_SDK("AWS SDK has Apache 2.0 License which is not complatible with GPLv2. Set -DNOT_FOR_DISTRIBUTION=ON if you need it")
+ ENDIF()
# Check compiler support
IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
EXECUTE_PROCESS(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE GCC_VERSION)
@@ -73,6 +76,7 @@ FUNCTION(USE_AWS_SDK_LIBS)
IF(NOT TARGET ${target})
MESSAGE(FATAL_ERROR "${target} is not a valid target")
ENDIF()
+ SET(NON_DISTRIBUTABLE_WARNING "Apache 2.0" CACHE INTERNAL "")
LIST(REMOVE_AT SDK_COMPONENTS 0)
FOREACH(comp ${SDK_COMPONENTS})
SET_PROPERTY(GLOBAL PROPERTY AWS_SDK_LIBS ${comp} APPEND)
diff --git a/cmake/build_configurations/mysql_release.cmake b/cmake/build_configurations/mysql_release.cmake
index 4b399a131f5..466255ad7d1 100644
--- a/cmake/build_configurations/mysql_release.cmake
+++ b/cmake/build_configurations/mysql_release.cmake
@@ -86,7 +86,6 @@ IF(FEATURE_SET)
ENDIF()
ENDIF()
-OPTION(ENABLED_LOCAL_INFILE "" ON)
SET(WITH_INNODB_SNAPPY OFF CACHE STRING "")
IF(WIN32)
SET(INSTALL_MYSQLTESTDIR "" CACHE STRING "")
diff --git a/cmake/readline.cmake b/cmake/readline.cmake
index 12a8980b6a9..f7a5291135c 100644
--- a/cmake/readline.cmake
+++ b/cmake/readline.cmake
@@ -134,7 +134,7 @@ MACRO (MYSQL_FIND_SYSTEM_READLINE)
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
+ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(USE_NEW_READLINE_INTERFACE 1)
ELSE()
SET(USE_NEW_READLINE_INTERFACE 0)
diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake
index 9f04c26e8d6..c8f7b3cc400 100644
--- a/cmake/submodules.cmake
+++ b/cmake/submodules.cmake
@@ -10,7 +10,12 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git")
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE cmake_update_submodules
RESULT_VARIABLE git_config_get_result)
- IF(git_config_get_result EQUAL 128 OR cmake_update_submodules MATCHES no)
+ IF(cmake_update_submodules MATCHES no)
+ SET(update_result 0)
+ SET(SUBMODULE_UPDATE_CONFIG_MESSAGE
+"\n\nTo update submodules automatically, set cmake.update-submodules to 'yes', or 'force' to update automatically:
+ ${GIT_EXECUTABLE} config cmake.update-submodules yes")
+ ELSEIF(git_config_get_result EQUAL 128)
SET(update_result 0)
ELSEIF (cmake_update_submodules MATCHES force)
MESSAGE(STATUS "Updating submodules (forced)")
@@ -31,7 +36,6 @@ ENDIF()
IF(update_result OR NOT EXISTS ${CMAKE_SOURCE_DIR}/libmariadb/CMakeLists.txt)
MESSAGE(FATAL_ERROR "No MariaDB Connector/C! Run
- git submodule update --init --recursive
-Then restart the build.
-")
+ ${GIT_EXECUTABLE} submodule update --init --recursive
+Then restart the build.${SUBMODULE_UPDATE_CONFIG_MESSAGE}")
ENDIF()
diff --git a/config.h.cmake b/config.h.cmake
index 247d983c501..fcc366939b2 100644
--- a/config.h.cmake
+++ b/config.h.cmake
@@ -445,7 +445,11 @@
/*
MySQL features
*/
-#cmakedefine ENABLED_LOCAL_INFILE 1
+#define LOCAL_INFILE_MODE_OFF 0
+#define LOCAL_INFILE_MODE_ON 1
+#define LOCAL_INFILE_MODE_AUTO 2
+#define ENABLED_LOCAL_INFILE LOCAL_INFILE_MODE_@ENABLED_LOCAL_INFILE@
+
#cmakedefine ENABLED_PROFILING 1
#cmakedefine EXTRA_DEBUG 1
#cmakedefine USE_SYMDIR 1
diff --git a/configure.cmake b/configure.cmake
index 08eac106e6a..947689d0f86 100644
--- a/configure.cmake
+++ b/configure.cmake
@@ -260,7 +260,7 @@ SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -DPACKAGE=test) # b
CHECK_INCLUDE_FILES (bfd.h BFD_H_EXISTS)
IF(BFD_H_EXISTS)
IF(NOT_FOR_DISTRIBUTION)
- SET(NON_DISTRIBUTABLE_WARNING 1)
+ SET(NON_DISTRIBUTABLE_WARNING "GPLv3" CACHE INTERNAL "")
SET(HAVE_BFD_H 1)
ENDIF()
ENDIF()
diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh
index 3442afbf376..6ef0cb33553 100755
--- a/debian/autobake-deb.sh
+++ b/debian/autobake-deb.sh
@@ -97,33 +97,6 @@ then
sed '/Package: mariadb-plugin-rocksdb/,/^$/d' -i debian/control
fi
-# AWS SDK requires c++11 -capable compiler.
-# Minimal supported versions are g++ 4.8 and clang 3.3.
-# AWS SDK also requires the build machine to have network access and git, so
-# it cannot be part of the base version included in Linux distros, but a pure
-# custom built plugin.
-if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q </dev/tcp/github.com/22'
-then
- cat <<EOF >> debian/control
-
-Package: mariadb-plugin-aws-key-management
-Architecture: any
-Breaks: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
-Replaces: mariadb-aws-key-management-10.1,
- mariadb-aws-key-management-10.2
-Depends: mariadb-server-10.4,
- \${misc:Depends},
- \${shlibs:Depends}
-Description: Amazon Web Service Key Management Service Plugin for MariaDB
- This encryption key management plugin gives an interface to the Amazon Web
- Services Key Management Service for managing encryption keys used for MariaDB
- data-at-rest encryption.
-EOF
-
- sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules
-fi
-
# Don't build cassandra package if thrift is not installed
if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]]
then
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index fcbecd6dfe8..5e529e665e1 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -1629,8 +1629,21 @@ ibx_copy_incremental_over_full()
}
}
+ if (directory_exists(ROCKSDB_BACKUP_DIR, false)) {
+ if (my_rmtree(ROCKSDB_BACKUP_DIR, MYF(0))) {
+ die("Can't remove " ROCKSDB_BACKUP_DIR);
+ }
+ }
+ snprintf(path, sizeof(path), "%s/" ROCKSDB_BACKUP_DIR, xtrabackup_incremental_dir);
+ if (directory_exists(path, false)) {
+ if (my_mkdir(ROCKSDB_BACKUP_DIR, 0777, MYF(0))) {
+ die("my_mkdir failed for " ROCKSDB_BACKUP_DIR);
+ }
+ copy_or_move_dir(path, ROCKSDB_BACKUP_DIR, true, true);
+ }
}
+
cleanup:
if (it != NULL) {
datadir_iter_free(it);
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index 0a547f21eff..00a9c4678f4 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -234,8 +234,6 @@ long innobase_write_io_threads = 4;
longlong innobase_page_size = (1LL << 14); /* 16KB */
char* innobase_buffer_pool_filename = NULL;
-longlong innobase_buffer_pool_size = 8*1024*1024L;
-
/* The default values for the following char* start-up parameters
are determined in innobase_init below: */
@@ -800,7 +798,6 @@ enum options_xtrabackup
OPT_INNODB_LOG_CHECKSUMS,
OPT_XTRA_INCREMENTAL_FORCE_SCAN,
OPT_DEFAULTS_GROUP,
- OPT_INNODB_ENCRYPT_LOG,
OPT_CLOSE_FILES,
OPT_CORE_FILE,
@@ -1257,11 +1254,6 @@ struct my_option xb_server_options[] =
(G_PTR*) &sys_tablespace_auto_extend_increment,
(G_PTR*) &sys_tablespace_auto_extend_increment,
0, GET_ULONG, REQUIRED_ARG, 8L, 1L, 1000L, 0, 1L, 0},
- {"innodb_buffer_pool_size", OPT_INNODB_BUFFER_POOL_SIZE,
- "The size of the memory buffer InnoDB uses to cache data and indexes of its tables.",
- (G_PTR*) &innobase_buffer_pool_size, (G_PTR*) &innobase_buffer_pool_size, 0,
- GET_LL, REQUIRED_ARG, 8*1024*1024L, 1024*1024L, LONGLONG_MAX, 0,
- 1024*1024L, 0},
{"innodb_data_file_path", OPT_INNODB_DATA_FILE_PATH,
"Path to individual files and their sizes.", &innobase_data_file_path,
&innobase_data_file_path, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
@@ -1375,10 +1367,6 @@ struct my_option xb_server_options[] =
&xb_plugin_dir, &xb_plugin_dir,
0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
- { "innodb-encrypt-log", OPT_INNODB_ENCRYPT_LOG, "Whether to encrypt innodb log",
- &srv_encrypt_log, &srv_encrypt_log,
- 0, GET_BOOL, REQUIRED_ARG, 0, 0, 0, 0, 0, 0 },
-
{"innodb-log-checksums", OPT_INNODB_LOG_CHECKSUMS,
"Whether to require checksums for InnoDB redo log blocks",
&innodb_log_checksums, &innodb_log_checksums,
@@ -1575,11 +1563,23 @@ end:
}
-static const char *xb_client_default_groups[]=
- { "xtrabackup", "mariabackup", "client", 0, 0, 0 };
+static const char *xb_client_default_groups[]={
+ "xtrabackup", "mariabackup",
+ "client", "client-server",
+ "client-mariadb",
+ 0, 0, 0
+};
-static const char *xb_server_default_groups[]=
- { "xtrabackup", "mariabackup", "mysqld", 0, 0, 0 };
+static const char *xb_server_default_groups[]={
+ "xtrabackup", "mariabackup",
+ "mysqld", "server", MYSQL_BASE_VERSION,
+ "mariadb", MARIADB_BASE_VERSION,
+ "client-server",
+ #ifdef WITH_WSREP
+ "galera",
+ #endif
+ 0, 0, 0
+};
static void print_version(void)
{
@@ -1821,13 +1821,6 @@ static bool innodb_init_param()
msg("mariabackup: use-memory can't be over 4GB"
" on 32-bit systems");
}
-
- if (innobase_buffer_pool_size > UINT_MAX32) {
- msg("mariabackup: innobase_buffer_pool_size can't be "
- "over 4GB on 32-bit systems");
-
- goto error;
- }
}
static char default_path[2] = { FN_CURLIB, 0 };
@@ -2763,7 +2756,10 @@ static bool xtrabackup_copy_logfile(bool last = false)
log_mutex_exit();
if (!start_lsn) {
- die("xtrabackup_copy_logfile() failed.");
+ msg(recv_sys->found_corrupt_log
+ ? "xtrabackup_copy_logfile() failed: corrupt log."
+ : "xtrabackup_copy_logfile() failed.");
+ return true;
}
} while (start_lsn == end_lsn);
diff --git a/include/my_sys.h b/include/my_sys.h
index 11993c02516..6a300e9aca3 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -613,7 +613,9 @@ static inline size_t my_b_bytes_in_cache(const IO_CACHE *info)
return (size_t) (info->read_end - info->read_pos);
}
-int my_b_copy_to_file(IO_CACHE *cache, FILE *file);
+int my_b_copy_to_file (IO_CACHE *cache, FILE *file, size_t count);
+int my_b_copy_all_to_file(IO_CACHE *cache, FILE *file);
+
my_off_t my_b_append_tell(IO_CACHE* info);
my_off_t my_b_safe_tell(IO_CACHE* info); /* picks the correct tell() */
int my_b_pread(IO_CACHE *info, uchar *Buffer, size_t Count, my_off_t pos);
@@ -627,6 +629,7 @@ extern int (*mysys_test_invalid_symlink)(const char *filename);
extern int my_copy(const char *from,const char *to,myf MyFlags);
extern int my_delete(const char *name,myf MyFlags);
+extern int my_rmtree(const char *name, myf Myflags);
extern int my_getwd(char * buf,size_t size,myf MyFlags);
extern int my_setwd(const char *dir,myf MyFlags);
extern int my_lock(File fd,int op,my_off_t start, my_off_t length,myf MyFlags);
diff --git a/include/my_valgrind.h b/include/my_valgrind.h
index 5ba288cedc3..575ed46a0ee 100644
--- a/include/my_valgrind.h
+++ b/include/my_valgrind.h
@@ -42,7 +42,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
#else
-# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_UNDEFINED(a,len) ((void) (a), (void) (len))
# define MEM_NOACCESS(a,len) ((void) 0)
# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
# define MEM_CHECK_DEFINED(a,len) ((void) 0)
@@ -51,7 +51,7 @@ https://github.com/google/sanitizers/wiki/AddressSanitizerManualPoisoning */
#if !defined(DBUG_OFF) || defined(TRASH_FREED_MEMORY)
#define TRASH_FILL(A,B,C) do { const size_t trash_tmp= (B); MEM_UNDEFINED(A, trash_tmp); memset(A, C, trash_tmp); } while (0)
#else
-#define TRASH_FILL(A,B,C) do { const size_t trash_tmp __attribute__((unused))= (B); MEM_UNDEFINED(A,trash_tmp); } while (0)
+#define TRASH_FILL(A,B,C) do { MEM_UNDEFINED((A), (B)); } while (0)
#endif
#define TRASH_ALLOC(A,B) do { TRASH_FILL(A,B,0xA5); MEM_UNDEFINED(A,B); } while(0)
diff --git a/include/mysql.h b/include/mysql.h
index a42f90db1ae..68b2e76f4b4 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -293,7 +293,7 @@ typedef struct st_mysql
/* session-wide random string */
char scramble[SCRAMBLE_LENGTH+1];
- my_bool unused1;
+ my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;
LIST *stmts; /* list of all statements */
diff --git a/include/mysql.h.pp b/include/mysql.h.pp
index e36131b93d2..1e4479e8f2b 100644
--- a/include/mysql.h.pp
+++ b/include/mysql.h.pp
@@ -382,7 +382,7 @@ typedef struct st_mysql
my_bool free_me;
my_bool reconnect;
char scramble[20 +1];
- my_bool unused1;
+ my_bool auto_local_infile;
void *unused2, *unused3, *unused4, *unused5;
LIST *stmts;
const struct st_mysql_methods *methods;
diff --git a/libmariadb b/libmariadb
-Subproject beb9d5ea8994bb90361c4b9f3d926eee2405517
+Subproject 2c5aebb3bc724c1663c481ba2fedde00ab494fa
diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test
index 39aa3d49d68..1f8138eb072 100644
--- a/mysql-test/include/check-testcase.test
+++ b/mysql-test/include/check-testcase.test
@@ -98,7 +98,6 @@ call mtr.check_testcase();
let $datadir=`select @@datadir`;
list_files $datadir mysql_upgrade_info;
list_files_write_file $datadir.tempfiles.txt $datadir/test #sql*;
---replace_regex /#sql-ib[0-9a-f]+-[0-9a-f]+\.ibd\n//
cat_file $datadir.tempfiles.txt;
remove_file $datadir.tempfiles.txt;
list_files $datadir/mysql #sql*;
diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql
index c4ffc292500..b5673b2a313 100644
--- a/mysql-test/include/mtr_check.sql
+++ b/mysql-test/include/mtr_check.sql
@@ -35,7 +35,6 @@ BEGIN
AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP'
AND variable_name not like 'GTID%POS'
AND variable_name != 'GTID_BINLOG_STATE'
- AND variable_name != 'AUTO_INCREMENT_INCREMENT'
ORDER BY variable_name;
-- Dump all databases, there should be none
diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result
index 92946b65e66..5ae90459ff4 100644
--- a/mysql-test/main/alter_table.result
+++ b/mysql-test/main/alter_table.result
@@ -2468,6 +2468,55 @@ ERROR 23000: Duplicate entry '1' for key 'i'
UNLOCK TABLES;
DROP TABLE t1;
#
+# MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
+#
+CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL,
+CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ui` (`c2`),
+ KEY `sid` (`c1`),
+ CONSTRAINT `sid` FOREIGN KEY (`c1`) REFERENCES `t1` (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t2 DROP CONSTRAINT sid;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `ui` (`c2`),
+ KEY `sid` (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t2 DROP CONSTRAINT ui;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `sid` (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `id` int(11) NOT NULL,
+ `c1` int(11) DEFAULT NULL,
+ `c2` int(11) NOT NULL,
+ KEY `sid` (`c1`)
+) ENGINE=InnoDB DEFAULT CHARSET=latin1
+DROP TABLE t2, t1;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test
index 829f4013cb3..0fab5575f13 100644
--- a/mysql-test/main/alter_table.test
+++ b/mysql-test/main/alter_table.test
@@ -2019,6 +2019,23 @@ DROP TABLE t1;
--echo #
+--echo # MDEV-17599 ALTER TABLE DROP CONSTRAINT does not work for foreign keys.
+--echo #
+
+CREATE TABLE t1(id INT PRIMARY KEY, c1 INT) ENGINE= INNODB;
+CREATE TABLE t2(id INT PRIMARY KEY, c1 INT, c2 INT NOT NULL,
+ CONSTRAINT sid FOREIGN KEY (`c1`) REFERENCES t1 (`id`) ON DELETE NO ACTION ON UPDATE NO ACTION,
+ CONSTRAINT UNIQUE `ui`(c2)) ENGINE= INNODB;
+SHOW CREATE TABLE t2;
+ALTER TABLE t2 DROP CONSTRAINT sid;
+SHOW CREATE TABLE t2;
+ALTER TABLE t2 DROP CONSTRAINT ui;
+SHOW CREATE TABLE t2;
+ALTER TABLE t2 DROP CONSTRAINT PRIMARY KEY;
+SHOW CREATE TABLE t2;
+DROP TABLE t2, t1;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result
index b26409e3d05..1e2a8100e84 100644
--- a/mysql-test/main/alter_table_errors.result
+++ b/mysql-test/main/alter_table_errors.result
@@ -27,3 +27,9 @@ t2 CREATE TEMPORARY TABLE `t2` (
`a` int(11) DEFAULT NULL,
`v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
+drop temporary table t1, t2;
+create temporary table t1 (a int);
+alter table t1 add column f text;
+insert into t1 values ('x','foo');
+ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1
+drop temporary table t1;
diff --git a/mysql-test/main/alter_table_errors.test b/mysql-test/main/alter_table_errors.test
index 8fa65b0f330..8726410ea0a 100644
--- a/mysql-test/main/alter_table_errors.test
+++ b/mysql-test/main/alter_table_errors.test
@@ -19,3 +19,13 @@ lock table t2 write;
--error ER_ALTER_OPERATION_NOT_SUPPORTED
alter table t2 change column a b int, algorithm=inplace;
show create table t2;
+drop temporary table t1, t2;
+
+#
+# MDEV-18083 ASAN heap-use-after-free in Field::set_warning_truncated_wrong_value upon inserting into temporary table
+#
+create temporary table t1 (a int);
+alter table t1 add column f text;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+insert into t1 values ('x','foo');
+drop temporary table t1;
diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result
index e882a4cdbe6..11ed734da0c 100644
--- a/mysql-test/main/check.result
+++ b/mysql-test/main/check.result
@@ -95,3 +95,10 @@ Warnings:
Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
alter table t1;
drop table t1;
+create temporary table t1 (a int default 0, check (a > 0));
+alter table t1 drop constraint if exists non_existing_constraint;
+Warnings:
+Note 1091 Can't DROP CONSTRAINT `non_existing_constraint`; check that it exists
+insert into t1 () values ();
+ERROR 23000: CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1`
+drop table t1;
diff --git a/mysql-test/main/check.test b/mysql-test/main/check.test
index 475a7996a09..29587a9f623 100644
--- a/mysql-test/main/check.test
+++ b/mysql-test/main/check.test
@@ -115,3 +115,12 @@ insert into t1 () values ();
alter ignore table t1 add constraint check (f > 0);
alter table t1;
drop table t1;
+
+#
+# MDEV-16905 ASAN heap-use-after-free in __interceptor_strnlen / ... / TABLE::verify_constraints upon INSERT into temporary table with CHECK constraint
+#
+create temporary table t1 (a int default 0, check (a > 0));
+alter table t1 drop constraint if exists non_existing_constraint;
+--error ER_CONSTRAINT_FAILED
+insert into t1 () values ();
+drop table t1;
diff --git a/mysql-test/main/check_constraint.result b/mysql-test/main/check_constraint.result
index 9a228f9ccc7..8cb1066ba9a 100644
--- a/mysql-test/main/check_constraint.result
+++ b/mysql-test/main/check_constraint.result
@@ -44,7 +44,7 @@ a b
103 103
set check_constraint_checks=@save_check_constraint;
alter table t1 add c int default 0 check (c < 10);
-ERROR 23000: CONSTRAINT `max` failed for table
+ERROR 23000: CONSTRAINT `max` failed for `test`.`t1`
set check_constraint_checks=0;
alter table t1 add c int default 0 check (c < 10);
alter table t1 add check (a+b+c < 500);
diff --git a/mysql-test/main/check_constraint.test b/mysql-test/main/check_constraint.test
index be06c3ec579..37fdc7203b1 100644
--- a/mysql-test/main/check_constraint.test
+++ b/mysql-test/main/check_constraint.test
@@ -27,7 +27,6 @@ insert into t1 values (101,101),(102,102),(600,600),(103,103);
select * from t1;
set check_constraint_checks=@save_check_constraint;
---replace_regex /failed for.*/failed for table/
--error ER_CONSTRAINT_FAILED
alter table t1 add c int default 0 check (c < 10);
diff --git a/mysql-test/main/check_constraint_innodb.result b/mysql-test/main/check_constraint_innodb.result
new file mode 100644
index 00000000000..45af3f512b7
--- /dev/null
+++ b/mysql-test/main/check_constraint_innodb.result
@@ -0,0 +1,9 @@
+create table t1 (a int, b smallint) engine=innodb;
+connect con1,localhost,root,,test;
+alter table t1 add constraint check (b < 8);
+alter table t1 modify column b int, algorithm=inplace;
+ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Cannot change column type INPLACE. Try ALGORITHM=COPY
+connection default;
+alter table t1 add primary key (a);
+drop table t1;
+disconnect con1;
diff --git a/mysql-test/main/check_constraint_innodb.test b/mysql-test/main/check_constraint_innodb.test
new file mode 100644
index 00000000000..d02aa320e84
--- /dev/null
+++ b/mysql-test/main/check_constraint_innodb.test
@@ -0,0 +1,14 @@
+--source include/have_innodb.inc
+
+#
+# MDEV-18239 ASAN use-after-poison in process_str_arg / ... / mark_unsupported_func or unexpected ER_BAD_FIELD_ERROR upon ALTER TABLE
+#
+create table t1 (a int, b smallint) engine=innodb;
+connect con1,localhost,root,,test;
+alter table t1 add constraint check (b < 8);
+error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON;
+alter table t1 modify column b int, algorithm=inplace;
+connection default;
+alter table t1 add primary key (a);
+drop table t1;
+disconnect con1;
diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def
index eecee845a35..c1cfd229a9b 100644
--- a/mysql-test/main/disabled.def
+++ b/mysql-test/main/disabled.def
@@ -18,6 +18,7 @@ innodb-wl5522-debug-zip : broken upstream
innodb_bug12902967 : broken upstream
file_contents : MDEV-6526 these files are not installed anymore
max_statement_time : cannot possibly work, depends on timing
+partition_open_files_limit : open_files_limit check broken by MDEV-18360
mysqlcheck : special tables like proxy , host specific to a system are shown
flush_read_lock : special tables like proxy , host specific to a system are shown
join_cache : enable after MDEV-17752 is fixed
diff --git a/mysql-test/main/error_simulation.result b/mysql-test/main/error_simulation.result
index e0ec26b2d1c..7e728d24fc8 100644
--- a/mysql-test/main/error_simulation.result
+++ b/mysql-test/main/error_simulation.result
@@ -1,6 +1,3 @@
-DROP TABLE IF EXISTS t1;
-Warnings:
-Note 1051 Unknown table 'test.t1'
CREATE TABLE t1 (
a varchar(32) character set utf8 collate utf8_bin NOT NULL,
b varchar(32) character set utf8 collate utf8_bin NOT NULL )
@@ -15,7 +12,7 @@ INSERT INTO t1 VALUES
set tmp_table_size=1024;
set session debug_dbug="+d,raise_error";
SELECT MAX(a) FROM t1 GROUP BY a,b;
-ERROR 23000: Can't write; duplicate key in table 'tmp_table'
+ERROR 23000: Can't write; duplicate key in table '(temporary)'
set tmp_table_size=default;
DROP TABLE t1;
#
diff --git a/mysql-test/main/error_simulation.test b/mysql-test/main/error_simulation.test
index beaaf603754..1debed871c7 100644
--- a/mysql-test/main/error_simulation.test
+++ b/mysql-test/main/error_simulation.test
@@ -1,12 +1,9 @@
--- source include/have_debug.inc
+--source include/have_debug.inc
--source include/not_embedded.inc
#
# Bug #28499: crash for grouping query when tmp_table_size is too small
#
-
-DROP TABLE IF EXISTS t1;
-
CREATE TABLE t1 (
a varchar(32) character set utf8 collate utf8_bin NOT NULL,
b varchar(32) character set utf8 collate utf8_bin NOT NULL )
@@ -26,14 +23,12 @@ set tmp_table_size=1024;
# tmp table in query is converted from heap to myisam
set session debug_dbug="+d,raise_error";
---replace_regex /in table '[^']+'/in table 'tmp_table'/
--error ER_DUP_KEY
SELECT MAX(a) FROM t1 GROUP BY a,b;
set tmp_table_size=default;
DROP TABLE t1;
-
--echo #
--echo # Bug #50946: fast index creation still seems to copy the table
--echo #
diff --git a/mysql-test/main/func_misc.result b/mysql-test/main/func_misc.result
index 2aa305191bd..1d284e45545 100644
--- a/mysql-test/main/func_misc.result
+++ b/mysql-test/main/func_misc.result
@@ -1483,6 +1483,14 @@ ip_full_addr
2000::
DROP PROCEDURE p1;
#
+# MDEV-18195 ASAN use-after-poison in my_strcasecmp_utf8 / Item::eq upon prepared statement with ORDER BY NAME_CONST
+#
+PREPARE stmt FROM "SELECT 'x' ORDER BY NAME_CONST( 'f', 'foo' )";
+EXECUTE stmt;
+x
+x
+DEALLOCATE PREPARE stmt;
+#
# Start of 10.2 tests
#
#
diff --git a/mysql-test/main/func_misc.test b/mysql-test/main/func_misc.test
index 1301b172910..331293a9c95 100644
--- a/mysql-test/main/func_misc.test
+++ b/mysql-test/main/func_misc.test
@@ -1130,6 +1130,14 @@ DELIMITER ;$$
CALL p1();
DROP PROCEDURE p1;
+--echo #
+--echo # MDEV-18195 ASAN use-after-poison in my_strcasecmp_utf8 / Item::eq upon prepared statement with ORDER BY NAME_CONST
+--echo #
+
+PREPARE stmt FROM "SELECT 'x' ORDER BY NAME_CONST( 'f', 'foo' )";
+EXECUTE stmt;
+DEALLOCATE PREPARE stmt;
+
--echo #
--echo # Start of 10.2 tests
diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test
index c3d0fb43520..3bc77ec50df 100644
--- a/mysql-test/main/gis.test
+++ b/mysql-test/main/gis.test
@@ -762,7 +762,6 @@ drop table t1;
--echo # on char > 31 bytes".
--echo #
create table t1(a char(32) not null) engine=myisam;
---replace_regex /'[^']*test\.#sql-[0-9a-f_]*'/'#sql-temporary'/
--error ER_WRONG_ARGUMENTS
create spatial index i on t1 (a);
drop table t1;
diff --git a/mysql-test/main/gis2.result b/mysql-test/main/gis2.result
index cb919ecdeb1..6eb1c54e8d4 100644
--- a/mysql-test/main/gis2.result
+++ b/mysql-test/main/gis2.result
@@ -33,6 +33,6 @@ SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1))));
set timestamp=10;
alter table t1 add column i int;
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`(temporary)`.`p` at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
diff --git a/mysql-test/main/mysql.result b/mysql-test/main/mysql.result
index 06ef7e95bc9..07f49d32b2e 100644
--- a/mysql-test/main/mysql.result
+++ b/mysql-test/main/mysql.result
@@ -600,3 +600,29 @@ a
2
drop table "a1\""b1";
set sql_mode=default;
+create table t1 (a text);
+select count(*) from t1;
+count(*)
+41
+truncate table t1;
+select count(*) from t1;
+count(*)
+41
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+truncate table t1;
+select count(*) from t1;
+count(*)
+41
+truncate table t1;
+select count(*) from t1;
+count(*)
+0
+truncate table t1;
+drop table t1;
diff --git a/mysql-test/main/mysql.test b/mysql-test/main/mysql.test
index c65860eb822..cd335973288 100644
--- a/mysql-test/main/mysql.test
+++ b/mysql-test/main/mysql.test
@@ -680,3 +680,25 @@ show create table "a1\""b1";
select * from "a1\""b1";
drop table "a1\""b1";
set sql_mode=default;
+
+#
+# mysql --local-infile
+#
+--let $ldli = load data local infile '$MYSQLTEST_VARDIR/tmp/bug.sql' into table test.t1;
+create table t1 (a text);
+--exec $MYSQL -e "$ldli"
+select count(*) from t1; truncate table t1;
+--exec $MYSQL --enable-local-infile -e "$ldli"
+select count(*) from t1; truncate table t1;
+--error 1
+--exec $MYSQL --disable-local-infile -e "$ldli"
+select count(*) from t1; truncate table t1;
+--error 1
+--exec $MYSQL -e "/*q*/$ldli"
+select count(*) from t1; truncate table t1;
+--exec $MYSQL --enable-local-infile -e "/*q*/$ldli"
+select count(*) from t1; truncate table t1;
+ --error 1
+ --exec $MYSQL --disable-local-infile -e "/*q*/$ldli"
+select count(*) from t1; truncate table t1;
+drop table t1;
diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result
index 680fd8196a8..b3cee345428 100644
--- a/mysql-test/main/mysqlbinlog_row_minimal.result
+++ b/mysql-test/main/mysqlbinlog_row_minimal.result
@@ -237,43 +237,40 @@ BEGIN
#Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL
#<date> server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num
# at 2591
-#<date> server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2657 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F
### UPDATE `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
-### @5=4 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
### UPDATE `test`.`t2`
### WHERE
### @1=11 /* INT meta=0 nullable=0 is_null=0 */
-### @5=4 /* INT meta=0 nullable=1 is_null=0 */
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
### UPDATE `test`.`t2`
### WHERE
### @1=12 /* INT meta=0 nullable=0 is_null=0 */
-### @5=NULL /* INT meta=0 nullable=1 is_null=1 */
### SET
### @5=5 /* INT meta=0 nullable=1 is_null=0 */
# Number of rows: 3
-# at 2665
-#<date> server id 1 end_log_pos 2738 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+# at 2657
+#<date> server id 1 end_log_pos 2730 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 2738
-#<date> server id 1 end_log_pos 2780 CRC32 XXX GTID 0-1-9
+# at 2730
+#<date> server id 1 end_log_pos 2772 CRC32 XXX GTID 0-1-9
/*!100001 SET @@session.gtid_seq_no=9*//*!*/;
BEGIN
/*!*/;
-# at 2780
-# at 2817
-#<date> server id 1 end_log_pos 2817 CRC32 XXX Annotate_rows:
+# at 2772
+# at 2809
+#<date> server id 1 end_log_pos 2809 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t1
-#<date> server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num
-# at 2873
-#<date> server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F
+#<date> server id 1 end_log_pos 2865 CRC32 XXX Table_map: `test`.`t1` mapped to number num
+# at 2865
+#<date> server id 1 end_log_pos 2919 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F
### DELETE FROM `test`.`t1`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -287,23 +284,23 @@ BEGIN
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# Number of rows: 4
-# at 2927
-#<date> server id 1 end_log_pos 3000 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+# at 2919
+#<date> server id 1 end_log_pos 2992 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
COMMIT
/*!*/;
-# at 3000
-#<date> server id 1 end_log_pos 3042 CRC32 XXX GTID 0-1-10
+# at 2992
+#<date> server id 1 end_log_pos 3034 CRC32 XXX GTID 0-1-10
/*!100001 SET @@session.gtid_seq_no=10*//*!*/;
BEGIN
/*!*/;
-# at 3042
-# at 3079
-#<date> server id 1 end_log_pos 3079 CRC32 XXX Annotate_rows:
+# at 3034
+# at 3071
+#<date> server id 1 end_log_pos 3071 CRC32 XXX Annotate_rows:
#Q> DELETE FROM t2
-#<date> server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num
-# at 3135
-#<date> server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F
+#<date> server id 1 end_log_pos 3127 CRC32 XXX Table_map: `test`.`t2` mapped to number num
+# at 3127
+#<date> server id 1 end_log_pos 3181 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F
### DELETE FROM `test`.`t2`
### WHERE
### @1=10 /* INT meta=0 nullable=0 is_null=0 */
@@ -317,13 +314,82 @@ BEGIN
### WHERE
### @1=13 /* INT meta=0 nullable=0 is_null=0 */
# Number of rows: 4
-# at 3189
-#<date> server id 1 end_log_pos 3262 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+# at 3181
+#<date> server id 1 end_log_pos 3254 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
+SET TIMESTAMP=X/*!*/;
+COMMIT
+/*!*/;
+# at 3254
+#<date> server id 1 end_log_pos 3302 CRC32 XXX Rotate to master-bin.000002 pos: 4
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=0*/;
+DROP TABLE t1,t2;
+CREATE TABLE `t1` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`is_deleted` BIT(1) DEFAULT b'0',
+`last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+`ref_id` BIGINT(20) UNSIGNED NOT NULL,
+PRIMARY KEY (`id`),
+KEY `last_updated_KEY` (`last_updated`)
+);
+CREATE TABLE `t2` (
+`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+`short_desc` VARCHAR(50) NOT NULL,
+PRIMARY KEY (`id`)
+);
+INSERT INTO t2 (id, short_desc) VALUES (1, 'test');
+INSERT INTO t1 (id, is_deleted, ref_id) VALUES (1, b'0', 1);
+FLUSH BINARY LOGS;
+UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
+SET t1.is_deleted = TRUE
+WHERE t1.id = 1;
+FLUSH BINARY LOGS;
+/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+# at 387
+#<date> server id 1 end_log_pos 429 CRC32 XXX GTID 0-1-16
+/*!100101 SET @@session.skip_parallel_replication=0*//*!*/;
+/*!100001 SET @@session.gtid_domain_id=0*//*!*/;
+/*!100001 SET @@session.server_id=1*//*!*/;
+/*!100001 SET @@session.gtid_seq_no=16*//*!*/;
+BEGIN
+/*!*/;
+# at 429
+# at 543
+#<date> server id 1 end_log_pos 543 CRC32 XXX Annotate_rows:
+#Q> UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
+#Q> SET t1.is_deleted = TRUE
+#Q> WHERE t1.id =
+#<date> server id 1 end_log_pos 594 CRC32 XXX Table_map: `test`.`t1` mapped to number 35
+# at 594
+#<date> server id 1 end_log_pos 643 CRC32 XXX Update_rows: table id 35 flags: STMT_END_F
+### UPDATE `test`.`t1`
+### WHERE
+### @1=1 /* LONGINT meta=0 nullable=0 is_null=0 */
+### SET
+### @2=b'1' /* BIT(1) meta=1 nullable=1 is_null=0 */
+### @3=X /* TIMESTAMP(0) meta=0 nullable=0 is_null=0 */
+# Number of rows: 1
+# at 643
+#<date> server id 1 end_log_pos 725 CRC32 XXX Query thread_id=5 exec_time=x error_code=0
SET TIMESTAMP=X/*!*/;
+SET @@session.pseudo_thread_id=5/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1, @@session.check_constraint_checks=1/*!*/;
+SET @@session.sql_mode=1411383296/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
COMMIT
/*!*/;
-# at 3262
-#<date> server id 1 end_log_pos 3310 CRC32 XXX Rotate to master-bin.000002 pos: 4
+# at 725
+#<date> server id 1 end_log_pos 773 CRC32 XXX Rotate to master-bin.000004 pos: 4
DELIMITER ;
# End of log file
ROLLBACK /* added by mysqlbinlog */;
diff --git a/mysql-test/main/mysqlbinlog_row_minimal.test b/mysql-test/main/mysqlbinlog_row_minimal.test
index 7909f75e9a1..85b816e1be5 100644
--- a/mysql-test/main/mysqlbinlog_row_minimal.test
+++ b/mysql-test/main/mysqlbinlog_row_minimal.test
@@ -26,8 +26,49 @@ DELETE FROM t2;
--let $datadir = `SELECT @@datadir`
FLUSH BINARY LOGS;
+
--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
--replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /Start:.*at startup/Start: xxx/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /mapped to number \d*/mapped to number num/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog
DROP TABLE t1,t2;
+
+#
+# MDEV-14605 ON UPDATE CURRENT_TIMESTAMP fields by multi-table UPDATE are not logged with binlog_row_image=MINIMAL
+#
+
+CREATE TABLE `t1` (
+
+ `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `is_deleted` BIT(1) DEFAULT b'0',
+ `last_updated` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
+ `ref_id` BIGINT(20) UNSIGNED NOT NULL,
+ PRIMARY KEY (`id`),
+ KEY `last_updated_KEY` (`last_updated`)
+);
+
+CREATE TABLE `t2` (
+ `id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
+ `short_desc` VARCHAR(50) NOT NULL,
+ PRIMARY KEY (`id`)
+);
+
+
+INSERT INTO t2 (id, short_desc) VALUES (1, 'test');
+INSERT INTO t1 (id, is_deleted, ref_id) VALUES (1, b'0', 1);
+FLUSH BINARY LOGS;
+--let $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+UPDATE t1 t1 INNER JOIN t2 t2 ON t1.ref_id = t2.id
+ SET t1.is_deleted = TRUE
+ WHERE t1.id = 1;
+
+--let $binlog = query_get_value(SHOW MASTER STATUS, File, 1)
+
+FLUSH BINARY LOGS;
+--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
+--replace_regex /\d{6} *\d*:\d\d:\d\d/<date>/ /SET TIMESTAMP=\d*/SET TIMESTAMP=X/ /exec_time=\d*/exec_time=x/ /@3=\d*/@3=X/ /CRC32 0x[0-9a-f]+/CRC32 XXX/
+--exec $MYSQL_BINLOG --verbose --verbose --base64-output=DECODE-ROWS $datadir/$binlog --start-position=$binlog_pos
+
+DROP TABLE t1,t2;
+
diff --git a/mysql-test/main/row-checksum-old.result b/mysql-test/main/row-checksum-old.result
index 87cd1cc89ed..d374013f61c 100644
--- a/mysql-test/main/row-checksum-old.result
+++ b/mysql-test/main/row-checksum-old.result
@@ -83,3 +83,19 @@ checksum table t1 extended;
Table Checksum
test.t1 452555338
drop table t1;
+#
+# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
+#
+CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
+insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
+# Important is that checksum is different from following
+CHECKSUM TABLE t1 EXTENDED;
+Table Checksum
+test.t1 2514025256
+UPDATE t1 SET c21='cat' WHERE c1=5;
+# Important is that checksum is different from above
+CHECKSUM TABLE t1 EXTENDED;
+Table Checksum
+test.t1 2326430205
+drop table t1;
+# End of 5.5 tests
diff --git a/mysql-test/main/row-checksum.result b/mysql-test/main/row-checksum.result
index f2e687f8b6e..4625e09c060 100644
--- a/mysql-test/main/row-checksum.result
+++ b/mysql-test/main/row-checksum.result
@@ -83,3 +83,19 @@ checksum table t1 extended;
Table Checksum
test.t1 229851577
drop table t1;
+#
+# MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
+#
+CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
+insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
+# Important is that checksum is different from following
+CHECKSUM TABLE t1 EXTENDED;
+Table Checksum
+test.t1 2514025256
+UPDATE t1 SET c21='cat' WHERE c1=5;
+# Important is that checksum is different from above
+CHECKSUM TABLE t1 EXTENDED;
+Table Checksum
+test.t1 2326430205
+drop table t1;
+# End of 5.5 tests
diff --git a/mysql-test/main/row-checksum.test b/mysql-test/main/row-checksum.test
index 82efcf3ef93..5acfda45f75 100644
--- a/mysql-test/main/row-checksum.test
+++ b/mysql-test/main/row-checksum.test
@@ -60,3 +60,20 @@ checksum table t1;
checksum table t1 quick;
checksum table t1 extended;
drop table t1;
+
+--echo #
+--echo # MDEV-17085: CHECKSUM TABLE EXTENDED does not work correctly
+--echo #
+
+CREATE TABLE t1 ( c1 int NOT NULL, c2 int NOT NULL, c4 varchar(20), c5 varchar(20), c6 varchar(20), c7 varchar(20), c8 varchar(20), c9 varchar(20), c10 varchar(20), c11 varchar(20), c12 varchar(20), c13 varchar(20), c14 varchar(20), c15 varchar(20), c16 varchar(20), c19 int NOT NULL, c20 int NOT NULL, c21 varchar(20), c22 VARCHAR(20), c23 varchar(20));
+
+insert into t1 values (5,0,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,0,0,"dog",NULL,NULL);
+--echo # Important is that checksum is different from following
+CHECKSUM TABLE t1 EXTENDED;
+UPDATE t1 SET c21='cat' WHERE c1=5;
+--echo # Important is that checksum is different from above
+CHECKSUM TABLE t1 EXTENDED;
+
+drop table t1;
+
+--echo # End of 5.5 tests
diff --git a/mysql-test/main/subselect2.result b/mysql-test/main/subselect2.result
index 21bf9aad122..0e71f22e52e 100644
--- a/mysql-test/main/subselect2.result
+++ b/mysql-test/main/subselect2.result
@@ -394,3 +394,25 @@ select null in (select a from t1 where a < out3.a union select a from t2 where
(select a from t3) +1 < out3.a+1) from t3 out3;
ERROR 21000: Subquery returns more than 1 row
drop table t1, t2, t3;
+CREATE TABLE t1(
+q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
+q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
+f1 int
+);
+CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
+INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
+INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
+SELECT f1,
+(SELECT t.f21 from t2 t where max(
+q11+q12+q13+q14+q15+q16+q17+q18+q19+
+q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
+SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
+SELECT 1 LIMIT 1) AS test
+FROM t1 GROUP BY f1;
+f1 test
+1 1
+2 1
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '1'
+Warning 1292 Truncated incorrect datetime value: '2'
+DROP TABLE t1,t2;
diff --git a/mysql-test/main/subselect2.test b/mysql-test/main/subselect2.test
index c106d40b095..5f7e5f80626 100644
--- a/mysql-test/main/subselect2.test
+++ b/mysql-test/main/subselect2.test
@@ -411,3 +411,23 @@ insert into t3 select a from t1;
select null in (select a from t1 where a < out3.a union select a from t2 where
(select a from t3) +1 < out3.a+1) from t3 out3;
drop table t1, t2, t3;
+
+#
+# Bug #28499924: INCORRECT BEHAVIOR WITH UNION IN SUBQUERY
+#
+CREATE TABLE t1(
+ q11 int, q12 int, q13 int, q14 int, q15 int, q16 int, q17 int, q18 int, q19 int,
+ q21 int, q22 int, q23 int, q24 int, q25 int, q26 int, q27 int, q28 int, q29 int,
+ f1 int
+);
+CREATE TABLE t2(f2 int, f21 int, f3 timestamp, f4 int, f5 int, f6 int);
+INSERT INTO t1 (f1) VALUES (1),(1),(2),(2);
+INSERT INTO t2 VALUES (1,1,"2004-02-29 11:11:11",0,0,0), (2,2,"2004-02-29 11:11:11",0,0,0);
+SELECT f1,
+ (SELECT t.f21 from t2 t where max(
+ q11+q12+q13+q14+q15+q16+q17+q18+q19+
+ q21+q22+q23+q24+q25+q26+q27+q28+q29) = t.f2 UNION
+ SELECT t.f3 FROM t2 AS t WHERE t1.f1=t.f2 AND t.f3=MAX(t1.f1) UNION
+ SELECT 1 LIMIT 1) AS test
+ FROM t1 GROUP BY f1;
+DROP TABLE t1,t2;
diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result
index 0fc2dd74534..482833dc967 100644
--- a/mysql-test/main/subselect_mat.result
+++ b/mysql-test/main/subselect_mat.result
@@ -2898,6 +2898,22 @@ SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
f
DROP TABLE t1, t2;
#
+# MDEV-18255: Server crashes in Bitmap<64u>::intersect
+#
+create table t1 (v1 varchar(1)) engine=myisam ;
+create table t2 (v1 varchar(1)) engine=myisam ;
+explain
+select 1 from t1 where exists
+(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE
+2 SUBQUERY NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+3 MATERIALIZED NULL NULL NULL NULL NULL NULL NULL no matching row in const table
+select 1 from t1 where exists
+(select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
+1
+drop table t1,t2;
+#
# MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
# UNION ALL
#
diff --git a/mysql-test/main/subselect_mat.test b/mysql-test/main/subselect_mat.test
index 7055b323906..fc43d19ae11 100644
--- a/mysql-test/main/subselect_mat.test
+++ b/mysql-test/main/subselect_mat.test
@@ -269,6 +269,19 @@ SELECT * FROM t2 WHERE f IN ( SELECT LEFT('foo',0) FROM t1 ORDER BY 1 );
DROP TABLE t1, t2;
--echo #
+--echo # MDEV-18255: Server crashes in Bitmap<64u>::intersect
+--echo #
+create table t1 (v1 varchar(1)) engine=myisam ;
+create table t2 (v1 varchar(1)) engine=myisam ;
+
+explain
+select 1 from t1 where exists
+ (select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
+select 1 from t1 where exists
+ (select 1 from t1 where t1.v1 in (select t2.v1 from t2 having t2.v1 < 'j')) ;
+drop table t1,t2;
+
+--echo #
--echo # MDEV-9489: Assertion `0' failed in Protocol::end_statement() on
--echo # UNION ALL
--echo #
diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result
index e4583cf6348..73f682755da 100644
--- a/mysql-test/main/subselect_sj2_mat.result
+++ b/mysql-test/main/subselect_sj2_mat.result
@@ -1734,6 +1734,10 @@ insert into t1(`id`,`local_name`) values
(11,'Rollover - Internet Payday'),
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
+ANALYZE TABLE t1;
+Table Op Msg_type Msg_text
+test.t1 analyze status Engine-independent statistics collected
+test.t1 analyze status OK
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --git a/mysql-test/main/subselect_sj2_mat.test b/mysql-test/main/subselect_sj2_mat.test
index 91057f0b201..6eeaceb82b0 100644
--- a/mysql-test/main/subselect_sj2_mat.test
+++ b/mysql-test/main/subselect_sj2_mat.test
@@ -335,6 +335,8 @@ insert into t1(`id`,`local_name`) values
(12,'AL Monthly Installment'),
(13,'AL Semi-Monthly Installment');
+ANALYZE TABLE t1;
+
explain
SELECT SQL_NO_CACHE t.id
FROM t1 t
diff --git a/mysql-test/suite/archive/partition_archive.result b/mysql-test/suite/archive/partition_archive.result
index a2e0fe7420f..41be0b31bce 100644
--- a/mysql-test/suite/archive/partition_archive.result
+++ b/mysql-test/suite/archive/partition_archive.result
@@ -30,7 +30,7 @@ partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
insert into t1 values (1), (2);
create index inx on t1 (a);
-ERROR HY000: Can't create table `db99`.`#sql-temporary` (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `db99`.`t1` (errno: 140 "Wrong create options")
alter table t1 add partition (partition p2 values in (3));
alter table t1 drop partition p2;
use test;
@@ -141,7 +141,7 @@ t1 CREATE TABLE `t1` (
PARTITION BY HASH (`fld1`)
PARTITIONS 5
ALTER TABLE t1 ENGINE= ARCHIVE;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t1` (errno: 140 "Wrong create options")
#After the patch, the ENGINE is correctly displayed as MyISAM
SHOW CREATE TABLE t1;
Table Create Table
diff --git a/mysql-test/suite/archive/partition_archive.test b/mysql-test/suite/archive/partition_archive.test
index aa2adb7e44d..dff6ec598d0 100644
--- a/mysql-test/suite/archive/partition_archive.test
+++ b/mysql-test/suite/archive/partition_archive.test
@@ -47,7 +47,7 @@ engine=archive
partition by list (a)
(partition p0 values in (1), partition p1 values in (2));
insert into t1 values (1), (2);
---replace_regex /#sql-[0-9a-f_]+/#sql-temporary/ /Not owner/Operation not permitted/
+--replace_regex /Not owner/Operation not permitted/
--error ER_CANT_CREATE_TABLE
create index inx on t1 (a);
alter table t1 add partition (partition p2 values in (3));
@@ -138,7 +138,6 @@ CREATE TABLE t1 (fld1 INT PRIMARY KEY) ENGINE= MYISAM PARTITION BY HASH(fld1)
PARTITIONS 5;
SHOW CREATE TABLE t1;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ENGINE= ARCHIVE;
diff --git a/mysql-test/suite/binlog/r/binlog_base64_flag.result b/mysql-test/suite/binlog/r/binlog_base64_flag.result
index 66cee19f13f..5e52ea54251 100644
--- a/mysql-test/suite/binlog/r/binlog_base64_flag.result
+++ b/mysql-test/suite/binlog/r/binlog_base64_flag.result
@@ -28,6 +28,25 @@ a
1
1
3
+DELETE FROM t1 WHERE a=3;
+BINLOG '
+ODdYRw8BAAAAZgAAAGoAAAABAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAA4N1hHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
+';
+SET @binlog_fragment_0='
+TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
+TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
+';
+SET @binlog_fragment_1='';
+BINLOG @binlog_fragment_0, @binlog_fragment_1;
+select * from t1;
+a
+1
+1
+3
+SELECT @binlog_fragment_0, @binlog_fragment_1 as 'NULL','NULL';
+@binlog_fragment_0 NULL NULL
+NULL NULL NULL
==== Test --base64-output=never on a binlog with row events ====
/*!50530 SET @@SESSION.PSEUDO_SLAVE_MODE=1*/;
/*!40019 SET @@session.max_insert_delayed_threads=0*/;
diff --git a/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
new file mode 100644
index 00000000000..5f685dfa785
--- /dev/null
+++ b/mysql-test/suite/binlog/r/binlog_mysqlbinlog_row_frag.result
@@ -0,0 +1,24 @@
+CREATE TABLE t (a TEXT);
+RESET MASTER;
+INSERT INTO t SET a=repeat('a', 1024);
+SELECT a into @a from t;
+FLUSH LOGS;
+DELETE FROM t;
+FOUND 1 /BINLOG @binlog_fragment_0, @binlog_fragment_1/ in mysqlbinlog.sql
+SELECT a LIKE @a as 'true' FROM t;
+true
+1
+BINLOG number-of-fragments must be exactly two
+BINLOG @binlog_fragment;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '' at line 1
+BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ' @binlog_fragment' at line 1
+SET @binlog_fragment_0='012345';
+SET @binlog_fragment_1='012345';
+BINLOG @binlog_fragment_0, @binlog_fragment_1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
+SET @binlog_fragment_0='012345';
+BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+ERROR 42000: Incorrect argument type to variable 'binlog_fragment_not_exist'
+# Cleanup
+DROP TABLE t;
diff --git a/mysql-test/suite/binlog/t/binlog_base64_flag.test b/mysql-test/suite/binlog/t/binlog_base64_flag.test
index f17b51166e9..e1187cd895c 100644
--- a/mysql-test/suite/binlog/t/binlog_base64_flag.test
+++ b/mysql-test/suite/binlog/t/binlog_base64_flag.test
@@ -67,6 +67,28 @@ TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
# The above line should succeed and 3 should be in the table
select * from t1;
+# The same as above with one-fragment BINLOG to prove
+# equivalency with the fragmented BINLOG @frag_0, @frag_1.
+DELETE FROM t1 WHERE a=3;
+# This is a binlog statement containing a Format_description_log_event
+# from the same version as the Table_map and Write_rows_log_event.
+BINLOG '
+ODdYRw8BAAAAZgAAAGoAAAABAAQANS4xLjIzLXJjLWRlYnVnLWxvZwAAAAAAAAAAAAAAAAAAAAAA
+AAAAAAAAAAAAAAAAAAA4N1hHEzgNAAgAEgAEBAQEEgAAUwAEGggAAAAICAgC
+';
+
+# This is a Table_map_log_event+Write_rows_log_event corresponding to:
+# INSERT INTO TABLE test.t1 VALUES (3)
+SET @binlog_fragment_0='
+TFtYRxMBAAAAKQAAAH8BAAAAABAAAAAAAAAABHRlc3QAAnQxAAEDAAE=
+TFtYRxcBAAAAIgAAAKEBAAAQABAAAAAAAAEAAf/+AwAAAA==
+';
+SET @binlog_fragment_1='';
+BINLOG @binlog_fragment_0, @binlog_fragment_1;
+# The above line should succeed and 3 should be in the table:
+select * from t1;
+# show "one-shot" feature of binlog_fragment variables
+SELECT @binlog_fragment_0, @binlog_fragment_1 as 'NULL','NULL';
# New mysqlbinlog supports --base64-output=never
--echo ==== Test --base64-output=never on a binlog with row events ====
diff --git a/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
new file mode 100644
index 00000000000..6765b26f3da
--- /dev/null
+++ b/mysql-test/suite/binlog/t/binlog_mysqlbinlog_row_frag.test
@@ -0,0 +1,46 @@
+--source include/have_debug.inc
+--source include/have_binlog_format_row.inc
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+CREATE TABLE t (a TEXT);
+# events of interest are guaranteed to stay in 000001 log
+RESET MASTER;
+--eval INSERT INTO t SET a=repeat('a', 1024)
+SELECT a into @a from t;
+FLUSH LOGS;
+DELETE FROM t;
+
+# Todo: MDEV-10362 to test multi-row Rows_log_event:s in verbose mode
+--exec $MYSQL_BINLOG -vv --debug-binlog-row-event-max-encoded-size=256 $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+--let SEARCH_PATTERN= BINLOG @binlog_fragment_0, @binlog_fragment_1
+--let SEARCH_FILE= $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+--source include/search_pattern_in_file.inc
+
+--exec $MYSQL test < $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+
+SELECT a LIKE @a as 'true' FROM t;
+
+# improper syntax error
+--echo BINLOG number-of-fragments must be exactly two
+--error ER_PARSE_ERROR
+BINLOG @binlog_fragment;
+--error ER_PARSE_ERROR
+BINLOG @binlog_fragment, @binlog_fragment, @binlog_fragment;
+
+# corrupted fragments error check (to the expected error code notice,
+# the same error code occurs in a similar unfragmented case)
+SET @binlog_fragment_0='012345';
+SET @binlog_fragment_1='012345';
+--error ER_SYNTAX_ERROR
+BINLOG @binlog_fragment_0, @binlog_fragment_1;
+
+# Not existing fragment is not allowed
+SET @binlog_fragment_0='012345';
+--error ER_WRONG_TYPE_FOR_VAR
+BINLOG @binlog_fragment_0, @binlog_fragment_not_exist;
+
+--echo # Cleanup
+--remove_file $MYSQLTEST_VARDIR/tmp/mysqlbinlog.sql
+DROP TABLE t;
diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
index 995360a5744..2c6372e1c61 100644
--- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result
+++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result
@@ -65,11 +65,11 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
CREATE TABLE t2 (a int not null primary key) engine=innodb;
ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+ERROR HY000: Can't create table `test`.`t2` (errno: 140 "Wrong create options")
SHOW WARNINGS;
Level Code Message
Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
+Error 1005 Can't create table `test`.`t2` (errno: 140 "Wrong create options")
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
SHOW CREATE TABLE t2;
Table Create Table
diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
index a6a4dbaff9b..bc7c3b3f13d 100644
--- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test
+++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test
@@ -92,10 +92,8 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
CREATE TABLE t2 (a int not null primary key) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
SHOW WARNINGS;
SHOW CREATE TABLE t2;
diff --git a/mysql-test/suite/encryption/t/innodb-spatial-index.test b/mysql-test/suite/encryption/t/innodb-spatial-index.test
index a50ef306351..0465225cd4f 100644
--- a/mysql-test/suite/encryption/t/innodb-spatial-index.test
+++ b/mysql-test/suite/encryption/t/innodb-spatial-index.test
@@ -20,7 +20,6 @@ if ($checksum_algorithm == "strict_full_crc32")
let $error_code = 0;
}
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error $error_code
CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL, SPATIAL index(coordinate)) ENGINE=INNODB
@@ -49,7 +48,6 @@ CREATE TABLE t1 (pk INT PRIMARY KEY AUTO_INCREMENT,
c VARCHAR(256), coordinate POINT NOT NULL) ENCRYPTED=YES ENGINE=INNODB;
# FIXME: MDEV-13851 Encrypted table refuses some form of ALGORITHM=COPY,
# but allows rebuild by FORCE
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error $error_code
ALTER TABLE t1 ADD SPATIAL INDEX b1(coordinate), ALGORITHM=COPY;
--error $error_code
diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
index 02d2867b657..ec375e9c5f6 100644
--- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result
+++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result
@@ -197,7 +197,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser2, localhost, testuser2, , db_datadict;
SELECT * FROM information_schema.routines;
@@ -209,7 +209,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connect testuser3, localhost, testuser3, , test;
SELECT * FROM information_schema.routines;
@@ -221,7 +221,7 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL
SELECT * FROM db_datadict_2.res_6_408002_2;
END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci
add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
-check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
+check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci
connection default;
disconnect testuser1;
diff --git a/mysql-test/suite/galera/r/galera_defaults.result b/mysql-test/suite/galera/r/galera_defaults.result
index d0eb22ffcbc..6dd5258ff6d 100644
--- a/mysql-test/suite/galera/r/galera_defaults.result
+++ b/mysql-test/suite/galera/r/galera_defaults.result
@@ -2,7 +2,7 @@ connection node_2;
connection node_1;
SELECT COUNT(*) `expect 48` FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'wsrep_%';
expect 48
-48
+49
SELECT VARIABLE_NAME, VARIABLE_VALUE
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
WHERE VARIABLE_NAME LIKE 'wsrep_%'
@@ -21,6 +21,7 @@ ORDER BY VARIABLE_NAME;
VARIABLE_NAME VARIABLE_VALUE
WSREP_AUTO_INCREMENT_CONTROL ON
WSREP_CAUSAL_READS ON
+WSREP_CERTIFICATION_RULES strict
WSREP_CERTIFY_NONPK ON
WSREP_CLUSTER_ADDRESS gcomm://
WSREP_CLUSTER_NAME my_wsrep_cluster
diff --git a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
index 7aac1662edd..a0c7e64af91 100644
--- a/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_2x3nodes.cnf
@@ -9,6 +9,7 @@ innodb-autoinc-lock-mode=2
default-storage-engine=innodb
wsrep_gtid_mode=1
gtid_ignore_duplicates
+auto_increment_increment=3
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
diff --git a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
index ab7493e313b..d33ed0caddf 100644
--- a/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
+++ b/mysql-test/suite/galera_3nodes/galera_3nodes.cnf
@@ -5,6 +5,7 @@
binlog-format=row
innodb-autoinc-lock-mode=2
default-storage-engine=innodb
+auto_increment_increment=3
wsrep-provider=@ENV.WSREP_PROVIDER
wsrep_node_address=127.0.0.1
diff --git a/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc b/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc
deleted file mode 100644
index 0dd693f2c63..00000000000
--- a/mysql-test/suite/galera_3nodes/include/have_mariabackup.inc
+++ /dev/null
@@ -1,4 +0,0 @@
-#
-# suite.pm will make sure that all tests including this file
-# will be skipped as needed
-#
diff --git a/mysql-test/suite/galera_3nodes/r/galera_garbd.result b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
index 88bb3ca2ff9..ebc5fdf33f4 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_garbd.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_garbd.result
@@ -2,9 +2,11 @@ connection node_2;
connection node_1;
connection node_1;
connection node_2;
-connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
+connection node_1;
+connection node_2;
connection node_3;
Killing node #3 to free ports for garbd ...
+connection node_3;
connection node_1;
Starting garbd ...
CREATE TABLE t1 (f1 INTEGER);
diff --git a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
index 8e6d27823f6..cb327107e2a 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_var_dirty_reads2.result
@@ -1,5 +1,9 @@
connection node_2;
connection node_1;
+connection node_1;
+connection node_2;
+connection node_3;
+connection node_1;
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
connection node_2;
diff --git a/mysql-test/suite/galera_3nodes/suite.pm b/mysql-test/suite/galera_3nodes/suite.pm
index 9882793cb20..5ed5cbd95db 100644
--- a/mysql-test/suite/galera_3nodes/suite.pm
+++ b/mysql-test/suite/galera_3nodes/suite.pm
@@ -50,9 +50,12 @@ push @::global_suppressions,
qr(WSREP: There are no nodes in the same segment that will ever be able to become donors, yet there is a suitable donor outside. Will use that one.),
qr(WSREP: evs::proto.*),
qr|WSREP: Ignoring possible split-brain \(allowed by configuration\) from view:.*|,
+ qr(WSREP: no nodes coming from prim view, prim not possible),
qr(WSREP: Member .* requested state transfer from .* but it is impossible to select State Transfer donor: Resource temporarily unavailable),
+ qr(WSREP: user message in state LEAVING),
qr(WSREP: .* sending install message failed: Transport endpoint is not connected),
qr(WSREP: .* sending install message failed: Resource temporarily unavailable),
+ qr(WSREP: Sending JOIN failed: -107 \(Transport endpoint is not connected\). Will retry in new primary component.),
qr(WSREP: Could not find peer:),
qr|WSREP: gcs_caused\(\) returned .*|,
qr|WSREP: Protocol violation. JOIN message sender .* is not in state transfer \(SYNCED\). Message ignored.|,
@@ -78,11 +81,11 @@ sub skip_combinations {
my %skip = ();
$skip{'include/have_filekeymanagement.inc'} = 'needs file_key_management plugin'
unless $ENV{FILE_KEY_MANAGEMENT_SO};
- $skip{'include/have_mariabackup.inc'} = 'Need mariabackup'
+ $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need mariabackup'
unless which(mariabackup);
- $skip{'include/have_mariabackup.inc'} = 'Need ss'
+ $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need ss'
unless which(ss);
- $skip{'include/have_mariabackup.inc'} = 'Need socat or nc'
+ $skip{'suite/galera/include/have_mariabackup.inc'} = 'Need socat or nc'
unless $ENV{MTR_GALERA_TFMT};
%skip;
}
diff --git a/mysql-test/suite/galera_3nodes/t/galera_garbd.test b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
index 68e288c06c7..aaa9ecc8083 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_garbd.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_garbd.test
@@ -16,12 +16,22 @@
--source suite/galera/include/galera_base_port.inc
--let $NODE_GALERAPORT_2 = $_NODE_GALERAPORT
---connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
--source suite/galera/include/galera_base_port.inc
--let $NODE_GALERAPORT_3 = $_NODE_GALERAPORT
---connection node_3
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
--echo Killing node #3 to free ports for garbd ...
+--connection node_3
+--let $gp3 = `SELECT SUBSTR(@@wsrep_provider_options, LOCATE('base_port =', @@wsrep_provider_options) + LENGTH('base_port = '))`
+--let $galera_port_3 = `SELECT SUBSTR('$gp3', 1, LOCATE(';', '$gp3') - 1)`
--source include/shutdown_mysqld.inc
--connection node_1
@@ -91,6 +101,8 @@ DROP TABLE t1;
--connection node_3
--source include/start_mysqld.inc
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
# Workaround for galera#101
diff --git a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
index 2abb67421c8..71d17c133a5 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_ipv6_mariabackup.test
@@ -1,6 +1,6 @@
--source include/galera_cluster.inc
--source include/check_ipv6.inc
---source include/have_mariabackup.inc
+--source suite/galera/include/have_mariabackup.inc
# Confirm that initial handshake happened over ipv6
diff --git a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
index 2ceda1ed352..9f9d6da17b9 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_var_dirty_reads2.test
@@ -5,6 +5,17 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+--let $galera_connection_name = node_3
+--let $galera_server_number = 3
+--source include/galera_connect.inc
+
+# Save original auto_increment_offset values.
+--let $node_1=node_1
+--let $node_2=node_2
+--let $node_3=node_3
+--source ../galera/include/auto_increment_offset_save.inc
+
+--connection node_1
CREATE TABLE t1 (f1 INTEGER);
INSERT INTO t1 VALUES (1);
@@ -111,3 +122,6 @@ SET GLOBAL wsrep_provider_options='gmcast.isolate=0';
--source include/galera_wait_ready.inc
DROP TABLE t1;
+
+# Restore original auto_increment_offset values.
+--source ../galera/include/auto_increment_offset_restore.inc
diff --git a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
index ac70701e2cc..28c854c44f4 100644
--- a/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
+++ b/mysql-test/suite/gcol/inc/gcol_column_def_options.inc
@@ -150,7 +150,6 @@ create table t2 (a int);
alter table t1 add constraint foreign key fk(d) references t2(a);
if ($support_virtual_foreign)
{
---replace_regex /`#sql-.*`/`#sql-temporary`/
--error ER_CANT_CREATE_TABLE
alter table t1 add constraint foreign key fk(b) references t2(a);
}
diff --git a/mysql-test/suite/gcol/inc/gcol_keys.inc b/mysql-test/suite/gcol/inc/gcol_keys.inc
index a16d425ed24..97c9e41b5e8 100644
--- a/mysql-test/suite/gcol/inc/gcol_keys.inc
+++ b/mysql-test/suite/gcol/inc/gcol_keys.inc
@@ -156,7 +156,6 @@ create table t1 (a int, b int generated always as (a+1) virtual,
foreign key (b) references t2(a));
create table t1 (a int, b int generated always as (a+1) virtual);
---replace_regex /`#sql-.*`/`#sql-temporary`/
--error ER_CANT_CREATE_TABLE
alter table t1 add foreign key (b) references t2(a);
drop table t1;
diff --git a/mysql-test/suite/gcol/r/gcol_keys_innodb.result b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
index 2ea0a256df7..a1cc26a8f06 100644
--- a/mysql-test/suite/gcol/r/gcol_keys_innodb.result
+++ b/mysql-test/suite/gcol/r/gcol_keys_innodb.result
@@ -153,7 +153,7 @@ foreign key (b) references t2(a));
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
create table t1 (a int, b int generated always as (a+1) virtual);
alter table t1 add foreign key (b) references t2(a);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
drop table t1;
# Allowed FK options.
create table t2 (a int primary key, b char(5));
diff --git a/mysql-test/suite/gcol/r/innodb_virtual_fk.result b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
index 732fa7c3f57..d5b4755e3c5 100644
--- a/mysql-test/suite/gcol/r/innodb_virtual_fk.result
+++ b/mysql-test/suite/gcol/r/innodb_virtual_fk.result
@@ -702,7 +702,7 @@ v3 TIME AS (c3) VIRTUAL,
v4 CHAR(10) AS (c4) VIRTUAL
) ENGINE=InnoDB;
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
SET foreign_key_checks=0;
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk' in the foreign table 't1'
@@ -725,7 +725,7 @@ t1 CREATE TABLE `t1` (
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE t1 DROP FOREIGN KEY fk;
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
diff --git a/mysql-test/suite/gcol/t/innodb_virtual_fk.test b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
index 92776aa407d..c484bb5dc0c 100644
--- a/mysql-test/suite/gcol/t/innodb_virtual_fk.test
+++ b/mysql-test/suite/gcol/t/innodb_virtual_fk.test
@@ -590,7 +590,6 @@ CREATE TABLE t1 (
v3 TIME AS (c3) VIRTUAL,
v4 CHAR(10) AS (c4) VIRTUAL
) ENGINE=InnoDB;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
SET foreign_key_checks=0;
@@ -601,7 +600,6 @@ ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
SET foreign_key_checks=1;
SHOW CREATE TABLE t1;
ALTER TABLE t1 DROP FOREIGN KEY fk;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t1 ADD CONSTRAINT fk FOREIGN KEY (v4) REFERENCES nosuch(col);
SHOW CREATE TABLE t1;
diff --git a/mysql-test/suite/innodb/r/add_constraint.result b/mysql-test/suite/innodb/r/add_constraint.result
index 798e87a3761..9d894e530c3 100644
--- a/mysql-test/suite/innodb/r/add_constraint.result
+++ b/mysql-test/suite/innodb/r/add_constraint.result
@@ -6,7 +6,7 @@ create table t2(a int, b int, key(a),key(b))engine=innodb;
alter table t2 add constraint b foreign key (b) references t1(a);
alter table t1 add constraint b1 foreign key (b) references t2(a);
alter table t2 add constraint b1 foreign key (b) references t1(a);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
alter table t2 drop foreign key b;
alter table t1 drop foreign key b1;
drop table t2;
diff --git a/mysql-test/suite/innodb/r/alter_foreign_crash.result b/mysql-test/suite/innodb/r/alter_foreign_crash.result
index 66ffb5f5411..34577ecf0fd 100644
--- a/mysql-test/suite/innodb/r/alter_foreign_crash.result
+++ b/mysql-test/suite/innodb/r/alter_foreign_crash.result
@@ -21,6 +21,6 @@ Tables_in_bug
parent
alter table parent row_format=dynamic;
Warnings:
-Warning 1088 InnoDB: Could not add foreign key constraints.
+Warning 1088 failed to load FOREIGN KEY constraints
drop table parent;
drop database bug;
diff --git a/mysql-test/suite/innodb/r/alter_varchar_change.result b/mysql-test/suite/innodb/r/alter_varchar_change.result
index ce729fe5612..ddf0449a040 100644
--- a/mysql-test/suite/innodb/r/alter_varchar_change.result
+++ b/mysql-test/suite/innodb/r/alter_varchar_change.result
@@ -491,3 +491,12 @@ t1 CREATE TABLE `t1` (
DROP TABLE t1;
DROP PROCEDURE get_index_id;
DROP PROCEDURE get_table_id;
+create table t (a varchar(100)) engine=innodb;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+name pos mtype prtype len
+a 0 1 524303 100
+alter table t modify a varchar(110), algorithm=inplace;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+name pos mtype prtype len
+a 0 1 524303 110
+drop table t;
diff --git a/mysql-test/suite/innodb/r/foreign_key.result b/mysql-test/suite/innodb/r/foreign_key.result
index 7195f3e7c3f..a6322284923 100644
--- a/mysql-test/suite/innodb/r/foreign_key.result
+++ b/mysql-test/suite/innodb/r/foreign_key.result
@@ -10,7 +10,7 @@ ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint
create table t2 (f1 int primary key,
constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
alter table t2 add constraint c1 foreign key (f1) references t1(f1);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+ERROR HY000: Can't create table `test`.`t2` (errno: 121 "Duplicate key on write or update")
set foreign_key_checks = 0;
alter table t2 add constraint c1 foreign key (f1) references t1(f1);
ERROR HY000: Duplicate FOREIGN KEY constraint name 'test/c1'
@@ -206,6 +206,61 @@ connection default;
ERROR 70100: Query execution was interrupted
disconnect fk;
DROP TABLE t3,t1;
+#
+# MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
+# or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
+#
+CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
+ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a b TIME;
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+DROP TABLE t1;
+#
+# MDEV-18256 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
+# upon DROP FOREIGN KEY
+#
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
+ENGINE=InnoDB;
+ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
+DROP TABLE t2, t1;
+CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
+Warnings:
+Warning 1088 failed to load FOREIGN KEY constraints
+ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
+Warnings:
+Warning 1088 failed to load FOREIGN KEY constraints
+DROP TABLE t1;
+CREATE TABLE t1 (f VARCHAR(256), FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY)
+ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
+Warnings:
+Warning 1088 failed to load FOREIGN KEY constraints
+ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
+DROP TABLE t1;
+#
+# MDEV-18630 Conditional jump or move depends on uninitialised value
+# in ib_push_warning / dict_create_foreign_constraints_low
+#
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b);
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+SHOW WARNINGS;
+Level Code Message
+Warning 150 Alter table test/#sql-temporary with foreign key constraint failed. Referenced table `test`.`t2` not found in the data dictionary near 'FOREIGN KEY (a) REFERENCES t2 (b)'.
+Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t1`
+DROP TABLE t1;
# Start of 10.2 tests
#
# MDEV-13246 Stale rows despite ON DELETE CASCADE constraint
diff --git a/mysql-test/suite/innodb/r/innodb-fk-warnings.result b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
index fc3f45f3d0a..0832e6ae9ff 100644
--- a/mysql-test/suite/innodb/r/innodb-fk-warnings.result
+++ b/mysql-test/suite/innodb/r/innodb-fk-warnings.result
@@ -39,21 +39,21 @@ Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is
Warning 1215 Cannot add foreign key constraint for `t2`
create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
alter table t2 add constraint b foreign key (b) references t2(b);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table '`test`.`t2`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near ' foreign key (b) references t2(b)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t2`
drop table t2, t1;
create table t1 (f1 integer primary key) engine=innodb;
alter table t1 add constraint c1 foreign key (f1) references t11(f1);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. Referenced table `test`.`t11` not found in the data dictionary near ' foreign key (f1) references t11(f1)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t1`
drop table t1;
create temporary table t1(a int not null primary key, b int, key(b)) engine=innodb;
create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
@@ -78,12 +78,12 @@ Warning 150 Create table `mysqld.1`.`t2` with foreign key constraint failed. Re
Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
Warning 1215 Cannot add foreign key constraint for `t2`
alter table t1 add foreign key(b) references t1(a);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary near 'foreign key(b) references t1(a)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t1`
drop table t1;
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
alter table t1 add foreign key(a,b) references t1(a);
@@ -101,12 +101,12 @@ Error 1239 Incorrect foreign key definition for 'foreign key without name': Key
drop table t1;
create table t1 (f1 integer not null primary key) engine=innodb;
alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t1` with foreign key constraint failed. You have defined a SET NULL condition but column 'f1' is defined as NOT NULL in ' foreign key (f1) references t1(f1) on update set null' near ' on update set null'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t1`
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
diff --git a/mysql-test/suite/innodb/r/innodb-fk.result b/mysql-test/suite/innodb/r/innodb-fk.result
index 4efa0214999..0a269bad828 100644
--- a/mysql-test/suite/innodb/r/innodb-fk.result
+++ b/mysql-test/suite/innodb/r/innodb-fk.result
@@ -62,12 +62,12 @@ PRIMARY KEY (`id`),
CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE
) ENGINE=InnoDB;
ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table `test`.`t2` with foreign key constraint failed. Referenced table `test`.`t3` not found in the data dictionary near ' FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `t2`
drop table t2;
drop table t1;
CREATE DATABASE kg_test1;
diff --git a/mysql-test/suite/innodb/r/innodb-index-online.result b/mysql-test/suite/innodb/r/innodb-index-online.result
index 07b2c0dfaac..86c9dd4fbbe 100644
--- a/mysql-test/suite/innodb/r/innodb-index-online.result
+++ b/mysql-test/suite/innodb/r/innodb-index-online.result
@@ -518,7 +518,7 @@ SET DEBUG_SYNC = 'RESET';
disconnect con1;
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
DROP TABLE t2,t1;
SET GLOBAL innodb_file_per_table = @global_innodb_file_per_table_orig;
SET GLOBAL innodb_monitor_enable = default;
diff --git a/mysql-test/suite/innodb/r/innodb-index.result b/mysql-test/suite/innodb/r/innodb-index.result
index 09e4da28564..e537d9c4ddc 100644
--- a/mysql-test/suite/innodb/r/innodb-index.result
+++ b/mysql-test/suite/innodb/r/innodb-index.result
@@ -508,7 +508,7 @@ t4 CREATE TABLE `t4` (
CONSTRAINT `dc` FOREIGN KEY (`a`) REFERENCES `t1` (`a`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
alter table t3 add constraint dc foreign key (a) references t1(a);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 121 "Duplicate key on write or update")
+ERROR HY000: Can't create table `test`.`t3` (errno: 121 "Duplicate key on write or update")
SET FOREIGN_KEY_CHECKS=0;
alter table t3 add constraint dc foreign key (a) references t1(a);
ERROR HY000: Failed to add the foreign key constraint 'test/dc' to system tables
@@ -955,13 +955,13 @@ PRIMARY KEY (c1)
SET FOREIGN_KEY_CHECKS=0;
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1), ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
@@ -970,13 +970,13 @@ FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=INPLACE;
ERROR HY000: Failed to add the foreign key constraint on table 't2'. Incorrect options in FOREIGN KEY constraint 'test/fk_t2_ca'
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
affected rows: 0
info: Records: 0 Duplicates: 0 Warnings: 0
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2), ALGORITHM=COPY;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t2` (errno: 150 "Foreign key constraint is incorrectly formed")
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c2);
ERROR HY000: Failed to add the foreign key constaint. Missing index for constraint 'fk_t2_ca' in the referenced table 't1'
diff --git a/mysql-test/suite/innodb/r/innodb_force_recovery.result b/mysql-test/suite/innodb/r/innodb_force_recovery.result
index bd533207ad2..0220f68a626 100644
--- a/mysql-test/suite/innodb/r/innodb_force_recovery.result
+++ b/mysql-test/suite/innodb/r/innodb_force_recovery.result
@@ -10,11 +10,11 @@ f1 f2
insert into t1 values(2, 3);
ERROR HY000: Running in read-only mode
alter table t1 add f3 int not null, algorithm=copy;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
alter table t1 add f3 int not null, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
drop index idx on t1;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+ERROR HY000: Can't create table `test`.`t1` (errno: 165 "Table is read only")
alter table t1 drop index idx, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
update t1 set f1=3 where f2=2;
@@ -38,11 +38,11 @@ f1 f2
insert into t2 values(2, 3);
ERROR HY000: Running in read-only mode
alter table t2 add f3 int not null, algorithm=copy;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only")
alter table t2 add f3 int not null, algorithm=inplace;
ERROR 0A000: ALGORITHM=INPLACE is not supported. Reason: Running in read-only mode. Try ALGORITHM=COPY
drop index idx on t2;
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 165 "Table is read only")
+ERROR HY000: Can't create table `test`.`t2` (errno: 165 "Table is read only")
update t2 set f1=3 where f2=2;
ERROR HY000: Running in read-only mode
create table t1(f1 int not null)engine=innodb;
diff --git a/mysql-test/suite/innodb/r/instant_varchar_enlarge.result b/mysql-test/suite/innodb/r/instant_varchar_enlarge.result
deleted file mode 100644
index 14f16bd4fe2..00000000000
--- a/mysql-test/suite/innodb/r/instant_varchar_enlarge.result
+++ /dev/null
@@ -1,9 +0,0 @@
-create table t (a varchar(100)) engine=innodb;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
-name pos mtype prtype len
-a 0 1 524303 100
-alter table t modify a varchar(110), algorithm=inplace;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
-name pos mtype prtype len
-a 0 1 524303 110
-drop table t;
diff --git a/mysql-test/suite/innodb/r/undo_truncate_recover.result b/mysql-test/suite/innodb/r/undo_truncate_recover.result
index 018ac65537a..8ab41331950 100644
--- a/mysql-test/suite/innodb/r/undo_truncate_recover.result
+++ b/mysql-test/suite/innodb/r/undo_truncate_recover.result
@@ -9,6 +9,7 @@ update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
set global debug_dbug = '+d,ib_undo_trunc';
commit;
+call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
SET GLOBAL innodb_fast_shutdown=0;
FOUND 1 /ib_undo_trunc/ in mysqld.1.err
drop table t1;
diff --git a/mysql-test/suite/innodb/t/add_constraint.test b/mysql-test/suite/innodb/t/add_constraint.test
index 7e86a7e5f97..f43f2977020 100644
--- a/mysql-test/suite/innodb/t/add_constraint.test
+++ b/mysql-test/suite/innodb/t/add_constraint.test
@@ -10,7 +10,6 @@ create table t2(a int, b int, key(a),key(b))engine=innodb;
alter table t2 add constraint b foreign key (b) references t1(a);
alter table t1 add constraint b1 foreign key (b) references t2(a);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t2 add constraint b1 foreign key (b) references t1(a);
diff --git a/mysql-test/suite/innodb/t/alter_varchar_change.test b/mysql-test/suite/innodb/t/alter_varchar_change.test
index 9769c63ac5e..65dc38a3411 100644
--- a/mysql-test/suite/innodb/t/alter_varchar_change.test
+++ b/mysql-test/suite/innodb/t/alter_varchar_change.test
@@ -358,3 +358,10 @@ DROP TABLE t1;
DROP PROCEDURE get_index_id;
DROP PROCEDURE get_table_id;
+
+# LEN must increase here
+create table t (a varchar(100)) engine=innodb;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+alter table t modify a varchar(110), algorithm=inplace;
+select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
+drop table t;
diff --git a/mysql-test/suite/innodb/t/foreign_key.test b/mysql-test/suite/innodb/t/foreign_key.test
index 6e8658c4e3e..4330f807d69 100644
--- a/mysql-test/suite/innodb/t/foreign_key.test
+++ b/mysql-test/suite/innodb/t/foreign_key.test
@@ -14,7 +14,6 @@ constraint c1 foreign key (f1) references t1(f1)) engine=InnoDB;
create table t2 (f1 int primary key,
constraint c1 foreign key (f1) references t1(f1)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t2 add constraint c1 foreign key (f1) references t1(f1);
@@ -191,6 +190,57 @@ disconnect fk;
DROP TABLE t3,t1;
+--echo #
+--echo # MDEV-18222 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
+--echo # or ASAN heap-use-after-free in dict_foreign_remove_from_cache upon CHANGE COLUMN
+--echo #
+CREATE TABLE t1 (a INT, UNIQUE(a), KEY(a)) ENGINE=InnoDB;
+ALTER TABLE t1 ADD FOREIGN KEY (a) REFERENCES t1 (a);
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 CHANGE COLUMN a a TIME NOT NULL;
+ALTER TABLE t1 ADD pk INT NOT NULL AUTO_INCREMENT PRIMARY KEY;
+ALTER TABLE t1 CHANGE COLUMN a b TIME;
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18256 InnoDB: Failing assertion: heap->magic_n == MEM_BLOCK_MAGIC_N
+--echo # upon DROP FOREIGN KEY
+--echo #
+CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB;
+CREATE TABLE t2 (b INT PRIMARY KEY, FOREIGN KEY fk1 (b) REFERENCES t1 (a))
+ENGINE=InnoDB;
+ALTER TABLE t2 DROP FOREIGN KEY fk1, DROP FOREIGN KEY fk1;
+DROP TABLE t2, t1;
+
+CREATE TABLE t1 (f VARCHAR(256)) ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
+ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
+DROP TABLE t1;
+
+CREATE TABLE t1 (f VARCHAR(256), FTS_DOC_ID BIGINT UNSIGNED PRIMARY KEY)
+ENGINE=InnoDB;
+SET SESSION FOREIGN_KEY_CHECKS = OFF;
+ALTER TABLE t1 ADD FOREIGN KEY (f) REFERENCES non_existing_table (x);
+SET SESSION FOREIGN_KEY_CHECKS = ON;
+ALTER TABLE t1 ADD FULLTEXT INDEX ft1 (f);
+ALTER TABLE t1 ADD FULLTEXT INDEX ft2 (f);
+DROP TABLE t1;
+
+--echo #
+--echo # MDEV-18630 Conditional jump or move depends on uninitialised value
+--echo # in ib_push_warning / dict_create_foreign_constraints_low
+--echo #
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+--error ER_CANT_CREATE_TABLE
+ALTER IGNORE TABLE t1 ADD FOREIGN KEY (a) REFERENCES t2 (b);
+--replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/
+SHOW WARNINGS;
+DROP TABLE t1;
+
--echo # Start of 10.2 tests
--echo #
diff --git a/mysql-test/suite/innodb/t/innodb-fk-warnings.test b/mysql-test/suite/innodb/t/innodb-fk-warnings.test
index f45ae00d788..55284179692 100644
--- a/mysql-test/suite/innodb/t/innodb-fk-warnings.test
+++ b/mysql-test/suite/innodb/t/innodb-fk-warnings.test
@@ -48,10 +48,8 @@ create table t2(a int, b int, constraint a foreign key a (a) references t1(a),
constraint a foreign key a (a) references t1(b)) engine=innodb;
show warnings;
create table t2(a int, b int, constraint a foreign key a (a) references t1(a)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
alter table t2 add constraint b foreign key (b) references t2(b);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t2, t1;
@@ -60,10 +58,8 @@ drop table t2, t1;
#
create table t1 (f1 integer primary key) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
alter table t1 add constraint c1 foreign key (f1) references t11(f1);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
@@ -87,15 +83,11 @@ create temporary table t1(a int not null primary key, b int, key(b)) engine=inno
--echo Warning 150 Alter table `mysqld.1`.`t1` with foreign key constraint failed. Referenced table `mysqld.1`.`t1` not found in the data dictionary close to foreign key(b) references t1(a).
--echo Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
--echo Warning 1215 Cannot add foreign key constraint
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create temporary table t2(a int, foreign key(a) references t1(a)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
alter table t1 add foreign key(b) references t1(a);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
@@ -103,17 +95,13 @@ drop table t1;
# Column numbers do not match
#
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1239
alter table t1 add foreign key(a,b) references t1(a);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
create table t1(a int not null primary key, b int, key(b)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1239
alter table t1 add foreign key(a) references t1(a,b);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
@@ -121,15 +109,11 @@ drop table t1;
# ON UPDATE/DELETE SET NULL on NOT NULL column
#
create table t1 (f1 integer not null primary key) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
alter table t1 add constraint c1 foreign key (f1) references t1(f1) on update set null;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table t2(a int not null, foreign key(a) references t1(f1) on delete set null) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
@@ -137,9 +121,7 @@ drop table t1;
# Incorrect types
#
create table t1 (id int not null primary key, f1 int, f2 int, key(f1)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table t2(a char(20), key(a), foreign key(a) references t1(f1)) engine=innodb;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
drop table t1;
diff --git a/mysql-test/suite/innodb/t/innodb-fk.test b/mysql-test/suite/innodb/t/innodb-fk.test
index 17e926e8647..8809dc55966 100644
--- a/mysql-test/suite/innodb/t/innodb-fk.test
+++ b/mysql-test/suite/innodb/t/innodb-fk.test
@@ -115,11 +115,9 @@ CREATE TABLE t2 (
CONSTRAINT fk2 FOREIGN KEY (f2) REFERENCES t1 (`id`) ON DELETE CASCADE
) ENGINE=InnoDB;
---replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/
--error 1005
ALTER TABLE t2 ADD CONSTRAINT fk3 FOREIGN KEY (f3) REFERENCES t3 (id) ON DELETE CASCADE;
---replace_regex /#sql-[0-9_a-f-]*/#sql-temporary/
show warnings;
drop table t2;
diff --git a/mysql-test/suite/innodb/t/innodb-index-online.test b/mysql-test/suite/innodb/t/innodb-index-online.test
index efe1c796cf1..5d92b010e60 100644
--- a/mysql-test/suite/innodb/t/innodb-index-online.test
+++ b/mysql-test/suite/innodb/t/innodb-index-online.test
@@ -492,7 +492,6 @@ reap;
SET DEBUG_SYNC = 'RESET';
disconnect con1;
CREATE TABLE t2 (c VARCHAR(64)) ENGINE=InnoDB;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
ALTER TABLE t2 ADD FOREIGN KEY (c) REFERENCES t1 (c);
DROP TABLE t2,t1;
diff --git a/mysql-test/suite/innodb/t/innodb-index.test b/mysql-test/suite/innodb/t/innodb-index.test
index bfbe62699fd..17cb9e7b4e1 100644
--- a/mysql-test/suite/innodb/t/innodb-index.test
+++ b/mysql-test/suite/innodb/t/innodb-index.test
@@ -218,7 +218,6 @@ alter table t4 add constraint dc foreign key (a) references t1(a);
--disable_info
show create table t4;
# mysqltest first does replace_regex, then replace_result
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
# a foreign key 'test/dc' already exists
@@ -416,7 +415,6 @@ SET FOREIGN_KEY_CHECKS=0;
--enable_info
# mysqltest first does replace_regex, then replace_result
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error ER_CANT_CREATE_TABLE
@@ -426,7 +424,6 @@ ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c1,c1);
# mysqltest first does replace_regex, then replace_result
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error ER_CANT_CREATE_TABLE
@@ -441,7 +438,6 @@ ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
FOREIGN KEY (c3,c2) REFERENCES t1(c2,c1), ALGORITHM=INPLACE;
# mysqltest first does replace_regex, then replace_result
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error ER_CANT_CREATE_TABLE
@@ -450,7 +446,6 @@ ALTER TABLE t2 ADD CONSTRAINT fk_t2_ca
ALTER TABLE t1 MODIFY COLUMN c2 BIGINT(12) NOT NULL;
# mysqltest first does replace_regex, then replace_result
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
# Embedded server doesn't chdir to data directory
--replace_result $MYSQLD_DATADIR ./ master-data/ ''
--error ER_CANT_CREATE_TABLE
diff --git a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
index a51a697931a..75504a53c55 100644
--- a/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
+++ b/mysql-test/suite/innodb/t/innodb-page_compression_tables.test
@@ -9,20 +9,16 @@ set global innodb_compression_algorithm = 1;
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_compressed=1;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
show create table innodb_compact;
show create table innodb_dynamic;
# MDEV-7133: InnoDB: Assertion failure in thread 140737091569408 in file dict0mem.cc line 74
# InnoDB: Failing assertion: dict_tf_is_valid(flags)
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error 1005
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_compressed=1;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
show create table innodb_redundant;
diff --git a/mysql-test/suite/innodb/t/innodb_force_recovery.test b/mysql-test/suite/innodb/t/innodb_force_recovery.test
index 9dae9f8e7c9..926719e193c 100644
--- a/mysql-test/suite/innodb/t/innodb_force_recovery.test
+++ b/mysql-test/suite/innodb/t/innodb_force_recovery.test
@@ -26,14 +26,12 @@ select * from t1;
--error ER_READ_ONLY_MODE
insert into t1 values(2, 3);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t1 add f3 int not null, algorithm=copy;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t1 add f3 int not null, algorithm=inplace;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
drop index idx on t1;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
@@ -66,14 +64,12 @@ select * from t2;
--error ER_READ_ONLY_MODE
insert into t2 values(2, 3);
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
alter table t2 add f3 int not null, algorithm=copy;
--error ER_ALTER_OPERATION_NOT_SUPPORTED_REASON
alter table t2 add f3 int not null, algorithm=inplace;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/
--error ER_CANT_CREATE_TABLE
drop index idx on t2;
diff --git a/mysql-test/suite/innodb/t/instant_varchar_enlarge.test b/mysql-test/suite/innodb/t/instant_varchar_enlarge.test
deleted file mode 100644
index 42689deca11..00000000000
--- a/mysql-test/suite/innodb/t/instant_varchar_enlarge.test
+++ /dev/null
@@ -1,8 +0,0 @@
---source include/have_innodb.inc
-
-# LEN must increase here
-create table t (a varchar(100)) engine=innodb;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
-alter table t modify a varchar(110), algorithm=inplace;
-select name, pos, mtype, prtype, len from information_schema.innodb_sys_columns where name='a';
-drop table t;
diff --git a/mysql-test/suite/innodb/t/undo_truncate_recover.test b/mysql-test/suite/innodb/t/undo_truncate_recover.test
index 5d680525c5b..1da64497550 100644
--- a/mysql-test/suite/innodb/t/undo_truncate_recover.test
+++ b/mysql-test/suite/innodb/t/undo_truncate_recover.test
@@ -39,17 +39,19 @@ update t1 set c = 'MariaDB';
update t1 set c = 'InnoDB';
eval set global debug_dbug = '+d,$SEARCH_PATTERN';
commit;
+call mtr.add_suppression("InnoDB: innodb_undo_tablespaces=0 disables dedicated undo log tablespaces");
SET GLOBAL innodb_fast_shutdown=0;
--source include/shutdown_mysqld.inc
--source include/search_pattern_in_file.inc
+--let $restart_parameters= --innodb-undo-tablespaces=1
if ($checksum_algorithm == "strict_full_crc32")
{
- let $restart_parameters= --innodb_checksum_algorithm=strict_crc32;
+ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_crc32;
}
if ($checksum_algorithm == "strict_crc32")
{
- let $restart_parameters= --innodb_checksum_algorithm=strict_full_crc32;
+ let $restart_parameters= $restart_parameters --innodb_checksum_algorithm=strict_full_crc32;
}
--source include/start_mysqld.inc
diff --git a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
index 2253c62bebf..cc24c6ff84f 100644
--- a/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
+++ b/mysql-test/suite/innodb_gis/r/alter_spatial_index.result
@@ -800,7 +800,7 @@ SET timestamp=default;
create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))) ENGINE=innodb;
set timestamp=10;
alter table t1 add column i int;
-ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`(temporary)`.`p` at row 1
+ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1
drop table t1;
SET timestamp=default;
CREATE OR REPLACE TABLE t1 (a INT) ENGINE=InnoDB;
diff --git a/mysql-test/suite/innodb_gis/r/point_basic.result b/mysql-test/suite/innodb_gis/r/point_basic.result
index 0fa5021dab9..d88b01d514b 100644
--- a/mysql-test/suite/innodb_gis/r/point_basic.result
+++ b/mysql-test/suite/innodb_gis/r/point_basic.result
@@ -1521,28 +1521,28 @@ child CREATE TABLE `child` (
SPATIAL KEY `idx2` (`p`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
show warnings;
Level Code Message
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `child`
ALTER TABLE parent DROP INDEX idx1;
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
Got one of the listed errors
show warnings;
Level Code Message
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is no index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `child`
ALTER TABLE child DROP INDEX idx2;
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
Got one of the listed errors
show warnings;
Level Code Message
Warning 150 Alter table '`test`.`child`' with foreign key constraint failed. There is only prefix index in the referenced table where the referenced columns appear as the first columns near 'FOREIGN KEY(p) REFERENCES parent(p)'.
-Error 1005 Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
-Warning 1215 Cannot add foreign key constraint for `#sql-temporary`
+Error 1005 Can't create table `test`.`child` (errno: 150 "Foreign key constraint is incorrectly formed")
+Warning 1215 Cannot add foreign key constraint for `child`
DROP TABLE child, parent;
#
# Bug#28763: Selecting geometry fields in UNION caused server crash.
diff --git a/mysql-test/suite/innodb_gis/t/point_basic.test b/mysql-test/suite/innodb_gis/t/point_basic.test
index 1c0d229802b..4ac90b93d4c 100644
--- a/mysql-test/suite/innodb_gis/t/point_basic.test
+++ b/mysql-test/suite/innodb_gis/t/point_basic.test
@@ -772,24 +772,18 @@ ALTER TABLE child ADD SPATIAL INDEX idx2(p ASC);
SHOW CREATE TABLE parent;
SHOW CREATE TABLE child;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANT_CREATE_TABLE
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
ALTER TABLE parent DROP INDEX idx1;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANNOT_ADD_FOREIGN,ER_CANT_CREATE_TABLE
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
ALTER TABLE child DROP INDEX idx2;
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
--error ER_CANNOT_ADD_FOREIGN,ER_CANT_CREATE_TABLE
ALTER TABLE child ADD FOREIGN KEY(p) REFERENCES parent(p);
---replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
show warnings;
DROP TABLE child, parent;
diff --git a/mysql-test/suite/mariabackup/encrypted_page_compressed.test b/mysql-test/suite/mariabackup/encrypted_page_compressed.test
index b4ca7eded14..b0bcdd9e33b 100644
--- a/mysql-test/suite/mariabackup/encrypted_page_compressed.test
+++ b/mysql-test/suite/mariabackup/encrypted_page_compressed.test
@@ -36,7 +36,7 @@ echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--error 1
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --core-file > $backuplog;
--enable_result_log
--let SEARCH_PATTERN=Database page corruption detected.*
diff --git a/mysql-test/suite/mariabackup/encrypted_page_corruption.test b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
index 4491c235ac4..5ba77597b35 100644
--- a/mysql-test/suite/mariabackup/encrypted_page_corruption.test
+++ b/mysql-test/suite/mariabackup/encrypted_page_corruption.test
@@ -51,7 +51,7 @@ let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log
--error 1
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir > $backuplog;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --extended-validation --target-dir=$targetdir --core-file > $backuplog;
--enable_result_log
diff --git a/mysql-test/suite/mariabackup/incremental_rocksdb.opt b/mysql-test/suite/mariabackup/incremental_rocksdb.opt
new file mode 100644
index 00000000000..e582413e5b5
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_rocksdb.opt
@@ -0,0 +1 @@
+--plugin-load=$HA_ROCKSDB_SO \ No newline at end of file
diff --git a/mysql-test/suite/mariabackup/incremental_rocksdb.result b/mysql-test/suite/mariabackup/incremental_rocksdb.result
new file mode 100644
index 00000000000..4e5b9c43389
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_rocksdb.result
@@ -0,0 +1,19 @@
+call mtr.add_suppression("InnoDB: New log files created");
+CREATE TABLE t(i INT PRIMARY KEY) ENGINE ROCKSDB;
+INSERT INTO t VALUES(1);
+# Create full backup , modify table, then create incremental/differential backup
+DROP TABLE t;
+CREATE TABLE t2(i INT PRIMARY KEY) ENGINE ROCKSDB;
+INSERT INTO t2 VALUES(2);
+# Prepare full backup, apply incremental one
+# Restore and check results
+# shutdown server
+# remove datadir
+# xtrabackup move back
+# restart server
+SELECT * FROM t2;
+i
+2
+DROP TABLE t2;
+DROP TABLE t;
+ERROR 42S02: Unknown table 'test.t'
diff --git a/mysql-test/suite/mariabackup/incremental_rocksdb.test b/mysql-test/suite/mariabackup/incremental_rocksdb.test
new file mode 100644
index 00000000000..32bce885c32
--- /dev/null
+++ b/mysql-test/suite/mariabackup/incremental_rocksdb.test
@@ -0,0 +1,38 @@
+--source include/have_rocksdb.inc
+call mtr.add_suppression("InnoDB: New log files created");
+
+let $basedir=$MYSQLTEST_VARDIR/tmp/backup;
+let $incremental_dir=$MYSQLTEST_VARDIR/tmp/backup_inc1;
+
+CREATE TABLE t(i INT PRIMARY KEY) ENGINE ROCKSDB;
+INSERT INTO t VALUES(1);
+
+echo # Create full backup , modify table, then create incremental/differential backup;
+--disable_result_log
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$basedir;
+--enable_result_log
+DROP TABLE t;
+CREATE TABLE t2(i INT PRIMARY KEY) ENGINE ROCKSDB;
+INSERT INTO t2 VALUES(2);
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$incremental_dir --incremental-basedir=$basedir;
+
+--disable_result_log
+echo # Prepare full backup, apply incremental one;
+exec $XTRABACKUP --prepare --target-dir=$basedir;
+
+exec $XTRABACKUP --prepare --target-dir=$basedir --incremental-dir=$incremental_dir ;
+
+echo # Restore and check results;
+let $targetdir=$basedir;
+-- source include/restart_and_restore.inc
+--enable_result_log
+
+SELECT * FROM t2;
+DROP TABLE t2;
+--error ER_BAD_TABLE_ERROR
+DROP TABLE t;
+
+# Cleanup
+rmdir $basedir;
+rmdir $incremental_dir;
+
diff --git a/mysql-test/suite/mariabackup/log_checksum_mismatch.test b/mysql-test/suite/mariabackup/log_checksum_mismatch.test
index f041b0aeedd..c8baf66e917 100644
--- a/mysql-test/suite/mariabackup/log_checksum_mismatch.test
+++ b/mysql-test/suite/mariabackup/log_checksum_mismatch.test
@@ -7,7 +7,7 @@ let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--disable_result_log
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch > $backuplog;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --dbug=+d,log_intermittent_checksum_mismatch --core-file > $backuplog;
--enable_result_log
--let SEARCH_RANGE = 10000000
diff --git a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
index b41d177e572..ce5c94a1c57 100644
--- a/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
+++ b/mysql-test/suite/mariabackup/unencrypted_page_compressed.test
@@ -38,7 +38,7 @@ echo # xtrabackup backup;
let $targetdir=$MYSQLTEST_VARDIR/tmp/backup;
let $backuplog=$MYSQLTEST_VARDIR/tmp/backup.log;
--error 1
-exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir > $backuplog;
+exec $XTRABACKUP --defaults-file=$MYSQLTEST_VARDIR/my.cnf --backup --target-dir=$targetdir --core-file > $backuplog;
--enable_result_log
--let SEARCH_PATTERN=Database page corruption detected.*
diff --git a/mysql-test/suite/perfschema/r/dml_setup_instruments.result b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
index e43841c80ac..a972cf02285 100644
--- a/mysql-test/suite/perfschema/r/dml_setup_instruments.result
+++ b/mysql-test/suite/perfschema/r/dml_setup_instruments.result
@@ -16,7 +16,9 @@ wait/synch/mutex/sql/LOCK_after_binlog_sync YES YES
wait/synch/mutex/sql/LOCK_audit_mask YES YES
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
- and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+ and name not in (
+'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
+'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
order by name limit 10;
NAME ENABLED TIMED
wait/synch/rwlock/sql/LOCK_all_status_vars YES YES
diff --git a/mysql-test/suite/perfschema/t/dml_setup_instruments.test b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
index 6b4fe89a1cf..098d6bd031d 100644
--- a/mysql-test/suite/perfschema/t/dml_setup_instruments.test
+++ b/mysql-test/suite/perfschema/t/dml_setup_instruments.test
@@ -22,10 +22,13 @@ select * from performance_schema.setup_instruments
order by name limit 10;
# CRYPTO_dynlock_value::lock is dependent on the build (SSL)
+# LOCK_named_pipe_full_access_group is dependent on the build (Windows)
select * from performance_schema.setup_instruments
where name like 'Wait/Synch/Rwlock/sql/%'
- and name not in ('wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock')
+ and name not in (
+ 'wait/synch/rwlock/sql/CRYPTO_dynlock_value::lock',
+ 'wait/synch/rwlock/sql/LOCK_named_pipe_full_access_group')
order by name limit 10;
# COND_handler_count is dependent on the build (Windows only)
diff --git a/mysql-test/suite/plugins/t/audit_null.test b/mysql-test/suite/plugins/t/audit_null.test
index 199e4ba154e..63f5f51e347 100644
--- a/mysql-test/suite/plugins/t/audit_null.test
+++ b/mysql-test/suite/plugins/t/audit_null.test
@@ -56,6 +56,6 @@ drop user testuser@localhost;
set global general_log=@old_global_general_log;
let $MYSQLD_DATADIR= `SELECT @@datadir`;
---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ /#sql2-[-0-9a-f_]*/#sql2-temporary/ /::1// /127.0.0.1//
+--replace_regex /::1// /127.0.0.1//
cat_file $MYSQLD_DATADIR/audit_null_tables.log;
diff --git a/mysql-test/suite/rpl/r/rpl_set_statement.test b/mysql-test/suite/rpl/r/rpl_set_statement.test
deleted file mode 100644
index e69de29bb2d..00000000000
--- a/mysql-test/suite/rpl/r/rpl_set_statement.test
+++ /dev/null
diff --git a/mysql-test/suite/sys_vars/r/all_vars.result b/mysql-test/suite/sys_vars/r/all_vars.result
index 1bd4e394f6a..b7beb7b5347 100644
--- a/mysql-test/suite/sys_vars/r/all_vars.result
+++ b/mysql-test/suite/sys_vars/r/all_vars.result
@@ -10,5 +10,6 @@ there should be *no* long test name listed below:
select distinct variable_name as `there should be *no* variables listed below:` from t2
left join t1 on variable_name=test_name where test_name is null;
there should be *no* variables listed below:
+wsrep_certification_rules
drop table t1;
drop table t2;
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
new file mode 100644
index 00000000000..2019c4dc616
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,32bit,xtradb.rdiff-disabled
@@ -0,0 +1,1236 @@
+--- suite/sys_vars/r/sysvars_innodb.result
++++ suite/sys_vars/r/sysvars_innodb,32bit.reject
+@@ -47,13 +47,27 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
++SESSION_VALUE NULL
++GLOBAL_VALUE 1
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 32
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_ADAPTIVE_MAX_SLEEP_DELAY
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 150000
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 150000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT The upper limit of the sleep delay in usec. Value of 0 disables it.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000000
+@@ -67,10 +81,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 8388608
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT DEPRECATED. This option may be removed in future releases, together with the option innodb_use_sys_malloc and with the InnoDB's internal memory allocator. Size of a memory pool InnoDB uses to store data dictionary information and other internal data structures.
+ NUMERIC_MIN_VALUE 524288
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 1024
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -81,7 +95,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 5
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Background commit interval in seconds
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1073741824
+@@ -137,7 +151,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB API transaction isolation level
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 3
+@@ -151,7 +165,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 64
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Data file autoextend increment in megabytes
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1000
+@@ -165,7 +179,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT The AUTOINC lock modes supported by InnoDB: 0 => Old style AUTOINC locking (for backward compatibility) 1 => New style AUTOINC locking 2 => No AUTOINC locking (unsafe for SBR)
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -263,7 +277,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 100
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Dump only the hottest N% of each buffer pool, defaults to 100
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 100
+@@ -305,7 +319,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of buffer pool instances, set to higher value on high-end machines to increase scalability
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 64
+@@ -355,6 +369,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_BUFFER_POOL_POPULATE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Deprecated. This option has no effect and will be removed in MariaDB 10.2.3.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_BUFFER_POOL_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 8388608
+@@ -375,7 +403,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT A number between [0, 100] that tells how oftern buffer pool dump status in percentages should be printed. E.g. 10 means that buffer pool dump status is printed when every 10% of number of buffer pool pages are dumped. Default is 0 (only start and end status is printed).
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -446,7 +474,7 @@
+ DEFAULT_VALUE ON
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF. Enable InnoDB checksums validation (enabled by default). Disable with --skip-innodb-checksums.
++VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -467,6 +495,104 @@
+ ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_EVICTION_FACTOR
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make page cleaner LRU flushes use evicted instead of flushed page counts for its heuristics
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_CLEANER_FLUSH_CHUNK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 100
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 100
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Divide page cleaner flush list flush batches into chunks of this size
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_FREE_LIST_LWM
++SESSION_VALUE NULL
++GLOBAL_VALUE 10
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 10
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Page cleaner will keep on flushing the same buffer pool instance if its free list length is below this percentage of innodb_lru_scan_depth
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 100
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_LRU_CHUNK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 100
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 100
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Divide page cleaner LRU list flush batches into chunks of this size
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_LSN_AGE_FACTOR
++SESSION_VALUE NULL
++GLOBAL_VALUE HIGH_CHECKPOINT
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE HIGH_CHECKPOINT
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The formula for LSN age factor for page cleaner adaptive flushing. LEGACY: Original Oracle MySQL 5.6 formula. HIGH_CHECKPOINT: (the default) Percona Server 5.6 formula.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST LEGACY,HIGH_CHECKPOINT
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_CLEANER_MAX_FLUSH_TIME
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT The maximum time limit for a single flush list flush iteration by the page cleaner thread in miliseconds
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_MAX_LRU_TIME
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT The maximum time limit for a single LRU tail flush iteration by the page cleaner thread in miliseconds
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -487,7 +613,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000
+@@ -515,7 +641,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 5
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT If the compression failure rate of a table is greater than this number more padding is added to the pages to reduce the failures. A value of zero implies no padding
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -543,7 +669,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 50
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Percentage of empty space on a data page that can be reserved to make the page compressible.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 75
+@@ -557,14 +683,28 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 5000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of times a thread is allowed to enter InnoDB within the same SQL query after it has once got the ticket
+ NUMERIC_MIN_VALUE 1
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CORRUPT_TABLE_ACTION
++SESSION_VALUE NULL
++GLOBAL_VALUE assert
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE assert
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST assert,warn,salvage
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_DATA_FILE_PATH
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ibdata1:12M:autoextend
+@@ -781,7 +921,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 120
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of pages reserved in doublewrite buffer for batch flushing
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 127
+@@ -789,6 +929,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_EMPTY_FREE_LIST_ALGORITHM
++SESSION_VALUE NULL
++GLOBAL_VALUE LEGACY
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE BACKOFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm to use for empty free list handling. Allowed values: LEGACY: Original Oracle MySQL 5.6 handling with single page flushes; BACKOFF: (default) Wait until cleaner produces a free page.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST LEGACY,BACKOFF
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1
+@@ -859,13 +1013,27 @@
+ ENUM_VALUE_LIST OFF,ON,FORCE
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_FAKE_CHANGES
++SESSION_VALUE OFF
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE SESSION
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT In the transaction after enabled, UPDATE, INSERT and DELETE only move the cursor to the records and do nothing other operations (no changes, no ibuf, no undo, no transaction log) in the transaction. This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FAST_SHUTDOWN
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Speeds up the shutdown process of the InnoDB storage engine. Possible values are 0, 1 (faster) or 2 (fastest - crash-like).
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -879,7 +1047,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 600
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum number of seconds that semaphore times out in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 4294967295
+@@ -949,7 +1117,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Make the first page of the given tablespace dirty.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -963,7 +1131,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 30
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of iterations over which the background flushing is averaged.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1000
+@@ -986,12 +1154,12 @@
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
+-SESSION_VALUE NULL
++SESSION_VALUE 1
+ GLOBAL_VALUE 1
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+-VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_SCOPE SESSION
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 3
+@@ -1019,7 +1187,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Set to 0 (don't flush neighbors from buffer pool), 1 (flush contiguous neighbors from buffer pool) or 2 (flush neighbors from buffer pool), when flushing a block
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 2
+@@ -1061,7 +1229,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Helps to save your data in case the disk image of the database becomes corrupt.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 6
+@@ -1069,6 +1237,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_FOREGROUND_PREFLUSH
++SESSION_VALUE NULL
++GLOBAL_VALUE EXPONENTIAL_BACKOFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE EXPONENTIAL_BACKOFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm InnoDB uses for the query threads at sync preflush. Possible values are SYNC_PREFLUSH: perform a sync preflush as Oracle MySQL; EXPONENTIAL_BACKOFF: (default) wait for the page cleaner flush.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST SYNC_PREFLUSH,EXPONENTIAL_BACKOFF
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FT_AUX_TABLE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE
+@@ -1089,7 +1271,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 8000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search cache size in bytes
+ NUMERIC_MIN_VALUE 1600000
+ NUMERIC_MAX_VALUE 80000000
+@@ -1131,7 +1313,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 84
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search maximum token size in characters
+ NUMERIC_MIN_VALUE 10
+ NUMERIC_MAX_VALUE 84
+@@ -1145,7 +1327,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 3
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search minimum token size in characters
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 16
+@@ -1159,7 +1341,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 2000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search number of words to optimize for each optimize table call
+ NUMERIC_MIN_VALUE 1000
+ NUMERIC_MAX_VALUE 10000
+@@ -1173,10 +1355,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 2000000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search query result cache limit in bytes
+ NUMERIC_MIN_VALUE 1000000
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1201,7 +1383,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 2
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT InnoDB Fulltext search parallel sort degree, will round up to nearest power of 2 number
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 16
+@@ -1215,7 +1397,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 640000000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Total memory allocated for InnoDB Fulltext Search cache
+ NUMERIC_MIN_VALUE 32000000
+ NUMERIC_MAX_VALUE 1600000000
+@@ -1243,7 +1425,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 100
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Up to what percentage of dirty pages should be flushed when innodb finds it has spare resources to do so.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 100
+@@ -1285,10 +1467,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 200
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of IOPs the server can do. Tunes the background IO rate
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1297,12 +1479,26 @@
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 2000
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+-DEFAULT_VALUE 18446744073709551615
++DEFAULT_VALUE 4294967295
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Limit to which innodb_io_capacity can be inflated.
+ NUMERIC_MIN_VALUE 100
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_KILL_IDLE_TRANSACTION
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT
++VARIABLE_COMMENT No effect for this build.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1335,6 +1531,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOCKING_FAKE_CHANGES
++SESSION_VALUE NULL
++GLOBAL_VALUE ON
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE ON
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT ###EXPERIMENTAL### if enabled, transactions will get S row locks instead of X locks for fake changes. If disabled, fake change transactions will not take any locks at all.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -1369,7 +1579,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 50
+ VARIABLE_SCOPE SESSION
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Timeout in seconds an InnoDB transaction may wait for a lock before being rolled back. Values above 100000000 disable the timeout.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1073741824
+@@ -1377,16 +1587,72 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOG_ARCHIVE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Set to 1 if you want to have logs archived.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_ARCH_DIR
++SESSION_VALUE NULL
++GLOBAL_VALUE PATH
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE VARCHAR
++VARIABLE_COMMENT Where full logs should be archived.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOG_ARCH_EXPIRE_SEC
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Expiration time for archived innodb transaction logs.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_BLOCK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 512
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 512
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT ###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!
++NUMERIC_MIN_VALUE 512
++NUMERIC_MAX_VALUE 65536
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_LOG_BUFFER_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1048576
+ GLOBAL_VALUE_ORIGIN CONFIG
+ DEFAULT_VALUE 16777216
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT The size of the buffer which InnoDB uses to write log to the log files on disk.
+ NUMERIC_MIN_VALUE 262144
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 1024
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -1405,6 +1671,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_CHECKSUM_ALGORITHM
++SESSION_VALUE NULL
++GLOBAL_VALUE INNODB
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE INNODB
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm InnoDB uses for log block checksums. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Logs created when this option is set to crc32/strict_crc32/none/strict_none will not be readable by any MySQL version or Percona Server versions that donot support this feature
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ON
+@@ -1425,7 +1705,7 @@
+ GLOBAL_VALUE_ORIGIN CONFIG
+ DEFAULT_VALUE 2
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of log files in the log group. InnoDB writes to the files in a circular fashion.
+ NUMERIC_MIN_VALUE 2
+ NUMERIC_MAX_VALUE 100
+@@ -1467,9 +1747,37 @@
+ GLOBAL_VALUE_ORIGIN CONFIG
+ DEFAULT_VALUE 1024
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT How deep to scan LRU to keep it clean
+ NUMERIC_MIN_VALUE 100
++NUMERIC_MAX_VALUE 4294967295
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_MAX_BITMAP_FILE_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 104857600
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 104857600
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum size of changed page bitmap files
++NUMERIC_MIN_VALUE 4096
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_MAX_CHANGED_PAGES
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum number of rows for INFORMATION_SCHEMA.INNODB_CHANGED_PAGES table, 0 - unlimited
++NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 18446744073709551615
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+@@ -1509,10 +1817,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Desired maximum length of the purge queue (0 = no limit)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1523,7 +1831,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum delay of user threads in micro-seconds
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 10000000
+@@ -1537,7 +1845,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of identical copies of log groups we keep for the database. Currently this should be set to 1.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 10
+@@ -1607,7 +1915,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 8
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT Number of multi-threaded flush threads
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
+@@ -1659,14 +1967,14 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_OPEN_FILES
+ SESSION_VALUE NULL
+-GLOBAL_VALUE 2000
++GLOBAL_VALUE 300
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT
++VARIABLE_TYPE INT
+ VARIABLE_COMMENT How many files at the maximum InnoDB keeps open at the same time.
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_MAX_VALUE 2147483647
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+@@ -1691,7 +1999,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 16
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of rw_locks protecting buffer pool page_hash. Rounded up to the next power of 2
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1024
+@@ -1705,7 +2013,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 16384
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Page size to use for all InnoDB tablespaces.
+ NUMERIC_MIN_VALUE 4096
+ NUMERIC_MAX_VALUE 65536
+@@ -1741,13 +2049,83 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Print lock wait timeout info to MySQL error log (off by default)
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_CLEANER
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make buffer pool cleaner and LRU manager threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_IO
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make I/O threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_MASTER
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make buffer pool cleaner thread acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_PURGE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make purge coordinator and worker threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_PURGE_BATCH_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 300
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 300
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of UNDO log pages to purge in one batch from the history list.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 5000
+@@ -1789,7 +2167,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Purge threads can be from 1 to 32. Default is 1.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 32
+@@ -1817,7 +2195,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 56
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of pages that must be accessed sequentially for InnoDB to trigger a readahead.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 64
+@@ -1831,7 +2209,7 @@
+ GLOBAL_VALUE_ORIGIN CONFIG
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of background read I/O threads in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
+@@ -1859,10 +2237,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Replication thread delay (ms) on the slave server if innodb_thread_concurrency is reached (0 by default)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -1887,7 +2265,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 128
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of undo logs to use (deprecated).
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 128
+@@ -1901,7 +2279,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT An InnoDB page number.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 4294967295
+@@ -1909,6 +2287,48 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_SCHED_PRIORITY_IO
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Nice value for the I/O handler thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SCHED_PRIORITY_MASTER
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Nice value for the master thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SCHED_PRIORITY_PURGE
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Nice value for the purge thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_SCRUB_LOG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -1937,6 +2357,34 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_SHOW_LOCKS_HELD
++SESSION_VALUE NULL
++GLOBAL_VALUE 10
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 10
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Number of locks held to print for each InnoDB transaction in SHOW INNODB STATUS.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 1000
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SHOW_VERBOSE_LOCKS
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE INT UNSIGNED
++VARIABLE_COMMENT Whether to show records locked in SHOW INNODB STATUS.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 1
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 0
+@@ -1957,7 +2405,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1048576
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Memory buffer size for index creation
+ NUMERIC_MIN_VALUE 65536
+ NUMERIC_MAX_VALUE 67108864
+@@ -1971,10 +2419,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 6
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Maximum delay between polling for a spin lock (6 by default)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -2014,7 +2462,7 @@
+ DEFAULT_VALUE nulls_equal
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE ENUM
+-VARIABLE_COMMENT Specifies how InnoDB index statistics collection code should treat NULLs. Possible values are NULLS_EQUAL (default), NULLS_UNEQUAL and NULLS_IGNORED
++VARIABLE_COMMENT Specifies how InnoDB index statistics collection code should treat NULLs
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -2181,7 +2629,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Size of the mutex/lock wait array.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 1024
+@@ -2195,10 +2643,10 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 30
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Count of spin-loop rounds in InnoDB mutexes (30 by default)
+ NUMERIC_MIN_VALUE 0
+-NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_MAX_VALUE 4294967295
+ NUMERIC_BLOCK_SIZE 0
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+@@ -2223,7 +2671,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Helps in performance tuning in heavily concurrent environments. Sets the maximum number of threads allowed inside InnoDB. Value 0 will disable the thread throttling.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000
+@@ -2237,7 +2685,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 10000
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Time of innodb thread sleeping before joining InnoDB queue (usec). Value 0 disable a sleep
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 1000000
+@@ -2259,6 +2707,34 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_TRACK_CHANGED_PAGES
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Track the redo log for changed pages and output a changed page bitmap
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_TRACK_REDO_LOG_NOW
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Force log tracker to catch up with checkpoint now
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -2307,7 +2783,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 128
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of undo logs to use.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 128
+@@ -2321,7 +2797,7 @@
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of undo tablespaces to use.
+ NUMERIC_MIN_VALUE 0
+ NUMERIC_MAX_VALUE 126
+@@ -2336,7 +2812,7 @@
+ DEFAULT_VALUE OFF
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT Prevent partial page writes, via atomic writes.The option is used to prevent partial writes in case of a crash/poweroff, as faster alternative to doublewrite buffer.Currently this option works only on Linux only with FusionIO device, and directFS filesystem.
++VARIABLE_COMMENT Prevent partial page writes, via atomic writes (beta). The option is used to prevent partial writes in case of a crash/poweroff, as faster alternative to doublewrite buffer. Currently this option works only on Linux only with FusionIO device, and directFS filesystem.
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -2357,6 +2833,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
++SESSION_VALUE NULL
++GLOBAL_VALUE ON
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE ON
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Use global innodb_flush_log_at_trx_commit value. (default: ON).
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_USE_MTFLUSH
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -2371,6 +2861,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_USE_STACKTRACE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Print stacktrace on long semaphore wait (off by default supported only on linux)
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_USE_SYS_MALLOC
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ON
+@@ -2401,12 +2905,12 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_VERSION
+ SESSION_VALUE NULL
+-GLOBAL_VALUE 5.6.43
++GLOBAL_VALUE 5.6.42-84.2
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE NULL
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE VARCHAR
+-VARIABLE_COMMENT InnoDB version
++VARIABLE_COMMENT Percona-InnoDB-plugin version
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -2419,7 +2923,7 @@
+ GLOBAL_VALUE_ORIGIN CONFIG
+ DEFAULT_VALUE 4
+ VARIABLE_SCOPE GLOBAL
+-VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_TYPE INT UNSIGNED
+ VARIABLE_COMMENT Number of background write I/O threads in InnoDB.
+ NUMERIC_MIN_VALUE 1
+ NUMERIC_MAX_VALUE 64
diff --git a/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
new file mode 100644
index 00000000000..998d95e523f
--- /dev/null
+++ b/mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.rdiff-disabled
@@ -0,0 +1,697 @@
+--- mysql-test/suite/sys_vars/r/sysvars_innodb.result 2018-07-30 23:41:05.030930072 +0200
++++ mysql-test/suite/sys_vars/r/sysvars_innodb,xtradb.reject 2018-07-31 09:45:20.330811949 +0200
+@@ -47,6 +47,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_ADAPTIVE_HASH_INDEX_PARTITIONS
++SESSION_VALUE NULL
++GLOBAL_VALUE 1
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Number of InnoDB adaptive hash index partitions (default 1: disable partitioning)
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 64
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_ADAPTIVE_MAX_SLEEP_DELAY
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 150000
+@@ -355,6 +369,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_BUFFER_POOL_POPULATE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Deprecated. This option has no effect and will be removed in MariaDB 10.2.3.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_BUFFER_POOL_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 8388608
+@@ -446,7 +474,7 @@
+ DEFAULT_VALUE ON
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF. Enable InnoDB checksums validation (enabled by default). Disable with --skip-innodb-checksums.
++VARIABLE_COMMENT DEPRECATED. Use innodb_checksum_algorithm=NONE instead of setting this to OFF
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -467,6 +495,104 @@
+ ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_EVICTION_FACTOR
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make page cleaner LRU flushes use evicted instead of flushed page counts for its heuristics
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_CLEANER_FLUSH_CHUNK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 100
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 100
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Divide page cleaner flush list flush batches into chunks of this size
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_FREE_LIST_LWM
++SESSION_VALUE NULL
++GLOBAL_VALUE 10
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 10
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Page cleaner will keep on flushing the same buffer pool instance if its free list length is below this percentage of innodb_lru_scan_depth
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 100
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_LRU_CHUNK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 100
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 100
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Divide page cleaner LRU list flush batches into chunks of this size
++NUMERIC_MIN_VALUE 1
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_LSN_AGE_FACTOR
++SESSION_VALUE NULL
++GLOBAL_VALUE HIGH_CHECKPOINT
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE HIGH_CHECKPOINT
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The formula for LSN age factor for page cleaner adaptive flushing. LEGACY: Original Oracle MySQL 5.6 formula. HIGH_CHECKPOINT: (the default) Percona Server 5.6 formula.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST LEGACY,HIGH_CHECKPOINT
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_CLEANER_MAX_FLUSH_TIME
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum time limit for a single flush list flush iteration by the page cleaner thread in miliseconds
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CLEANER_MAX_LRU_TIME
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum time limit for a single LRU tail flush iteration by the page cleaner thread in miliseconds
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_CMP_PER_INDEX_ENABLED
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -565,6 +691,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_CORRUPT_TABLE_ACTION
++SESSION_VALUE NULL
++GLOBAL_VALUE assert
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE assert
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT Warn corruptions of user tables as 'corrupt table' instead of not crashing itself, when used with file_per_table. All file io for the datafile after detected as corrupt are disabled, except for the deletion.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST assert,warn,salvage
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_DATA_FILE_PATH
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ibdata1:12M:autoextend
+@@ -789,6 +929,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_EMPTY_FREE_LIST_ALGORITHM
++SESSION_VALUE NULL
++GLOBAL_VALUE LEGACY
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE BACKOFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm to use for empty free list handling. Allowed values: LEGACY: Original Oracle MySQL 5.6 handling with single page flushes; BACKOFF: (default) Wait until cleaner produces a free page.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST LEGACY,BACKOFF
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_ENCRYPTION_ROTATE_KEY_AGE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1
+@@ -859,6 +1013,20 @@
+ ENUM_VALUE_LIST OFF,ON,FORCE
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_FAKE_CHANGES
++SESSION_VALUE OFF
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE SESSION
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT In the transaction after enabled, UPDATE, INSERT and DELETE only move the cursor to the records and do nothing other operations (no changes, no ibuf, no undo, no transaction log) in the transaction. This is to cause replication prefetch IO. ATTENTION: the transaction started after enabled is affected.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FAST_SHUTDOWN
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1
+@@ -986,11 +1154,11 @@
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FLUSH_LOG_AT_TRX_COMMIT
+-SESSION_VALUE NULL
++SESSION_VALUE 1
+ GLOBAL_VALUE 1
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 1
+-VARIABLE_SCOPE GLOBAL
++VARIABLE_SCOPE SESSION
+ VARIABLE_TYPE BIGINT UNSIGNED
+ VARIABLE_COMMENT Controls the durability/speed trade-off for commits. Set to 0 (write and flush redo log to disk only once per second), 1 (flush to disk at each commit), 2 (write to log at commit but flush to disk only once per second) or 3 (flush to disk at prepare and at commit, slower and usually redundant). 1 and 3 guarantees that after a crash, committed transactions will not be lost and will be consistent with the binlog and other transactional engines. 2 can get inconsistent and lose transactions if there is a power failure or kernel crash but not if mysqld crashes. 0 has no guarantees in case of crash. 0 and 2 can be faster than 1 or 3.
+ NUMERIC_MIN_VALUE 0
+@@ -1069,6 +1237,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_FOREGROUND_PREFLUSH
++SESSION_VALUE NULL
++GLOBAL_VALUE EXPONENTIAL_BACKOFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE EXPONENTIAL_BACKOFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm InnoDB uses for the query threads at sync preflush. Possible values are SYNC_PREFLUSH: perform a sync preflush as Oracle MySQL; EXPONENTIAL_BACKOFF: (default) wait for the page cleaner flush.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST SYNC_PREFLUSH,EXPONENTIAL_BACKOFF
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_FT_AUX_TABLE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE
+@@ -1307,6 +1489,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_KILL_IDLE_TRANSACTION
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT
++VARIABLE_COMMENT No effect for this build.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 9223372036854775807
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_LARGE_PREFIX
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -1335,6 +1531,20 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOCKING_FAKE_CHANGES
++SESSION_VALUE NULL
++GLOBAL_VALUE ON
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE ON
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT ###EXPERIMENTAL### if enabled, transactions will get S row locks instead of X locks for fake changes. If disabled, fake change transactions will not take any locks at all.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_LOCKS_UNSAFE_FOR_BINLOG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -1377,6 +1587,62 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOG_ARCHIVE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Set to 1 if you want to have logs archived.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_ARCH_DIR
++SESSION_VALUE NULL
++GLOBAL_VALUE PATH
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE VARCHAR
++VARIABLE_COMMENT Where full logs should be archived.
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_LOG_ARCH_EXPIRE_SEC
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Expiration time for archived innodb transaction logs.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_BLOCK_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 512
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 512
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT ###EXPERIMENTAL###: The log block size of the transaction log file. Changing for created log file is not supported. Use on your own risk!
++NUMERIC_MIN_VALUE 512
++NUMERIC_MAX_VALUE 65536
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_LOG_BUFFER_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 1048576
+@@ -1405,6 +1671,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_LOG_CHECKSUM_ALGORITHM
++SESSION_VALUE NULL
++GLOBAL_VALUE INNODB
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE INNODB
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE ENUM
++VARIABLE_COMMENT The algorithm InnoDB uses for log block checksums. Possible values are CRC32 (hardware accelerated if the CPU supports it) write crc32, allow any of the other checksums to match when reading; STRICT_CRC32 write crc32, do not allow other algorithms to match when reading; INNODB write a software calculated checksum, allow any other checksums to match when reading; STRICT_INNODB write a software calculated checksum, do not allow other algorithms to match when reading; NONE write a constant magic number, do not do any checksum verification when reading (same as innodb_checksums=OFF); STRICT_NONE write a constant magic number, do not allow values other than that magic number when reading; Logs created when this option is set to crc32/strict_crc32/none/strict_none will not be readable by any MySQL version or Percona Server versions that donot support this feature
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST CRC32,STRICT_CRC32,INNODB,STRICT_INNODB,NONE,STRICT_NONE
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_LOG_COMPRESSED_PAGES
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ON
+@@ -1475,6 +1755,34 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_MAX_BITMAP_FILE_SIZE
++SESSION_VALUE NULL
++GLOBAL_VALUE 104857600
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 104857600
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum size of changed page bitmap files
++NUMERIC_MIN_VALUE 4096
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_MAX_CHANGED_PAGES
++SESSION_VALUE NULL
++GLOBAL_VALUE 1000000
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 1000000
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT The maximum number of rows for INFORMATION_SCHEMA.INNODB_CHANGED_PAGES table, 0 - unlimited
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 18446744073709551615
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_MAX_DIRTY_PAGES_PCT
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 75.000000
+@@ -1659,7 +1967,7 @@
+ COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_OPEN_FILES
+ SESSION_VALUE NULL
+-GLOBAL_VALUE 2000
++GLOBAL_VALUE 300
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE 0
+ VARIABLE_SCOPE GLOBAL
+@@ -1741,6 +2049,76 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRINT_LOCK_WAIT_TIMEOUT_INFO
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Print lock wait timeout info to MySQL error log (off by default)
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_CLEANER
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make buffer pool cleaner and LRU manager threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_IO
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make I/O threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_MASTER
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make buffer pool cleaner thread acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_PRIORITY_PURGE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Make purge coordinator and worker threads acquire shared resources with priority
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_PURGE_BATCH_SIZE
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 300
+@@ -1909,6 +2287,48 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_SCHED_PRIORITY_IO
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Nice value for the I/O handler thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SCHED_PRIORITY_MASTER
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Nice value for the master thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SCHED_PRIORITY_PURGE
++SESSION_VALUE NULL
++GLOBAL_VALUE 19
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 19
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Nice value for the purge thread scheduling
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 39
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
+ VARIABLE_NAME INNODB_SCRUB_LOG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -1937,6 +2357,34 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_SHOW_LOCKS_HELD
++SESSION_VALUE NULL
++GLOBAL_VALUE 10
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 10
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Number of locks held to print for each InnoDB transaction in SHOW INNODB STATUS.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 1000
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT REQUIRED
++VARIABLE_NAME INNODB_SHOW_VERBOSE_LOCKS
++SESSION_VALUE NULL
++GLOBAL_VALUE 0
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE 0
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BIGINT UNSIGNED
++VARIABLE_COMMENT Whether to show records locked in SHOW INNODB STATUS.
++NUMERIC_MIN_VALUE 0
++NUMERIC_MAX_VALUE 1
++NUMERIC_BLOCK_SIZE 0
++ENUM_VALUE_LIST NULL
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_SIMULATE_COMP_FAILURES
+ SESSION_VALUE NULL
+ GLOBAL_VALUE 0
+@@ -2014,7 +2462,7 @@
+ DEFAULT_VALUE nulls_equal
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE ENUM
+-VARIABLE_COMMENT Specifies how InnoDB index statistics collection code should treat NULLs. Possible values are NULLS_EQUAL (default), NULLS_UNEQUAL and NULLS_IGNORED
++VARIABLE_COMMENT Specifies how InnoDB index statistics collection code should treat NULLs
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -2259,6 +2707,34 @@
+ ENUM_VALUE_LIST NULL
+ READ_ONLY NO
+ COMMAND_LINE_ARGUMENT OPTIONAL
++VARIABLE_NAME INNODB_TRACK_CHANGED_PAGES
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Track the redo log for changed pages and output a changed page bitmap
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_TRACK_REDO_LOG_NOW
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Force log tracker to catch up with checkpoint now
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_TRX_PURGE_VIEW_UPDATE_ONLY_DEBUG
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -2336,7 +2812,7 @@
+ DEFAULT_VALUE OFF
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE BOOLEAN
+-VARIABLE_COMMENT Prevent partial page writes, via atomic writes.The option is used to prevent partial writes in case of a crash/poweroff, as faster alternative to doublewrite buffer.Currently this option works only on Linux only with FusionIO device, and directFS filesystem.
++VARIABLE_COMMENT Prevent partial page writes, via atomic writes (beta). The option is used to prevent partial writes in case of a crash/poweroff, as faster alternative to doublewrite buffer. Currently this option works only on Linux only with FusionIO device, and directFS filesystem.
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
+@@ -2357,6 +2833,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_USE_GLOBAL_FLUSH_LOG_AT_TRX_COMMIT
++SESSION_VALUE NULL
++GLOBAL_VALUE ON
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE ON
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Use global innodb_flush_log_at_trx_commit value. (default: ON).
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY NO
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_USE_MTFLUSH
+ SESSION_VALUE NULL
+ GLOBAL_VALUE OFF
+@@ -2371,6 +2861,20 @@
+ ENUM_VALUE_LIST OFF,ON
+ READ_ONLY YES
+ COMMAND_LINE_ARGUMENT NONE
++VARIABLE_NAME INNODB_USE_STACKTRACE
++SESSION_VALUE NULL
++GLOBAL_VALUE OFF
++GLOBAL_VALUE_ORIGIN COMPILE-TIME
++DEFAULT_VALUE OFF
++VARIABLE_SCOPE GLOBAL
++VARIABLE_TYPE BOOLEAN
++VARIABLE_COMMENT Print stacktrace on long semaphore wait (off by default supported only on linux)
++NUMERIC_MIN_VALUE NULL
++NUMERIC_MAX_VALUE NULL
++NUMERIC_BLOCK_SIZE NULL
++ENUM_VALUE_LIST OFF,ON
++READ_ONLY YES
++COMMAND_LINE_ARGUMENT NONE
+ VARIABLE_NAME INNODB_USE_SYS_MALLOC
+ SESSION_VALUE NULL
+ GLOBAL_VALUE ON
+@@ -2401,12 +2905,12 @@
+ COMMAND_LINE_ARGUMENT OPTIONAL
+ VARIABLE_NAME INNODB_VERSION
+ SESSION_VALUE NULL
+-GLOBAL_VALUE 5.6.43
++GLOBAL_VALUE 5.6.42-84.2
+ GLOBAL_VALUE_ORIGIN COMPILE-TIME
+ DEFAULT_VALUE NULL
+ VARIABLE_SCOPE GLOBAL
+ VARIABLE_TYPE VARCHAR
+-VARIABLE_COMMENT InnoDB version
++VARIABLE_COMMENT Percona-InnoDB-plugin version
+ NUMERIC_MIN_VALUE NULL
+ NUMERIC_MAX_VALUE NULL
+ NUMERIC_BLOCK_SIZE NULL
diff --git a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
index 23a45f39896..5ec5b9ccf30 100644
--- a/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
+++ b/mysql-test/suite/sys_vars/r/sysvars_wsrep.result
@@ -29,6 +29,20 @@ NUMERIC_BLOCK_SIZE NULL
ENUM_VALUE_LIST OFF,ON
READ_ONLY NO
COMMAND_LINE_ARGUMENT OPTIONAL
+VARIABLE_NAME WSREP_CERTIFICATION_RULES
+SESSION_VALUE NULL
+GLOBAL_VALUE strict
+GLOBAL_VALUE_ORIGIN COMPILE-TIME
+DEFAULT_VALUE strict
+VARIABLE_SCOPE GLOBAL
+VARIABLE_TYPE ENUM
+VARIABLE_COMMENT Certification rules to use in the cluster. Possible values are: "strict": stricter rules that could result in more certification failures. "optimized": relaxed rules that allow more concurrency and cause less certification failures.
+NUMERIC_MIN_VALUE NULL
+NUMERIC_MAX_VALUE NULL
+NUMERIC_BLOCK_SIZE NULL
+ENUM_VALUE_LIST strict,optimized
+READ_ONLY NO
+COMMAND_LINE_ARGUMENT REQUIRED
VARIABLE_NAME WSREP_CERTIFY_NONPK
SESSION_VALUE NULL
GLOBAL_VALUE ON
diff --git a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
index d2a5ad46129..bc2301cfd39 100644
--- a/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
+++ b/mysql-test/suite/sys_vars/r/tmp_disk_table_size_func.result
@@ -18,7 +18,7 @@ Variable_name Value
Created_tmp_disk_tables 1
set @@session.tmp_disk_table_size=1000000;
select count(*) as c from t1 group by b having c>1;
-ERROR HY000: The table '#sql_xxx' is full
+ERROR HY000: The table '(temporary)' is full
show status like "created_tmp_disk%";
Variable_name Value
Created_tmp_disk_tables 2
diff --git a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
index 9c1e596d3e4..6b3d2e1fa1b 100644
--- a/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
+++ b/mysql-test/suite/sys_vars/t/tmp_disk_table_size_func.test
@@ -21,7 +21,6 @@ insert into t1 values (20000,"A");
select count(*) as c from t1 group by b having c>1;
show status like "created_tmp_disk%";
set @@session.tmp_disk_table_size=1000000;
---replace_regex /The table '.*' is full/The table '#sql_xxx' is full/
--error ER_RECORD_FILE_FULL
select count(*) as c from t1 group by b having c>1;
show status like "created_tmp_disk%";
diff --git a/mysql-test/suite/vcol/inc/vcol_keys.inc b/mysql-test/suite/vcol/inc/vcol_keys.inc
index 7c9f60c0fb0..8ec89daff0b 100644
--- a/mysql-test/suite/vcol/inc/vcol_keys.inc
+++ b/mysql-test/suite/vcol/inc/vcol_keys.inc
@@ -127,7 +127,6 @@ if ($with_foreign_keys) {
create table t1 (a int, b int as (a+1), foreign key (b) references t2(a));
create table t1 (a int, b int as (a+1));
---replace_regex /`#sql-.*`/`#sql-temporary`/
--error ER_CANT_CREATE_TABLE
alter table t1 add foreign key (b) references t2(a);
drop table t1;
diff --git a/mysql-test/suite/vcol/r/vcol_keys_innodb.result b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
index 242baba32af..c6c05429978 100644
--- a/mysql-test/suite/vcol/r/vcol_keys_innodb.result
+++ b/mysql-test/suite/vcol/r/vcol_keys_innodb.result
@@ -126,7 +126,7 @@ create table t1 (a int, b int as (a+1), foreign key (b) references t2(a));
ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
create table t1 (a int, b int as (a+1));
alter table t1 add foreign key (b) references t2(a);
-ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 150 "Foreign key constraint is incorrectly formed")
+ERROR HY000: Can't create table `test`.`t1` (errno: 150 "Foreign key constraint is incorrectly formed")
drop table t1;
# Allowed FK options.
create table t2 (a int primary key, b char(5));
diff --git a/mysys/mf_iocache2.c b/mysys/mf_iocache2.c
index 2bb36129c91..6bd6fb10c14 100644
--- a/mysys/mf_iocache2.c
+++ b/mysys/mf_iocache2.c
@@ -23,51 +23,56 @@
#include <stdarg.h>
#include <m_ctype.h>
-/*
- Copy contents of an IO_CACHE to a file.
-
- SYNOPSIS
- my_b_copy_to_file()
- cache IO_CACHE to copy from
- file File to copy to
-
- DESCRIPTION
- Copy the contents of the cache to the file. The cache will be
- re-inited to a read cache and will read from the beginning of the
- cache.
-
- If a failure to write fully occurs, the cache is only copied
- partially.
+/**
+ Copy the cache to the file. Copying can be constrained to @c count
+ number of bytes when the parameter is less than SIZE_T_MAX. The
+ cache will be optionally re-inited to a read cache and will read
+ from the beginning of the cache. If a failure to write fully
+ occurs, the cache is only copied partially.
TODO
- Make this function solid by handling partial reads from the cache
- in a correct manner: it should be atomic.
-
- RETURN VALUE
- 0 All OK
- 1 An error occurred
+ Make this function solid by handling partial reads from the cache
+ in a correct manner: it should be atomic.
+
+ @param cache IO_CACHE to copy from
+ @param file File to copy to
+ @param count the copied size or the max of the type
+ when the whole cache is to be copied.
+ @return
+ 0 All OK
+ 1 An error occurred
*/
int
-my_b_copy_to_file(IO_CACHE *cache, FILE *file)
+my_b_copy_to_file(IO_CACHE *cache, FILE *file,
+ size_t count)
{
- size_t bytes_in_cache;
+ size_t curr_write, bytes_in_cache;
DBUG_ENTER("my_b_copy_to_file");
- /* Reinit the cache to read from the beginning of the cache */
- if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE))
- DBUG_RETURN(1);
bytes_in_cache= my_b_bytes_in_cache(cache);
do
{
- if (my_fwrite(file, cache->read_pos, bytes_in_cache,
+ curr_write= MY_MIN(bytes_in_cache, count);
+ if (my_fwrite(file, cache->read_pos, curr_write,
MYF(MY_WME | MY_NABP)) == (size_t) -1)
DBUG_RETURN(1);
- } while ((bytes_in_cache= my_b_fill(cache)));
+
+ cache->read_pos += curr_write;
+ count -= curr_write;
+ } while (count && (bytes_in_cache= my_b_fill(cache)));
if(cache->error == -1)
DBUG_RETURN(1);
DBUG_RETURN(0);
}
+int my_b_copy_all_to_file(IO_CACHE *cache, FILE *file)
+{
+ DBUG_ENTER("my_b_copy_all_to_file");
+ /* Reinit the cache to read from the beginning of the cache */
+ if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE))
+ DBUG_RETURN(1);
+ DBUG_RETURN(my_b_copy_to_file(cache, file, SIZE_T_MAX));
+}
my_off_t my_b_append_tell(IO_CACHE* info)
{
diff --git a/mysys/my_delete.c b/mysys/my_delete.c
index cba24f90565..044c55d8fb1 100644
--- a/mysys/my_delete.c
+++ b/mysys/my_delete.c
@@ -18,6 +18,7 @@
#include <my_sys.h>
#ifdef _WIN32
+#include <direct.h> /* rmdir */
static int my_win_unlink(const char *name);
#endif
@@ -158,3 +159,63 @@ error:
DBUG_RETURN(-1);
}
#endif
+
+/*
+ Remove directory recursively.
+*/
+int my_rmtree(const char *dir, myf MyFlags)
+{
+ char path[FN_REFLEN];
+ char sep[] = { FN_LIBCHAR, 0 };
+ int err = 0;
+ uint i;
+
+ MY_DIR *dir_info = my_dir(dir, MYF(MY_DONT_SORT | MY_WANT_STAT));
+ if (!dir_info)
+ return 1;
+
+ for (i = 0; i < dir_info->number_of_files; i++)
+ {
+ FILEINFO *file = dir_info->dir_entry + i;
+ /* Skip "." and ".." */
+ if (!strcmp(file->name, ".") || !strcmp(file->name, ".."))
+ continue;
+
+ strxnmov(path, sizeof(path), dir, sep, file->name, NULL);
+
+ if (!MY_S_ISDIR(file->mystat->st_mode))
+ {
+ err = my_delete(path, MyFlags);
+#ifdef _WIN32
+ /*
+ On Windows, check and possible reset readonly attribute.
+ my_delete(), or DeleteFile does not remove theses files.
+ */
+ if (err)
+ {
+ DWORD attr = GetFileAttributes(path);
+ if (attr != INVALID_FILE_ATTRIBUTES &&
+ (attr & FILE_ATTRIBUTE_READONLY))
+ {
+ SetFileAttributes(path, attr &~FILE_ATTRIBUTE_READONLY);
+ err = my_delete(path, MyFlags);
+ }
+ }
+#endif
+ }
+ else
+ err = my_rmtree(path, MyFlags);
+
+ if (err)
+ break;
+ }
+
+ my_dirend(dir_info);
+
+ if (!err)
+ err = rmdir(dir);
+
+ return err;
+}
+
+
diff --git a/mysys/my_file.c b/mysys/my_file.c
index a23ab487d00..23226595b2e 100644
--- a/mysys/my_file.c
+++ b/mysys/my_file.c
@@ -52,10 +52,9 @@ static uint set_max_open_files(uint max_file_limit)
DBUG_PRINT("info", ("rlim_cur: %u rlim_max: %u",
(uint) rlimit.rlim_cur,
(uint) rlimit.rlim_max));
- if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY)
- rlimit.rlim_cur = max_file_limit;
- if (rlimit.rlim_cur >= max_file_limit)
- DBUG_RETURN(rlimit.rlim_cur); /* purecov: inspected */
+ if ((ulonglong) rlimit.rlim_cur == (ulonglong) RLIM_INFINITY ||
+ rlimit.rlim_cur >= max_file_limit)
+ DBUG_RETURN(max_file_limit);
rlimit.rlim_cur= rlimit.rlim_max= max_file_limit;
if (setrlimit(RLIMIT_NOFILE, &rlimit))
max_file_limit= old_cur; /* Use original value */
diff --git a/mysys/my_malloc.c b/mysys/my_malloc.c
index cdf59d4b8cc..05bc5349b35 100644
--- a/mysys/my_malloc.c
+++ b/mysys/my_malloc.c
@@ -116,6 +116,7 @@ void *my_malloc(size_t size, myf my_flags)
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
update_malloc_size(size + MALLOC_PREFIX_SIZE,
MY_TEST(my_flags & MY_THREAD_SPECIFIC));
+ TRASH_ALLOC(point, size);
DBUG_EXECUTE_IF("simulate_out_of_memory",
{
/* my_free() handles memory accounting */
diff --git a/plugin/aws_key_management/CMakeLists.txt b/plugin/aws_key_management/CMakeLists.txt
index b6f48cd18a0..248d56e8d76 100644
--- a/plugin/aws_key_management/CMakeLists.txt
+++ b/plugin/aws_key_management/CMakeLists.txt
@@ -11,4 +11,4 @@ MYSQL_ADD_PLUGIN(aws_key_management
IF(TARGET aws_key_management)
USE_AWS_SDK_LIBS(aws_key_management kms)
-ENDIF() \ No newline at end of file
+ENDIF()
diff --git a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
index 2adc6811f3f..a095dace6cb 100644
--- a/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
+++ b/plugin/wsrep_info/mysql-test/wsrep_info/suite.pm
@@ -32,10 +32,12 @@ push @::global_suppressions,
qr(WSREP: Failed to send state UUID:.*),
qr(WSREP: wsrep_sst_receive_address.*),
qr(WSREP: Could not open saved state file for reading: .*),
+ qr(WSREP: Could not open state file for reading: .*),
qr(WSREP: last inactive check more than .* skipping check),
qr(WSREP: Gap in state sequence. Need state transfer.),
qr(WSREP: Failed to prepare for incremental state transfer: .*),
qr(WSREP: SYNC message from member .* in non-primary configuration. Ignored.),
+ qr|WSREP: access file\(.*gvwstate.dat\) failed\(No such file or directory\)|,
);
diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh
index 54b5bed4546..4ab486186f4 100644
--- a/scripts/mysql_install_db.sh
+++ b/scripts/mysql_install_db.sh
@@ -41,6 +41,9 @@ auth_root_authentication_method=socket
auth_root_socket_user=""
skip_test_db=0
+dirname0=`dirname $0 2>/dev/null`
+dirname0=`dirname $dirname0 2>/dev/null`
+
usage()
{
cat <<EOF
@@ -242,11 +245,6 @@ cannot_find_file()
echo "If you don't want to do a full install, you can use the --srcdir"
echo "option to only install the mysql database and privilege tables"
echo
- echo "If you compiled from source, you need to either run 'make install' to"
- echo "copy the software into the correct location ready for operation."
- echo "If you don't want to do a full install, you can use the --srcdir"
- echo "option to only install the mysql database and privilege tables"
- echo
echo "If you are using a binary release, you must either be at the top"
echo "level of the extracted archive, or pass the --basedir option"
echo "pointing to that location."
@@ -287,6 +285,9 @@ then
cannot_find_file my_print_defaults $basedir/bin $basedir/extra
exit 1
fi
+elif test -n "$dirname0" -a -x "$dirname0/@bindir@/my_print_defaults"
+then
+ print_defaults="$dirname0/@bindir@/my_print_defaults"
else
print_defaults="@bindir@/my_print_defaults"
fi
@@ -302,6 +303,8 @@ fi
parse_arguments `"$print_defaults" $defaults $defaults_group_suffix --mysqld mysql_install_db`
parse_arguments PICK-ARGS-FROM-ARGV "$@"
+rel_mysqld="$dirname0/@INSTALL_SBINDIR@/mysqld"
+
# Configure paths to support files
if test -n "$srcdir"
then
@@ -344,6 +347,17 @@ then
fi
plugindir=`find_in_dirs --dir auth_socket.so $basedir/lib*/plugin $basedir/lib*/mysql/plugin`
pamtooldir=$plugindir
+# relative from where the script was run for a relocatable install
+elif test -n "$dirname0" -a -x "$rel_mysqld" -a ! "$rel_mysqld" -ef "@sbindir@/mysqld"
+then
+ basedir="$dirname0"
+ bindir="$basedir/@INSTALL_BINDIR@"
+ resolveip="$bindir/resolveip"
+ mysqld="$rel_mysqld"
+ srcpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ buildpkgdatadir="$basedir/@INSTALL_MYSQLSHAREDIR@"
+ plugindir="$basedir/@INSTALL_PLUGINDIR@"
+ pamtooldir=$plugindir
else
basedir="@prefix@"
bindir="@bindir@"
diff --git a/scripts/wsrep_sst_mariabackup.sh b/scripts/wsrep_sst_mariabackup.sh
index 1e018f1a515..b01833fe224 100644
--- a/scripts/wsrep_sst_mariabackup.sh
+++ b/scripts/wsrep_sst_mariabackup.sh
@@ -516,7 +516,7 @@ kill_xtrabackup()
setup_ports()
{
if [[ "$WSREP_SST_OPT_ROLE" == "donor" ]];then
- if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then
+ if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then
remain=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\][:/]' '{ print $2 }')
REMOTEIP=$(echo $WSREP_SST_OPT_ADDR | awk -F '\\]:' '{ print $1 }')"]"
SST_PORT=$(echo $remain | awk -F '[:/]' '{ print $1 }')
@@ -529,7 +529,7 @@ setup_ports()
sst_ver=$(echo $WSREP_SST_OPT_ADDR | awk -F '[:/]' '{ print $5 }')
fi
else
- if [[ ${WSREP_SST_OPT_ADDR:0:1} == '[' ]];then
+ if [ "${WSREP_SST_OPT_ADDR#\[}" != "$WSREP_SST_OPT_ADDR" ]; then
SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $2 }')
else
SST_PORT=$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $2 }')
@@ -972,7 +972,7 @@ then
if [ -z "${SST_PORT}" ]
then
SST_PORT=4444
- if [[ ${ADDR:0:1} == '[' ]];then
+ if [ "${ADDR#\[}" != "$ADDR" ]; then
ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F '\\]:' '{ print $1 }')]:${SST_PORT}"
else
ADDR="$(echo ${WSREP_SST_OPT_ADDR} | awk -F ':' '{ print $1 }'):${SST_PORT}"
diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh
index 6a71d7bbfb3..e78beefce8f 100644
--- a/scripts/wsrep_sst_rsync.sh
+++ b/scripts/wsrep_sst_rsync.sh
@@ -400,7 +400,7 @@ then
rm -rf "$RSYNC_PID"
ADDR=$WSREP_SST_OPT_ADDR
- if [[ ${ADDR:0:1} == '[' ]]; then
+ if [ "${ADDR#\[}" != "$ADDR" ]; then
RSYNC_PORT=$(echo $ADDR | awk -F '\\]:' '{ print $2 }')
RSYNC_ADDR=$(echo $ADDR | awk -F '\\]:' '{ print $1 }')"]"
else
diff --git a/sql-common/client.c b/sql-common/client.c
index 69404e43613..c66cb1a749d 100644
--- a/sql-common/client.c
+++ b/sql-common/client.c
@@ -112,6 +112,12 @@ my_bool net_flush(NET *net);
#include <my_context.h>
#include <mysql_async.h>
+typedef enum {
+ ALWAYS_ACCEPT, /* heuristics is disabled, use CLIENT_LOCAL_FILES */
+ WAIT_FOR_QUERY, /* heuristics is enabled, not sending files */
+ ACCEPT_FILE_REQUEST /* heuristics is enabled, ready to send a file */
+} auto_local_infile_state;
+
#define native_password_plugin_name "mysql_native_password"
#define old_password_plugin_name "mysql_old_password"
@@ -1375,8 +1381,10 @@ mysql_init(MYSQL *mysql)
--enable-local-infile
*/
-#if defined(ENABLED_LOCAL_INFILE) && !defined(MYSQL_SERVER)
+#if ENABLED_LOCAL_INFILE && !defined(MYSQL_SERVER)
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
+ mysql->auto_local_infile= ENABLED_LOCAL_INFILE == LOCAL_INFILE_MODE_AUTO
+ ? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
#endif
mysql->options.methods_to_use= MYSQL_OPT_GUESS_CONNECTION;
@@ -3696,8 +3704,14 @@ static my_bool cli_read_query_result(MYSQL *mysql)
ulong field_count;
MYSQL_DATA *fields;
ulong length;
+#ifdef MYSQL_CLIENT
+ my_bool can_local_infile= mysql->auto_local_infile != WAIT_FOR_QUERY;
+#endif
DBUG_ENTER("cli_read_query_result");
+ if (mysql->auto_local_infile == ACCEPT_FILE_REQUEST)
+ mysql->auto_local_infile= WAIT_FOR_QUERY;
+
if ((length = cli_safe_read(mysql)) == packet_error)
DBUG_RETURN(1);
free_old_query(mysql); /* Free old result */
@@ -3734,7 +3748,8 @@ get_info:
{
int error;
- if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES))
+ if (!(mysql->options.client_flag & CLIENT_LOCAL_FILES) ||
+ !can_local_infile)
{
set_mysql_error(mysql, CR_MALFORMED_PACKET, unknown_sqlstate);
DBUG_RETURN(1);
@@ -3772,6 +3787,13 @@ int STDCALL
mysql_send_query(MYSQL* mysql, const char* query, ulong length)
{
DBUG_ENTER("mysql_send_query");
+ if (mysql->options.client_flag & CLIENT_LOCAL_FILES &&
+ mysql->auto_local_infile == WAIT_FOR_QUERY &&
+ (*query == 'l' || *query == 'L'))
+ {
+ if (strncasecmp(query, STRING_WITH_LEN("load")) == 0)
+ mysql->auto_local_infile= ACCEPT_FILE_REQUEST;
+ }
DBUG_RETURN(simple_command(mysql, COM_QUERY, (uchar*) query, length, 1));
}
@@ -3985,10 +4007,12 @@ mysql_options(MYSQL *mysql,enum mysql_option option, const void *arg)
mysql->options.protocol=MYSQL_PROTOCOL_PIPE; /* Force named pipe */
break;
case MYSQL_OPT_LOCAL_INFILE: /* Allow LOAD DATA LOCAL ?*/
- if (!arg || MY_TEST(*(uint*) arg))
+ if (!arg || *(uint*) arg)
mysql->options.client_flag|= CLIENT_LOCAL_FILES;
else
mysql->options.client_flag&= ~CLIENT_LOCAL_FILES;
+ mysql->auto_local_infile= arg && *(uint*)arg == LOCAL_INFILE_MODE_AUTO
+ ? WAIT_FOR_QUERY : ALWAYS_ACCEPT;
break;
case MYSQL_INIT_COMMAND:
add_init_command(&mysql->options,arg);
diff --git a/sql/field.cc b/sql/field.cc
index bb4a0f06fc4..6fe6af2d303 100644
--- a/sql/field.cc
+++ b/sql/field.cc
@@ -8975,7 +8975,7 @@ int Field_geom::store(const char *from, size_t length, CHARSET_INFO *cs)
(uint32) geom_type != wkb_type)
{
const char *db= table->s->db.str;
- const char *tab_name= table->s->error_table_name();
+ const char *tab_name= table->s->table_name.str;
if (!db)
db= "";
@@ -11022,7 +11022,7 @@ void Field::set_warning_truncated_wrong_value(const char *type_arg,
{
THD *thd= get_thd();
const char *db_name= table->s->db.str;
- const char *table_name= table->s->error_table_name();
+ const char *table_name= table->s->table_name.str;
if (!db_name)
db_name= "";
diff --git a/sql/item.cc b/sql/item.cc
index a6b4402b6ba..47e10ba4004 100644
--- a/sql/item.cc
+++ b/sql/item.cc
@@ -1952,7 +1952,12 @@ bool Item_name_const::is_null()
Item_name_const::Item_name_const(THD *thd, Item *name_arg, Item *val):
Item_fixed_hybrid(thd), value_item(val), name_item(name_arg)
{
+ StringBuffer<128> name_buffer;
+ String *name_str;
Item::maybe_null= TRUE;
+ if (name_item->basic_const_item() &&
+ (name_str= name_item->val_str(&name_buffer))) // Can't have a NULL name
+ set_name(thd, name_str->ptr(), name_str->length(), name_str->charset());
}
@@ -1988,25 +1993,14 @@ Item::Type Item_name_const::type() const
bool Item_name_const::fix_fields(THD *thd, Item **ref)
{
- char buf[128];
- String *item_name;
- String s(buf, sizeof(buf), &my_charset_bin);
- s.length(0);
-
if (value_item->fix_fields_if_needed(thd, &value_item) ||
name_item->fix_fields_if_needed(thd, &name_item) ||
!value_item->const_item() ||
- !name_item->const_item() ||
- !(item_name= name_item->val_str(&s))) // Can't have a NULL name
+ !name_item->const_item())
{
my_error(ER_RESERVED_SYNTAX, MYF(0), "NAME_CONST");
return TRUE;
}
- if (is_autogenerated_name)
- {
- set_name(thd, item_name->c_ptr(), (uint) item_name->length(),
- system_charset_info);
- }
if (value_item->collation.derivation == DERIVATION_NUMERIC)
collation.set_numeric();
else
diff --git a/sql/item_func.cc b/sql/item_func.cc
index ef0dc0ba34b..e6b57750ec7 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -4477,7 +4477,7 @@ bool Item_func_set_user_var::register_field_in_bitmap(void *arg)
true failure
*/
-static bool
+bool
update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
Item_result type, CHARSET_INFO *cs,
bool unsigned_arg)
diff --git a/sql/item_func.h b/sql/item_func.h
index 6408cf4dd55..e4dc1d80bf9 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -3436,4 +3436,8 @@ bool eval_const_cond(COND *cond);
extern bool volatile mqh_used;
+bool update_hash(user_var_entry *entry, bool set_null, void *ptr, size_t length,
+ Item_result type, CHARSET_INFO *cs,
+ bool unsigned_arg);
+
#endif /* ITEM_FUNC_INCLUDED */
diff --git a/sql/log.cc b/sql/log.cc
index a4a2b4b1e37..a89be15a0d7 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2016, Oracle and/or its affiliates.
- Copyright (c) 2009, 2017, MariaDB Corporation.
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2009, 2019, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -3994,7 +3994,7 @@ int MYSQL_BIN_LOG::find_log_pos(LOG_INFO *linfo, const char *log_name,
// if the log entry matches, null string matching anything
if (!log_name ||
(log_name_len == fname_len &&
- !memcmp(full_fname, full_log_name, log_name_len)))
+ !strncmp(full_fname, full_log_name, log_name_len)))
{
DBUG_PRINT("info", ("Found log file entry"));
linfo->index_file_start_offset= offset;
diff --git a/sql/log_event.cc b/sql/log_event.cc
index bbadda3167e..70f0e6c2623 100644
--- a/sql/log_event.cc
+++ b/sql/log_event.cc
@@ -3685,9 +3685,23 @@ void free_table_map_log_event(Table_map_log_event *event)
delete event;
}
+/**
+ Encode the event, optionally per 'do_print_encoded' arg store the
+ result into the argument cache; optionally per event_info's
+ 'verbose' print into the cache a verbose representation of the event.
+ Note, no extra wrapping is done to the being io-cached data, like
+ to producing a BINLOG query. It's left for a routine that extracts from
+ the cache.
+
+ @param file pointer to IO_CACHE
+ @param print_event_info pointer to print_event_info specializing
+ what out of and how to print the event
+ @param do_print_encoded whether to store base64-encoded event
+ into @file.
+*/
bool Log_event::print_base64(IO_CACHE* file,
PRINT_EVENT_INFO* print_event_info,
- bool more)
+ bool do_print_encoded)
{
uchar *ptr= (uchar *)temp_buf;
uint32 size= uint4korr(ptr + EVENT_LEN_OFFSET);
@@ -3738,12 +3752,9 @@ bool Log_event::print_base64(IO_CACHE* file,
delete ev;
}
- if (print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
- print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
- ! print_event_info->short_form)
+ if (do_print_encoded)
{
size_t const tmp_str_sz= my_base64_needed_encoded_length((int) size);
- bool error= 0;
char *tmp_str;
if (!(tmp_str= (char *) my_malloc(tmp_str_sz, MYF(MY_WME))))
goto err;
@@ -3753,17 +3764,8 @@ bool Log_event::print_base64(IO_CACHE* file,
DBUG_ASSERT(0);
}
- if (my_b_tell(file) == 0)
- if (unlikely(my_b_write_string(file, "\nBINLOG '\n")))
- error= 1;
- if (likely(!error) && unlikely(my_b_printf(file, "%s\n", tmp_str)))
- error= 1;
- if (!more && likely(!error))
- if (unlikely(my_b_printf(file, "'%s\n", print_event_info->delimiter)))
- error= 1;
+ my_b_printf(file, "%s\n", tmp_str);
my_free(tmp_str);
- if (unlikely(error))
- goto err;
}
#ifdef WHEN_FLASHBACK_REVIEW_READY
@@ -3877,9 +3879,22 @@ bool Log_event::print_base64(IO_CACHE* file,
}
#else
if (print_event_info->verbose)
+ {
+ /*
+ Verbose event printout can't start before encoded data
+ got enquoted. This is done at this point though multi-row
+ statement remain vulnerable.
+ TODO: fix MDEV-10362 to remove this workaround.
+ */
+ if (print_event_info->base64_output_mode !=
+ BASE64_OUTPUT_DECODE_ROWS)
+ my_b_printf(file, "'%s\n", print_event_info->delimiter);
error= ev->print_verbose(file, print_event_info);
+ }
else
+ {
ev->count_row_events(print_event_info);
+ }
#endif
delete ev;
if (unlikely(error))
@@ -5585,6 +5600,22 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
else
thd->variables.collation_database= thd->db_charset;
+ {
+ const CHARSET_INFO *cs= thd->charset();
+ /*
+ We cannot ask for parsing a statement using a character set
+ without state_maps (parser internal data).
+ */
+ if (!cs->state_map)
+ {
+ rli->report(ERROR_LEVEL, ER_SLAVE_FATAL_ERROR,
+ ER_THD(thd, ER_SLAVE_FATAL_ERROR),
+ "character_set cannot be parsed");
+ thd->is_slave_error= true;
+ goto end;
+ }
+ }
+
/*
Record any GTID in the same transaction, so slave state is
transactionally consistent.
@@ -6023,11 +6054,18 @@ bool Start_log_event_v3::print(FILE* file, PRINT_EVENT_INFO* print_event_info)
print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
!print_event_info->short_form)
{
- if (print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS)
- if (my_b_printf(&cache, "BINLOG '\n"))
- goto err;
- if (print_base64(&cache, print_event_info, FALSE))
+ /* BINLOG is matched with the delimiter below on the same level */
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS;
+ if (do_print_encoded)
+ my_b_printf(&cache, "BINLOG '\n");
+
+ if (print_base64(&cache, print_event_info, do_print_encoded))
goto err;
+
+ if (do_print_encoded)
+ my_b_printf(&cache, "'%s\n", print_event_info->delimiter);
+
print_event_info->printed_fd_event= TRUE;
}
DBUG_RETURN(cache.flush_data());
@@ -9189,12 +9227,6 @@ User_var_log_event(const char* buf, uint event_len,
val_len= uint4korr(buf + UV_VAL_IS_NULL + UV_VAL_TYPE_SIZE +
UV_CHARSET_NUMBER_SIZE);
- if (val + val_len > buf_end)
- {
- error= true;
- goto err;
- }
-
/**
We need to check if this is from an old server
that did not pack information for flags.
@@ -10969,7 +11001,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len,
DBUG_VOID_RETURN;
}
size_t const data_size= event_len - read_size;
- DBUG_PRINT("info",("m_table_id: %lu m_flags: %d m_width: %lu data_size: %lu",
+ DBUG_PRINT("info",("m_table_id: %llu m_flags: %d m_width: %lu data_size: %lu",
m_table_id, m_flags, m_width, (ulong) data_size));
m_rows_buf= (uchar*) my_malloc(data_size, MYF(MY_WME));
@@ -11182,12 +11214,12 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
DBUG_ENTER("Rows_log_event::do_apply_event(Relay_log_info*)");
int error= 0;
/*
- If m_table_id == ~0UL, then we have a dummy event that does not
+ If m_table_id == ~0ULL, then we have a dummy event that does not
contain any data. In that case, we just remove all tables in the
tables_to_lock list, close the thread tables, and return with
success.
*/
- if (m_table_id == ~0UL)
+ if (m_table_id == ~0ULL)
{
/*
This one is supposed to be set: just an extra check so that
@@ -11453,7 +11485,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
table= m_table= rgi->m_table_map.get_table(m_table_id);
- DBUG_PRINT("debug", ("m_table:%p, m_table_id: %lu%s",
+ DBUG_PRINT("debug", ("m_table:%p, m_table_id: %llu%s",
m_table, m_table_id,
table && master_had_triggers ?
" (master had triggers)" : ""));
@@ -11819,14 +11851,14 @@ Rows_log_event::do_update_pos(rpl_group_info *rgi)
bool Rows_log_event::write_data_header()
{
uchar buf[ROWS_HEADER_LEN_V2]; // No need to init the buffer
- DBUG_ASSERT(m_table_id != ~0UL);
+ DBUG_ASSERT(m_table_id != ~0ULL);
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{
int4store(buf + 0, m_table_id);
int2store(buf + 4, m_flags);
return (write_data(buf, 6));
});
- int6store(buf + RW_MAPID_OFFSET, (ulonglong)m_table_id);
+ int6store(buf + RW_MAPID_OFFSET, m_table_id);
int2store(buf + RW_FLAGS_OFFSET, m_flags);
return write_data(buf, ROWS_HEADER_LEN);
}
@@ -11894,12 +11926,226 @@ void Rows_log_event::pack_info(Protocol *protocol)
char const *const flagstr=
get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
size_t bytes= my_snprintf(buf, sizeof(buf),
- "table_id: %lu%s", m_table_id, flagstr);
+ "table_id: %llu%s", m_table_id, flagstr);
protocol->store(buf, bytes, &my_charset_bin);
}
#endif
#ifdef MYSQL_CLIENT
+
+const char str_binlog[]= "\nBINLOG '\n";
+const char fmt_delim[]= "'%s\n";
+const char fmt_n_delim[]= "\n'%s";
+const char fmt_frag[]= "\nSET @binlog_fragment_%d ='\n";
+const char fmt_binlog2[]= "BINLOG @binlog_fragment_0, @binlog_fragment_1%s\n";
+
+/**
+ Print an event "body" cache to @c file possibly in two fragments.
+ Each fragement is optionally per @c do_wrap to produce an SQL statement.
+
+ @param file a file to print to
+ @param body the "body" IO_CACHE of event
+ @param do_wrap whether to wrap base64-encoded strings with
+ SQL cover.
+ @param delimiter delimiter string
+
+ @param is_verbose MDEV-10362 workraround parameter to pass
+ info on presence of verbose printout in cache encoded data
+
+ The function signals on any error through setting @c body->error to -1.
+*/
+bool copy_cache_to_file_wrapped(IO_CACHE *body,
+ FILE *file,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose)
+{
+ const my_off_t cache_size= my_b_tell(body);
+
+ if (reinit_io_cache(body, READ_CACHE, 0L, FALSE, FALSE))
+ goto err;
+
+ if (!do_wrap)
+ {
+ my_b_copy_to_file(body, file, SIZE_T_MAX);
+ }
+ else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
+ opt_binlog_rows_event_max_encoded_size)
+ {
+ /*
+ 2 fragments can always represent near 1GB row-based
+ base64-encoded event as two strings each of size less than
+ max(max_allowed_packet). Greater number of fragments does not
+ save from potential need to tweak (increase) @@max_allowed_packet
+ before to process the fragments. So 2 is safe and enough.
+
+ Split the big query when its packet size's estimation exceeds a
+ limit. The estimate includes the maximum packet header
+ contribution of non-compressed packet.
+ */
+ my_fprintf(file, fmt_frag, 0);
+ if (my_b_copy_to_file(body, file, (size_t) cache_size/2 + 1))
+ goto err;
+ my_fprintf(file, fmt_n_delim, delimiter);
+
+ my_fprintf(file, fmt_frag, 1);
+ if (my_b_copy_to_file(body, file, SIZE_T_MAX))
+ goto err;
+ if (!is_verbose)
+ my_fprintf(file, fmt_delim, delimiter);
+
+ my_fprintf(file, fmt_binlog2, delimiter);
+ }
+ else
+ {
+ my_fprintf(file, str_binlog);
+ if (my_b_copy_to_file(body, file, SIZE_T_MAX))
+ goto err;
+ if (!is_verbose)
+ my_fprintf(file, fmt_delim, delimiter);
+ }
+ reinit_io_cache(body, WRITE_CACHE, 0, FALSE, TRUE);
+
+ return false;
+
+err:
+ body->error = -1;
+ return true;
+}
+
+
+/**
+ Print an event "body" cache to @c file possibly in two fragments.
+ Each fragement is optionally per @c do_wrap to produce an SQL statement.
+
+ @param file a file to print to
+ @param body the "body" IO_CACHE of event
+ @param do_wrap whether to wrap base64-encoded strings with
+ SQL cover.
+ @param delimiter delimiter string
+
+ The function signals on any error through setting @c body->error to -1.
+*/
+bool copy_cache_to_string_wrapped(IO_CACHE *cache,
+ LEX_STRING *to,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose)
+{
+ const my_off_t cache_size= my_b_tell(cache);
+ // contribution to total size estimate of formating
+ const size_t fmt_size=
+ sizeof(str_binlog) + 2*(sizeof(fmt_frag) + 2 /* %d */) +
+ sizeof(fmt_delim) + sizeof(fmt_n_delim) +
+ sizeof(fmt_binlog2) +
+ 3*PRINT_EVENT_INFO::max_delimiter_size;
+
+ if (reinit_io_cache(cache, READ_CACHE, 0L, FALSE, FALSE))
+ goto err;
+
+ if (!(to->str= (char*) my_malloc((size_t)cache->end_of_file + fmt_size,
+ MYF(0))))
+ {
+ perror("Out of memory: can't allocate memory in "
+ "copy_cache_to_string_wrapped().");
+ goto err;
+ }
+
+ if (!do_wrap)
+ {
+ if (my_b_read(cache, (uchar*) to->str,
+ (to->length= (size_t)cache->end_of_file)))
+ goto err;
+ }
+ else if (4 + sizeof(str_binlog) + cache_size + sizeof(fmt_delim) >
+ opt_binlog_rows_event_max_encoded_size)
+ {
+ /*
+ 2 fragments can always represent near 1GB row-based
+ base64-encoded event as two strings each of size less than
+ max(max_allowed_packet). Greater number of fragments does not
+ save from potential need to tweak (increase) @@max_allowed_packet
+ before to process the fragments. So 2 is safe and enough.
+
+ Split the big query when its packet size's estimation exceeds a
+ limit. The estimate includes the maximum packet header
+ contribution of non-compressed packet.
+ */
+ char *str= to->str;
+ size_t add_to_len;
+
+ str += (to->length= sprintf(str, fmt_frag, 0));
+ if (my_b_read(cache, (uchar*) str, (uint32) (cache_size/2 + 1)))
+ goto err;
+ str += (add_to_len = (uint32) (cache_size/2 + 1));
+ to->length += add_to_len;
+ str += (add_to_len= sprintf(str, fmt_n_delim, delimiter));
+ to->length += add_to_len;
+
+ str += (add_to_len= sprintf(str, fmt_frag, 1));
+ to->length += add_to_len;
+ if (my_b_read(cache, (uchar*) str, uint32(cache->end_of_file - (cache_size/2 + 1))))
+ goto err;
+ str += (add_to_len= uint32(cache->end_of_file - (cache_size/2 + 1)));
+ to->length += add_to_len;
+ if (!is_verbose)
+ {
+ str += (add_to_len= sprintf(str , fmt_delim, delimiter));
+ to->length += add_to_len;
+ }
+ to->length += sprintf(str, fmt_binlog2, delimiter);
+ }
+ else
+ {
+ char *str= to->str;
+
+ str += (to->length= sprintf(str, str_binlog));
+ if (my_b_read(cache, (uchar*) str, (size_t)cache->end_of_file))
+ goto err;
+ str += cache->end_of_file;
+ to->length += (size_t)cache->end_of_file;
+ if (!is_verbose)
+ to->length += sprintf(str , fmt_delim, delimiter);
+ }
+
+ reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE);
+
+ return false;
+
+err:
+ cache->error= -1;
+ return true;
+}
+
+/**
+ The function invokes base64 encoder to run on the current
+ event string and store the result into two caches.
+ When the event ends the current statement the caches are is copied into
+ the argument file.
+ Copying is also concerned how to wrap the event, specifically to produce
+ a valid SQL syntax.
+ When the encoded data size is within max(MAX_ALLOWED_PACKET)
+ a regular BINLOG query is composed. Otherwise it is build as fragmented
+
+ SET @binlog_fragment_0='...';
+ SET @binlog_fragment_1='...';
+ BINLOG @binlog_fragment_0, @binlog_fragment_1;
+
+ where fragments are represented by a pair of indexed user
+ "one shot" variables.
+
+ @note
+ If any changes made don't forget to duplicate them to
+ Old_rows_log_event as long as it's supported.
+
+ @param file pointer to IO_CACHE
+ @param print_event_info pointer to print_event_info specializing
+ what out of and how to print the event
+ @param name the name of a table that the event operates on
+
+ The function signals on any error of cache access through setting
+ that cache's @c error to -1.
+*/
bool Rows_log_event::print_helper(FILE *file,
PRINT_EVENT_INFO *print_event_info,
char const *const name)
@@ -11909,18 +12155,24 @@ bool Rows_log_event::print_helper(FILE *file,
#ifdef WHEN_FLASHBACK_REVIEW_READY
IO_CACHE *const sql= &print_event_info->review_sql_cache;
#endif
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
+ !print_event_info->short_form;
bool const last_stmt_event= get_flags(STMT_END_F);
if (!print_event_info->short_form)
{
+ char llbuff[22];
+
print_header(head, print_event_info, !last_stmt_event);
- if (my_b_printf(head, "\t%s: table id %lu%s\n",
- name, m_table_id,
+ if (my_b_printf(head, "\t%s: table id %s%s\n",
+ name, ullstr(m_table_id, llbuff),
last_stmt_event ? " flags: STMT_END_F" : ""))
goto err;
}
if (!print_event_info->short_form || print_event_info->print_row_count)
- if (print_base64(body, print_event_info, !last_stmt_event))
+ if (print_base64(body, print_event_info, do_print_encoded))
goto err;
if (last_stmt_event)
@@ -11928,25 +12180,31 @@ bool Rows_log_event::print_helper(FILE *file,
if (!is_flashback)
{
if (copy_event_cache_to_file_and_reinit(head, file) ||
- copy_event_cache_to_file_and_reinit(body, file))
+ copy_cache_to_file_wrapped(body, file, do_print_encoded,
+ print_event_info->delimiter,
+ print_event_info->verbose))
goto err;
}
else
{
- LEX_STRING tmp_str;
- if (copy_event_cache_to_string_and_reinit(head, &tmp_str))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length); // Not \0 terminated
- my_free(tmp_str.str);
- if (copy_event_cache_to_string_and_reinit(body, &tmp_str))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length);
- my_free(tmp_str.str);
+ LEX_STRING tmp_str;
+
+ if (copy_event_cache_to_string_and_reinit(head, &tmp_str))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length); // Not \0 terminated);
+ my_free(tmp_str.str);
+
+ if (copy_cache_to_string_wrapped(body, &tmp_str, do_print_encoded,
+ print_event_info->delimiter,
+ print_event_info->verbose))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length);
+ my_free(tmp_str.str);
#ifdef WHEN_FLASHBACK_REVIEW_READY
- if (copy_event_cache_to_string_and_reinit(sql, &tmp_str))
- return 1;
- output_buf.append(tmp_str.str, tmp_str.length);
- my_free(tmp_str.str);
+ if (copy_event_cache_to_string_and_reinit(sql, &tmp_str))
+ return 1;
+ output_buf.append(tmp_str.str, tmp_str.length);
+ my_free(tmp_str.str);
#endif
}
}
@@ -12217,7 +12475,7 @@ Table_map_log_event::Table_map_log_event(THD *thd, TABLE *tbl, ulong tid,
uchar cbuf[MAX_INT_WIDTH];
uchar *cbuf_end;
DBUG_ENTER("Table_map_log_event::Table_map_log_event(TABLE)");
- DBUG_ASSERT(m_table_id != ~0UL);
+ DBUG_ASSERT(m_table_id != ~0ULL);
/*
In TABLE_SHARE, "db" and "table_name" are 0-terminated (see this comment in
table.cc / alloc_table_share():
@@ -12302,7 +12560,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
#endif
m_dbnam(NULL), m_dblen(0), m_tblnam(NULL), m_tbllen(0),
m_colcnt(0), m_coltype(0),
- m_memory(NULL), m_table_id(ULONG_MAX), m_flags(0),
+ m_memory(NULL), m_table_id(ULONGLONG_MAX), m_flags(0),
m_data_size(0), m_field_metadata(0), m_field_metadata_size(0),
m_null_bits(0), m_meta_memory(NULL)
{
@@ -12339,7 +12597,7 @@ Table_map_log_event::Table_map_log_event(const char *buf, uint event_len,
post_start+= TM_FLAGS_OFFSET;
}
- DBUG_ASSERT(m_table_id != ~0UL);
+ DBUG_ASSERT(m_table_id != ~0ULL);
m_flags= uint2korr(post_start);
@@ -12659,7 +12917,7 @@ int Table_map_log_event::do_apply_event(rpl_group_info *rgi)
table_list->updating= 1;
table_list->required_type= TABLE_TYPE_NORMAL;
- DBUG_PRINT("debug", ("table: %s is mapped to %lu",
+ DBUG_PRINT("debug", ("table: %s is mapped to %llu",
table_list->table_name.str,
table_list->table_id));
table_list->master_had_triggers= ((m_flags & TM_BIT_HAS_TRIGGERS_F) ? 1 : 0);
@@ -12761,7 +13019,7 @@ int Table_map_log_event::do_update_pos(rpl_group_info *rgi)
#ifndef MYSQL_CLIENT
bool Table_map_log_event::write_data_header()
{
- DBUG_ASSERT(m_table_id != ~0UL);
+ DBUG_ASSERT(m_table_id != ~0ULL);
uchar buf[TABLE_MAP_HEADER_LEN];
DBUG_EXECUTE_IF("old_row_based_repl_4_byte_map_id_master",
{
@@ -12769,7 +13027,7 @@ bool Table_map_log_event::write_data_header()
int2store(buf + 4, m_flags);
return (write_data(buf, 6));
});
- int6store(buf + TM_MAPID_OFFSET, (ulonglong)m_table_id);
+ int6store(buf + TM_MAPID_OFFSET, m_table_id);
int2store(buf + TM_FLAGS_OFFSET, m_flags);
return write_data(buf, TABLE_MAP_HEADER_LEN);
}
@@ -12819,7 +13077,7 @@ void Table_map_log_event::pack_info(Protocol *protocol)
{
char buf[256];
size_t bytes= my_snprintf(buf, sizeof(buf),
- "table_id: %lu (%s.%s)",
+ "table_id: %llu (%s.%s)",
m_table_id, m_dbnam, m_tblnam);
protocol->store(buf, bytes, &my_charset_bin);
}
@@ -12834,17 +13092,25 @@ bool Table_map_log_event::print(FILE *file, PRINT_EVENT_INFO *print_event_info)
{
if (!print_event_info->short_form)
{
+ char llbuff[22];
+
print_header(&print_event_info->head_cache, print_event_info, TRUE);
if (my_b_printf(&print_event_info->head_cache,
- "\tTable_map: %`s.%`s mapped to number %lu%s\n",
- m_dbnam, m_tblnam, m_table_id,
+ "\tTable_map: %`s.%`s mapped to number %s%s\n",
+ m_dbnam, m_tblnam, ullstr(m_table_id, llbuff),
((m_flags & TM_BIT_HAS_TRIGGERS_F) ?
" (has triggers)" : "")))
goto err;
}
if (!print_event_info->short_form || print_event_info->print_row_count)
{
- if (print_base64(&print_event_info->body_cache, print_event_info, TRUE) ||
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
+ !print_event_info->short_form;
+
+ if (print_base64(&print_event_info->body_cache, print_event_info,
+ do_print_encoded) ||
copy_event_cache_to_file_and_reinit(&print_event_info->head_cache,
file))
goto err;
@@ -14768,7 +15034,7 @@ err:
bool copy_event_cache_to_file_and_reinit(IO_CACHE *cache, FILE *file)
{
- return (my_b_copy_to_file(cache, file) ||
+ return (my_b_copy_all_to_file(cache, file) ||
reinit_io_cache(cache, WRITE_CACHE, 0, FALSE, TRUE));
}
diff --git a/sql/log_event.h b/sql/log_event.h
index 38a40c90799..339db756aab 100644
--- a/sql/log_event.h
+++ b/sql/log_event.h
@@ -866,6 +866,7 @@ typedef struct st_print_event_info
bool allow_parallel_printed;
bool found_row_event;
bool print_row_count;
+ static const uint max_delimiter_size= 16;
/* Settings on how to print the events */
bool short_form;
/*
@@ -1264,7 +1265,7 @@ public:
bool print_header(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
bool is_more);
bool print_base64(IO_CACHE* file, PRINT_EVENT_INFO* print_event_info,
- bool is_more);
+ bool do_print_encoded);
#endif /* MYSQL_SERVER */
/* The following code used for Flashback */
@@ -4333,7 +4334,7 @@ public:
int rewrite_db(const char* new_name, size_t new_name_len,
const Format_description_log_event*);
#endif
- ulong get_table_id() const { return m_table_id; }
+ ulonglong get_table_id() const { return m_table_id; }
const char *get_table_name() const { return m_tblnam; }
const char *get_db_name() const { return m_dbnam; }
@@ -4377,7 +4378,7 @@ private:
uchar *m_coltype;
uchar *m_memory;
- ulong m_table_id;
+ ulonglong m_table_id;
flag_set m_flags;
size_t m_data_size;
@@ -4506,7 +4507,7 @@ public:
MY_BITMAP const *get_cols() const { return &m_cols; }
MY_BITMAP const *get_cols_ai() const { return &m_cols_ai; }
size_t get_width() const { return m_width; }
- ulong get_table_id() const { return m_table_id; }
+ ulonglong get_table_id() const { return m_table_id; }
#if defined(MYSQL_SERVER)
/*
@@ -4607,7 +4608,7 @@ protected:
#ifdef MYSQL_SERVER
TABLE *m_table; /* The table the rows belong to */
#endif
- ulong m_table_id; /* Table ID */
+ ulonglong m_table_id; /* Table ID */
MY_BITMAP m_cols; /* Bitmap denoting columns available */
ulong m_width; /* The width of the columns bitmap */
/*
@@ -5171,6 +5172,19 @@ public:
virtual int get_data_size() { return IGNORABLE_HEADER_LEN; }
};
+#ifdef MYSQL_CLIENT
+bool copy_cache_to_string_wrapped(IO_CACHE *body,
+ LEX_STRING *to,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose);
+bool copy_cache_to_file_wrapped(IO_CACHE *body,
+ FILE *file,
+ bool do_wrap,
+ const char *delimiter,
+ bool is_verbose);
+#endif
+
#ifdef MYSQL_SERVER
/*****************************************************************************
diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc
index 66c4c2bef42..b5381ec6d74 100644
--- a/sql/log_event_old.cc
+++ b/sql/log_event_old.cc
@@ -1842,27 +1842,34 @@ void Old_rows_log_event::pack_info(Protocol *protocol)
#ifdef MYSQL_CLIENT
+/* Method duplicates Rows_log_event's one */
bool Old_rows_log_event::print_helper(FILE *file,
PRINT_EVENT_INFO *print_event_info,
char const *const name)
{
IO_CACHE *const head= &print_event_info->head_cache;
IO_CACHE *const body= &print_event_info->body_cache;
+ bool do_print_encoded=
+ print_event_info->base64_output_mode != BASE64_OUTPUT_DECODE_ROWS &&
+ print_event_info->base64_output_mode != BASE64_OUTPUT_NEVER &&
+ !print_event_info->short_form;
+
if (!print_event_info->short_form)
{
- bool const last_stmt_event= get_flags(STMT_END_F);
- if (print_header(head, print_event_info, !last_stmt_event) ||
+ if (print_header(head, print_event_info, !do_print_encoded) ||
my_b_printf(head, "\t%s: table id %lu%s\n",
name, m_table_id,
- last_stmt_event ? " flags: STMT_END_F" : "") ||
- print_base64(body, print_event_info, !last_stmt_event))
+ do_print_encoded ? " flags: STMT_END_F" : "") ||
+ print_base64(body, print_event_info, do_print_encoded))
goto err;
}
if (get_flags(STMT_END_F))
{
if (copy_event_cache_to_file_and_reinit(head, file) ||
- copy_event_cache_to_file_and_reinit(body, file))
+ copy_cache_to_file_wrapped(body, file, do_print_encoded,
+ print_event_info->delimiter,
+ print_event_info->verbose))
goto err;
}
return 0;
diff --git a/sql/partition_info.cc b/sql/partition_info.cc
index 0ac4014a669..2f021d6118c 100644
--- a/sql/partition_info.cc
+++ b/sql/partition_info.cc
@@ -878,7 +878,7 @@ void partition_info::vers_set_hist_part(THD *thd)
return;
warn:
my_error(WARN_VERS_PART_FULL, MYF(ME_WARNING|ME_ERROR_LOG),
- table->s->db.str, table->s->error_table_name(),
+ table->s->db.str, table->s->table_name.str,
vers_info->hist_part->partition_name);
}
diff --git a/sql/rpl_tblmap.cc b/sql/rpl_tblmap.cc
index 7284e4be15c..02543a429b8 100644
--- a/sql/rpl_tblmap.cc
+++ b/sql/rpl_tblmap.cc
@@ -43,7 +43,7 @@ table_mapping::table_mapping()
constructor is called at startup only.
*/
(void) my_hash_init(&m_table_ids,&my_charset_bin,TABLE_ID_HASH_SIZE,
- offsetof(entry,table_id),sizeof(ulong),
+ offsetof(entry,table_id),sizeof(ulonglong),
0,0,0);
/* We don't preallocate any block, this is consistent with m_free=0 above */
init_alloc_root(&m_mem_root, "table_mapping",
@@ -60,20 +60,20 @@ table_mapping::~table_mapping()
free_root(&m_mem_root, MYF(0));
}
-TABLE* table_mapping::get_table(ulong table_id)
+TABLE* table_mapping::get_table(ulonglong table_id)
{
DBUG_ENTER("table_mapping::get_table(ulong)");
- DBUG_PRINT("enter", ("table_id: %lu", table_id));
+ DBUG_PRINT("enter", ("table_id: %llu", table_id));
entry *e= find_entry(table_id);
if (e)
{
- DBUG_PRINT("info", ("tid %lu -> table %p (%s)",
+ DBUG_PRINT("info", ("tid %llu -> table %p (%s)",
table_id, e->table,
MAYBE_TABLE_NAME(e->table)));
DBUG_RETURN(e->table);
}
- DBUG_PRINT("info", ("tid %lu is not mapped!", table_id));
+ DBUG_PRINT("info", ("tid %llu is not mapped!", table_id));
DBUG_RETURN(NULL);
}
@@ -103,11 +103,11 @@ int table_mapping::expand()
return 0;
}
-int table_mapping::set_table(ulong table_id, TABLE* table)
+int table_mapping::set_table(ulonglong table_id, TABLE* table)
{
DBUG_ENTER("table_mapping::set_table(ulong,TABLE*)");
- DBUG_PRINT("enter", ("table_id: %lu table: %p (%s)",
- table_id,
+ DBUG_PRINT("enter", ("table_id: %llu table: %p (%s)",
+ table_id,
table, MAYBE_TABLE_NAME(table)));
entry *e= find_entry(table_id);
if (e == 0)
@@ -134,13 +134,13 @@ int table_mapping::set_table(ulong table_id, TABLE* table)
DBUG_RETURN(ERR_MEMORY_ALLOCATION);
}
- DBUG_PRINT("info", ("tid %lu -> table %p (%s)",
+ DBUG_PRINT("info", ("tid %llu -> table %p (%s)",
table_id, e->table,
MAYBE_TABLE_NAME(e->table)));
DBUG_RETURN(0); // All OK
}
-int table_mapping::remove_table(ulong table_id)
+int table_mapping::remove_table(ulonglong table_id)
{
entry *e= find_entry(table_id);
if (e)
diff --git a/sql/rpl_tblmap.h b/sql/rpl_tblmap.h
index 9fb1c4afbd7..05b298e6053 100644
--- a/sql/rpl_tblmap.h
+++ b/sql/rpl_tblmap.h
@@ -70,10 +70,10 @@ public:
table_mapping();
~table_mapping();
- TABLE* get_table(ulong table_id);
+ TABLE* get_table(ulonglong table_id);
- int set_table(ulong table_id, TABLE* table);
- int remove_table(ulong table_id);
+ int set_table(ulonglong table_id, TABLE* table);
+ int remove_table(ulonglong table_id);
void clear_tables();
ulong count() const { return m_table_ids.records; }
@@ -83,14 +83,14 @@ private:
it, which only works for PODs)
*/
struct entry {
- ulong table_id;
+ ulonglong table_id;
union {
TABLE *table;
entry *next;
};
};
- entry *find_entry(ulong table_id)
+ entry *find_entry(ulonglong table_id)
{
return (entry *) my_hash_search(&m_table_ids,
(uchar*)&table_id,
diff --git a/sql/sql_binlog.cc b/sql/sql_binlog.cc
index 1fa3cca7c27..97b8e2e4f91 100644
--- a/sql/sql_binlog.cc
+++ b/sql/sql_binlog.cc
@@ -110,6 +110,64 @@ static int check_event_type(int type, Relay_log_info *rli)
}
/**
+ Copy fragments into the standard placeholder thd->lex->comment.str.
+
+ Compute the size of the (still) encoded total,
+ allocate and then copy fragments one after another.
+ The size can exceed max(max_allowed_packet) which is not a
+ problem as no String instance is created off this char array.
+
+ @param thd THD handle
+ @return
+ 0 at success,
+ -1 otherwise.
+*/
+int binlog_defragment(THD *thd)
+{
+ user_var_entry *entry[2];
+ LEX_CSTRING name[2]= { thd->lex->comment, thd->lex->ident };
+
+ /* compute the total size */
+ thd->lex->comment.str= NULL;
+ thd->lex->comment.length= 0;
+ for (uint k= 0; k < 2; k++)
+ {
+ entry[k]=
+ (user_var_entry*) my_hash_search(&thd->user_vars, (uchar*) name[k].str,
+ name[k].length);
+ if (!entry[k] || entry[k]->type != STRING_RESULT)
+ {
+ my_error(ER_WRONG_TYPE_FOR_VAR, MYF(0), name[k].str);
+ return -1;
+ }
+ thd->lex->comment.length += entry[k]->length;
+ }
+
+ thd->lex->comment.str= // to be freed by the caller
+ (char *) my_malloc(thd->lex->comment.length, MYF(MY_WME));
+ if (!thd->lex->comment.str)
+ {
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ return -1;
+ }
+
+ /* fragments are merged into allocated buf while the user var:s get reset */
+ size_t gathered_length= 0;
+ for (uint k=0; k < 2; k++)
+ {
+ memcpy(const_cast<char*>(thd->lex->comment.str) + gathered_length, entry[k]->value,
+ entry[k]->length);
+ gathered_length += entry[k]->length;
+ update_hash(entry[k], true, NULL, 0, STRING_RESULT, &my_charset_bin, 0);
+ }
+
+ DBUG_ASSERT(gathered_length == thd->lex->comment.length);
+
+ return 0;
+}
+
+
+/**
Execute a BINLOG statement.
To execute the BINLOG command properly the server needs to know
@@ -134,14 +192,6 @@ void mysql_client_binlog_statement(THD* thd)
if (check_global_access(thd, SUPER_ACL))
DBUG_VOID_RETURN;
- size_t coded_len= thd->lex->comment.length;
- if (!coded_len)
- {
- my_error(ER_SYNTAX_ERROR, MYF(0));
- DBUG_VOID_RETURN;
- }
- size_t decoded_len= my_base64_needed_decoded_length((int)coded_len);
-
/*
option_bits will be changed when applying the event. But we don't expect
it be changed permanently after BINLOG statement, so backup it first.
@@ -156,6 +206,8 @@ void mysql_client_binlog_statement(THD* thd)
int err;
Relay_log_info *rli;
rpl_group_info *rgi;
+ char *buf= NULL;
+ size_t coded_len= 0, decoded_len= 0;
rli= thd->rli_fake;
if (!rli && (rli= thd->rli_fake= new Relay_log_info(FALSE)))
@@ -165,13 +217,13 @@ void mysql_client_binlog_statement(THD* thd)
rgi->thd= thd;
const char *error= 0;
- char *buf= (char *) my_malloc(decoded_len, MYF(MY_WME));
Log_event *ev = 0;
+ my_bool is_fragmented= FALSE;
/*
Out of memory check
*/
- if (!(rli && buf))
+ if (!(rli))
{
my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1); /* needed 1 bytes */
goto end;
@@ -179,6 +231,23 @@ void mysql_client_binlog_statement(THD* thd)
DBUG_ASSERT(rli->belongs_to_client());
+ if (unlikely(is_fragmented= thd->lex->comment.str && thd->lex->ident.str))
+ if (binlog_defragment(thd))
+ goto end;
+
+ if (!(coded_len= thd->lex->comment.length))
+ {
+ my_error(ER_SYNTAX_ERROR, MYF(0));
+ goto end;
+ }
+
+ decoded_len= my_base64_needed_decoded_length((int)coded_len);
+ if (!(buf= (char *) my_malloc(decoded_len, MYF(MY_WME))))
+ {
+ my_error(ER_OUTOFMEMORY, MYF(ME_FATAL), 1);
+ goto end;
+ }
+
for (char const *strptr= thd->lex->comment.str ;
strptr < thd->lex->comment.str + thd->lex->comment.length ; )
{
@@ -317,6 +386,8 @@ void mysql_client_binlog_statement(THD* thd)
my_ok(thd);
end:
+ if (unlikely(is_fragmented))
+ my_free(const_cast<char*>(thd->lex->comment.str));
thd->variables.option_bits= thd_options;
rgi->slave_close_thread_tables(thd);
my_free(buf);
diff --git a/sql/sql_class.cc b/sql/sql_class.cc
index 8c5cadcf5a6..7a623ce6697 100644
--- a/sql/sql_class.cc
+++ b/sql/sql_class.cc
@@ -6726,6 +6726,22 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
DBUG_ASSERT(is_current_stmt_binlog_format_row() &&
((WSREP(this) && wsrep_emulate_bin_log) || mysql_bin_log.is_open()));
+ /**
+ Save a reference to the original read bitmaps
+ We will need this to restore the bitmaps at the end as
+ binlog_prepare_row_images() may change table->read_set.
+ table->read_set is used by pack_row and deep in
+ binlog_prepare_pending_events().
+ */
+ MY_BITMAP *old_read_set= table->read_set;
+
+ /**
+ This will remove spurious fields required during execution but
+ not needed for binlogging. This is done according to the:
+ binlog-row-image option.
+ */
+ binlog_prepare_row_images(table);
+
size_t const before_maxlen= max_row_length(table, table->read_set,
before_record);
size_t const after_maxlen= max_row_length(table, table->rpl_write_set,
@@ -6739,9 +6755,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
uchar *after_row= row_data.slot(1);
size_t const before_size= pack_row(table, table->read_set, before_row,
- before_record);
+ before_record);
size_t const after_size= pack_row(table, table->rpl_write_set, after_row,
- after_record);
+ after_record);
/* Ensure that all events in a GTID group are in the same cache */
if (variables.option_bits & OPTION_GTID_BEGIN)
@@ -6776,6 +6792,9 @@ int THD::binlog_update_row(TABLE* table, bool is_trans,
int error= ev->add_row_data(before_row, before_size) ||
ev->add_row_data(after_row, after_size);
+ /* restore read set for the rest of execution */
+ table->column_bitmaps_set_no_signal(old_read_set,
+ table->write_set);
return error;
}
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 88494f8c169..361340ee235 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -4465,7 +4465,7 @@ public:
char buff[MYSQL_ERRMSG_SIZE];
CHARSET_INFO *cs= &my_charset_latin1;
const char *db_name= s ? s->db.str : NULL;
- const char *table_name= s ? s->error_table_name() : NULL;
+ const char *table_name= s ? s->table_name.str : NULL;
if (!db_name)
db_name= "";
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index c4c141900f1..d3f4793fb67 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4131,7 +4131,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only)
inner_join->select_options|= SELECT_DESCRIBE;
}
res= inner_join->optimize();
- sl->update_used_tables();
+ if (!inner_join->cleaned)
+ sl->update_used_tables();
sl->update_correlated_cache();
is_correlated_unit|= sl->is_correlated;
inner_join->select_options= save_options;
diff --git a/sql/sql_lex.h b/sql/sql_lex.h
index ee4baba1134..4af0f919c91 100644
--- a/sql/sql_lex.h
+++ b/sql/sql_lex.h
@@ -3038,6 +3038,10 @@ public:
String *wild; /* Wildcard in SHOW {something} LIKE 'wild'*/
sql_exchange *exchange;
select_result *result;
+ /**
+ @c the two may also hold BINLOG arguments: either comment holds a
+ base64-char string or both represent the BINLOG fragment user variables.
+ */
LEX_CSTRING comment, ident;
LEX_USER *grant_user;
XID *xid;
diff --git a/sql/sql_repl.cc b/sql/sql_repl.cc
index 59f6a45a52f..7fc3bb5926d 100644
--- a/sql/sql_repl.cc
+++ b/sql/sql_repl.cc
@@ -1,5 +1,5 @@
-/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2008, 2017, MariaDB Corporation
+/* Copyright (c) 2000, 2018, Oracle and/or its affiliates.
+ Copyright (c) 2008, 2019, MariaDB Corporation
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -558,7 +558,7 @@ static my_bool log_in_use_callback(THD *thd, const char *log_name)
my_bool result= 0;
mysql_mutex_lock(&thd->LOCK_thd_data);
if (auto linfo= thd->current_linfo)
- result= !memcmp(log_name, linfo->log_file_name, strlen(log_name) + 1);
+ result= !strcmp(log_name, linfo->log_file_name);
mysql_mutex_unlock(&thd->LOCK_thd_data);
return result;
}
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ef712f76031..de38cbf778d 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -17864,7 +17864,7 @@ create_tmp_table(THD *thd, TMP_TABLE_PARAM *param, List<Item> &fields,
table->no_rows_with_nulls= param->force_not_null_cols;
table->s= share;
- init_tmp_table_share(thd, share, "", 0, tmpname, tmpname);
+ init_tmp_table_share(thd, share, "", 0, "(temporary)", tmpname);
share->blob_field= blob_field;
share->table_charset= param->table_charset;
share->primary_key= MAX_KEY; // Indicate no primary key
@@ -18718,8 +18718,7 @@ bool Virtual_tmp_table::sp_set_all_fields_from_item(THD *thd, Item *value)
bool open_tmp_table(TABLE *table)
{
int error;
- if (unlikely((error= table->file->ha_open(table, table->s->table_name.str,
- O_RDWR,
+ if (unlikely((error= table->file->ha_open(table, table->s->path.str, O_RDWR,
HA_OPEN_TMP_TABLE |
HA_OPEN_INTERNAL_TABLE))))
{
@@ -18915,7 +18914,7 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
}
}
- if (unlikely((error= maria_create(share->table_name.str,
+ if (unlikely((error= maria_create(share->path.str,
file_type,
share->keys, &keydef,
(uint) (*recinfo-start_recinfo),
@@ -19070,12 +19069,12 @@ bool create_internal_tmp_table(TABLE *table, KEY *keyinfo,
bzero((char*) &create_info,sizeof(create_info));
create_info.data_file_length= table->in_use->variables.tmp_disk_table_size;
- if (unlikely((error= mi_create(share->table_name.str, share->keys, &keydef,
- (uint) (*recinfo-start_recinfo),
+ if (unlikely((error= mi_create(share->path.str, share->keys, &keydef,
+ (uint) (*recinfo-start_recinfo),
start_recinfo,
- share->uniques, &uniquedef,
+ share->uniques, &uniquedef,
&create_info,
- HA_CREATE_TMP_TABLE |
+ HA_CREATE_TMP_TABLE |
HA_CREATE_INTERNAL_TABLE |
((share->db_create_options &
HA_OPTION_PACK_RECORD) ?
@@ -19226,7 +19225,7 @@ err_killed:
(void) table->file->ha_rnd_end();
(void) new_table.file->ha_close();
err1:
- new_table.file->ha_delete_table(new_table.s->table_name.str);
+ new_table.file->ha_delete_table(new_table.s->path.str);
err2:
delete new_table.file;
thd_proc_info(thd, save_proc_info);
@@ -19255,10 +19254,10 @@ free_tmp_table(THD *thd, TABLE *entry)
entry->file->info(HA_STATUS_VARIABLE);
thd->tmp_tables_size+= (entry->file->stats.data_file_length +
entry->file->stats.index_file_length);
- entry->file->ha_drop_table(entry->s->table_name.str);
+ entry->file->ha_drop_table(entry->s->path.str);
}
else
- entry->file->ha_delete_table(entry->s->table_name.str);
+ entry->file->ha_delete_table(entry->s->path.str);
delete entry->file;
}
diff --git a/sql/sql_table.cc b/sql/sql_table.cc
index 4dd9d43a7b9..a3f1f616edd 100644
--- a/sql/sql_table.cc
+++ b/sql/sql_table.cc
@@ -5891,7 +5891,8 @@ static bool is_candidate_key(KEY *key)
KEY_PART_INFO *key_part;
KEY_PART_INFO *key_part_end= key->key_part + key->user_defined_key_parts;
- if (!(key->flags & HA_NOSAME) || (key->flags & HA_NULL_PART_KEY))
+ if (!(key->flags & HA_NOSAME) || (key->flags & HA_NULL_PART_KEY) ||
+ (key->flags & HA_KEY_HAS_PART_KEY_SEG))
return false;
for (key_part= key->key_part; key_part < key_part_end; key_part++)
@@ -6459,9 +6460,7 @@ static int compare_uint(const uint *s, const uint *t)
@retval false success
*/
-static bool fill_alter_inplace_info(THD *thd,
- TABLE *table,
- bool varchar,
+static bool fill_alter_inplace_info(THD *thd, TABLE *table, bool varchar,
Alter_inplace_info *ha_alter_info)
{
Field **f_ptr, *field, *old_field;
@@ -6469,7 +6468,6 @@ static bool fill_alter_inplace_info(THD *thd,
Create_field *new_field;
KEY_PART_INFO *key_part, *new_part;
KEY_PART_INFO *end;
- uint candidate_key_count= 0;
Alter_info *alter_info= ha_alter_info->alter_info;
DBUG_ENTER("fill_alter_inplace_info");
DBUG_PRINT("info", ("alter_info->flags: %llu", alter_info->flags));
@@ -6773,8 +6771,13 @@ static bool fill_alter_inplace_info(THD *thd,
Primary key index for the new table
*/
const KEY* const new_pk= (ha_alter_info->key_count > 0 &&
- is_candidate_key(ha_alter_info->key_info_buffer)) ?
+ (!my_strcasecmp(system_charset_info,
+ ha_alter_info->key_info_buffer->name.str,
+ primary_key_name) ||
+ is_candidate_key(ha_alter_info->key_info_buffer))) ?
ha_alter_info->key_info_buffer : NULL;
+ const KEY *const old_pk= table->s->primary_key == MAX_KEY ? NULL :
+ table->key_info + table->s->primary_key;
DBUG_PRINT("info", ("index count old: %d new: %d",
table->s->keys, ha_alter_info->key_count));
@@ -6874,8 +6877,7 @@ static bool fill_alter_inplace_info(THD *thd,
(i) Old table doesn't have primary key, new table has it and vice-versa
(ii) Primary key changed to another existing index
*/
- if ((new_key == new_pk) !=
- ((uint) (table_key - table->key_info) == table->s->primary_key))
+ if ((new_key == new_pk) != (table_key == old_pk))
goto index_changed;
/* Check that key comment is not changed. */
@@ -6937,22 +6939,6 @@ static bool fill_alter_inplace_info(THD *thd,
/* Now let us calculate flags for storage engine API. */
- /* Count all existing candidate keys. */
- for (table_key= table->key_info; table_key < table_key_end; table_key++)
- {
- /*
- Check if key is a candidate key, This key is either already primary key
- or could be promoted to primary key if the original primary key is
- dropped.
- In MySQL one is allowed to create primary key with partial fields (i.e.
- primary key which is not considered candidate). For simplicity we count
- such key as a candidate key here.
- */
- if (((uint) (table_key - table->key_info) == table->s->primary_key) ||
- is_candidate_key(table_key))
- candidate_key_count++;
- }
-
/* Figure out what kind of indexes we are dropping. */
KEY **dropped_key;
KEY **dropped_key_end= ha_alter_info->index_drop_buffer +
@@ -6965,21 +6951,10 @@ static bool fill_alter_inplace_info(THD *thd,
if (table_key->flags & HA_NOSAME)
{
- /*
- Unique key. Check for PRIMARY KEY. Also see comment about primary
- and candidate keys above.
- */
- if ((uint) (table_key - table->key_info) == table->s->primary_key)
- {
+ if (table_key == old_pk)
ha_alter_info->handler_flags|= ALTER_DROP_PK_INDEX;
- candidate_key_count--;
- }
else
- {
ha_alter_info->handler_flags|= ALTER_DROP_UNIQUE_INDEX;
- if (is_candidate_key(table_key))
- candidate_key_count--;
- }
}
else
ha_alter_info->handler_flags|= ALTER_DROP_NON_UNIQUE_NON_PRIM_INDEX;
@@ -6992,24 +6967,10 @@ static bool fill_alter_inplace_info(THD *thd,
if (new_key->flags & HA_NOSAME)
{
- bool is_pk= !my_strcasecmp(system_charset_info,
- new_key->name.str, primary_key_name);
-
- if ((!(new_key->flags & HA_KEY_HAS_PART_KEY_SEG) &&
- !(new_key->flags & HA_NULL_PART_KEY)) ||
- is_pk)
- {
- /* Candidate key or primary key! */
- if (candidate_key_count == 0 || is_pk)
- ha_alter_info->handler_flags|= ALTER_ADD_PK_INDEX;
- else
- ha_alter_info->handler_flags|= ALTER_ADD_UNIQUE_INDEX;
- candidate_key_count++;
- }
+ if (new_key == new_pk)
+ ha_alter_info->handler_flags|= ALTER_ADD_PK_INDEX;
else
- {
ha_alter_info->handler_flags|= ALTER_ADD_UNIQUE_INDEX;
- }
}
else
ha_alter_info->handler_flags|= ALTER_ADD_NON_UNIQUE_NON_PRIM_INDEX;
@@ -8432,7 +8393,12 @@ mysql_prepare_alter_table(THD *thd, TABLE *table,
}
if (!drop)
{
- check->expr->walk(&Item::rename_fields_processor, 1, &column_rename_param);
+ if (alter_info->flags & ALTER_RENAME_COLUMN)
+ {
+ check->expr->walk(&Item::rename_fields_processor, 1,
+ &column_rename_param);
+ table->m_needs_reopen= 1; // because new column name is on thd->mem_root
+ }
new_constraint_list.push_back(check, thd->mem_root);
}
}
@@ -9315,6 +9281,64 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
THD_STAGE_INFO(thd, stage_setup);
+ if (alter_info->flags & ALTER_DROP_CHECK_CONSTRAINT)
+ {
+ /*
+ ALTER TABLE DROP CONSTRAINT
+ should be replaced with ... DROP [FOREIGN] KEY
+ if the constraint is the FOREIGN KEY or UNIQUE one.
+ */
+
+ List_iterator<Alter_drop> drop_it(alter_info->drop_list);
+ Alter_drop *drop;
+ List <FOREIGN_KEY_INFO> fk_child_key_list;
+ table->file->get_foreign_key_list(thd, &fk_child_key_list);
+
+ alter_info->flags&= ~ALTER_DROP_CHECK_CONSTRAINT;
+
+ while ((drop= drop_it++))
+ {
+ if (drop->type == Alter_drop::CHECK_CONSTRAINT)
+ {
+ {
+ /* Test if there is a FOREIGN KEY with this name. */
+ FOREIGN_KEY_INFO *f_key;
+ List_iterator<FOREIGN_KEY_INFO> fk_key_it(fk_child_key_list);
+
+ while ((f_key= fk_key_it++))
+ {
+ if (my_strcasecmp(system_charset_info, f_key->foreign_id->str,
+ drop->name) == 0)
+ {
+ drop->type= Alter_drop::FOREIGN_KEY;
+ alter_info->flags|= ALTER_DROP_FOREIGN_KEY;
+ goto do_continue;
+ }
+ }
+ }
+
+ {
+ /* Test if there is an UNIQUE with this name. */
+ uint n_key;
+
+ for (n_key=0; n_key < table->s->keys; n_key++)
+ {
+ if ((table->key_info[n_key].flags & HA_NOSAME) &&
+ my_strcasecmp(system_charset_info,
+ drop->name, table->key_info[n_key].name.str) == 0) // Merge todo: review '.str'
+ {
+ drop->type= Alter_drop::KEY;
+ alter_info->flags|= ALTER_DROP_INDEX;
+ goto do_continue;
+ }
+ }
+ }
+ }
+ alter_info->flags|= ALTER_DROP_CHECK_CONSTRAINT;
+do_continue:;
+ }
+ }
+
handle_if_exists_options(thd, table, alter_info);
/*
@@ -9639,7 +9663,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
thd->create_and_open_tmp_table(new_db_type, &frm,
alter_ctx.get_tmp_path(),
alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
+ alter_ctx.new_name.str,
false, true)))
goto err_new_table_cleanup;
@@ -9755,7 +9779,7 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
goto err_new_table_cleanup;
if (ha_create_table(thd, alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str, alter_ctx.tmp_name.str,
+ alter_ctx.new_db.str, alter_ctx.new_name.str,
create_info, &frm))
goto err_new_table_cleanup;
@@ -9763,11 +9787,11 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
no_ha_table= false;
/* Open the table since we need to copy the data. */
- new_table= thd->create_and_open_tmp_table(new_db_type, &frm,
- alter_ctx.get_tmp_path(),
- alter_ctx.new_db.str,
- alter_ctx.tmp_name.str,
- true, true);
+ new_table=
+ thd->create_and_open_tmp_table(new_db_type, &frm, alter_ctx.get_tmp_path(),
+ alter_ctx.new_db.str,
+ alter_ctx.new_name.str,
+ true, true);
if (!new_table)
goto err_new_table_cleanup;
@@ -9827,7 +9851,6 @@ bool mysql_alter_table(THD *thd, const LEX_CSTRING *new_db,
goto err_new_table_cleanup;
}
}
- new_table->s->orig_table_name= table->s->table_name.str;
/*
Note: In case of MERGE table, we do not attach children. We do not
@@ -10687,7 +10710,10 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
{
/* calculating table's checksum */
ha_checksum crc= 0;
- uchar null_mask=256 - (1 << t->s->last_null_bit_pos);
+ DBUG_ASSERT(t->s->last_null_bit_pos < 8);
+ uchar null_mask= (t->s->last_null_bit_pos ?
+ (256 - (1 << t->s->last_null_bit_pos)):
+ 0);
t->use_all_stored_columns();
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 00566c463e8..bdc1893637d 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -2073,6 +2073,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
opt_lock_wait_timeout
opt_delete_gtid_domain
asrow_attribute
+ opt_constraint_no_id
END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -6659,6 +6660,11 @@ check_constraint:
}
;
+opt_constraint_no_id:
+ /* Empty */ {}
+ | CONSTRAINT {}
+ ;
+
opt_constraint:
/* empty */ { $$= null_clex_str; }
| constraint { $$= $1; }
@@ -8374,7 +8380,7 @@ alter_list_item:
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_FOREIGN_KEY;
}
- | DROP PRIMARY_SYM KEY_SYM
+ | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM
{
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
@@ -8886,8 +8892,17 @@ binlog_base64_event:
{
Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
Lex->comment= $2;
+ Lex->ident.str= NULL;
+ Lex->ident.length= 0;
}
- ;
+ |
+ BINLOG_SYM '@' ident_or_text ',' '@' ident_or_text
+ {
+ Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
+ Lex->comment= $3;
+ Lex->ident= $6;
+ }
+ ;
check_view_or_table:
table_or_tables table_list opt_mi_check_type
diff --git a/sql/sql_yacc_ora.yy b/sql/sql_yacc_ora.yy
index 025241f8e93..6a6c901c197 100644
--- a/sql/sql_yacc_ora.yy
+++ b/sql/sql_yacc_ora.yy
@@ -1580,6 +1580,7 @@ bool my_yyoverflow(short **a, YYSTYPE **b, size_t *yystacksize);
set_assign
sf_tail_standalone
sp_tail_standalone
+ opt_constraint_no_id
END_OF_INPUT
%type <NONE> call sp_proc_stmts sp_proc_stmts1 sp_proc_stmt
@@ -6597,6 +6598,11 @@ check_constraint:
}
;
+opt_constraint_no_id:
+ /* Empty */ {}
+ | CONSTRAINT {}
+ ;
+
opt_constraint:
/* empty */ { $$= null_clex_str; }
| constraint { $$= $1; }
@@ -8401,7 +8407,7 @@ alter_list_item:
lex->alter_info.drop_list.push_back(ad, thd->mem_root);
lex->alter_info.flags|= ALTER_DROP_FOREIGN_KEY;
}
- | DROP PRIMARY_SYM KEY_SYM
+ | DROP opt_constraint_no_id PRIMARY_SYM KEY_SYM
{
LEX *lex=Lex;
Alter_drop *ad= (new (thd->mem_root)
@@ -8913,8 +8919,17 @@ binlog_base64_event:
{
Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
Lex->comment= $2;
+ Lex->ident.str= NULL;
+ Lex->ident.length= 0;
}
- ;
+ |
+ BINLOG_SYM '@' ident_or_text ',' '@' ident_or_text
+ {
+ Lex->sql_command = SQLCOM_BINLOG_BASE64_EVENT;
+ Lex->comment= $3;
+ Lex->ident= $6;
+ }
+ ;
check_view_or_table:
table_or_tables table_list opt_mi_check_type
diff --git a/sql/sys_vars.cc b/sql/sys_vars.cc
index 766e655b20a..64a8b0c17b5 100644
--- a/sql/sys_vars.cc
+++ b/sql/sys_vars.cc
@@ -5484,6 +5484,19 @@ static Sys_var_mybool Sys_wsrep_certify_nonPK(
GLOBAL_VAR(wsrep_certify_nonPK),
CMD_LINE(OPT_ARG), DEFAULT(TRUE));
+static const char *wsrep_certification_rules_names[]= { "strict", "optimized", NullS };
+static Sys_var_enum Sys_wsrep_certification_rules(
+ "wsrep_certification_rules",
+ "Certification rules to use in the cluster. Possible values are: "
+ "\"strict\": stricter rules that could result in more certification "
+ "failures. "
+ "\"optimized\": relaxed rules that allow more concurrency and "
+ "cause less certification failures.",
+ GLOBAL_VAR(wsrep_certification_rules), CMD_LINE(REQUIRED_ARG),
+ wsrep_certification_rules_names, DEFAULT(WSREP_CERTIFICATION_RULES_STRICT),
+ NO_MUTEX_GUARD, NOT_IN_BINLOG, ON_CHECK(0),
+ ON_UPDATE(0));
+
static Sys_var_mybool Sys_wsrep_causal_reads(
"wsrep_causal_reads", "Setting this variable is equivalent "
"to setting wsrep_sync_wait READ flag",
diff --git a/sql/table.cc b/sql/table.cc
index 7682119c241..75f5a464186 100644
--- a/sql/table.cc
+++ b/sql/table.cc
@@ -5450,7 +5450,7 @@ int TABLE::verify_constraints(bool ignore_failure)
field_error.append((*chk)->name.str);
my_error(ER_CONSTRAINT_FAILED,
MYF(ignore_failure ? ME_WARNING : 0), field_error.c_ptr(),
- s->db.str, s->error_table_name());
+ s->db.str, s->table_name.str);
return ignore_failure ? VIEW_CHECK_SKIP : VIEW_CHECK_ERROR;
}
}
diff --git a/sql/table.h b/sql/table.h
index 914f4dc15c2..82fefe60e0b 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -646,16 +646,6 @@ struct TABLE_SHARE
LEX_CSTRING normalized_path; /* unpack_filename(path) */
LEX_CSTRING connect_string;
- const char* orig_table_name; /* Original table name for this tmp table */
- const char* error_table_name() const /* Get table name for error messages */
- {
- return tmp_table ? (
- orig_table_name ?
- orig_table_name :
- "(temporary)") :
- table_name.str;
- }
-
/*
Set of keys in use, implemented as a Bitmap.
Excludes keys disabled by ALTER TABLE ... DISABLE KEYS.
@@ -2100,7 +2090,7 @@ struct TABLE_LIST
/* Index names in a "... JOIN ... USE/IGNORE INDEX ..." clause. */
List<Index_hint> *index_hints;
TABLE *table; /* opened table */
- ulong table_id; /* table id (from binlog) for opened table */
+ ulonglong table_id; /* table id (from binlog) for opened table */
/*
select_result for derived table to pass it from table creation to table
filling procedure
diff --git a/sql/wsrep_mysqld.cc b/sql/wsrep_mysqld.cc
index 18c2e7072e2..0b31c361abc 100644
--- a/sql/wsrep_mysqld.cc
+++ b/sql/wsrep_mysqld.cc
@@ -90,6 +90,7 @@ my_bool wsrep_convert_LOCK_to_trx; // Convert locking sessions to t
my_bool wsrep_auto_increment_control; // Control auto increment variables
my_bool wsrep_drupal_282555_workaround; // Retry autoinc insert after dupkey
my_bool wsrep_certify_nonPK; // Certify, even when no primary key
+ulong wsrep_certification_rules = WSREP_CERTIFICATION_RULES_STRICT;
my_bool wsrep_recovery; // Recovery
my_bool wsrep_replicate_myisam; // Enable MyISAM replication
my_bool wsrep_log_conflicts;
diff --git a/sql/wsrep_mysqld.h b/sql/wsrep_mysqld.h
index dc2793c384d..d12cc835136 100644
--- a/sql/wsrep_mysqld.h
+++ b/sql/wsrep_mysqld.h
@@ -32,6 +32,7 @@ typedef struct st_mysql_show_var SHOW_VAR;
#include <sql_priv.h>
#include "mdl.h"
#include "sql_table.h"
+#include "wsrep_mysqld_c.h"
#include "wsrep/provider.hpp"
#include "wsrep/streaming_context.hpp"
diff --git a/sql/wsrep_mysqld_c.h b/sql/wsrep_mysqld_c.h
new file mode 100644
index 00000000000..235a871c113
--- /dev/null
+++ b/sql/wsrep_mysqld_c.h
@@ -0,0 +1,30 @@
+/* Copyright 2018-2018 Codership Oy <http://www.codership.com>
+
+ 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+#ifndef WSREP_MYSQLD_C_H
+#define WSREP_MYSQLD_C_H
+
+enum enum_wsrep_certification_rules {
+ WSREP_CERTIFICATION_RULES_STRICT,
+ WSREP_CERTIFICATION_RULES_OPTIMIZED
+};
+
+/* This is intentionally declared as a weak global symbol, so that
+the same ha_innodb.so can be used with the embedded server
+(which does not link to the definition of this variable)
+and with the regular server built WITH_WSREP. */
+extern ulong wsrep_certification_rules __attribute__((weak));
+
+#endif /* WSREP_MYSQLD_C_H */
diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc
index 7599765c07a..10467ea0ade 100644
--- a/storage/connect/ha_connect.cc
+++ b/storage/connect/ha_connect.cc
@@ -170,9 +170,9 @@
#define JSONMAX 10 // JSON Default max grp size
extern "C" {
- char version[]= "Version 1.06.0008 October 06, 2018";
+ char version[]= "Version 1.06.0009 January 27, 2019";
#if defined(__WIN__)
- char compver[]= "Version 1.06.0008 " __DATE__ " " __TIME__;
+ char compver[]= "Version 1.06.0009 " __DATE__ " " __TIME__;
char slash= '\\';
#else // !__WIN__
char slash= '/';
@@ -204,6 +204,26 @@ pthread_mutex_t parmut;
pthread_mutex_t usrmut;
pthread_mutex_t tblmut;
+#if defined(DEVELOPMENT)
+char *GetUserVariable(PGLOBAL g, const uchar *varname);
+
+char *GetUserVariable(PGLOBAL g, const uchar *varname)
+{
+ char buf[1024];
+ bool b;
+ THD *thd = current_thd;
+ CHARSET_INFO *cs = system_charset_info;
+ String *str = NULL, tmp(buf, sizeof(buf), cs);
+ HASH uvars = thd->user_vars;
+ user_var_entry *uvar = (user_var_entry*)my_hash_search(&uvars, varname, 0);
+
+ if (uvar)
+ str = uvar->val_str(&b, &tmp, NOT_FIXED_DEC);
+
+ return str ? PlugDup(g, str->ptr()) : NULL;
+}; // end of GetUserVariable
+#endif // DEVELOPMENT
+
/***********************************************************************/
/* Utility functions. */
/***********************************************************************/
@@ -1793,7 +1813,9 @@ PCSZ ha_connect::GetDBName(PCSZ name)
const char *ha_connect::GetTableName(void)
{
- return tshp ? tshp->table_name.str : table_share->table_name.str;
+ const char *path= tshp ? tshp->path.str : table_share->path.str;
+ const char *name= strrchr(path, slash);
+ return name ? name+1 : path;
} // end of GetTableName
char *ha_connect::GetPartName(void)
@@ -1912,9 +1934,11 @@ int ha_connect::OpenTable(PGLOBAL g, bool del)
break;
} // endswitch xmode
- if (xmod != MODE_INSERT || tdbp->GetAmType() == TYPE_AM_MYSQL
- || tdbp->GetAmType() == TYPE_AM_ODBC
- || tdbp->GetAmType() == TYPE_AM_JDBC) {
+ // g->More is 1 when executing commands from triggers
+ if (!g->More && (xmod != MODE_INSERT
+ || tdbp->GetAmType() == TYPE_AM_MYSQL
+ || tdbp->GetAmType() == TYPE_AM_ODBC
+ || tdbp->GetAmType() == TYPE_AM_JDBC)) {
// Get the list of used fields (columns)
char *p;
unsigned int k1, k2, n1, n2;
@@ -4627,7 +4651,9 @@ MODE ha_connect::CheckMode(PGLOBAL g, THD *thd,
break;
case SQLCOM_CREATE_VIEW:
case SQLCOM_DROP_VIEW:
- newmode= MODE_ANY;
+ case SQLCOM_CREATE_TRIGGER:
+ case SQLCOM_DROP_TRIGGER:
+ newmode= MODE_ANY;
break;
case SQLCOM_ALTER_TABLE:
*chk= true;
@@ -4670,6 +4696,9 @@ int ha_connect::start_stmt(THD *thd, thr_lock_type lock_type)
PGLOBAL g= GetPlug(thd, xp);
DBUG_ENTER("ha_connect::start_stmt");
+ if (table->triggers)
+ g->More= 1; // We don't know which columns are used by the trigger
+
if (check_privileges(thd, GetTableOptionStruct(), table->s->db.str, true))
DBUG_RETURN(HA_ERR_INTERNAL_ERROR);
@@ -7308,7 +7337,7 @@ maria_declare_plugin(connect)
0x0106, /* version number (1.06) */
NULL, /* status variables */
connect_system_variables, /* system variables */
- "1.06.0008", /* string version */
+ "1.06.0009", /* string version */
MariaDB_PLUGIN_MATURITY_STABLE /* maturity */
}
maria_declare_plugin_end;
diff --git a/storage/connect/jsonudf.cpp b/storage/connect/jsonudf.cpp
index 07a67e37379..d521322edb6 100644
--- a/storage/connect/jsonudf.cpp
+++ b/storage/connect/jsonudf.cpp
@@ -1667,7 +1667,7 @@ static PCSZ MakeKey(PGLOBAL g, UDF_ARGS *args, int i)
int j = 0, n = args->attribute_lengths[i];
my_bool b; // true if attribute is zero terminated
PSZ p;
- const char *s = args->attributes[i];
+ PCSZ s = args->attributes[i];
if (s && *s && (n || *s == '\'')) {
if ((b = (!n || !s[n])))
@@ -5806,6 +5806,52 @@ char *envar(UDF_INIT *initid, UDF_ARGS *args, char *result,
return str;
} // end of envar
+#if defined(DEVELOPMENT)
+extern char *GetUserVariable(PGLOBAL g, const uchar *varname);
+
+/*********************************************************************************/
+/* Utility function returning a user variable value. */
+/*********************************************************************************/
+my_bool uvar_init(UDF_INIT *initid, UDF_ARGS *args, char *message)
+{
+ unsigned long reslen, memlen;
+
+ if (args->arg_count != 1) {
+ strcpy(message, "Unique argument must be a user variable name");
+ return true;
+ } else
+ CalcLen(args, false, reslen, memlen, true);
+
+ initid->maybe_null = true;
+ return JsonInit(initid, args, message, true, reslen, memlen, 2048);
+} // end of uvar_init
+
+char *uvar(UDF_INIT *initid, UDF_ARGS *args, char *result,
+ unsigned long *res_length, char *is_null, char *)
+{
+ char *str, varname[256];
+ PGLOBAL g = (PGLOBAL)initid->ptr;
+ int n = MY_MIN(args->lengths[0], sizeof(varname) - 1);
+
+ PlugSubSet(g->Sarea, g->Sarea_Size);
+ memcpy(varname, args->args[0], n);
+ varname[n] = 0;
+
+ if (!(str = GetUserVariable(g, (const uchar*)&varname))) {
+ *res_length = 0;
+ *is_null = 1;
+ } else
+ *res_length = strlen(str);
+
+ return str;
+} // end of uvar
+
+void uvar_deinit(UDF_INIT* initid)
+{
+ JsonFreeMem((PGLOBAL)initid->ptr);
+} // end of uvar_deinit
+#endif // DEVELOPMENT
+
/*********************************************************************************/
/* Returns the distinct number of B occurences in A. */
/*********************************************************************************/
diff --git a/storage/connect/jsonudf.h b/storage/connect/jsonudf.h
index 23e8c0e1aed..ee56869a111 100644
--- a/storage/connect/jsonudf.h
+++ b/storage/connect/jsonudf.h
@@ -238,6 +238,11 @@ extern "C" {
DllExport my_bool envar_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport char *envar(UDF_EXEC_ARGS);
+#if defined(DEVELOPMENT)
+ DllExport my_bool uvar_init(UDF_INIT*, UDF_ARGS*, char*);
+ DllExport char *uvar(UDF_EXEC_ARGS);
+#endif // DEVELOPMENT
+
DllExport my_bool countin_init(UDF_INIT*, UDF_ARGS*, char*);
DllExport long long countin(UDF_EXEC_ARGS);
} // extern "C"
diff --git a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
index 07cc3c465ea..bec1dc8725b 100644
--- a/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
+++ b/storage/connect/mysql-test/connect/r/jdbc_postgresql.result
@@ -1,4 +1,4 @@
-SET GLOBAL connect_class_path='C:/MariaDB-10.2/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
+SET GLOBAL connect_class_path='C:/MariaDB-10.0/MariaDB/storage/connect/mysql-test/connect/std_data/JavaWrappers.jar;C:/Jconnectors/postgresql-42.2.1.jar';
CREATE TABLE t2 (
command varchar(128) not null,
number int(5) not null flag=1,
diff --git a/storage/connect/mysql-test/connect/r/part_table.result b/storage/connect/mysql-test/connect/r/part_table.result
index f3a556ae784..ee17a1d32b9 100644
--- a/storage/connect/mysql-test/connect/r/part_table.result
+++ b/storage/connect/mysql-test/connect/r/part_table.result
@@ -23,7 +23,7 @@ id msg
CREATE TABLE xt3 (
id INT KEY NOT NULL,
msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
Warnings:
Warning 1105 No file name. Table will use xt3.csv
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
@@ -92,7 +92,7 @@ id msg
EXPLAIN PARTITIONS
SELECT * FROM t1 WHERE id = 81;
id select_type table partitions type possible_keys key key_len ref rows Extra
-1 SIMPLE t1 3 ALL NULL NULL NULL NULL 4 Using where
+1 SIMPLE t1 3 ALL NULL NULL NULL NULL 6 Using where
DELETE FROM t1;
Warnings:
Note 1105 xt1: 4 affected rows
diff --git a/storage/connect/mysql-test/connect/t/part_table.test b/storage/connect/mysql-test/connect/t/part_table.test
index 5edd5766bd6..0fb2a11f0f9 100644
--- a/storage/connect/mysql-test/connect/t/part_table.test
+++ b/storage/connect/mysql-test/connect/t/part_table.test
@@ -22,7 +22,7 @@ SELECT * FROM xt2;
CREATE TABLE xt3 (
id INT KEY NOT NULL,
msg VARCHAR(32))
-ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=10;
+ENGINE=CONNECT TABLE_TYPE=CSV AVG_ROW_LENGTH=6;
INSERT INTO xt3 VALUES(60,'sixty'),(81,'eighty one'),(72,'seventy two');
SELECT * FROM xt3;
diff --git a/storage/connect/tabext.cpp b/storage/connect/tabext.cpp
index f2d5eb0e69d..e9c7b2490d8 100644
--- a/storage/connect/tabext.cpp
+++ b/storage/connect/tabext.cpp
@@ -1,7 +1,7 @@
/************* Tabext C++ Functions Source Code File (.CPP) ************/
-/* Name: TABEXT.CPP Version 1.0 */
+/* Name: TABEXT.CPP Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2017 */
+/* (C) Copyright to the author Olivier BERTRAND 2017 - 2019 */
/* */
/* This file contains the TBX, TDB and OPJOIN classes functions. */
/***********************************************************************/
@@ -446,6 +446,43 @@ bool TDBEXT::MakeSQL(PGLOBAL g, bool cnt)
} // end of MakeSQL
/***********************************************************************/
+/* Remove the NAME_CONST functions that are added by procedures. */
+/***********************************************************************/
+void TDBEXT::RemoveConst(PGLOBAL g, char *stmt)
+{
+ char *p, *p2;
+ char val[1025], nval[1025];
+ int n, nc;
+
+ while ((p = strstr(stmt, "NAME_CONST")))
+ if ((n = sscanf(p, "%*[^,],%1024[^)])%n", val, &nc))) {
+ if (trace(33))
+ htrc("p=%s\nn=%d val=%s nc=%d\n", p, n, val, nc);
+
+ *p = 0;
+
+ if ((p2 = strstr(val, "'"))) {
+ if ((n = sscanf(p2, "%*['\\]%1024[^'\\]", nval))) {
+ if (trace(33))
+ htrc("p2=%s\nn=%d nval=%s\n", p2, n, nval);
+
+ strcat(strcat(strcat(strcat(stmt, "'"), nval), "'"), p + nc);
+ } else
+ break;
+
+ } else
+ strcat(strcat(strcat(strcat(stmt, "("), val), ")"), p + nc);
+
+ if (trace(33))
+ htrc("stmt=%s\n", stmt);
+
+ } else
+ break;
+
+ return;
+} // end of RemoveConst
+
+/***********************************************************************/
/* MakeCommand: make the Update or Delete statement to send to the */
/* MySQL server. Limited to remote values and filtering. */
/***********************************************************************/
@@ -524,6 +561,8 @@ bool TDBEXT::MakeCommand(PGLOBAL g)
stmt[i++] = (Qrystr[k] == '`') ? q : Qrystr[k];
} while (Qrystr[k++]);
+ RemoveConst(g, stmt);
+
if (body)
strcat(stmt, body);
diff --git a/storage/connect/tabext.h b/storage/connect/tabext.h
index 6b67c2ab5ed..5fef1b9ece0 100644
--- a/storage/connect/tabext.h
+++ b/storage/connect/tabext.h
@@ -1,7 +1,7 @@
/*************** Tabext H Declares Source Code File (.H) ***************/
-/* Name: TABEXT.H Version 1.0 */
+/* Name: TABEXT.H Version 1.1 */
/* */
-/* (C) Copyright to the author Olivier BERTRAND 2017 */
+/* (C) Copyright to the author Olivier BERTRAND 2017 - 2019 */
/* */
/* This is the EXTDEF, TABEXT and EXTCOL classes definitions. */
/***********************************************************************/
@@ -130,6 +130,7 @@ protected:
virtual bool MakeSQL(PGLOBAL g, bool cnt);
//virtual bool MakeInsert(PGLOBAL g);
virtual bool MakeCommand(PGLOBAL g);
+ void RemoveConst(PGLOBAL g, char *stmt);
int Decode(PCSZ utf, char *buf, size_t n);
// Members
diff --git a/storage/connect/tabjdbc.cpp b/storage/connect/tabjdbc.cpp
index adb3fc4fb51..789daff6fcd 100644
--- a/storage/connect/tabjdbc.cpp
+++ b/storage/connect/tabjdbc.cpp
@@ -1,11 +1,11 @@
/************* TabJDBC C++ Program Source Code File (.CPP) *************/
/* PROGRAM NAME: TABJDBC */
/* ------------- */
-/* Version 1.2 */
+/* Version 1.3 */
/* */
/* COPYRIGHT: */
/* ---------- */
-/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */
+/* (C) Copyright to the author Olivier BERTRAND 2016-2019 */
/* */
/* WHAT THIS PROGRAM DOES: */
/* ----------------------- */
@@ -72,7 +72,6 @@
#include "tabext.h"
#include "tabjdbc.h"
#include "tabmul.h"
-//#include "reldef.h"
#include "tabcol.h"
#include "valblk.h"
#include "ha_connect.h"
@@ -89,6 +88,9 @@ extern int num_read, num_there, num_eq[2]; // Statistics
/* External function. */
/***********************************************************************/
bool ExactInfo(void);
+#if defined(DEVELOPMENT)
+extern char *GetUserVariable(PGLOBAL g, const uchar *varname);
+#endif // DEVELOPMENT
/* -------------------------- Class JDBCDEF -------------------------- */
@@ -147,10 +149,6 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
return RC_FX;
Tabname = p;
-// } else if (b) {
-// // Otherwise, straight server name,
-// Tabname = GetStringCatInfo(g, "Name", NULL);
-// Tabname = GetStringCatInfo(g, "Tabname", Tabname);
} // endif
if (trace(1))
@@ -165,6 +163,11 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
return RC_FX;
} // endif server
+#if defined(DEVELOPMENT)
+ if (*server->host == '@') {
+ Url = GetUserVariable(g, (const uchar*)&server->host[1]);
+ } else
+#endif // 0
if (strncmp(server->host, "jdbc:", 5)) {
// Now make the required URL
Url = (PSZ)PlugSubAlloc(g, NULL, 0);
@@ -185,12 +188,15 @@ int JDBCDEF::ParseURL(PGLOBAL g, char *url, bool b)
} else // host is a URL
Url = PlugDup(g, server->host);
- if (server->username)
+ if (!Username && server->username)
Username = PlugDup(g, server->username);
- if (server->password)
+ if (!Password && server->password)
Password = PlugDup(g, server->password);
+ Driver = PlugDup(g, GetListOption(g, "Driver", server->owner, NULL));
+ Wrapname = PlugDup(g, GetListOption(g, "Wrapper", server->owner, NULL));
+ Memory = atoi(GetListOption(g, "Memory", server->owner, "0"));
return RC_NF;
} // endif
@@ -208,7 +214,6 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
if (EXTDEF::DefineAM(g, am, poff))
return true;
- Driver = GetStringCatInfo(g, "Driver", NULL);
Desc = Url = GetStringCatInfo(g, "Connect", NULL);
if (!Url && !Catfunc) {
@@ -228,7 +233,10 @@ bool JDBCDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
return true;
} // endif rc
- Wrapname = GetStringCatInfo(g, "Wrapper", NULL);
+ // Default values may have been set in ParseURL
+ Memory = GetIntCatInfo("Memory", Memory);
+ Driver = GetStringCatInfo(g, "Driver", Driver);
+ Wrapname = GetStringCatInfo(g, "Wrapper", Wrapname);
return false;
} // end of DefineAM
@@ -558,33 +566,42 @@ bool TDBJDBC::OpenDB(PGLOBAL g)
this, Tdb_No, Use, Mode);
if (Use == USE_OPEN) {
- /*******************************************************************/
- /* Table already open, just replace it at its beginning. */
- /*******************************************************************/
- if (Memory == 1) {
- if ((Qrp = Jcp->AllocateResult(g, this)))
- Memory = 2; // Must be filled
- else
- Memory = 0; // Allocation failed, don't use it
-
- } else if (Memory == 2)
- Memory = 3; // Ok to use memory result
-
- if (Memory < 3) {
- // Method will depend on cursor type
- if ((Rbuf = Query ? Jcp->Rewind(Query->GetStr()) : 0) < 0)
- if (Mode != MODE_READX) {
- Jcp->Close();
- return true;
- } else
- Rbuf = 0;
+ if (Mode == MODE_READ || Mode == MODE_READX) {
+ /*****************************************************************/
+ /* Table already open, just replace it at its beginning. */
+ /*****************************************************************/
+ if (Memory == 1) {
+ if ((Qrp = Jcp->AllocateResult(g, this)))
+ Memory = 2; // Must be filled
+ else
+ Memory = 0; // Allocation failed, don't use it
- } else
- Rbuf = Qrp->Nblin;
+ } else if (Memory == 2)
+ Memory = 3; // Ok to use memory result
+
+ if (Memory < 3) {
+ // Method will depend on cursor type
+ if ((Rbuf = Query ? Jcp->Rewind(Query->GetStr()) : 0) < 0)
+ if (Mode != MODE_READX) {
+ Jcp->Close();
+ return true;
+ } else
+ Rbuf = 0;
+
+ } else
+ Rbuf = Qrp->Nblin;
+
+ CurNum = 0;
+ Fpos = 0;
+ Curpos = 1;
+ } else if (Mode == MODE_UPDATE || Mode == MODE_DELETE) {
+ // new update coming from a trigger or procedure
+ Query = NULL;
+ SetCondFil(NULL);
+ Qrystr = To_Def->GetStringCatInfo(g, "Query_String", "?");
+ } else { //if (Mode == MODE_INSERT)
+ } // endif Mode
- CurNum = 0;
- Fpos = 0;
- Curpos = 1;
return false;
} // endif use
diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp
index d20e793ff88..afab52aa282 100644
--- a/storage/connect/tabjson.cpp
+++ b/storage/connect/tabjson.cpp
@@ -1,6 +1,6 @@
/************* tabjson C++ Program Source Code File (.CPP) *************/
-/* PROGRAM NAME: tabjson Version 1.5 */
-/* (C) Copyright to the author Olivier BERTRAND 2014 - 2017 */
+/* PROGRAM NAME: tabjson Version 1.7 */
+/* (C) Copyright to the author Olivier BERTRAND 2014 - 2019 */
/* This program are the JSON class DB execution routines. */
/***********************************************************************/
@@ -110,8 +110,8 @@ PQRYRES JSONColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt, bool info)
buftyp, fldtyp, length, false, false);
crp = qrp->Colresp->Next->Next->Next->Next->Next->Next;
- crp->Name = "Nullable";
- crp->Next->Name = "Jpath";
+ crp->Name = PlugDup(g, "Nullable");
+ crp->Next->Name = PlugDup(g, "Jpath");
if (info || !qrp)
return qrp;
@@ -173,6 +173,7 @@ JSONDISC::JSONDISC(PGLOBAL g, uint *lg)
int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
{
+ char filename[_MAX_PATH];
bool mgo = (GetTypeID(topt->type) == TAB_MONGO);
PCSZ level = GetStringTableOption(g, topt, "Level", NULL);
@@ -209,6 +210,12 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
return 0;
} // endif Fn
+ if (tdp->Fn) {
+ // We used the file name relative to recorded datapath
+ PlugSetPath(filename, tdp->Fn, tdp->GetPath());
+ tdp->Fn = PlugDup(g, filename);
+ } // endif Fn
+
if (trace(1))
htrc("File %s objname=%s pretty=%d lvl=%d\n",
tdp->Fn, tdp->Objname, tdp->Pretty, lvl);
@@ -342,7 +349,7 @@ int JSONDISC::GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt)
strncpy(colname, jpp->GetKey(), 64);
fmt[bf] = 0;
- if (Find(g, jpp->GetVal(), MY_MIN(lvl, 0)))
+ if (Find(g, jpp->GetVal(), colname, MY_MIN(lvl, 0)))
goto err;
} // endfor jpp
@@ -385,7 +392,7 @@ err:
return 0;
} // end of GetColumns
-bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
+bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j)
{
char *p, *pc = colname + strlen(colname);
int ars;
@@ -413,12 +420,14 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
job = (PJOB)jsp;
for (PJPR jrp = job->GetFirst(); jrp; jrp = jrp->GetNext()) {
- if (*jrp->GetKey() != '$') {
- strncat(strncat(fmt, sep, 128), jrp->GetKey(), 128);
- strncat(strncat(colname, "_", 64), jrp->GetKey(), 64);
+ PCSZ k = jrp->GetKey();
+
+ if (*k != '$') {
+ strncat(strncat(fmt, sep, 128), k, 128);
+ strncat(strncat(colname, "_", 64), k, 64);
} // endif Key
- if (Find(g, jrp->GetVal(), j + 1))
+ if (Find(g, jrp->GetVal(), k, j + 1))
return true;
*p = *pc = 0;
@@ -428,13 +437,13 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
case TYPE_JAR:
jar = (PJAR)jsp;
- if (all || (tdp->Xcol && !stricmp(tdp->Xcol, colname)))
+ if (all || (tdp->Xcol && !stricmp(tdp->Xcol, key)))
ars = jar->GetSize(false);
else
ars = MY_MIN(jar->GetSize(false), 1);
for (int k = 0; k < ars; k++) {
- if (!tdp->Xcol || stricmp(tdp->Xcol, colname)) {
+ if (!tdp->Xcol || stricmp(tdp->Xcol, key)) {
sprintf(buf, "%d", k);
if (tdp->Uri)
@@ -448,7 +457,7 @@ bool JSONDISC::Find(PGLOBAL g, PJVAL jvp, int j)
} else
strncat(fmt, (tdp->Uri ? sep : "[*]"), 128);
- if (Find(g, jar->GetValue(k), j))
+ if (Find(g, jar->GetValue(k), "", j))
return true;
*p = *pc = 0;
@@ -522,7 +531,9 @@ void JSONDISC::AddColumn(PGLOBAL g)
n++;
} // endif jcp
- pjcp = jcp;
+ if (jcp)
+ pjcp = jcp;
+
} // end of AddColumn
@@ -549,7 +560,7 @@ JSONDEF::JSONDEF(void)
/***********************************************************************/
/* DefineAM: define specific AM block values. */
/***********************************************************************/
-bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
+bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff)
{
Schema = GetStringCatInfo(g, "DBname", Schema);
Jmode = (JMODE)GetIntCatInfo("Jmode", MODE_OBJECT);
@@ -561,7 +572,8 @@ bool JSONDEF::DefineAM(PGLOBAL g, LPCSTR, int poff)
Sep = *GetStringCatInfo(g, "Separator", ".");
Accept = GetBoolCatInfo("Accept", false);
- if (Uri = GetStringCatInfo(g, "Connect", NULL)) {
+ // Don't use url as uri when called from REST OEM module
+ if (stricmp(am, "REST") && (Uri = GetStringCatInfo(g, "Connect", NULL))) {
#if defined(JAVA_SUPPORT) || defined(CMGO_SUPPORT)
Collname = GetStringCatInfo(g, "Name",
(Catfunc & (FNC_TABLE | FNC_COL)) ? NULL : Name);
@@ -2340,7 +2352,7 @@ void TDBJSON::CloseDB(PGLOBAL g)
TDBJCL::TDBJCL(PJDEF tdp) : TDBCAT(tdp)
{
Topt = tdp->GetTopt();
- Db = tdp->Schema;
+ Db = tdp->Schema;
Dsn = tdp->Uri;
} // end of TDBJCL constructor
diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h
index fcbfe4ed1ec..8721a2a5ab7 100644
--- a/storage/connect/tabjson.h
+++ b/storage/connect/tabjson.h
@@ -52,7 +52,7 @@ public:
// Functions
int GetColumns(PGLOBAL g, PCSZ db, PCSZ dsn, PTOS topt);
- bool Find(PGLOBAL g, PJVAL jvp, int j);
+ bool Find(PGLOBAL g, PJVAL jvp, PCSZ key, int j);
void AddColumn(PGLOBAL g);
// Members
diff --git a/storage/connect/tabxml.cpp b/storage/connect/tabxml.cpp
index 573339bce35..19490d350e8 100644
--- a/storage/connect/tabxml.cpp
+++ b/storage/connect/tabxml.cpp
@@ -163,8 +163,11 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
return NULL;
tdp->Tabname = tab;
+ tdp->Tabname = (char*)GetStringTableOption(g, topt, "Tabname", tab);
+ tdp->Rowname = (char*)GetStringTableOption(g, topt, "Rownode", NULL);
tdp->Zipped = GetBooleanTableOption(g, topt, "Zipped", false);
tdp->Entry = GetStringTableOption(g, topt, "Entry", NULL);
+ tdp->Skip = GetBooleanTableOption(g, topt, "Skipnull", false);
if (!(op = GetStringTableOption(g, topt, "Xmlsup", NULL)))
#if defined(__WIN__)
@@ -280,7 +283,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
if (!vp->atp)
node = vp->nl->GetItem(g, vp->k++, tdp->Usedom ? node : NULL);
- strncat(fmt, colname, XLEN(fmt));
+ if (!j)
+ strncat(fmt, colname, XLEN(fmt));
+
strncat(fmt, "/", XLEN(fmt));
strncat(xcol->Name, "_", XLEN(xcol->Name));
j++;
@@ -302,6 +307,7 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
case RC_INFO:
PushWarning(g, txmp);
case RC_OK:
+ xcol->Cbn = !strlen(buf);
break;
default:
goto err;
@@ -327,9 +333,9 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
xcp->Len = MY_MAX(xcp->Len, xcol->Len);
xcp->Scale = MY_MAX(xcp->Scale, xcol->Scale);
- xcp->Cbn |= xcol->Cbn;
+ xcp->Cbn |= (xcol->Cbn || !xcol->Len);
xcp->Found = true;
- } else {
+ } else if(xcol->Len || !tdp->Skip) {
// New column
xcp = new(g) XMCOL(g, xcol, fmt, i);
length[0] = MY_MAX(length[0], strlen(xcol->Name));
@@ -344,7 +350,8 @@ PQRYRES XMLColumns(PGLOBAL g, char *db, char *tab, PTOS topt, bool info)
n++;
} // endif xcp
- pxcp = xcp;
+ if (xcp)
+ pxcp = xcp;
if (vp->atp)
vp->atp = vp->atp->GetNext(g);
@@ -445,6 +452,7 @@ XMLDEF::XMLDEF(void)
Usedom = false;
Zipped = false;
Mulentries = false;
+ Skip = false;
} // end of XMLDEF constructor
/***********************************************************************/
@@ -814,127 +822,141 @@ bool TDBXML::Initialize(PGLOBAL g)
} // endif Bufdone
#if !defined(UNIX)
- if (!Root) try {
+ if (!Root) try {
#else
- if (!Root) {
+ if (!Root) {
#endif
- char tabpath[64], filename[_MAX_PATH];
-
- // We used the file name relative to recorded datapath
- PlugSetPath(filename, Xfile, GetPath());
-
- // Load or re-use the table file
- rc = LoadTableFile(g, filename);
-
- if (rc == RC_OK) {
- // Get root node
- if (!(Root = Docp->GetRoot(g))) {
- // This should never happen as load should have failed
- strcpy(g->Message, MSG(EMPTY_DOC));
- goto error;
- } // endif Root
-
- // If tabname is not an Xpath,
- // construct one that will find it anywhere
- if (!strchr(Tabname, '/'))
- strcat(strcpy(tabpath, "//"), Tabname);
- else
- strcpy(tabpath, Tabname);
-
- // Evaluate table xpath
- if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
- if (TabNode->GetType() != XML_ELEMENT_NODE) {
- sprintf(g->Message, MSG(BAD_NODE_TYPE), TabNode->GetType());
- goto error;
- } // endif Type
-
- } else if (Mode == MODE_INSERT && XmlDB) {
- // We are adding a new table to a multi-table file
-
- // If XmlDB is not an Xpath,
- // construct one that will find it anywhere
- if (!strchr(XmlDB, '/'))
- strcat(strcpy(tabpath, "//"), XmlDB);
- else
- strcpy(tabpath, XmlDB);
-
- if (!(DBnode = Root->SelectSingleNode(g, tabpath))) {
- // DB node does not exist yet; we cannot create it
- // because we don't know where it should be placed
- sprintf(g->Message, MSG(MISSING_NODE), XmlDB, Xfile);
- goto error;
- } // endif DBnode
-
- if (!(TabNode = DBnode->AddChildNode(g, Tabname))) {
- sprintf(g->Message, MSG(FAIL_ADD_NODE), Tabname);
- goto error;
- } // endif TabNode
-
- DBnode->AddText(g, "\n");
- } else
- TabNode = Root; // Try this ?
-
- } else if (rc == RC_NF || rc == RC_EF) {
- // The XML file does not exist or is void
- if (Mode == MODE_INSERT) {
- // New Document
- char buf[64];
-
- // Create the XML node
- if (Docp->NewDoc(g, "1.0")) {
- strcpy(g->Message, MSG(NEW_DOC_FAILED));
- goto error;
- } // endif NewDoc
-
- // Now we can link the Xblock
- To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
-
- // Add a CONNECT comment node
- strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
- Docp->AddComment(g, buf);
-
- if (XmlDB) {
- // This is a multi-table file
- DBnode = Root = Docp->NewRoot(g, XmlDB);
- DBnode->AddText(g, "\n");
- TabNode = DBnode->AddChildNode(g, Tabname);
- DBnode->AddText(g, "\n");
- } else
- TabNode = Root = Docp->NewRoot(g, Tabname);
-
- if (TabNode == NULL || Root == NULL) {
- strcpy(g->Message, MSG(XML_INIT_ERROR));
- goto error;
- } else if (SetTabNode(g))
- goto error;
-
- } else {
- sprintf(g->Message, MSG(FILE_UNFOUND), Xfile);
-
- if (Mode == MODE_READ) {
- PushWarning(g, this);
- Void = true;
- } // endif Mode
-
- goto error;
- } // endif Mode
-
- } else if (rc == RC_INFO) {
- // Loading failed
- sprintf(g->Message, MSG(LOADING_FAILED), Xfile);
- goto error;
- } else // (rc == RC_FX)
- goto error;
-
- // Get row node list
- if (Rowname)
- Nlist = TabNode->SelectNodes(g, Rowname);
- else
- Nlist = TabNode->GetChildElements(g);
-
- Docp->SetNofree(true); // For libxml2
+ char tabpath[64], filename[_MAX_PATH];
+
+ // We used the file name relative to recorded datapath
+ PlugSetPath(filename, Xfile, GetPath());
+
+ // Load or re-use the table file
+ rc = LoadTableFile(g, filename);
+
+ if (rc == RC_OK) {
+ // Get root node
+ if (!(Root = Docp->GetRoot(g))) {
+ // This should never happen as load should have failed
+ strcpy(g->Message, MSG(EMPTY_DOC));
+ goto error;
+ } // endif Root
+
+ // If tabname is not an Xpath,
+ // construct one that will find it anywhere
+ if (!strchr(Tabname, '/'))
+ strcat(strcpy(tabpath, "//"), Tabname);
+ else
+ strcpy(tabpath, Tabname);
+
+ // Evaluate table xpath
+ if ((TabNode = Root->SelectSingleNode(g, tabpath))) {
+ if (TabNode->GetType() != XML_ELEMENT_NODE) {
+ sprintf(g->Message, MSG(BAD_NODE_TYPE), TabNode->GetType());
+ goto error;
+ } // endif Type
+
+ } else if (Mode == MODE_INSERT && XmlDB) {
+ // We are adding a new table to a multi-table file
+
+ // If XmlDB is not an Xpath,
+ // construct one that will find it anywhere
+ if (!strchr(XmlDB, '/'))
+ strcat(strcpy(tabpath, "//"), XmlDB);
+ else
+ strcpy(tabpath, XmlDB);
+
+ if (!(DBnode = Root->SelectSingleNode(g, tabpath))) {
+ // DB node does not exist yet; we cannot create it
+ // because we don't know where it should be placed
+ sprintf(g->Message, MSG(MISSING_NODE), XmlDB, Xfile);
+ goto error;
+ } // endif DBnode
+
+ if (!(TabNode = DBnode->AddChildNode(g, Tabname))) {
+ sprintf(g->Message, MSG(FAIL_ADD_NODE), Tabname);
+ goto error;
+ } // endif TabNode
+
+ DBnode->AddText(g, "\n");
+ } else {
+ TabNode = Root; // Try this ?
+ Tabname = TabNode->GetName(g);
+ } // endif's
+
+ } else if (rc == RC_NF || rc == RC_EF) {
+ // The XML file does not exist or is void
+ if (Mode == MODE_INSERT) {
+ // New Document
+ char buf[64];
+
+ // Create the XML node
+ if (Docp->NewDoc(g, "1.0")) {
+ strcpy(g->Message, MSG(NEW_DOC_FAILED));
+ goto error;
+ } // endif NewDoc
+
+ // Now we can link the Xblock
+ To_Xb = Docp->LinkXblock(g, Mode, rc, filename);
+
+ // Add a CONNECT comment node
+ strcpy(buf, " Created by the MariaDB CONNECT Storage Engine");
+ Docp->AddComment(g, buf);
+
+ if (XmlDB) {
+ // This is a multi-table file
+ DBnode = Root = Docp->NewRoot(g, XmlDB);
+ DBnode->AddText(g, "\n");
+ TabNode = DBnode->AddChildNode(g, Tabname);
+ DBnode->AddText(g, "\n");
+ } else
+ TabNode = Root = Docp->NewRoot(g, Tabname);
+
+ if (TabNode == NULL || Root == NULL) {
+ strcpy(g->Message, MSG(XML_INIT_ERROR));
+ goto error;
+ } else if (SetTabNode(g))
+ goto error;
+
+ } else {
+ sprintf(g->Message, MSG(FILE_UNFOUND), Xfile);
+
+ if (Mode == MODE_READ) {
+ PushWarning(g, this);
+ Void = true;
+ } // endif Mode
+
+ goto error;
+ } // endif Mode
+
+ } else if (rc == RC_INFO) {
+ // Loading failed
+ sprintf(g->Message, MSG(LOADING_FAILED), Xfile);
+ goto error;
+ } else // (rc == RC_FX)
+ goto error;
+
+ if (!Rowname) {
+ for (PXNODE n = TabNode->GetChild(g); n; n = n->GetNext(g))
+ if (n->GetType() == XML_ELEMENT_NODE) {
+ Rowname = n->GetName(g);
+ break;
+ } // endif Type
+
+ if (!Rowname)
+ Rowname = TabNode->GetName(g);
+ } // endif Rowname
+
+ // Get row node list
+ if (strcmp(Rowname, Tabname))
+ Nlist = TabNode->SelectNodes(g, Rowname);
+ else
+ Nrow = 1;
+
+
+ Docp->SetNofree(true); // For libxml2
#if defined(__WIN__)
- } catch(_com_error e) {
+ } catch (_com_error e) {
// We come here if a DOM command threw an error
char buf[128];
@@ -1221,10 +1243,14 @@ int TDBXML::ReadDB(PGLOBAL g)
htrc("TDBXML ReadDB: Irow=%d RowNode=%p\n", Irow, RowNode);
// Get the new row node
- if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) {
- sprintf(g->Message, MSG(MISSING_ROWNODE), Irow);
- return RC_FX;
- } // endif RowNode
+ if (Nlist) {
+ if ((RowNode = Nlist->GetItem(g, Irow, RowNode)) == NULL) {
+ sprintf(g->Message, MSG(MISSING_ROWNODE), Irow);
+ return RC_FX;
+ } // endif RowNode
+
+ } else
+ RowNode = TabNode;
if (Colname && Coltype == 2)
Clist = RowNode->SelectNodes(g, Colname, Clist);
@@ -1279,6 +1305,7 @@ int TDBXML::WriteDB(PGLOBAL g)
/***********************************************************************/
int TDBXML::DeleteDB(PGLOBAL g, int irc)
{
+ // TODO: Handle null Nlist
if (irc == RC_FX) {
// Delete all rows
for (Irow = 0; Irow < Nrow; Irow++)
diff --git a/storage/connect/tabxml.h b/storage/connect/tabxml.h
index 102767e965a..fb3913f08ea 100644
--- a/storage/connect/tabxml.h
+++ b/storage/connect/tabxml.h
@@ -52,6 +52,7 @@ class DllExport XMLDEF : public TABDEF { /* Logical table description */
bool Usedom; /* True: DOM, False: libxml2 */
bool Zipped; /* True: Zipped XML file(s) */
bool Mulentries; /* True: multiple entries in zip file*/
+ bool Skip; /* Skip null columns */
}; // end of XMLDEF
#if defined(INCLUDE_TDBXML)
diff --git a/storage/innobase/dict/dict0dict.cc b/storage/innobase/dict/dict0dict.cc
index 7664bc2064d..bc9bbad8ec3 100644
--- a/storage/innobase/dict/dict0dict.cc
+++ b/storage/innobase/dict/dict0dict.cc
@@ -4295,7 +4295,6 @@ dict_create_foreign_constraints_low(
const char* create_table_name;
const char* orig;
char create_name[MAX_TABLE_NAME_LEN + 1];
- char operation[8];
ut_ad(!srv_read_only_mode);
ut_ad(mutex_own(&dict_sys->mutex));
@@ -4306,41 +4305,33 @@ dict_create_foreign_constraints_low(
orig = ptr;
ptr = dict_accept(cs, ptr, "ALTER", &success);
- strcpy((char *)operation, success ? "Alter " : "Create ");
+ const char* const operation = success ? "Alter " : "Create ";
if (!success) {
orig = ptr;
ptr = dict_scan_to(ptr, "CREATE");
ptr = dict_scan_to(ptr, "TABLE");
ptr = dict_accept(cs, ptr, "TABLE", &success);
+ create_table_name = NULL;
if (success) {
ptr = dict_scan_table_name(cs, ptr, &table_to_create, name,
- &success, heap, &create_table_name);
+ &success, heap, &create_table_name);
}
- if (success) {
- char *bufend;
- bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
- create_table_name, strlen(create_table_name),
- trx->mysql_thd);
- create_name[bufend-create_name]='\0';
- ptr = orig;
- } else {
- char *bufend;
- ptr = orig;
- bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
- name, strlen(name), trx->mysql_thd);
- create_name[bufend-create_name]='\0';
- }
-
- goto loop;
+ ptr = orig;
+ const char* n = create_table_name ? create_table_name : name;
+ char *bufend = innobase_convert_name(create_name, MAX_TABLE_NAME_LEN,
+ n, strlen(n), trx->mysql_thd);
+ create_name[bufend-create_name] = '\0';
+ } else {
+ strncpy(create_name, name, sizeof create_name);
+ create_name[(sizeof create_name) - 1] = '\0';
}
if (table == NULL) {
mutex_enter(&dict_foreign_err_mutex);
dict_foreign_error_report_low(ef, create_name);
- dict_foreign_error_report_low(ef, create_name);
fprintf(ef, "%s table %s with foreign key constraint"
" failed. Table %s not found from data dictionary."
" Error close to %s.\n",
@@ -4375,19 +4366,13 @@ dict_create_foreign_constraints_low(
ptr = dict_scan_table_name(cs, ptr, &table_to_alter, name,
&success, heap, &referenced_table_name);
- if (table_to_alter) {
- char *bufend;
- bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
- table_to_alter->name.m_name, strlen(table_to_alter->name.m_name),
- trx->mysql_thd);
- create_name[bufend-create_name]='\0';
- } else {
- char *bufend;
- bufend = innobase_convert_name((char *)create_name, MAX_TABLE_NAME_LEN,
- referenced_table_name, strlen(referenced_table_name),
- trx->mysql_thd);
+ {
+ const char* n = table_to_alter
+ ? table_to_alter->name.m_name : referenced_table_name;
+ char* bufend = innobase_convert_name(
+ create_name, MAX_TABLE_NAME_LEN, n, strlen(n),
+ trx->mysql_thd);
create_name[bufend-create_name]='\0';
-
}
if (!success) {
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
index 307374ec700..b1dc295206a 100644
--- a/storage/innobase/handler/handler0alter.cc
+++ b/storage/innobase/handler/handler0alter.cc
@@ -6145,18 +6145,23 @@ new_clustered_failed:
goto err_exit;
}
- size_t dblen = ctx->old_table->name.dblen() + 1;
- size_t tablen = altered_table->s->table_name.length;
+ size_t prefixlen= strlen(mysql_data_home);
+ if (mysql_data_home[prefixlen-1] != FN_LIBCHAR)
+ prefixlen++;
+ size_t tablen = altered_table->s->path.length - prefixlen;
const char* part = ctx->old_table->name.part();
size_t partlen = part ? strlen(part) : 0;
char* new_table_name = static_cast<char*>(
- mem_heap_alloc(ctx->heap,
- dblen + tablen + partlen + 1));
- memcpy(new_table_name, ctx->old_table->name.m_name, dblen);
- memcpy(new_table_name + dblen,
- altered_table->s->table_name.str, tablen);
- memcpy(new_table_name + dblen + tablen,
- part ? part : "", partlen + 1);
+ mem_heap_alloc(ctx->heap, tablen + partlen + 1));
+ memcpy(new_table_name,
+ altered_table->s->path.str + prefixlen, tablen);
+#ifdef _WIN32
+ {
+ char *sep= strchr(new_table_name, FN_LIBCHAR);
+ sep[0]= '/';
+ }
+#endif
+ memcpy(new_table_name + tablen, part ? part : "", partlen + 1);
ulint n_cols = 0;
ulint n_v_cols = 0;
dtuple_t* defaults;
@@ -7662,12 +7667,14 @@ check_if_ok_to_rename:
continue;
}
+ dict_foreign_t* foreign;
+
for (dict_foreign_set::iterator it
= m_prebuilt->table->foreign_set.begin();
it != m_prebuilt->table->foreign_set.end();
++it) {
- dict_foreign_t* foreign = *it;
+ foreign = *it;
const char* fid = strchr(foreign->id, '/');
DBUG_ASSERT(fid);
@@ -7678,7 +7685,6 @@ check_if_ok_to_rename:
if (!my_strcasecmp(system_charset_info,
fid, drop->name)) {
- drop_fk[n_drop_fk++] = foreign;
goto found_fk;
}
}
@@ -7687,13 +7693,20 @@ check_if_ok_to_rename:
drop->type_name(), drop->name);
goto err_exit;
found_fk:
+ for (ulint i = n_drop_fk; i--; ) {
+ if (drop_fk[i] == foreign) {
+ goto dup_fk;
+ }
+ }
+ drop_fk[n_drop_fk++] = foreign;
+dup_fk:
continue;
}
DBUG_ASSERT(n_drop_fk > 0);
DBUG_ASSERT(n_drop_fk
- == ha_alter_info->alter_info->drop_list.elements);
+ <= ha_alter_info->alter_info->drop_list.elements);
} else {
drop_fk = NULL;
}
@@ -8825,7 +8838,7 @@ err_exit:
rename_foreign:
trx->op_info = "renaming column in SYS_FOREIGN_COLS";
- std::list<dict_foreign_t*> fk_evict;
+ std::set<dict_foreign_t*> fk_evict;
bool foreign_modified;
for (dict_foreign_set::const_iterator it = user_table->foreign_set.begin();
@@ -8865,7 +8878,7 @@ rename_foreign:
}
if (foreign_modified) {
- fk_evict.push_back(foreign);
+ fk_evict.insert(foreign);
}
}
@@ -8907,7 +8920,7 @@ rename_foreign:
}
if (foreign_modified) {
- fk_evict.push_back(foreign);
+ fk_evict.insert(foreign);
}
}
@@ -9724,6 +9737,8 @@ commit_try_rebuild(
DBUG_ASSERT(!(ha_alter_info->handler_flags
& ALTER_DROP_FOREIGN_KEY)
|| ctx->num_to_drop_fk > 0);
+ DBUG_ASSERT(ctx->num_to_drop_fk
+ <= ha_alter_info->alter_info->drop_list.elements);
for (dict_index_t* index = dict_table_get_first_index(rebuilt_table);
index;
@@ -10023,7 +10038,7 @@ commit_try_norebuild(
& ALTER_DROP_FOREIGN_KEY)
|| ctx->num_to_drop_fk > 0);
DBUG_ASSERT(ctx->num_to_drop_fk
- == ha_alter_info->alter_info->drop_list.elements
+ <= ha_alter_info->alter_info->drop_list.elements
|| ctx->num_to_drop_vcol
== ha_alter_info->alter_info->drop_list.elements);
@@ -10179,9 +10194,10 @@ after a successful commit_try_norebuild() call.
@param altered_table the TABLE after the ALTER
@param table the TABLE before the ALTER
@param trx Data dictionary transaction
-(will be started and committed, for DROP INDEX) */
+(will be started and committed, for DROP INDEX)
+@return whether all replacements were found for dropped indexes */
inline MY_ATTRIBUTE((nonnull))
-void
+bool
commit_cache_norebuild(
/*===================*/
Alter_inplace_info* ha_alter_info,
@@ -10195,6 +10211,8 @@ commit_cache_norebuild(
DBUG_ASSERT(ctx->new_table->space != fil_system.temp_space);
DBUG_ASSERT(!ctx->new_table->is_temporary());
+ bool found = true;
+
if (ctx->page_compression_level) {
DBUG_ASSERT(ctx->new_table->space != fil_system.sys_space);
ctx->new_table->flags &=
@@ -10297,7 +10315,7 @@ commit_cache_norebuild(
if (!dict_foreign_replace_index(
index->table, ctx->col_names, index)) {
- ut_a(!ctx->prebuilt->trx->check_foreigns);
+ found = false;
}
/* Mark the index dropped
@@ -10389,7 +10407,7 @@ commit_cache_norebuild(
: NULL;
DBUG_ASSERT((ctx->new_table->fts == NULL)
== (ctx->new_table->fts_doc_id_index == NULL));
- DBUG_VOID_RETURN;
+ DBUG_RETURN(found);
}
/** Adjust the persistent statistics after non-rebuilding ALTER TABLE.
@@ -10574,7 +10592,6 @@ ha_innobase::commit_inplace_alter_table(
Alter_inplace_info* ha_alter_info,
bool commit)
{
- dberr_t error;
ha_innobase_inplace_ctx*ctx0;
struct mtr_buf_copy_t logs;
@@ -10662,7 +10679,7 @@ ha_innobase::commit_inplace_alter_table(
transactions collected during crash recovery could be
holding InnoDB locks only, not MySQL locks. */
- error = row_merge_lock_table(
+ dberr_t error = row_merge_lock_table(
m_prebuilt->trx, ctx->old_table, LOCK_X);
if (error != DB_SUCCESS) {
@@ -10852,9 +10869,9 @@ ha_innobase::commit_inplace_alter_table(
file operations that will be performed in
commit_cache_rebuild(), and if none, generate
the redo log for these operations. */
- error = fil_mtr_rename_log(ctx->old_table,
- ctx->new_table,
- ctx->tmp_name, &mtr);
+ dberr_t error = fil_mtr_rename_log(
+ ctx->old_table, ctx->new_table, ctx->tmp_name,
+ &mtr);
if (error != DB_SUCCESS) {
/* Out of memory or a problem will occur
when renaming files. */
@@ -10990,31 +11007,29 @@ ha_innobase::commit_inplace_alter_table(
/* Rename the tablespace files. */
commit_cache_rebuild(ctx);
- error = innobase_update_foreign_cache(ctx, m_user_thd);
- if (error != DB_SUCCESS) {
- goto foreign_fail;
- }
- } else {
- error = innobase_update_foreign_cache(ctx, m_user_thd);
-
- if (error != DB_SUCCESS) {
+ if (innobase_update_foreign_cache(ctx, m_user_thd)
+ != DB_SUCCESS
+ && m_prebuilt->trx->check_foreigns) {
foreign_fail:
- /* The data dictionary cache
- should be corrupted now. The
- best solution should be to
- kill and restart the server,
- but the *.frm file has not
- been replaced yet. */
push_warning_printf(
m_user_thd,
Sql_condition::WARN_LEVEL_WARN,
ER_ALTER_INFO,
- "InnoDB: Could not add foreign"
- " key constraints.");
- } else {
- commit_cache_norebuild(ha_alter_info, ctx,
- altered_table,
- table, trx);
+ "failed to load FOREIGN KEY"
+ " constraints");
+ }
+ } else {
+ bool fk_fail = innobase_update_foreign_cache(
+ ctx, m_user_thd) != DB_SUCCESS;
+
+ if (!commit_cache_norebuild(ha_alter_info, ctx,
+ altered_table, table,
+ trx)) {
+ fk_fail = true;
+ }
+
+ if (fk_fail && m_prebuilt->trx->check_foreigns) {
+ goto foreign_fail;
}
}
@@ -11230,7 +11245,7 @@ foreign_fail:
before this is completed, some orphan tables
with ctx->tmp_name may be recovered. */
trx_start_for_ddl(trx, TRX_DICT_OP_TABLE);
- error = row_merge_drop_table(trx, ctx->old_table);
+ dberr_t error = row_merge_drop_table(trx, ctx->old_table);
if (error != DB_SUCCESS) {
ib::error() << "Inplace alter table " << ctx->old_table->name
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index bc060ac517c..52f1ace7e37 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -9030,10 +9030,12 @@ i_s_innodb_mutexes_fill_table(
}
OK(field_store_string(fields[MUTEXES_NAME], mutex->cmutex_name));
- OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(mutex->cfile_name)));
- OK(fields[MUTEXES_CREATE_LINE]->store(mutex->cline, true));
+ OK(field_store_string(fields[MUTEXES_CREATE_FILE],
+ innobase_basename(mutex->cfile_name)));
+ OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true));
fields[MUTEXES_CREATE_LINE]->set_notnull();
- OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)mutex->count_os_wait));
+ OK(fields[MUTEXES_OS_WAITS]->store(lock->count_os_wait, true));
+ fields[MUTEXES_OS_WAITS]->set_notnull();
OK(schema_table_store_record(thd, tables->table));
}
@@ -9054,44 +9056,59 @@ i_s_innodb_mutexes_fill_table(
mutex_exit(&mutex_list_mutex);
#endif /* JAN_TODO_FIXME */
- mutex_enter(&rw_lock_list_mutex);
+ {
+ struct Locking
+ {
+ Locking() { mutex_enter(&rw_lock_list_mutex); }
+ ~Locking() { mutex_exit(&rw_lock_list_mutex); }
+ } locking;
+
+ for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL;
+ lock = UT_LIST_GET_NEXT(list, lock)) {
+ if (lock->count_os_wait == 0) {
+ continue;
+ }
- for (lock = UT_LIST_GET_FIRST(rw_lock_list); lock != NULL;
- lock = UT_LIST_GET_NEXT(list, lock)) {
- if (lock->count_os_wait == 0) {
- continue;
- }
+ if (buf_pool_is_block_lock(lock)) {
+ block_lock = lock;
+ block_lock_oswait_count += lock->count_os_wait;
+ continue;
+ }
- if (buf_pool_is_block_lock(lock)) {
- block_lock = lock;
- block_lock_oswait_count += lock->count_os_wait;
- continue;
+ //OK(field_store_string(fields[MUTEXES_NAME],
+ // lock->lock_name));
+ OK(field_store_string(
+ fields[MUTEXES_CREATE_FILE],
+ innobase_basename(lock->cfile_name)));
+ OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline,
+ true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
+ OK(fields[MUTEXES_OS_WAITS]->store(lock->count_os_wait,
+ true));
+ fields[MUTEXES_OS_WAITS]->set_notnull();
+ OK(schema_table_store_record(thd, tables->table));
}
- //OK(field_store_string(fields[MUTEXES_NAME], lock->lock_name));
- OK(field_store_string(fields[MUTEXES_CREATE_FILE], innobase_basename(lock->cfile_name)));
- OK(fields[MUTEXES_CREATE_LINE]->store(lock->cline, true));
- fields[MUTEXES_CREATE_LINE]->set_notnull();
- OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)lock->count_os_wait));
- OK(schema_table_store_record(thd, tables->table));
- }
-
- if (block_lock) {
- char buf1[IO_SIZE];
-
- snprintf(buf1, sizeof buf1, "combined %s",
- innobase_basename(block_lock->cfile_name));
-
- //OK(field_store_string(fields[MUTEXES_NAME], block_lock->lock_name));
- OK(field_store_string(fields[MUTEXES_CREATE_FILE], buf1));
- OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline, true));
- fields[MUTEXES_CREATE_LINE]->set_notnull();
- OK(field_store_ulint(fields[MUTEXES_OS_WAITS], (longlong)block_lock_oswait_count));
- OK(schema_table_store_record(thd, tables->table));
+ if (block_lock) {
+ char buf1[IO_SIZE];
+
+ snprintf(buf1, sizeof buf1, "combined %s",
+ innobase_basename(block_lock->cfile_name));
+
+ //OK(field_store_string(fields[MUTEXES_NAME],
+ // block_lock->lock_name));
+ OK(field_store_string(fields[MUTEXES_CREATE_FILE],
+ buf1));
+ OK(fields[MUTEXES_CREATE_LINE]->store(block_lock->cline,
+ true));
+ fields[MUTEXES_CREATE_LINE]->set_notnull();
+ OK(fields[MUTEXES_OS_WAITS]->store(
+ block_lock_oswait_count, true));
+ fields[MUTEXES_OS_WAITS]->set_notnull();
+ OK(schema_table_store_record(thd, tables->table));
+ }
}
- mutex_exit(&rw_lock_list_mutex);
-
DBUG_RETURN(0);
}
diff --git a/storage/innobase/include/trx0rseg.h b/storage/innobase/include/trx0rseg.h
index dbd80486b71..a89b82c7a43 100644
--- a/storage/innobase/include/trx0rseg.h
+++ b/storage/innobase/include/trx0rseg.h
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2018, MariaDB Corporation.
+Copyright (c) 2017, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -194,7 +194,7 @@ struct trx_rseg_t {
|| (srv_undo_space_id_start > 0
&& space->id >= srv_undo_space_id_start
&& space->id <= srv_undo_space_id_start
- + srv_undo_tablespaces_active)
+ + srv_undo_tablespaces_open)
|| !srv_was_started);
return(space->id != SRV_TMP_SPACE_ID);
}
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index 3285f5e860c..bc2e7082f55 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -2,7 +2,7 @@
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2012, Facebook Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
diff --git a/storage/innobase/row/row0mysql.cc b/storage/innobase/row/row0mysql.cc
index 071ef9ffd92..8001b5ff43b 100644
--- a/storage/innobase/row/row0mysql.cc
+++ b/storage/innobase/row/row0mysql.cc
@@ -4474,9 +4474,6 @@ row_rename_table_for_mysql(
" = TO_BINARY(:old_table_name);\n"
"END;\n"
, FALSE, trx);
- if (err != DB_SUCCESS) {
- goto end;
- }
} else if (n_constraints_to_drop > 0) {
/* Drop some constraints of tmp tables. */
diff --git a/storage/innobase/row/row0sel.cc b/storage/innobase/row/row0sel.cc
index 73ed5f06825..ee872eaff93 100644
--- a/storage/innobase/row/row0sel.cc
+++ b/storage/innobase/row/row0sel.cc
@@ -3022,20 +3022,20 @@ row_sel_store_mysql_field(
Note that the template in prebuilt may advise us to copy only a few
columns to mysql_rec, other columns are left blank. All columns may not
be needed in the query.
-@param[out] mysql_rec row in the MySQL format
-@param[in] prebuilt prebuilt structure
-@param[in] rec Innobase record in the index
- which was described in prebuilt's
- template, or in the clustered index;
- must be protected by a page latch
-@param[in] vrow virtual columns
-@param[in] rec_clust whether the rec in the clustered index
-@param[in] index index of rec
-@param[in] offsets array returned by rec_get_offsets(rec)
-@return TRUE on success, FALSE if not all columns could be retrieved */
-static MY_ATTRIBUTE((warn_unused_result))
-ibool
-row_sel_store_mysql_rec(
+@param[out] mysql_rec row in the MySQL format
+@param[in] prebuilt cursor
+@param[in] rec Innobase record in the index
+ which was described in prebuilt's
+ template, or in the clustered index;
+ must be protected by a page latch
+@param[in] vrow virtual columns
+@param[in] rec_clust whether index must be the clustered index
+@param[in] index index of rec
+@param[in] offsets array returned by rec_get_offsets(rec)
+@retval true on success
+@retval false if not all columns could be retrieved */
+MY_ATTRIBUTE((warn_unused_result))
+static bool row_sel_store_mysql_rec(
byte* mysql_rec,
row_prebuilt_t* prebuilt,
const rec_t* rec,
@@ -3057,13 +3057,18 @@ row_sel_store_mysql_rec(
const mysql_row_templ_t*templ = &prebuilt->mysql_template[i];
if (templ->is_virtual && dict_index_is_clust(index)) {
+ /* Virtual columns are never declared NOT NULL. */
+ ut_ad(templ->mysql_null_bit_mask);
/* Skip virtual columns if it is not a covered
search or virtual key read is not requested. */
- if (!dict_index_has_virtual(prebuilt->index)
+ if (!rec_clust
+ || !prebuilt->index->has_virtual()
|| (!prebuilt->read_just_key
- && !prebuilt->m_read_virtual_key)
- || !rec_clust) {
+ && !prebuilt->m_read_virtual_key)) {
+ /* Initialize the NULL bit. */
+ mysql_rec[templ->mysql_null_byte_offset]
+ |= (byte) templ->mysql_null_bit_mask;
continue;
}
@@ -3138,7 +3143,7 @@ row_sel_store_mysql_rec(
rec, index, offsets,
field_no, templ)) {
- DBUG_RETURN(FALSE);
+ DBUG_RETURN(false);
}
}
@@ -3155,7 +3160,7 @@ row_sel_store_mysql_rec(
}
}
- DBUG_RETURN(TRUE);
+ DBUG_RETURN(true);
}
/*********************************************************************//**
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 2d210be771a..e82d486c206 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -3,7 +3,7 @@
Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2008, Google Inc.
Copyright (c) 2009, Percona Inc.
-Copyright (c) 2013, 2018, MariaDB Corporation.
+Copyright (c) 2013, 2019, MariaDB Corporation.
Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described
@@ -2199,6 +2199,7 @@ files_checked:
thread_started[2 + SRV_MAX_N_IO_THREADS] = true;
lock_sys.timeout_thread_active = true;
+ DBUG_EXECUTE_IF("innodb_skip_monitors", goto skip_monitors;);
/* Create the thread which warns of long semaphore waits */
srv_error_monitor_active = true;
thread_handles[3 + SRV_MAX_N_IO_THREADS] = os_thread_create(
@@ -2215,6 +2216,9 @@ files_checked:
srv_start_state |= SRV_START_STATE_LOCK_SYS
| SRV_START_STATE_MONITOR;
+#ifndef DBUG_OFF
+skip_monitors:
+#endif
ut_ad(srv_force_recovery >= SRV_FORCE_NO_UNDO_LOG_SCAN
|| !purge_sys.enabled());
diff --git a/storage/maria/ma_delete.c b/storage/maria/ma_delete.c
index b4b02212a16..2fe20d09bab 100644
--- a/storage/maria/ma_delete.c
+++ b/storage/maria/ma_delete.c
@@ -695,9 +695,7 @@ static int del(MARIA_HA *info, MARIA_KEY *key,
key_start= keypos;
if (tmp_key.flag & (SEARCH_USER_KEY_HAS_TRANSID |
SEARCH_PAGE_KEY_HAS_TRANSID))
- {
_ma_mark_page_with_transid(share, anc_page);
- }
/* Save pointer to next leaf on parent page */
if (!(*keyinfo->get_key)(&ret_key, page_flag, share->base.key_reflength,
diff --git a/storage/maria/ma_write.c b/storage/maria/ma_write.c
index c2b521e3c02..52eefa33bc3 100644
--- a/storage/maria/ma_write.c
+++ b/storage/maria/ma_write.c
@@ -844,9 +844,8 @@ int _ma_insert(register MARIA_HA *info, MARIA_KEY *key,
a_length+=t_length;
if (key->flag & (SEARCH_USER_KEY_HAS_TRANSID | SEARCH_PAGE_KEY_HAS_TRANSID))
- {
_ma_mark_page_with_transid(share, anc_page);
- }
+
anc_page->size= a_length;
page_store_size(share, anc_page);
diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h
index 1c77beb3c0f..7da53f788cf 100644
--- a/storage/maria/maria_def.h
+++ b/storage/maria/maria_def.h
@@ -781,8 +781,8 @@ struct st_maria_handler
transid_korr((buff) + LSN_STORE_SIZE)
#define _ma_store_keypage_flag(share,x,flag) x[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (flag)
#define _ma_mark_page_with_transid(share, page) \
- (page)->flag|= KEYPAGE_FLAG_HAS_TRANSID; \
- (page)->buff[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (page)->flag;
+ do { (page)->flag|= KEYPAGE_FLAG_HAS_TRANSID; \
+ (page)->buff[(share)->keypage_header - KEYPAGE_USED_SIZE - KEYPAGE_FLAG_SIZE]= (page)->flag; } while (0)
#define KEYPAGE_KEY_VERSION(share, x) ((x) + \
(share)->keypage_header - \
diff --git a/storage/tokudb/PerconaFT/COPYING.APACHEv2 b/storage/tokudb/PerconaFT/COPYING.APACHEv2
new file mode 100644
index 00000000000..ecbfc770fa9
--- /dev/null
+++ b/storage/tokudb/PerconaFT/COPYING.APACHEv2
@@ -0,0 +1,174 @@
+Apache License
+ Version 2.0, January 2004
+ http://www.apache.org/licenses/
+
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+ 1. Definitions.
+
+ "License" shall mean the terms and conditions for use, reproduction,
+ and distribution as defined by Sections 1 through 9 of this document.
+
+ "Licensor" shall mean the copyright owner or entity authorized by
+ the copyright owner that is granting the License.
+
+ "Legal Entity" shall mean the union of the acting entity and all
+ other entities that control, are controlled by, or are under common
+ control with that entity. For the purposes of this definition,
+ "control" means (i) the power, direct or indirect, to cause the
+ direction or management of such entity, whether by contract or
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
+ outstanding shares, or (iii) beneficial ownership of such entity.
+
+ "You" (or "Your") shall mean an individual or Legal Entity
+ exercising permissions granted by this License.
+
+ "Source" form shall mean the preferred form for making modifications,
+ including but not limited to software source code, documentation
+ source, and configuration files.
+
+ "Object" form shall mean any form resulting from mechanical
+ transformation or translation of a Source form, including but
+ not limited to compiled object code, generated documentation,
+ and conversions to other media types.
+
+ "Work" shall mean the work of authorship, whether in Source or
+ Object form, made available under the License, as indicated by a
+ copyright notice that is included in or attached to the work
+ (an example is provided in the Appendix below).
+
+ "Derivative Works" shall mean any work, whether in Source or Object
+ form, that is based on (or derived from) the Work and for which the
+ editorial revisions, annotations, elaborations, or other modifications
+ represent, as a whole, an original work of authorship. For the purposes
+ of this License, Derivative Works shall not include works that remain
+ separable from, or merely link (or bind by name) to the interfaces of,
+ the Work and Derivative Works thereof.
+
+ "Contribution" shall mean any work of authorship, including
+ the original version of the Work and any modifications or additions
+ to that Work or Derivative Works thereof, that is intentionally
+ submitted to Licensor for inclusion in the Work by the copyright owner
+ or by an individual or Legal Entity authorized to submit on behalf of
+ the copyright owner. For the purposes of this definition, "submitted"
+ means any form of electronic, verbal, or written communication sent
+ to the Licensor or its representatives, including but not limited to
+ communication on electronic mailing lists, source code control systems,
+ and issue tracking systems that are managed by, or on behalf of, the
+ Licensor for the purpose of discussing and improving the Work, but
+ excluding communication that is conspicuously marked or otherwise
+ designated in writing by the copyright owner as "Not a Contribution."
+
+ "Contributor" shall mean Licensor and any individual or Legal Entity
+ on behalf of whom a Contribution has been received by Licensor and
+ subsequently incorporated within the Work.
+
+ 2. Grant of Copyright License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ copyright license to reproduce, prepare Derivative Works of,
+ publicly display, publicly perform, sublicense, and distribute the
+ Work and such Derivative Works in Source or Object form.
+
+ 3. Grant of Patent License. Subject to the terms and conditions of
+ this License, each Contributor hereby grants to You a perpetual,
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+ (except as stated in this section) patent license to make, have made,
+ use, offer to sell, sell, import, and otherwise transfer the Work,
+ where such license applies only to those patent claims licensable
+ by such Contributor that are necessarily infringed by their
+ Contribution(s) alone or by combination of their Contribution(s)
+ with the Work to which such Contribution(s) was submitted. If You
+ institute patent litigation against any entity (including a
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
+ or a Contribution incorporated within the Work constitutes direct
+ or contributory patent infringement, then any patent licenses
+ granted to You under this License for that Work shall terminate
+ as of the date such litigation is filed.
+
+ 4. Redistribution. You may reproduce and distribute copies of the
+ Work or Derivative Works thereof in any medium, with or without
+ modifications, and in Source or Object form, provided that You
+ meet the following conditions:
+
+ (a) You must give any other recipients of the Work or
+ Derivative Works a copy of this License; and
+
+ (b) You must cause any modified files to carry prominent notices
+ stating that You changed the files; and
+
+ (c) You must retain, in the Source form of any Derivative Works
+ that You distribute, all copyright, patent, trademark, and
+ attribution notices from the Source form of the Work,
+ excluding those notices that do not pertain to any part of
+ the Derivative Works; and
+
+ (d) If the Work includes a "NOTICE" text file as part of its
+ distribution, then any Derivative Works that You distribute must
+ include a readable copy of the attribution notices contained
+ within such NOTICE file, excluding those notices that do not
+ pertain to any part of the Derivative Works, in at least one
+ of the following places: within a NOTICE text file distributed
+ as part of the Derivative Works; within the Source form or
+ documentation, if provided along with the Derivative Works; or,
+ within a display generated by the Derivative Works, if and
+ wherever such third-party notices normally appear. The contents
+ of the NOTICE file are for informational purposes only and
+ do not modify the License. You may add Your own attribution
+ notices within Derivative Works that You distribute, alongside
+ or as an addendum to the NOTICE text from the Work, provided
+ that such additional attribution notices cannot be construed
+ as modifying the License.
+
+ You may add Your own copyright statement to Your modifications and
+ may provide additional or different license terms and conditions
+ for use, reproduction, or distribution of Your modifications, or
+ for any such Derivative Works as a whole, provided Your use,
+ reproduction, and distribution of the Work otherwise complies with
+ the conditions stated in this License.
+
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
+ any Contribution intentionally submitted for inclusion in the Work
+ by You to the Licensor shall be under the terms and conditions of
+ this License, without any additional terms or conditions.
+ Notwithstanding the above, nothing herein shall supersede or modify
+ the terms of any separate license agreement you may have executed
+ with Licensor regarding such Contributions.
+
+ 6. Trademarks. This License does not grant permission to use the trade
+ names, trademarks, service marks, or product names of the Licensor,
+ except as required for reasonable and customary use in describing the
+ origin of the Work and reproducing the content of the NOTICE file.
+
+ 7. Disclaimer of Warranty. Unless required by applicable law or
+ agreed to in writing, Licensor provides the Work (and each
+ Contributor provides its Contributions) on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+ implied, including, without limitation, any warranties or conditions
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+ PARTICULAR PURPOSE. You are solely responsible for determining the
+ appropriateness of using or redistributing the Work and assume any
+ risks associated with Your exercise of permissions under this License.
+
+ 8. Limitation of Liability. In no event and under no legal theory,
+ whether in tort (including negligence), contract, or otherwise,
+ unless required by applicable law (such as deliberate and grossly
+ negligent acts) or agreed to in writing, shall any Contributor be
+ liable to You for damages, including any direct, indirect, special,
+ incidental, or consequential damages of any character arising as a
+ result of this License or out of the use or inability to use the
+ Work (including but not limited to damages for loss of goodwill,
+ work stoppage, computer failure or malfunction, or any and all
+ other commercial damages or losses), even if such Contributor
+ has been advised of the possibility of such damages.
+
+ 9. Accepting Warranty or Additional Liability. While redistributing
+ the Work or Derivative Works thereof, You may choose to offer,
+ and charge a fee for, acceptance of support, warranty, indemnity,
+ or other liability obligations and/or rights consistent with this
+ License. However, in accepting such obligations, You may act only
+ on Your own behalf and on Your sole responsibility, not on behalf
+ of any other Contributor, and only if You agree to indemnify,
+ defend, and hold each Contributor harmless for any liability
+ incurred by, or claims asserted against, such Contributor by reason
+ of your accepting any such warranty or additional liability.
diff --git a/storage/tokudb/PerconaFT/README.md b/storage/tokudb/PerconaFT/README.md
index ffb646b67af..26333df877e 100644
--- a/storage/tokudb/PerconaFT/README.md
+++ b/storage/tokudb/PerconaFT/README.md
@@ -104,11 +104,14 @@ All source code and test contributions must be provided under a [BSD 2-Clause][b
License
-------
+Portions of the PerconaFT library (the 'locktree' and 'omt') are available under the Apache version 2 license.
PerconaFT is available under the GPL version 2, and AGPL version 3.
-See [COPYING.AGPLv3][agpllicense],
+See [COPYING.APACHEv2][apachelicense],
+[COPYING.AGPLv3][agpllicense],
[COPYING.GPLv2][gpllicense], and
[PATENTS][patents].
+[apachelicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.APACHEv2
[agpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.AGPLv3
[gpllicense]: http://github.com/Percona/PerconaFT/blob/master/COPYING.GPLv2
[patents]: http://github.com/Percona/PerconaFT/blob/master/PATENTS
diff --git a/storage/tokudb/PerconaFT/ft/txn/txn_manager.h b/storage/tokudb/PerconaFT/ft/txn/txn_manager.h
index 7cdc52c4f43..25fa6032112 100644
--- a/storage/tokudb/PerconaFT/ft/txn/txn_manager.h
+++ b/storage/tokudb/PerconaFT/ft/txn/txn_manager.h
@@ -46,11 +46,11 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
void set_test_txn_sync_callback(void (*) (pthread_t, void*), void*);
#define toku_test_txn_sync_callback(a) ((test_txn_sync_callback)? test_txn_sync_callback( a,test_txn_sync_callback_extra) : (void) 0)
-#if TOKU_DEBUG_TXN_SYNC
+#if defined(TOKU_DEBUG_TXN_SYNC)
#define toku_debug_txn_sync(a) toku_test_txn_sync_callback(a)
#else
#define toku_debug_txn_sync(a) ((void) 0)
-#endif
+#endif // defined(TOKU_DEBUG_TXN_SYNC)
typedef struct txn_manager *TXN_MANAGER;
diff --git a/storage/tokudb/PerconaFT/locktree/concurrent_tree.cc b/storage/tokudb/PerconaFT/locktree/concurrent_tree.cc
index 9347267db49..e07f32c98fb 100644
--- a/storage/tokudb/PerconaFT/locktree/concurrent_tree.cc
+++ b/storage/tokudb/PerconaFT/locktree/concurrent_tree.cc
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/concurrent_tree.h b/storage/tokudb/PerconaFT/locktree/concurrent_tree.h
index 1eb339b7317..66a7ff176bb 100644
--- a/storage/tokudb/PerconaFT/locktree/concurrent_tree.h
+++ b/storage/tokudb/PerconaFT/locktree/concurrent_tree.h
@@ -32,6 +32,20 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/keyrange.cc b/storage/tokudb/PerconaFT/locktree/keyrange.cc
index 8c2a69d4703..2b4b3bbd4fd 100644
--- a/storage/tokudb/PerconaFT/locktree/keyrange.cc
+++ b/storage/tokudb/PerconaFT/locktree/keyrange.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/keyrange.h b/storage/tokudb/PerconaFT/locktree/keyrange.h
index 079ac3d7a80..a454287cbc8 100644
--- a/storage/tokudb/PerconaFT/locktree/keyrange.h
+++ b/storage/tokudb/PerconaFT/locktree/keyrange.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.cc b/storage/tokudb/PerconaFT/locktree/lock_request.cc
index c0829e3f4e1..51898d4ccb1 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.cc
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/lock_request.h b/storage/tokudb/PerconaFT/locktree/lock_request.h
index 9e82b31541e..455433cb90c 100644
--- a/storage/tokudb/PerconaFT/locktree/lock_request.h
+++ b/storage/tokudb/PerconaFT/locktree/lock_request.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.cc b/storage/tokudb/PerconaFT/locktree/locktree.cc
index 069aae26f66..8ba3f0f00ae 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.cc
+++ b/storage/tokudb/PerconaFT/locktree/locktree.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/locktree.h b/storage/tokudb/PerconaFT/locktree/locktree.h
index 1ba7a51b124..7006b6fb01d 100644
--- a/storage/tokudb/PerconaFT/locktree/locktree.h
+++ b/storage/tokudb/PerconaFT/locktree/locktree.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/manager.cc b/storage/tokudb/PerconaFT/locktree/manager.cc
index 6bb5c77bf32..21f8dc6cf01 100644
--- a/storage/tokudb/PerconaFT/locktree/manager.cc
+++ b/storage/tokudb/PerconaFT/locktree/manager.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/range_buffer.cc b/storage/tokudb/PerconaFT/locktree/range_buffer.cc
index 3ddfd0faf97..d1f14fc4a52 100644
--- a/storage/tokudb/PerconaFT/locktree/range_buffer.cc
+++ b/storage/tokudb/PerconaFT/locktree/range_buffer.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/range_buffer.h b/storage/tokudb/PerconaFT/locktree/range_buffer.h
index b0e36968e73..811b0f85e69 100644
--- a/storage/tokudb/PerconaFT/locktree/range_buffer.h
+++ b/storage/tokudb/PerconaFT/locktree/range_buffer.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/treenode.cc b/storage/tokudb/PerconaFT/locktree/treenode.cc
index cc3a4969643..0247242f975 100644
--- a/storage/tokudb/PerconaFT/locktree/treenode.cc
+++ b/storage/tokudb/PerconaFT/locktree/treenode.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/treenode.h b/storage/tokudb/PerconaFT/locktree/treenode.h
index 08aad2b6636..981e8b5a9cf 100644
--- a/storage/tokudb/PerconaFT/locktree/treenode.h
+++ b/storage/tokudb/PerconaFT/locktree/treenode.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/txnid_set.cc b/storage/tokudb/PerconaFT/locktree/txnid_set.cc
index 82b59453156..bd4e9723155 100644
--- a/storage/tokudb/PerconaFT/locktree/txnid_set.cc
+++ b/storage/tokudb/PerconaFT/locktree/txnid_set.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/txnid_set.h b/storage/tokudb/PerconaFT/locktree/txnid_set.h
index 109d7f798e4..81fd45b6dde 100644
--- a/storage/tokudb/PerconaFT/locktree/txnid_set.h
+++ b/storage/tokudb/PerconaFT/locktree/txnid_set.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/wfg.cc b/storage/tokudb/PerconaFT/locktree/wfg.cc
index 9a234f50060..26b7a3b5295 100644
--- a/storage/tokudb/PerconaFT/locktree/wfg.cc
+++ b/storage/tokudb/PerconaFT/locktree/wfg.cc
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/locktree/wfg.h b/storage/tokudb/PerconaFT/locktree/wfg.h
index c56886e1362..5c1599592e6 100644
--- a/storage/tokudb/PerconaFT/locktree/wfg.h
+++ b/storage/tokudb/PerconaFT/locktree/wfg.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
index d742555f878..786a6ef0546 100644
--- a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
+++ b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.cc
@@ -184,9 +184,9 @@ void toku_instr_file_io_end(toku_io_instrumentation &io_instr, ssize_t count) {
void toku_instr_mutex_init(const toku_instr_key &key, toku_mutex_t &mutex) {
mutex.psi_mutex = PSI_MUTEX_CALL(init_mutex)(key.id(), &mutex.pmutex);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
mutex.instr_key_id = key.id();
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_mutex_destroy(PSI_mutex *&mutex_instr) {
@@ -242,9 +242,9 @@ void toku_instr_mutex_unlock(PSI_mutex *mutex_instr) {
void toku_instr_cond_init(const toku_instr_key &key, toku_cond_t &cond) {
cond.psi_cond = PSI_COND_CALL(init_cond)(key.id(), &cond.pcond);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
cond.instr_key_id = key.id();
-#endif
+#endif // // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_cond_destroy(PSI_cond *&cond_instr) {
@@ -295,9 +295,9 @@ void toku_instr_cond_broadcast(const toku_cond_t &cond) {
void toku_instr_rwlock_init(const toku_instr_key &key,
toku_pthread_rwlock_t &rwlock) {
rwlock.psi_rwlock = PSI_RWLOCK_CALL(init_rwlock)(key.id(), &rwlock.rwlock);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
rwlock.instr_key_id = key.id();
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
}
void toku_instr_rwlock_destroy(PSI_rwlock *&rwlock_instr) {
diff --git a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h
index d6b0ed35ce9..beb833a163c 100644
--- a/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h
+++ b/storage/tokudb/PerconaFT/portability/toku_instr_mysql.h
@@ -12,8 +12,15 @@
// undefine them here to avoid compilation errors.
#undef __STDC_FORMAT_MACROS
#undef __STDC_LIMIT_MACROS
-#include <mysql/psi/mysql_file.h> // PSI_file
-#include <mysql/psi/mysql_thread.h> // PSI_mutex
+#include "mysql/psi/mysql_file.h" // PSI_file
+#include "mysql/psi/mysql_thread.h" // PSI_mutex
+#include "mysql/psi/mysql_stage.h" // PSI_stage
+
+#if (MYSQL_VERSION_ID >= 80000) && ( MYSQL_VERSION_ID <= 100000)
+#include "mysql/psi/mysql_cond.h"
+#include "mysql/psi/mysql_mutex.h"
+#include "mysql/psi/mysql_rwlock.h"
+#endif // (MYSQL_VERSION_ID >= nn)
#ifndef HAVE_PSI_MUTEX_INTERFACE
#error HAVE_PSI_MUTEX_INTERFACE required
diff --git a/storage/tokudb/PerconaFT/portability/toku_pthread.h b/storage/tokudb/PerconaFT/portability/toku_pthread.h
index a0dfcc246a7..d05c6fabf53 100644
--- a/storage/tokudb/PerconaFT/portability/toku_pthread.h
+++ b/storage/tokudb/PerconaFT/portability/toku_pthread.h
@@ -64,23 +64,23 @@ struct toku_mutex_t {
pthread_mutex_t pmutex;
struct PSI_mutex
*psi_mutex; /* The performance schema instrumentation hook */
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
pthread_t owner; // = pthread_self(); // for debugging
bool locked;
bool valid;
pfs_key_t instr_key_id;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
};
struct toku_cond_t {
pthread_cond_t pcond;
struct PSI_cond *psi_cond;
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
pfs_key_t instr_key_id;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
};
-#ifdef TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_COND_INITIALIZER \
{ \
.pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr, \
@@ -89,14 +89,14 @@ struct toku_cond_t {
#else
#define TOKU_COND_INITIALIZER \
{ .pcond = PTHREAD_COND_INITIALIZER, .psi_cond = nullptr }
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
struct toku_pthread_rwlock_t {
pthread_rwlock_t rwlock;
struct PSI_rwlock *psi_rwlock;
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
pfs_key_t instr_key_id;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
};
typedef struct toku_mutex_aligned {
@@ -117,7 +117,7 @@ typedef struct toku_mutex_aligned {
#define ZERO_MUTEX_INITIALIZER \
{}
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
@@ -126,12 +126,12 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
// Darwin doesn't provide adaptive mutexes
#if defined(__APPLE__)
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_DEFAULT
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr, .owner = 0, \
@@ -140,10 +140,10 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_MUTEX_INITIALIZER, .psi_mutex = nullptr }
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
#else // __FreeBSD__, __linux__, at least
#define TOKU_MUTEX_ADAPTIVE PTHREAD_MUTEX_ADAPTIVE_NP
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ \
.pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr, \
@@ -152,8 +152,8 @@ typedef struct toku_mutex_aligned {
#else
#define TOKU_ADAPTIVE_MUTEX_INITIALIZER \
{ .pmutex = PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP, .psi_mutex = nullptr }
-#endif
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
+#endif // defined(__APPLE__)
// Different OSes implement mutexes as different amounts of nested structs.
// C++ will fill out all missing values with zeroes if you provide at least one
@@ -198,7 +198,7 @@ toku_mutexattr_destroy(toku_pthread_mutexattr_t *attr) {
assert_zero(r);
}
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
invariant(mutex->locked);
invariant(mutex->owner == pthread_self());
@@ -207,7 +207,7 @@ static inline void toku_mutex_assert_locked(const toku_mutex_t *mutex) {
static inline void
toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
}
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
// asserting that a mutex is unlocked only makes sense
// if the calling thread can guaruntee that no other threads
@@ -217,7 +217,7 @@ toku_mutex_assert_locked(const toku_mutex_t *mutex __attribute__((unused))) {
// when a node is locked the caller knows that no other threads
// can be trying to lock its childrens' mutexes. the children
// are in one of two fixed states: locked or unlocked.
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
static inline void
toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
invariant(mutex->owner == 0);
@@ -226,7 +226,7 @@ toku_mutex_assert_unlocked(toku_mutex_t *mutex) {
#else
static inline void toku_mutex_assert_unlocked(toku_mutex_t *mutex
__attribute__((unused))) {}
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
#define toku_mutex_lock(M) \
toku_mutex_lock_with_source_location(M, __FILE__, __LINE__)
@@ -241,13 +241,13 @@ static inline void toku_cond_init(toku_cond_t *cond,
toku_mutex_trylock_with_source_location(M, __FILE__, __LINE__)
inline void toku_mutex_unlock(toku_mutex_t *mutex) {
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->owner == pthread_self());
invariant(mutex->valid);
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_unlock(mutex->psi_mutex);
int r = pthread_mutex_unlock(&mutex->pmutex);
assert_zero(r);
@@ -264,13 +264,13 @@ inline void toku_mutex_lock_with_source_location(toku_mutex_t *mutex,
toku_instr_mutex_lock_end(mutex_instr, r);
assert_zero(r);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->valid);
invariant(!mutex->locked);
invariant(mutex->owner == 0);
mutex->locked = true;
mutex->owner = pthread_self();
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
@@ -283,7 +283,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
const int r = pthread_mutex_lock(&mutex->pmutex);
toku_instr_mutex_lock_end(mutex_instr, r);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
if (r == 0) {
invariant(mutex->valid);
invariant(!mutex->locked);
@@ -291,7 +291,7 @@ inline int toku_mutex_trylock_with_source_location(toku_mutex_t *mutex,
mutex->locked = true;
mutex->owner = pthread_self();
}
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
return r;
}
@@ -320,11 +320,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
const char *src_file,
uint src_line) {
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
/* Instrumentation start */
toku_cond_instrumentation cond_instr;
@@ -342,11 +342,11 @@ inline void toku_cond_wait_with_source_location(toku_cond_t *cond,
toku_instr_cond_wait_end(cond_instr, r);
assert_zero(r);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(!mutex->locked);
mutex->locked = true;
mutex->owner = pthread_self();
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
@@ -354,11 +354,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
toku_timespec_t *wakeup_at,
const char *src_file,
uint src_line) {
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->locked);
mutex->locked = false;
mutex->owner = 0;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
/* Instrumentation start */
toku_cond_instrumentation cond_instr;
@@ -376,11 +376,11 @@ inline int toku_cond_timedwait_with_source_location(toku_cond_t *cond,
/* Instrumentation end */
toku_instr_cond_wait_end(cond_instr, r);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(!mutex->locked);
mutex->locked = true;
mutex->owner = pthread_self();
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
return r;
}
@@ -399,26 +399,26 @@ inline void toku_cond_broadcast(toku_cond_t *cond) {
inline void toku_mutex_init(const toku_instr_key &key,
toku_mutex_t *mutex,
const toku_pthread_mutexattr_t *attr) {
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
mutex->valid = true;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_init(key, *mutex);
const int r = pthread_mutex_init(&mutex->pmutex, attr);
assert_zero(r);
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
mutex->locked = false;
invariant(mutex->valid);
mutex->valid = true;
mutex->owner = 0;
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
}
inline void toku_mutex_destroy(toku_mutex_t *mutex) {
-#if TOKU_PTHREAD_DEBUG
+#if defined(TOKU_PTHREAD_DEBUG)
invariant(mutex->valid);
mutex->valid = false;
invariant(!mutex->locked);
-#endif
+#endif // defined(TOKU_PTHREAD_DEBUG)
toku_instr_mutex_destroy(mutex->psi_mutex);
int r = pthread_mutex_destroy(&mutex->pmutex);
assert_zero(r);
diff --git a/storage/tokudb/PerconaFT/util/growable_array.h b/storage/tokudb/PerconaFT/util/growable_array.h
index e8873ae4abd..ad60ea6395b 100644
--- a/storage/tokudb/PerconaFT/util/growable_array.h
+++ b/storage/tokudb/PerconaFT/util/growable_array.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/PerconaFT/util/omt.cc b/storage/tokudb/PerconaFT/util/omt.cc
index 1fae0712c77..846c4df7f54 100644
--- a/storage/tokudb/PerconaFT/util/omt.cc
+++ b/storage/tokudb/PerconaFT/util/omt.cc
@@ -32,1105 +32,1356 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
-#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
+#ident \
+ "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
-#include <string.h>
#include <db.h>
+#include <string.h>
#include <portability/memory.h>
namespace toku {
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create(void) {
- this->create_internal(2);
- if (supports_marks) {
- this->convert_to_tree();
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::create(void) {
+ this->create_internal(2);
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
}
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create_no_array(void) {
- if (!supports_marks) {
- this->create_internal_no_array(0);
- } else {
- this->is_array = false;
- this->capacity = 0;
- this->d.t.nodes = nullptr;
- this->d.t.root.set_to_null();
- this->d.t.free_idx = 0;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create_from_sorted_array(const omtdata_t *const values, const uint32_t numvalues) {
- this->create_internal(numvalues);
- memcpy(this->d.a.values, values, numvalues * (sizeof values[0]));
- this->d.a.num_values = numvalues;
- if (supports_marks) {
- this->convert_to_tree();
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create_steal_sorted_array(omtdata_t **const values, const uint32_t numvalues, const uint32_t new_capacity) {
- paranoid_invariant_notnull(values);
- this->create_internal_no_array(new_capacity);
- this->d.a.num_values = numvalues;
- this->d.a.values = *values;
- *values = nullptr;
- if (supports_marks) {
- this->convert_to_tree();
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-int omt<omtdata_t, omtdataout_t, supports_marks>::split_at(omt *const newomt, const uint32_t idx) {
- barf_if_marked(*this);
- paranoid_invariant_notnull(newomt);
- if (idx > this->size()) { return EINVAL; }
- this->convert_to_array();
- const uint32_t newsize = this->size() - idx;
- newomt->create_from_sorted_array(&this->d.a.values[this->d.a.start_idx + idx], newsize);
- this->d.a.num_values = idx;
- this->maybe_resize_array(idx);
- if (supports_marks) {
- this->convert_to_tree();
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::merge(omt *const leftomt, omt *const rightomt) {
- barf_if_marked(*this);
- paranoid_invariant_notnull(leftomt);
- paranoid_invariant_notnull(rightomt);
- const uint32_t leftsize = leftomt->size();
- const uint32_t rightsize = rightomt->size();
- const uint32_t newsize = leftsize + rightsize;
-
- if (leftomt->is_array) {
- if (leftomt->capacity - (leftomt->d.a.start_idx + leftomt->d.a.num_values) >= rightsize) {
- this->create_steal_sorted_array(&leftomt->d.a.values, leftomt->d.a.num_values, leftomt->capacity);
- this->d.a.start_idx = leftomt->d.a.start_idx;
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::create_no_array(void) {
+ if (!supports_marks) {
+ this->create_internal_no_array(0);
+ } else {
+ this->is_array = false;
+ this->capacity = 0;
+ this->d.t.nodes = nullptr;
+ this->d.t.root.set_to_null();
+ this->d.t.free_idx = 0;
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::create_from_sorted_array(
+ const omtdata_t *const values,
+ const uint32_t numvalues) {
+ this->create_internal(numvalues);
+ memcpy(this->d.a.values, values, numvalues * (sizeof values[0]));
+ this->d.a.num_values = numvalues;
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void
+ omt<omtdata_t, omtdataout_t, supports_marks>::create_steal_sorted_array(
+ omtdata_t **const values,
+ const uint32_t numvalues,
+ const uint32_t new_capacity) {
+ paranoid_invariant_notnull(values);
+ this->create_internal_no_array(new_capacity);
+ this->d.a.num_values = numvalues;
+ this->d.a.values = *values;
+ *values = nullptr;
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::split_at(
+ omt *const newomt,
+ const uint32_t idx) {
+ barf_if_marked(*this);
+ paranoid_invariant_notnull(newomt);
+ if (idx > this->size()) {
+ return EINVAL;
+ }
+ this->convert_to_array();
+ const uint32_t newsize = this->size() - idx;
+ newomt->create_from_sorted_array(
+ &this->d.a.values[this->d.a.start_idx + idx], newsize);
+ this->d.a.num_values = idx;
+ this->maybe_resize_array(idx);
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ return 0;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::merge(
+ omt *const leftomt,
+ omt *const rightomt) {
+ barf_if_marked(*this);
+ paranoid_invariant_notnull(leftomt);
+ paranoid_invariant_notnull(rightomt);
+ const uint32_t leftsize = leftomt->size();
+ const uint32_t rightsize = rightomt->size();
+ const uint32_t newsize = leftsize + rightsize;
+
+ if (leftomt->is_array) {
+ if (leftomt->capacity -
+ (leftomt->d.a.start_idx + leftomt->d.a.num_values) >=
+ rightsize) {
+ this->create_steal_sorted_array(&leftomt->d.a.values,
+ leftomt->d.a.num_values,
+ leftomt->capacity);
+ this->d.a.start_idx = leftomt->d.a.start_idx;
+ } else {
+ this->create_internal(newsize);
+ memcpy(&this->d.a.values[0],
+ &leftomt->d.a.values[leftomt->d.a.start_idx],
+ leftomt->d.a.num_values * (sizeof this->d.a.values[0]));
+ }
} else {
this->create_internal(newsize);
+ leftomt->fill_array_with_subtree_values(&this->d.a.values[0],
+ leftomt->d.t.root);
+ }
+ leftomt->destroy();
+ this->d.a.num_values = leftsize;
+
+ if (rightomt->is_array) {
+ memcpy(
+ &this->d.a.values[this->d.a.start_idx + this->d.a.num_values],
+ &rightomt->d.a.values[rightomt->d.a.start_idx],
+ rightomt->d.a.num_values * (sizeof this->d.a.values[0]));
+ } else {
+ rightomt->fill_array_with_subtree_values(
+ &this->d.a.values[this->d.a.start_idx + this->d.a.num_values],
+ rightomt->d.t.root);
+ }
+ rightomt->destroy();
+ this->d.a.num_values += rightsize;
+ paranoid_invariant(this->size() == newsize);
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::clone(const omt &src) {
+ barf_if_marked(*this);
+ this->create_internal(src.size());
+ if (src.is_array) {
memcpy(&this->d.a.values[0],
- &leftomt->d.a.values[leftomt->d.a.start_idx],
- leftomt->d.a.num_values * (sizeof this->d.a.values[0]));
- }
- } else {
- this->create_internal(newsize);
- leftomt->fill_array_with_subtree_values(&this->d.a.values[0], leftomt->d.t.root);
- }
- leftomt->destroy();
- this->d.a.num_values = leftsize;
-
- if (rightomt->is_array) {
- memcpy(&this->d.a.values[this->d.a.start_idx + this->d.a.num_values],
- &rightomt->d.a.values[rightomt->d.a.start_idx],
- rightomt->d.a.num_values * (sizeof this->d.a.values[0]));
- } else {
- rightomt->fill_array_with_subtree_values(&this->d.a.values[this->d.a.start_idx + this->d.a.num_values],
- rightomt->d.t.root);
- }
- rightomt->destroy();
- this->d.a.num_values += rightsize;
- paranoid_invariant(this->size() == newsize);
- if (supports_marks) {
- this->convert_to_tree();
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::clone(const omt &src) {
- barf_if_marked(*this);
- this->create_internal(src.size());
- if (src.is_array) {
- memcpy(&this->d.a.values[0], &src.d.a.values[src.d.a.start_idx], src.d.a.num_values * (sizeof this->d.a.values[0]));
- } else {
- src.fill_array_with_subtree_values(&this->d.a.values[0], src.d.t.root);
- }
- this->d.a.num_values = src.size();
- if (supports_marks) {
- this->convert_to_tree();
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::clear(void) {
- if (this->is_array) {
- this->d.a.start_idx = 0;
- this->d.a.num_values = 0;
- } else {
- this->d.t.root.set_to_null();
- this->d.t.free_idx = 0;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::destroy(void) {
- this->clear();
- this->capacity = 0;
- if (this->is_array) {
- if (this->d.a.values != nullptr) {
- toku_free(this->d.a.values);
+ &src.d.a.values[src.d.a.start_idx],
+ src.d.a.num_values * (sizeof this->d.a.values[0]));
+ } else {
+ src.fill_array_with_subtree_values(&this->d.a.values[0],
+ src.d.t.root);
}
- this->d.a.values = nullptr;
- } else {
- if (this->d.t.nodes != nullptr) {
- toku_free(this->d.t.nodes);
+ this->d.a.num_values = src.size();
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::clear(void) {
+ if (this->is_array) {
+ this->d.a.start_idx = 0;
+ this->d.a.num_values = 0;
+ } else {
+ this->d.t.root.set_to_null();
+ this->d.t.free_idx = 0;
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::destroy(void) {
+ this->clear();
+ this->capacity = 0;
+ if (this->is_array) {
+ if (this->d.a.values != nullptr) {
+ toku_free(this->d.a.values);
+ }
+ this->d.a.values = nullptr;
+ } else {
+ if (this->d.t.nodes != nullptr) {
+ toku_free(this->d.t.nodes);
+ }
+ this->d.t.nodes = nullptr;
}
- this->d.t.nodes = nullptr;
}
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::size(void) const {
- if (this->is_array) {
- return this->d.a.num_values;
- } else {
- return this->nweight(this->d.t.root);
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::size(void) const {
+ if (this->is_array) {
+ return this->d.a.num_values;
+ } else {
+ return this->nweight(this->d.t.root);
+ }
}
-}
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::insert(
+ const omtdata_t &value,
+ const omtcmp_t &v,
+ uint32_t *const idx) {
+ int r;
+ uint32_t insert_idx;
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::insert(const omtdata_t &value, const omtcmp_t &v, uint32_t *const idx) {
- int r;
- uint32_t insert_idx;
+ r = this->find_zero<omtcmp_t, h>(v, nullptr, &insert_idx);
+ if (r == 0) {
+ if (idx)
+ *idx = insert_idx;
+ return DB_KEYEXIST;
+ }
+ if (r != DB_NOTFOUND)
+ return r;
- r = this->find_zero<omtcmp_t, h>(v, nullptr, &insert_idx);
- if (r==0) {
- if (idx) *idx = insert_idx;
- return DB_KEYEXIST;
+ if ((r = this->insert_at(value, insert_idx)))
+ return r;
+ if (idx)
+ *idx = insert_idx;
+
+ return 0;
}
- if (r != DB_NOTFOUND) return r;
- if ((r = this->insert_at(value, insert_idx))) return r;
- if (idx) *idx = insert_idx;
+ // The following 3 functions implement a static if for us.
+ template <typename omtdata_t, typename omtdataout_t>
+ static void barf_if_marked(
+ const omt<omtdata_t, omtdataout_t, false> &UU(omt)) {}
- return 0;
-}
+ template <typename omtdata_t, typename omtdataout_t>
+ static void barf_if_marked(const omt<omtdata_t, omtdataout_t, true> &omt) {
+ invariant(!omt.has_marks());
+ }
-// The following 3 functions implement a static if for us.
-template<typename omtdata_t, typename omtdataout_t>
-static void barf_if_marked(const omt<omtdata_t, omtdataout_t, false> &UU(omt)) {
-}
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ bool omt<omtdata_t, omtdataout_t, supports_marks>::has_marks(void) const {
+ static_assert(supports_marks, "Does not support marks");
+ if (this->d.t.root.is_null()) {
+ return false;
+ }
+ const omt_node &node = this->d.t.nodes[this->d.t.root.get_index()];
+ return node.get_marks_below() || node.get_marked();
+ }
-template<typename omtdata_t, typename omtdataout_t>
-static void barf_if_marked(const omt<omtdata_t, omtdataout_t, true> &omt) {
- invariant(!omt.has_marks());
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-bool omt<omtdata_t, omtdataout_t, supports_marks>::has_marks(void) const {
- static_assert(supports_marks, "Does not support marks");
- if (this->d.t.root.is_null()) {
- return false;
- }
- const omt_node &node = this->d.t.nodes[this->d.t.root.get_index()];
- return node.get_marks_below() || node.get_marked();
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-int omt<omtdata_t, omtdataout_t, supports_marks>::insert_at(const omtdata_t &value, const uint32_t idx) {
- barf_if_marked(*this);
- if (idx > this->size()) { return EINVAL; }
-
- this->maybe_resize_or_convert(this->size() + 1);
- if (this->is_array && idx != this->d.a.num_values &&
- (idx != 0 || this->d.a.start_idx == 0)) {
- this->convert_to_tree();
- }
- if (this->is_array) {
- if (idx == this->d.a.num_values) {
- this->d.a.values[this->d.a.start_idx + this->d.a.num_values] = value;
- }
- else {
- this->d.a.values[--this->d.a.start_idx] = value;
- }
- this->d.a.num_values++;
- }
- else {
- subtree *rebalance_subtree = nullptr;
- this->insert_internal(&this->d.t.root, value, idx, &rebalance_subtree);
- if (rebalance_subtree != nullptr) {
- this->rebalance(rebalance_subtree);
- }
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-int omt<omtdata_t, omtdataout_t, supports_marks>::set_at(const omtdata_t &value, const uint32_t idx) {
- barf_if_marked(*this);
- if (idx >= this->size()) { return EINVAL; }
-
- if (this->is_array) {
- this->set_at_internal_array(value, idx);
- } else {
- this->set_at_internal(this->d.t.root, value, idx);
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-int omt<omtdata_t, omtdataout_t, supports_marks>::delete_at(const uint32_t idx) {
- barf_if_marked(*this);
- if (idx >= this->size()) { return EINVAL; }
-
- this->maybe_resize_or_convert(this->size() - 1);
- if (this->is_array && idx != 0 && idx != this->d.a.num_values - 1) {
- this->convert_to_tree();
- }
- if (this->is_array) {
- //Testing for 0 does not rule out it being the last entry.
- //Test explicitly for num_values-1
- if (idx != this->d.a.num_values - 1) {
- this->d.a.start_idx++;
- }
- this->d.a.num_values--;
- } else {
- subtree *rebalance_subtree = nullptr;
- this->delete_internal(&this->d.t.root, idx, nullptr, &rebalance_subtree);
- if (rebalance_subtree != nullptr) {
- this->rebalance(rebalance_subtree);
- }
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate(iterate_extra_t *const iterate_extra) const {
- return this->iterate_on_range<iterate_extra_t, f>(0, this->size(), iterate_extra);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_on_range(const uint32_t left, const uint32_t right, iterate_extra_t *const iterate_extra) const {
- if (right > this->size()) { return EINVAL; }
- if (left == right) { return 0; }
- if (this->is_array) {
- return this->iterate_internal_array<iterate_extra_t, f>(left, right, iterate_extra);
- }
- return this->iterate_internal<iterate_extra_t, f>(left, right, this->d.t.root, 0, iterate_extra);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_and_mark_range(const uint32_t left, const uint32_t right, iterate_extra_t *const iterate_extra) {
- static_assert(supports_marks, "does not support marks");
- if (right > this->size()) { return EINVAL; }
- if (left == right) { return 0; }
- paranoid_invariant(!this->is_array);
- return this->iterate_and_mark_range_internal<iterate_extra_t, f>(left, right, this->d.t.root, 0, iterate_extra);
-}
-
-//TODO: We can optimize this if we steal 3 bits. 1 bit: this node is marked. 1 bit: left subtree has marks. 1 bit: right subtree has marks.
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_over_marked(iterate_extra_t *const iterate_extra) const {
- static_assert(supports_marks, "does not support marks");
- paranoid_invariant(!this->is_array);
- return this->iterate_over_marked_internal<iterate_extra_t, f>(this->d.t.root, 0, iterate_extra);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::unmark(const subtree &subtree, const uint32_t index, GrowableArray<node_idx> *const indexes) {
- if (subtree.is_null()) { return; }
- omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t index_root = index + this->nweight(n.left);
-
- const bool below = n.get_marks_below();
- if (below) {
- this->unmark(n.left, index, indexes);
- }
- if (n.get_marked()) {
- indexes->push(index_root);
- }
- n.clear_stolen_bits();
- if (below) {
- this->unmark(n.right, index_root + 1, indexes);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::delete_all_marked(void) {
- static_assert(supports_marks, "does not support marks");
- if (!this->has_marks()) {
- return;
- }
- paranoid_invariant(!this->is_array);
- GrowableArray<node_idx> marked_indexes;
- marked_indexes.init();
-
- // Remove all marks.
- // We need to delete all the stolen bits before calling delete_at to prevent barfing.
- this->unmark(this->d.t.root, 0, &marked_indexes);
-
- for (uint32_t i = 0; i < marked_indexes.get_size(); i++) {
- // Delete from left to right, shift by number already deleted.
- // Alternative is delete from right to left.
- int r = this->delete_at(marked_indexes.fetch_unchecked(i) - i);
- lazy_assert_zero(r);
- }
- marked_indexes.deinit();
- barf_if_marked(*this);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::verify_marks_consistent_internal(const subtree &subtree, const bool UU(allow_marks)) const {
- if (subtree.is_null()) {
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::insert_at(
+ const omtdata_t &value,
+ const uint32_t idx) {
+ barf_if_marked(*this);
+ if (idx > this->size()) {
+ return EINVAL;
+ }
+
+ this->maybe_resize_or_convert(this->size() + 1);
+ if (this->is_array && idx != this->d.a.num_values &&
+ (idx != 0 || this->d.a.start_idx == 0)) {
+ this->convert_to_tree();
+ }
+ if (this->is_array) {
+ if (idx == this->d.a.num_values) {
+ this->d.a.values[this->d.a.start_idx + this->d.a.num_values] =
+ value;
+ } else {
+ this->d.a.values[--this->d.a.start_idx] = value;
+ }
+ this->d.a.num_values++;
+ } else {
+ subtree *rebalance_subtree = nullptr;
+ this->insert_internal(
+ &this->d.t.root, value, idx, &rebalance_subtree);
+ if (rebalance_subtree != nullptr) {
+ this->rebalance(rebalance_subtree);
+ }
+ }
return 0;
}
- const omt_node &node = this->d.t.nodes[subtree.get_index()];
- uint32_t num_marks = verify_marks_consistent_internal(node.left, node.get_marks_below());
- num_marks += verify_marks_consistent_internal(node.right, node.get_marks_below());
- if (node.get_marks_below()) {
- paranoid_invariant(allow_marks);
- paranoid_invariant(num_marks > 0);
- } else {
- // redundant with invariant below, but nice to have explicitly
- paranoid_invariant(num_marks == 0);
- }
- if (node.get_marked()) {
- paranoid_invariant(allow_marks);
- ++num_marks;
- }
- return num_marks;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::verify_marks_consistent(void) const {
- static_assert(supports_marks, "does not support marks");
- paranoid_invariant(!this->is_array);
- this->verify_marks_consistent_internal(this->d.t.root, true);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
-void omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr(iterate_extra_t *const iterate_extra) {
- if (this->is_array) {
- this->iterate_ptr_internal_array<iterate_extra_t, f>(0, this->size(), iterate_extra);
- } else {
- this->iterate_ptr_internal<iterate_extra_t, f>(0, this->size(), this->d.t.root, 0, iterate_extra);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-int omt<omtdata_t, omtdataout_t, supports_marks>::fetch(const uint32_t idx, omtdataout_t *const value) const {
- if (idx >= this->size()) { return EINVAL; }
- if (this->is_array) {
- this->fetch_internal_array(idx, value);
- } else {
- this->fetch_internal(this->d.t.root, idx, value);
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_zero(const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- uint32_t tmp_index;
- uint32_t *const child_idxp = (idxp != nullptr) ? idxp : &tmp_index;
- int r;
- if (this->is_array) {
- r = this->find_internal_zero_array<omtcmp_t, h>(extra, value, child_idxp);
- }
- else {
- r = this->find_internal_zero<omtcmp_t, h>(this->d.t.root, extra, value, child_idxp);
- }
- return r;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find(const omtcmp_t &extra, int direction, omtdataout_t *const value, uint32_t *const idxp) const {
- uint32_t tmp_index;
- uint32_t *const child_idxp = (idxp != nullptr) ? idxp : &tmp_index;
- paranoid_invariant(direction != 0);
- if (direction < 0) {
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::set_at(
+ const omtdata_t &value,
+ const uint32_t idx) {
+ barf_if_marked(*this);
+ if (idx >= this->size()) {
+ return EINVAL;
+ }
+
if (this->is_array) {
- return this->find_internal_minus_array<omtcmp_t, h>(extra, value, child_idxp);
+ this->set_at_internal_array(value, idx);
} else {
- return this->find_internal_minus<omtcmp_t, h>(this->d.t.root, extra, value, child_idxp);
+ this->set_at_internal(this->d.t.root, value, idx);
+ }
+ return 0;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::delete_at(
+ const uint32_t idx) {
+ barf_if_marked(*this);
+ if (idx >= this->size()) {
+ return EINVAL;
+ }
+
+ this->maybe_resize_or_convert(this->size() - 1);
+ if (this->is_array && idx != 0 && idx != this->d.a.num_values - 1) {
+ this->convert_to_tree();
}
- } else {
if (this->is_array) {
- return this->find_internal_plus_array<omtcmp_t, h>(extra, value, child_idxp);
+ // Testing for 0 does not rule out it being the last entry.
+ // Test explicitly for num_values-1
+ if (idx != this->d.a.num_values - 1) {
+ this->d.a.start_idx++;
+ }
+ this->d.a.num_values--;
} else {
- return this->find_internal_plus<omtcmp_t, h>(this->d.t.root, extra, value, child_idxp);
+ subtree *rebalance_subtree = nullptr;
+ this->delete_internal(
+ &this->d.t.root, idx, nullptr, &rebalance_subtree);
+ if (rebalance_subtree != nullptr) {
+ this->rebalance(rebalance_subtree);
+ }
}
+ return 0;
}
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-size_t omt<omtdata_t, omtdataout_t, supports_marks>::memory_size(void) {
- if (this->is_array) {
- return (sizeof *this) + this->capacity * (sizeof this->d.a.values[0]);
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate(
+ iterate_extra_t *const iterate_extra) const {
+ return this->iterate_on_range<iterate_extra_t, f>(
+ 0, this->size(), iterate_extra);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_on_range(
+ const uint32_t left,
+ const uint32_t right,
+ iterate_extra_t *const iterate_extra) const {
+ if (right > this->size()) {
+ return EINVAL;
+ }
+ if (left == right) {
+ return 0;
+ }
+ if (this->is_array) {
+ return this->iterate_internal_array<iterate_extra_t, f>(
+ left, right, iterate_extra);
+ }
+ return this->iterate_internal<iterate_extra_t, f>(
+ left, right, this->d.t.root, 0, iterate_extra);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_and_mark_range(
+ const uint32_t left,
+ const uint32_t right,
+ iterate_extra_t *const iterate_extra) {
+ static_assert(supports_marks, "does not support marks");
+ if (right > this->size()) {
+ return EINVAL;
+ }
+ if (left == right) {
+ return 0;
+ }
+ paranoid_invariant(!this->is_array);
+ return this->iterate_and_mark_range_internal<iterate_extra_t, f>(
+ left, right, this->d.t.root, 0, iterate_extra);
+ }
+
+ // TODO: We can optimize this if we steal 3 bits. 1 bit: this node is
+ // marked. 1 bit: left subtree has marks. 1 bit: right subtree has marks.
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_over_marked(
+ iterate_extra_t *const iterate_extra) const {
+ static_assert(supports_marks, "does not support marks");
+ paranoid_invariant(!this->is_array);
+ return this->iterate_over_marked_internal<iterate_extra_t, f>(
+ this->d.t.root, 0, iterate_extra);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::unmark(
+ const subtree &st,
+ const uint32_t index,
+ GrowableArray<node_idx> *const indexes) {
+ if (st.is_null()) {
+ return;
+ }
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t index_root = index + this->nweight(n.left);
+
+ const bool below = n.get_marks_below();
+ if (below) {
+ this->unmark(n.left, index, indexes);
+ }
+ if (n.get_marked()) {
+ indexes->push(index_root);
+ }
+ n.clear_stolen_bits();
+ if (below) {
+ this->unmark(n.right, index_root + 1, indexes);
+ }
}
- return (sizeof *this) + this->capacity * (sizeof this->d.t.nodes[0]);
-}
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::delete_all_marked(void) {
+ static_assert(supports_marks, "does not support marks");
+ if (!this->has_marks()) {
+ return;
+ }
+ paranoid_invariant(!this->is_array);
+ GrowableArray<node_idx> marked_indexes;
+ marked_indexes.init();
+
+ // Remove all marks.
+ // We need to delete all the stolen bits before calling delete_at to
+ // prevent barfing.
+ this->unmark(this->d.t.root, 0, &marked_indexes);
+
+ for (uint32_t i = 0; i < marked_indexes.get_size(); i++) {
+ // Delete from left to right, shift by number already deleted.
+ // Alternative is delete from right to left.
+ int r = this->delete_at(marked_indexes.fetch_unchecked(i) - i);
+ lazy_assert_zero(r);
+ }
+ marked_indexes.deinit();
+ barf_if_marked(*this);
+ }
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create_internal_no_array(const uint32_t new_capacity) {
- this->is_array = true;
- this->d.a.start_idx = 0;
- this->d.a.num_values = 0;
- this->d.a.values = nullptr;
- this->capacity = new_capacity;
-}
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::
+ verify_marks_consistent_internal(const subtree &st,
+ const bool UU(allow_marks)) const {
+ if (st.is_null()) {
+ return 0;
+ }
+ const omt_node &node = this->d.t.nodes[st.get_index()];
+ uint32_t num_marks =
+ verify_marks_consistent_internal(node.left, node.get_marks_below());
+ num_marks += verify_marks_consistent_internal(node.right,
+ node.get_marks_below());
+ if (node.get_marks_below()) {
+ paranoid_invariant(allow_marks);
+ paranoid_invariant(num_marks > 0);
+ } else {
+ // redundant with invariant below, but nice to have explicitly
+ paranoid_invariant(num_marks == 0);
+ }
+ if (node.get_marked()) {
+ paranoid_invariant(allow_marks);
+ ++num_marks;
+ }
+ return num_marks;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::verify_marks_consistent(
+ void) const {
+ static_assert(supports_marks, "does not support marks");
+ paranoid_invariant(!this->is_array);
+ this->verify_marks_consistent_internal(this->d.t.root, true);
+ }
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::create_internal(const uint32_t new_capacity) {
- this->create_internal_no_array(new_capacity);
- XMALLOC_N(this->capacity, this->d.a.values);
-}
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename iterate_extra_t,
+ int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr(
+ iterate_extra_t *const iterate_extra) {
+ if (this->is_array) {
+ this->iterate_ptr_internal_array<iterate_extra_t, f>(
+ 0, this->size(), iterate_extra);
+ } else {
+ this->iterate_ptr_internal<iterate_extra_t, f>(
+ 0, this->size(), this->d.t.root, 0, iterate_extra);
+ }
+ }
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::nweight(const subtree &subtree) const {
- if (subtree.is_null()) {
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::fetch(
+ const uint32_t idx,
+ omtdataout_t *const value) const {
+ if (idx >= this->size()) {
+ return EINVAL;
+ }
+ if (this->is_array) {
+ this->fetch_internal_array(idx, value);
+ } else {
+ this->fetch_internal(this->d.t.root, idx, value);
+ }
return 0;
- } else {
- return this->d.t.nodes[subtree.get_index()].weight;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-typename omt<omtdata_t, omtdataout_t, supports_marks>::node_idx omt<omtdata_t, omtdataout_t, supports_marks>::node_malloc(void) {
- paranoid_invariant(this->d.t.free_idx < this->capacity);
- omt_node &n = this->d.t.nodes[this->d.t.free_idx];
- n.clear_stolen_bits();
- return this->d.t.free_idx++;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::node_free(const node_idx UU(idx)) {
- paranoid_invariant(idx < this->capacity);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::maybe_resize_array(const uint32_t n) {
- const uint32_t new_size = n<=2 ? 4 : 2*n;
- const uint32_t room = this->capacity - this->d.a.start_idx;
-
- if (room < n || this->capacity / 2 >= new_size) {
- omtdata_t *XMALLOC_N(new_size, tmp_values);
- memcpy(tmp_values, &this->d.a.values[this->d.a.start_idx],
- this->d.a.num_values * (sizeof tmp_values[0]));
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_zero(
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ uint32_t tmp_index;
+ uint32_t *const child_idxp = (idxp != nullptr) ? idxp : &tmp_index;
+ int r;
+ if (this->is_array) {
+ r = this->find_internal_zero_array<omtcmp_t, h>(
+ extra, value, child_idxp);
+ } else {
+ r = this->find_internal_zero<omtcmp_t, h>(
+ this->d.t.root, extra, value, child_idxp);
+ }
+ return r;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find(
+ const omtcmp_t &extra,
+ int direction,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ uint32_t tmp_index;
+ uint32_t *const child_idxp = (idxp != nullptr) ? idxp : &tmp_index;
+ paranoid_invariant(direction != 0);
+ if (direction < 0) {
+ if (this->is_array) {
+ return this->find_internal_minus_array<omtcmp_t, h>(
+ extra, value, child_idxp);
+ } else {
+ return this->find_internal_minus<omtcmp_t, h>(
+ this->d.t.root, extra, value, child_idxp);
+ }
+ } else {
+ if (this->is_array) {
+ return this->find_internal_plus_array<omtcmp_t, h>(
+ extra, value, child_idxp);
+ } else {
+ return this->find_internal_plus<omtcmp_t, h>(
+ this->d.t.root, extra, value, child_idxp);
+ }
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ size_t omt<omtdata_t, omtdataout_t, supports_marks>::memory_size(void) {
+ if (this->is_array) {
+ return (sizeof *this) +
+ this->capacity * (sizeof this->d.a.values[0]);
+ }
+ return (sizeof *this) + this->capacity * (sizeof this->d.t.nodes[0]);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::create_internal_no_array(
+ const uint32_t new_capacity) {
+ this->is_array = true;
this->d.a.start_idx = 0;
- this->capacity = new_size;
- toku_free(this->d.a.values);
- this->d.a.values = tmp_values;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::fill_array_with_subtree_values(omtdata_t *const array, const subtree &subtree) const {
- if (subtree.is_null()) return;
- const omt_node &tree = this->d.t.nodes[subtree.get_index()];
- this->fill_array_with_subtree_values(&array[0], tree.left);
- array[this->nweight(tree.left)] = tree.value;
- this->fill_array_with_subtree_values(&array[this->nweight(tree.left) + 1], tree.right);
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::convert_to_array(void) {
- if (!this->is_array) {
- const uint32_t num_values = this->size();
- uint32_t new_size = 2*num_values;
- new_size = new_size < 4 ? 4 : new_size;
-
- omtdata_t *XMALLOC_N(new_size, tmp_values);
- this->fill_array_with_subtree_values(tmp_values, this->d.t.root);
- toku_free(this->d.t.nodes);
- this->is_array = true;
- this->capacity = new_size;
- this->d.a.num_values = num_values;
- this->d.a.values = tmp_values;
- this->d.a.start_idx = 0;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::rebuild_from_sorted_array(subtree *const subtree, const omtdata_t *const values, const uint32_t numvalues) {
- if (numvalues==0) {
- subtree->set_to_null();
- } else {
- const uint32_t halfway = numvalues/2;
- const node_idx newidx = this->node_malloc();
- omt_node *const newnode = &this->d.t.nodes[newidx];
- newnode->weight = numvalues;
- newnode->value = values[halfway];
- subtree->set_index(newidx);
- // update everything before the recursive calls so the second call can be a tail call.
- this->rebuild_from_sorted_array(&newnode->left, &values[0], halfway);
- this->rebuild_from_sorted_array(&newnode->right, &values[halfway+1], numvalues - (halfway+1));
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::convert_to_tree(void) {
- if (this->is_array) {
- const uint32_t num_nodes = this->size();
- uint32_t new_size = num_nodes*2;
- new_size = new_size < 4 ? 4 : new_size;
-
- omt_node *XMALLOC_N(new_size, new_nodes);
- omtdata_t *const values = this->d.a.values;
- omtdata_t *const tmp_values = &values[this->d.a.start_idx];
- this->is_array = false;
- this->d.t.nodes = new_nodes;
- this->capacity = new_size;
- this->d.t.free_idx = 0;
- this->d.t.root.set_to_null();
- this->rebuild_from_sorted_array(&this->d.t.root, tmp_values, num_nodes);
- toku_free(values);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::maybe_resize_or_convert(const uint32_t n) {
- if (this->is_array) {
- this->maybe_resize_array(n);
- } else {
- const uint32_t new_size = n<=2 ? 4 : 2*n;
- const uint32_t num_nodes = this->nweight(this->d.t.root);
- if ((this->capacity/2 >= new_size) ||
- (this->d.t.free_idx >= this->capacity && num_nodes < n) ||
- (this->capacity<n)) {
- this->convert_to_array();
- // if we had a free list, the "supports_marks" version could
- // just resize, as it is now, we have to convert to and back
- // from an array.
- if (supports_marks) {
- this->convert_to_tree();
+ this->d.a.num_values = 0;
+ this->d.a.values = nullptr;
+ this->capacity = new_capacity;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::create_internal(
+ const uint32_t new_capacity) {
+ this->create_internal_no_array(new_capacity);
+ XMALLOC_N(this->capacity, this->d.a.values);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ uint32_t omt<omtdata_t, omtdataout_t, supports_marks>::nweight(
+ const subtree &st) const {
+ if (st.is_null()) {
+ return 0;
+ } else {
+ return this->d.t.nodes[st.get_index()].weight;
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ typename omt<omtdata_t, omtdataout_t, supports_marks>::node_idx
+ omt<omtdata_t, omtdataout_t, supports_marks>::node_malloc(void) {
+ paranoid_invariant(this->d.t.free_idx < this->capacity);
+ omt_node &n = this->d.t.nodes[this->d.t.free_idx];
+ n.clear_stolen_bits();
+ return this->d.t.free_idx++;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::node_free(
+ const node_idx UU(idx)) {
+ paranoid_invariant(idx < this->capacity);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::maybe_resize_array(
+ const uint32_t n) {
+ const uint32_t new_size = n <= 2 ? 4 : 2 * n;
+ const uint32_t room = this->capacity - this->d.a.start_idx;
+
+ if (room < n || this->capacity / 2 >= new_size) {
+ omtdata_t *XMALLOC_N(new_size, tmp_values);
+ memcpy(tmp_values,
+ &this->d.a.values[this->d.a.start_idx],
+ this->d.a.num_values * (sizeof tmp_values[0]));
+ this->d.a.start_idx = 0;
+ this->capacity = new_size;
+ toku_free(this->d.a.values);
+ this->d.a.values = tmp_values;
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::
+ fill_array_with_subtree_values(omtdata_t *const array,
+ const subtree &st) const {
+ if (st.is_null())
+ return;
+ const omt_node &tree = this->d.t.nodes[st.get_index()];
+ this->fill_array_with_subtree_values(&array[0], tree.left);
+ array[this->nweight(tree.left)] = tree.value;
+ this->fill_array_with_subtree_values(
+ &array[this->nweight(tree.left) + 1], tree.right);
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::convert_to_array(void) {
+ if (!this->is_array) {
+ const uint32_t num_values = this->size();
+ uint32_t new_size = 2 * num_values;
+ new_size = new_size < 4 ? 4 : new_size;
+
+ omtdata_t *XMALLOC_N(new_size, tmp_values);
+ this->fill_array_with_subtree_values(tmp_values, this->d.t.root);
+ toku_free(this->d.t.nodes);
+ this->is_array = true;
+ this->capacity = new_size;
+ this->d.a.num_values = num_values;
+ this->d.a.values = tmp_values;
+ this->d.a.start_idx = 0;
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void
+ omt<omtdata_t, omtdataout_t, supports_marks>::rebuild_from_sorted_array(
+ subtree *const st,
+ const omtdata_t *const values,
+ const uint32_t numvalues) {
+ if (numvalues == 0) {
+ st->set_to_null();
+ } else {
+ const uint32_t halfway = numvalues / 2;
+ const node_idx newidx = this->node_malloc();
+ omt_node *const newnode = &this->d.t.nodes[newidx];
+ newnode->weight = numvalues;
+ newnode->value = values[halfway];
+ st->set_index(newidx);
+ // update everything before the recursive calls so the second call
+ // can be a tail call.
+ this->rebuild_from_sorted_array(
+ &newnode->left, &values[0], halfway);
+ this->rebuild_from_sorted_array(&newnode->right,
+ &values[halfway + 1],
+ numvalues - (halfway + 1));
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::convert_to_tree(void) {
+ if (this->is_array) {
+ const uint32_t num_nodes = this->size();
+ uint32_t new_size = num_nodes * 2;
+ new_size = new_size < 4 ? 4 : new_size;
+
+ omt_node *XMALLOC_N(new_size, new_nodes);
+ omtdata_t *const values = this->d.a.values;
+ omtdata_t *const tmp_values = &values[this->d.a.start_idx];
+ this->is_array = false;
+ this->d.t.nodes = new_nodes;
+ this->capacity = new_size;
+ this->d.t.free_idx = 0;
+ this->d.t.root.set_to_null();
+ this->rebuild_from_sorted_array(
+ &this->d.t.root, tmp_values, num_nodes);
+ toku_free(values);
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::maybe_resize_or_convert(
+ const uint32_t n) {
+ if (this->is_array) {
+ this->maybe_resize_array(n);
+ } else {
+ const uint32_t new_size = n <= 2 ? 4 : 2 * n;
+ const uint32_t num_nodes = this->nweight(this->d.t.root);
+ if ((this->capacity / 2 >= new_size) ||
+ (this->d.t.free_idx >= this->capacity && num_nodes < n) ||
+ (this->capacity < n)) {
+ this->convert_to_array();
+ // if we had a free list, the "supports_marks" version could
+ // just resize, as it is now, we have to convert to and back
+ // from an array.
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
}
}
}
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-bool omt<omtdata_t, omtdataout_t, supports_marks>::will_need_rebalance(const subtree &subtree, const int leftmod, const int rightmod) const {
- if (subtree.is_null()) { return false; }
- const omt_node &n = this->d.t.nodes[subtree.get_index()];
- // one of the 1's is for the root.
- // the other is to take ceil(n/2)
- const uint32_t weight_left = this->nweight(n.left) + leftmod;
- const uint32_t weight_right = this->nweight(n.right) + rightmod;
- return ((1+weight_left < (1+1+weight_right)/2)
- ||
- (1+weight_right < (1+1+weight_left)/2));
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::insert_internal(subtree *const subtreep, const omtdata_t &value, const uint32_t idx, subtree **const rebalance_subtree) {
- if (subtreep->is_null()) {
- paranoid_invariant_zero(idx);
- const node_idx newidx = this->node_malloc();
- omt_node *const newnode = &this->d.t.nodes[newidx];
- newnode->weight = 1;
- newnode->left.set_to_null();
- newnode->right.set_to_null();
- newnode->value = value;
- subtreep->set_index(newidx);
- } else {
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ bool omt<omtdata_t, omtdataout_t, supports_marks>::will_need_rebalance(
+ const subtree &st,
+ const int leftmod,
+ const int rightmod) const {
+ if (st.is_null()) {
+ return false;
+ }
+ const omt_node &n = this->d.t.nodes[st.get_index()];
+ // one of the 1's is for the root.
+ // the other is to take ceil(n/2)
+ const uint32_t weight_left = this->nweight(n.left) + leftmod;
+ const uint32_t weight_right = this->nweight(n.right) + rightmod;
+ return ((1 + weight_left < (1 + 1 + weight_right) / 2) ||
+ (1 + weight_right < (1 + 1 + weight_left) / 2));
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::insert_internal(
+ subtree *const subtreep,
+ const omtdata_t &value,
+ const uint32_t idx,
+ subtree **const rebalance_subtree) {
+ if (subtreep->is_null()) {
+ paranoid_invariant_zero(idx);
+ const node_idx newidx = this->node_malloc();
+ omt_node *const newnode = &this->d.t.nodes[newidx];
+ newnode->weight = 1;
+ newnode->left.set_to_null();
+ newnode->right.set_to_null();
+ newnode->value = value;
+ subtreep->set_index(newidx);
+ } else {
+ omt_node &n = this->d.t.nodes[subtreep->get_index()];
+ n.weight++;
+ if (idx <= this->nweight(n.left)) {
+ if (*rebalance_subtree == nullptr &&
+ this->will_need_rebalance(*subtreep, 1, 0)) {
+ *rebalance_subtree = subtreep;
+ }
+ this->insert_internal(&n.left, value, idx, rebalance_subtree);
+ } else {
+ if (*rebalance_subtree == nullptr &&
+ this->will_need_rebalance(*subtreep, 0, 1)) {
+ *rebalance_subtree = subtreep;
+ }
+ const uint32_t sub_index = idx - this->nweight(n.left) - 1;
+ this->insert_internal(
+ &n.right, value, sub_index, rebalance_subtree);
+ }
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::set_at_internal_array(
+ const omtdata_t &value,
+ const uint32_t idx) {
+ this->d.a.values[this->d.a.start_idx + idx] = value;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::set_at_internal(
+ const subtree &st,
+ const omtdata_t &value,
+ const uint32_t idx) {
+ paranoid_invariant(!st.is_null());
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t leftweight = this->nweight(n.left);
+ if (idx < leftweight) {
+ this->set_at_internal(n.left, value, idx);
+ } else if (idx == leftweight) {
+ n.value = value;
+ } else {
+ this->set_at_internal(n.right, value, idx - leftweight - 1);
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::delete_internal(
+ subtree *const subtreep,
+ const uint32_t idx,
+ omt_node *const copyn,
+ subtree **const rebalance_subtree) {
+ paranoid_invariant_notnull(subtreep);
+ paranoid_invariant_notnull(rebalance_subtree);
+ paranoid_invariant(!subtreep->is_null());
omt_node &n = this->d.t.nodes[subtreep->get_index()];
- n.weight++;
- if (idx <= this->nweight(n.left)) {
- if (*rebalance_subtree == nullptr && this->will_need_rebalance(*subtreep, 1, 0)) {
+ const uint32_t leftweight = this->nweight(n.left);
+ if (idx < leftweight) {
+ n.weight--;
+ if (*rebalance_subtree == nullptr &&
+ this->will_need_rebalance(*subtreep, -1, 0)) {
*rebalance_subtree = subtreep;
}
- this->insert_internal(&n.left, value, idx, rebalance_subtree);
+ this->delete_internal(&n.left, idx, copyn, rebalance_subtree);
+ } else if (idx == leftweight) {
+ if (n.left.is_null()) {
+ const uint32_t oldidx = subtreep->get_index();
+ *subtreep = n.right;
+ if (copyn != nullptr) {
+ copyn->value = n.value;
+ }
+ this->node_free(oldidx);
+ } else if (n.right.is_null()) {
+ const uint32_t oldidx = subtreep->get_index();
+ *subtreep = n.left;
+ if (copyn != nullptr) {
+ copyn->value = n.value;
+ }
+ this->node_free(oldidx);
+ } else {
+ if (*rebalance_subtree == nullptr &&
+ this->will_need_rebalance(*subtreep, 0, -1)) {
+ *rebalance_subtree = subtreep;
+ }
+ // don't need to copy up value, it's only used by this
+ // next call, and when that gets to the bottom there
+ // won't be any more recursion
+ n.weight--;
+ this->delete_internal(&n.right, 0, &n, rebalance_subtree);
+ }
} else {
- if (*rebalance_subtree == nullptr && this->will_need_rebalance(*subtreep, 0, 1)) {
+ n.weight--;
+ if (*rebalance_subtree == nullptr &&
+ this->will_need_rebalance(*subtreep, 0, -1)) {
*rebalance_subtree = subtreep;
}
- const uint32_t sub_index = idx - this->nweight(n.left) - 1;
- this->insert_internal(&n.right, value, sub_index, rebalance_subtree);
- }
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::set_at_internal_array(const omtdata_t &value, const uint32_t idx) {
- this->d.a.values[this->d.a.start_idx + idx] = value;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::set_at_internal(const subtree &subtree, const omtdata_t &value, const uint32_t idx) {
- paranoid_invariant(!subtree.is_null());
- omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t leftweight = this->nweight(n.left);
- if (idx < leftweight) {
- this->set_at_internal(n.left, value, idx);
- } else if (idx == leftweight) {
- n.value = value;
- } else {
- this->set_at_internal(n.right, value, idx - leftweight - 1);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::delete_internal(subtree *const subtreep, const uint32_t idx, omt_node *const copyn, subtree **const rebalance_subtree) {
- paranoid_invariant_notnull(subtreep);
- paranoid_invariant_notnull(rebalance_subtree);
- paranoid_invariant(!subtreep->is_null());
- omt_node &n = this->d.t.nodes[subtreep->get_index()];
- const uint32_t leftweight = this->nweight(n.left);
- if (idx < leftweight) {
- n.weight--;
- if (*rebalance_subtree == nullptr && this->will_need_rebalance(*subtreep, -1, 0)) {
- *rebalance_subtree = subtreep;
- }
- this->delete_internal(&n.left, idx, copyn, rebalance_subtree);
- } else if (idx == leftweight) {
- if (n.left.is_null()) {
- const uint32_t oldidx = subtreep->get_index();
- *subtreep = n.right;
- if (copyn != nullptr) {
- copyn->value = n.value;
+ this->delete_internal(
+ &n.right, idx - leftweight - 1, copyn, rebalance_subtree);
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_internal_array(
+ const uint32_t left,
+ const uint32_t right,
+ iterate_extra_t *const iterate_extra) const {
+ int r;
+ for (uint32_t i = left; i < right; ++i) {
+ r = f(this->d.a.values[this->d.a.start_idx + i], i, iterate_extra);
+ if (r != 0) {
+ return r;
}
- this->node_free(oldidx);
- } else if (n.right.is_null()) {
- const uint32_t oldidx = subtreep->get_index();
- *subtreep = n.left;
- if (copyn != nullptr) {
- copyn->value = n.value;
+ }
+ return 0;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename iterate_extra_t,
+ int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr_internal(
+ const uint32_t left,
+ const uint32_t right,
+ const subtree &st,
+ const uint32_t idx,
+ iterate_extra_t *const iterate_extra) {
+ if (!st.is_null()) {
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t idx_root = idx + this->nweight(n.left);
+ if (left < idx_root) {
+ this->iterate_ptr_internal<iterate_extra_t, f>(
+ left, right, n.left, idx, iterate_extra);
}
- this->node_free(oldidx);
- } else {
- if (*rebalance_subtree == nullptr && this->will_need_rebalance(*subtreep, 0, -1)) {
- *rebalance_subtree = subtreep;
+ if (left <= idx_root && idx_root < right) {
+ int r = f(&n.value, idx_root, iterate_extra);
+ lazy_assert_zero(r);
+ }
+ if (idx_root + 1 < right) {
+ this->iterate_ptr_internal<iterate_extra_t, f>(
+ left, right, n.right, idx_root + 1, iterate_extra);
}
- // don't need to copy up value, it's only used by this
- // next call, and when that gets to the bottom there
- // won't be any more recursion
- n.weight--;
- this->delete_internal(&n.right, 0, &n, rebalance_subtree);
- }
- } else {
- n.weight--;
- if (*rebalance_subtree == nullptr && this->will_need_rebalance(*subtreep, 0, -1)) {
- *rebalance_subtree = subtreep;
- }
- this->delete_internal(&n.right, idx - leftweight - 1, copyn, rebalance_subtree);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_internal_array(const uint32_t left, const uint32_t right,
- iterate_extra_t *const iterate_extra) const {
- int r;
- for (uint32_t i = left; i < right; ++i) {
- r = f(this->d.a.values[this->d.a.start_idx + i], i, iterate_extra);
- if (r != 0) {
- return r;
}
}
- return 0;
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
-void omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr_internal(const uint32_t left, const uint32_t right,
- const subtree &subtree, const uint32_t idx,
- iterate_extra_t *const iterate_extra) {
- if (!subtree.is_null()) {
- omt_node &n = this->d.t.nodes[subtree.get_index()];
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename iterate_extra_t,
+ int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
+ void
+ omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr_internal_array(
+ const uint32_t left,
+ const uint32_t right,
+ iterate_extra_t *const iterate_extra) {
+ for (uint32_t i = left; i < right; ++i) {
+ int r =
+ f(&this->d.a.values[this->d.a.start_idx + i], i, iterate_extra);
+ lazy_assert_zero(r);
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_internal(
+ const uint32_t left,
+ const uint32_t right,
+ const subtree &st,
+ const uint32_t idx,
+ iterate_extra_t *const iterate_extra) const {
+ if (st.is_null()) {
+ return 0;
+ }
+ int r;
+ const omt_node &n = this->d.t.nodes[st.get_index()];
const uint32_t idx_root = idx + this->nweight(n.left);
if (left < idx_root) {
- this->iterate_ptr_internal<iterate_extra_t, f>(left, right, n.left, idx, iterate_extra);
+ r = this->iterate_internal<iterate_extra_t, f>(
+ left, right, n.left, idx, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
}
if (left <= idx_root && idx_root < right) {
- int r = f(&n.value, idx_root, iterate_extra);
- lazy_assert_zero(r);
+ r = f(n.value, idx_root, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
}
if (idx_root + 1 < right) {
- this->iterate_ptr_internal<iterate_extra_t, f>(left, right, n.right, idx_root + 1, iterate_extra);
- }
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(omtdata_t *, const uint32_t, iterate_extra_t *const)>
-void omt<omtdata_t, omtdataout_t, supports_marks>::iterate_ptr_internal_array(const uint32_t left, const uint32_t right,
- iterate_extra_t *const iterate_extra) {
- for (uint32_t i = left; i < right; ++i) {
- int r = f(&this->d.a.values[this->d.a.start_idx + i], i, iterate_extra);
- lazy_assert_zero(r);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_internal(const uint32_t left, const uint32_t right,
- const subtree &subtree, const uint32_t idx,
- iterate_extra_t *const iterate_extra) const {
- if (subtree.is_null()) { return 0; }
- int r;
- const omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t idx_root = idx + this->nweight(n.left);
- if (left < idx_root) {
- r = this->iterate_internal<iterate_extra_t, f>(left, right, n.left, idx, iterate_extra);
- if (r != 0) { return r; }
- }
- if (left <= idx_root && idx_root < right) {
- r = f(n.value, idx_root, iterate_extra);
- if (r != 0) { return r; }
- }
- if (idx_root + 1 < right) {
- return this->iterate_internal<iterate_extra_t, f>(left, right, n.right, idx_root + 1, iterate_extra);
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_and_mark_range_internal(const uint32_t left, const uint32_t right,
- const subtree &subtree, const uint32_t idx,
- iterate_extra_t *const iterate_extra) {
- paranoid_invariant(!subtree.is_null());
- int r;
- omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t idx_root = idx + this->nweight(n.left);
- if (left < idx_root && !n.left.is_null()) {
- n.set_marks_below_bit();
- r = this->iterate_and_mark_range_internal<iterate_extra_t, f>(left, right, n.left, idx, iterate_extra);
- if (r != 0) { return r; }
- }
- if (left <= idx_root && idx_root < right) {
- n.set_marked_bit();
- r = f(n.value, idx_root, iterate_extra);
- if (r != 0) { return r; }
- }
- if (idx_root + 1 < right && !n.right.is_null()) {
- n.set_marks_below_bit();
- return this->iterate_and_mark_range_internal<iterate_extra_t, f>(left, right, n.right, idx_root + 1, iterate_extra);
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename iterate_extra_t,
- int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::iterate_over_marked_internal(const subtree &subtree, const uint32_t idx,
- iterate_extra_t *const iterate_extra) const {
- if (subtree.is_null()) { return 0; }
- int r;
- const omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t idx_root = idx + this->nweight(n.left);
- if (n.get_marks_below()) {
- r = this->iterate_over_marked_internal<iterate_extra_t, f>(n.left, idx, iterate_extra);
- if (r != 0) { return r; }
- }
- if (n.get_marked()) {
- r = f(n.value, idx_root, iterate_extra);
- if (r != 0) { return r; }
- }
- if (n.get_marks_below()) {
- return this->iterate_over_marked_internal<iterate_extra_t, f>(n.right, idx_root + 1, iterate_extra);
- }
- return 0;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::fetch_internal_array(const uint32_t i, omtdataout_t *const value) const {
- if (value != nullptr) {
- copyout(value, &this->d.a.values[this->d.a.start_idx + i]);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::fetch_internal(const subtree &subtree, const uint32_t i, omtdataout_t *const value) const {
- omt_node &n = this->d.t.nodes[subtree.get_index()];
- const uint32_t leftweight = this->nweight(n.left);
- if (i < leftweight) {
- this->fetch_internal(n.left, i, value);
- } else if (i == leftweight) {
- if (value != nullptr) {
- copyout(value, &n);
- }
- } else {
- this->fetch_internal(n.right, i - leftweight - 1, value);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::fill_array_with_subtree_idxs(node_idx *const array, const subtree &subtree) const {
- if (!subtree.is_null()) {
- const omt_node &tree = this->d.t.nodes[subtree.get_index()];
- this->fill_array_with_subtree_idxs(&array[0], tree.left);
- array[this->nweight(tree.left)] = subtree.get_index();
- this->fill_array_with_subtree_idxs(&array[this->nweight(tree.left) + 1], tree.right);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::rebuild_subtree_from_idxs(subtree *const subtree, const node_idx *const idxs, const uint32_t numvalues) {
- if (numvalues==0) {
- subtree->set_to_null();
- } else {
- uint32_t halfway = numvalues/2;
- subtree->set_index(idxs[halfway]);
- //node_idx newidx = idxs[halfway];
- omt_node &newnode = this->d.t.nodes[subtree->get_index()];
- newnode.weight = numvalues;
- // value is already in there.
- this->rebuild_subtree_from_idxs(&newnode.left, &idxs[0], halfway);
- this->rebuild_subtree_from_idxs(&newnode.right, &idxs[halfway+1], numvalues-(halfway+1));
- //n_idx = newidx;
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::rebalance(subtree *const subtree) {
- node_idx idx = subtree->get_index();
- if (idx==this->d.t.root.get_index()) {
- //Try to convert to an array.
- //If this fails, (malloc) nothing will have changed.
- //In the failure case we continue on to the standard rebalance
- //algorithm.
- this->convert_to_array();
- if (supports_marks) {
- this->convert_to_tree();
+ return this->iterate_internal<iterate_extra_t, f>(
+ left, right, n.right, idx_root + 1, iterate_extra);
}
- } else {
- const omt_node &n = this->d.t.nodes[idx];
- node_idx *tmp_array;
- size_t mem_needed = n.weight * (sizeof tmp_array[0]);
- size_t mem_free = (this->capacity - this->d.t.free_idx) * (sizeof this->d.t.nodes[0]);
- bool malloced;
- if (mem_needed<=mem_free) {
- //There is sufficient free space at the end of the nodes array
- //to hold enough node indexes to rebalance.
- malloced = false;
- tmp_array = reinterpret_cast<node_idx *>(&this->d.t.nodes[this->d.t.free_idx]);
- }
- else {
- malloced = true;
- XMALLOC_N(n.weight, tmp_array);
- }
- this->fill_array_with_subtree_idxs(tmp_array, *subtree);
- this->rebuild_subtree_from_idxs(subtree, tmp_array, n.weight);
- if (malloced) toku_free(tmp_array);
- }
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(omtdata_t *const out, const omt_node *const n) {
- *out = n->value;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(omtdata_t **const out, omt_node *const n) {
- *out = &n->value;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(omtdata_t *const out, const omtdata_t *const stored_value_ptr) {
- *out = *stored_value_ptr;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(omtdata_t **const out, omtdata_t *const stored_value_ptr) {
- *out = stored_value_ptr;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_zero_array(const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- uint32_t min = this->d.a.start_idx;
- uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
- uint32_t best_pos = subtree::NODE_NULL;
- uint32_t best_zero = subtree::NODE_NULL;
-
- while (min!=limit) {
- uint32_t mid = (min + limit) / 2;
- int hv = h(this->d.a.values[mid], extra);
- if (hv<0) {
- min = mid+1;
- }
- else if (hv>0) {
- best_pos = mid;
- limit = mid;
- }
- else {
- best_zero = mid;
- limit = mid;
- }
- }
- if (best_zero!=subtree::NODE_NULL) {
- //Found a zero
- if (value != nullptr) {
- copyout(value, &this->d.a.values[best_zero]);
+ return 0;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::
+ iterate_and_mark_range_internal(const uint32_t left,
+ const uint32_t right,
+ const subtree &st,
+ const uint32_t idx,
+ iterate_extra_t *const iterate_extra) {
+ paranoid_invariant(!st.is_null());
+ int r;
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t idx_root = idx + this->nweight(n.left);
+ if (left < idx_root && !n.left.is_null()) {
+ n.set_marks_below_bit();
+ r = this->iterate_and_mark_range_internal<iterate_extra_t, f>(
+ left, right, n.left, idx, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
+ }
+ if (left <= idx_root && idx_root < right) {
+ n.set_marked_bit();
+ r = f(n.value, idx_root, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
+ }
+ if (idx_root + 1 < right && !n.right.is_null()) {
+ n.set_marks_below_bit();
+ return this->iterate_and_mark_range_internal<iterate_extra_t, f>(
+ left, right, n.right, idx_root + 1, iterate_extra);
}
- *idxp = best_zero - this->d.a.start_idx;
return 0;
}
- if (best_pos!=subtree::NODE_NULL) *idxp = best_pos - this->d.a.start_idx;
- else *idxp = this->d.a.num_values;
- return DB_NOTFOUND;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_zero(const subtree &subtree, const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- if (subtree.is_null()) {
- *idxp = 0;
- return DB_NOTFOUND;
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <
+ typename iterate_extra_t,
+ int (*f)(const omtdata_t &, const uint32_t, iterate_extra_t *const)>
+ int
+ omt<omtdata_t, omtdataout_t, supports_marks>::iterate_over_marked_internal(
+ const subtree &st,
+ const uint32_t idx,
+ iterate_extra_t *const iterate_extra) const {
+ if (st.is_null()) {
+ return 0;
+ }
+ int r;
+ const omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t idx_root = idx + this->nweight(n.left);
+ if (n.get_marks_below()) {
+ r = this->iterate_over_marked_internal<iterate_extra_t, f>(
+ n.left, idx, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
+ }
+ if (n.get_marked()) {
+ r = f(n.value, idx_root, iterate_extra);
+ if (r != 0) {
+ return r;
+ }
+ }
+ if (n.get_marks_below()) {
+ return this->iterate_over_marked_internal<iterate_extra_t, f>(
+ n.right, idx_root + 1, iterate_extra);
+ }
+ return 0;
}
- omt_node &n = this->d.t.nodes[subtree.get_index()];
- int hv = h(n.value, extra);
- if (hv<0) {
- int r = this->find_internal_zero<omtcmp_t, h>(n.right, extra, value, idxp);
- *idxp += this->nweight(n.left)+1;
- return r;
- } else if (hv>0) {
- return this->find_internal_zero<omtcmp_t, h>(n.left, extra, value, idxp);
- } else {
- int r = this->find_internal_zero<omtcmp_t, h>(n.left, extra, value, idxp);
- if (r==DB_NOTFOUND) {
- *idxp = this->nweight(n.left);
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::fetch_internal_array(
+ const uint32_t i,
+ omtdataout_t *const value) const {
+ if (value != nullptr) {
+ copyout(value, &this->d.a.values[this->d.a.start_idx + i]);
+ }
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::fetch_internal(
+ const subtree &st,
+ const uint32_t i,
+ omtdataout_t *const value) const {
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ const uint32_t leftweight = this->nweight(n.left);
+ if (i < leftweight) {
+ this->fetch_internal(n.left, i, value);
+ } else if (i == leftweight) {
if (value != nullptr) {
copyout(value, &n);
}
- r = 0;
+ } else {
+ this->fetch_internal(n.right, i - leftweight - 1, value);
}
- return r;
}
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_plus_array(const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- uint32_t min = this->d.a.start_idx;
- uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
- uint32_t best = subtree::NODE_NULL;
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void
+ omt<omtdata_t, omtdataout_t, supports_marks>::fill_array_with_subtree_idxs(
+ node_idx *const array,
+ const subtree &st) const {
+ if (!st.is_null()) {
+ const omt_node &tree = this->d.t.nodes[st.get_index()];
+ this->fill_array_with_subtree_idxs(&array[0], tree.left);
+ array[this->nweight(tree.left)] = st.get_index();
+ this->fill_array_with_subtree_idxs(
+ &array[this->nweight(tree.left) + 1], tree.right);
+ }
+ }
- while (min != limit) {
- const uint32_t mid = (min + limit) / 2;
- const int hv = h(this->d.a.values[mid], extra);
- if (hv > 0) {
- best = mid;
- limit = mid;
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void
+ omt<omtdata_t, omtdataout_t, supports_marks>::rebuild_subtree_from_idxs(
+ subtree *const st,
+ const node_idx *const idxs,
+ const uint32_t numvalues) {
+ if (numvalues == 0) {
+ st->set_to_null();
} else {
- min = mid + 1;
+ uint32_t halfway = numvalues / 2;
+ st->set_index(idxs[halfway]);
+ // node_idx newidx = idxs[halfway];
+ omt_node &newnode = this->d.t.nodes[st->get_index()];
+ newnode.weight = numvalues;
+ // value is already in there.
+ this->rebuild_subtree_from_idxs(&newnode.left, &idxs[0], halfway);
+ this->rebuild_subtree_from_idxs(
+ &newnode.right, &idxs[halfway + 1], numvalues - (halfway + 1));
+ // n_idx = newidx;
}
}
- if (best == subtree::NODE_NULL) { return DB_NOTFOUND; }
- if (value != nullptr) {
- copyout(value, &this->d.a.values[best]);
- }
- *idxp = best - this->d.a.start_idx;
- return 0;
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_plus(const subtree &subtree, const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- if (subtree.is_null()) {
- return DB_NOTFOUND;
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::rebalance(
+ subtree *const st) {
+ node_idx idx = st->get_index();
+ if (idx == this->d.t.root.get_index()) {
+ // Try to convert to an array.
+ // If this fails, (malloc) nothing will have changed.
+ // In the failure case we continue on to the standard rebalance
+ // algorithm.
+ this->convert_to_array();
+ if (supports_marks) {
+ this->convert_to_tree();
+ }
+ } else {
+ const omt_node &n = this->d.t.nodes[idx];
+ node_idx *tmp_array;
+ size_t mem_needed = n.weight * (sizeof tmp_array[0]);
+ size_t mem_free = (this->capacity - this->d.t.free_idx) *
+ (sizeof this->d.t.nodes[0]);
+ bool malloced;
+ if (mem_needed <= mem_free) {
+ // There is sufficient free space at the end of the nodes array
+ // to hold enough node indexes to rebalance.
+ malloced = false;
+ tmp_array = reinterpret_cast<node_idx *>(
+ &this->d.t.nodes[this->d.t.free_idx]);
+ } else {
+ malloced = true;
+ XMALLOC_N(n.weight, tmp_array);
+ }
+ this->fill_array_with_subtree_idxs(tmp_array, *st);
+ this->rebuild_subtree_from_idxs(st, tmp_array, n.weight);
+ if (malloced)
+ toku_free(tmp_array);
+ }
}
- omt_node *const n = &this->d.t.nodes[subtree.get_index()];
- int hv = h(n->value, extra);
- int r;
- if (hv > 0) {
- r = this->find_internal_plus<omtcmp_t, h>(n->left, extra, value, idxp);
- if (r == DB_NOTFOUND) {
- *idxp = this->nweight(n->left);
- if (value != nullptr) {
- copyout(value, n);
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(
+ omtdata_t *const out,
+ const omt_node *const n) {
+ *out = n->value;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(
+ omtdata_t **const out,
+ omt_node *const n) {
+ *out = &n->value;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(
+ omtdata_t *const out,
+ const omtdata_t *const stored_value_ptr) {
+ *out = *stored_value_ptr;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ void omt<omtdata_t, omtdataout_t, supports_marks>::copyout(
+ omtdata_t **const out,
+ omtdata_t *const stored_value_ptr) {
+ *out = stored_value_ptr;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_zero_array(
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ uint32_t min = this->d.a.start_idx;
+ uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
+ uint32_t best_pos = subtree::NODE_NULL;
+ uint32_t best_zero = subtree::NODE_NULL;
+
+ while (min != limit) {
+ uint32_t mid = (min + limit) / 2;
+ int hv = h(this->d.a.values[mid], extra);
+ if (hv < 0) {
+ min = mid + 1;
+ } else if (hv > 0) {
+ best_pos = mid;
+ limit = mid;
+ } else {
+ best_zero = mid;
+ limit = mid;
}
- r = 0;
}
- } else {
- r = this->find_internal_plus<omtcmp_t, h>(n->right, extra, value, idxp);
- if (r == 0) {
- *idxp += this->nweight(n->left) + 1;
+ if (best_zero != subtree::NODE_NULL) {
+ // Found a zero
+ if (value != nullptr) {
+ copyout(value, &this->d.a.values[best_zero]);
+ }
+ *idxp = best_zero - this->d.a.start_idx;
+ return 0;
}
+ if (best_pos != subtree::NODE_NULL)
+ *idxp = best_pos - this->d.a.start_idx;
+ else
+ *idxp = this->d.a.num_values;
+ return DB_NOTFOUND;
}
- return r;
-}
-
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_minus_array(const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- uint32_t min = this->d.a.start_idx;
- uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
- uint32_t best = subtree::NODE_NULL;
- while (min != limit) {
- const uint32_t mid = (min + limit) / 2;
- const int hv = h(this->d.a.values[mid], extra);
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_zero(
+ const subtree &st,
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ if (st.is_null()) {
+ *idxp = 0;
+ return DB_NOTFOUND;
+ }
+ omt_node &n = this->d.t.nodes[st.get_index()];
+ int hv = h(n.value, extra);
if (hv < 0) {
- best = mid;
- min = mid + 1;
+ int r = this->find_internal_zero<omtcmp_t, h>(
+ n.right, extra, value, idxp);
+ *idxp += this->nweight(n.left) + 1;
+ return r;
+ } else if (hv > 0) {
+ return this->find_internal_zero<omtcmp_t, h>(
+ n.left, extra, value, idxp);
} else {
- limit = mid;
+ int r = this->find_internal_zero<omtcmp_t, h>(
+ n.left, extra, value, idxp);
+ if (r == DB_NOTFOUND) {
+ *idxp = this->nweight(n.left);
+ if (value != nullptr) {
+ copyout(value, &n);
+ }
+ r = 0;
+ }
+ return r;
}
}
- if (best == subtree::NODE_NULL) { return DB_NOTFOUND; }
- if (value != nullptr) {
- copyout(value, &this->d.a.values[best]);
- }
- *idxp = best - this->d.a.start_idx;
- return 0;
-}
-template<typename omtdata_t, typename omtdataout_t, bool supports_marks>
-template<typename omtcmp_t,
- int (*h)(const omtdata_t &, const omtcmp_t &)>
-int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_minus(const subtree &subtree, const omtcmp_t &extra, omtdataout_t *const value, uint32_t *const idxp) const {
- paranoid_invariant_notnull(idxp);
- if (subtree.is_null()) {
- return DB_NOTFOUND;
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_plus_array(
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ uint32_t min = this->d.a.start_idx;
+ uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
+ uint32_t best = subtree::NODE_NULL;
+
+ while (min != limit) {
+ const uint32_t mid = (min + limit) / 2;
+ const int hv = h(this->d.a.values[mid], extra);
+ if (hv > 0) {
+ best = mid;
+ limit = mid;
+ } else {
+ min = mid + 1;
+ }
+ }
+ if (best == subtree::NODE_NULL) {
+ return DB_NOTFOUND;
+ }
+ if (value != nullptr) {
+ copyout(value, &this->d.a.values[best]);
+ }
+ *idxp = best - this->d.a.start_idx;
+ return 0;
}
- omt_node *const n = &this->d.t.nodes[subtree.get_index()];
- int hv = h(n->value, extra);
- if (hv < 0) {
- int r = this->find_internal_minus<omtcmp_t, h>(n->right, extra, value, idxp);
- if (r == 0) {
- *idxp += this->nweight(n->left) + 1;
- } else if (r == DB_NOTFOUND) {
- *idxp = this->nweight(n->left);
- if (value != nullptr) {
- copyout(value, n);
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_plus(
+ const subtree &st,
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ if (st.is_null()) {
+ return DB_NOTFOUND;
+ }
+ omt_node *const n = &this->d.t.nodes[st.get_index()];
+ int hv = h(n->value, extra);
+ int r;
+ if (hv > 0) {
+ r = this->find_internal_plus<omtcmp_t, h>(
+ n->left, extra, value, idxp);
+ if (r == DB_NOTFOUND) {
+ *idxp = this->nweight(n->left);
+ if (value != nullptr) {
+ copyout(value, n);
+ }
+ r = 0;
+ }
+ } else {
+ r = this->find_internal_plus<omtcmp_t, h>(
+ n->right, extra, value, idxp);
+ if (r == 0) {
+ *idxp += this->nweight(n->left) + 1;
}
- r = 0;
}
return r;
- } else {
- return this->find_internal_minus<omtcmp_t, h>(n->left, extra, value, idxp);
}
-}
-} // namespace toku
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_minus_array(
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ uint32_t min = this->d.a.start_idx;
+ uint32_t limit = this->d.a.start_idx + this->d.a.num_values;
+ uint32_t best = subtree::NODE_NULL;
+
+ while (min != limit) {
+ const uint32_t mid = (min + limit) / 2;
+ const int hv = h(this->d.a.values[mid], extra);
+ if (hv < 0) {
+ best = mid;
+ min = mid + 1;
+ } else {
+ limit = mid;
+ }
+ }
+ if (best == subtree::NODE_NULL) {
+ return DB_NOTFOUND;
+ }
+ if (value != nullptr) {
+ copyout(value, &this->d.a.values[best]);
+ }
+ *idxp = best - this->d.a.start_idx;
+ return 0;
+ }
+
+ template <typename omtdata_t, typename omtdataout_t, bool supports_marks>
+ template <typename omtcmp_t, int (*h)(const omtdata_t &, const omtcmp_t &)>
+ int omt<omtdata_t, omtdataout_t, supports_marks>::find_internal_minus(
+ const subtree &st,
+ const omtcmp_t &extra,
+ omtdataout_t *const value,
+ uint32_t *const idxp) const {
+ paranoid_invariant_notnull(idxp);
+ if (st.is_null()) {
+ return DB_NOTFOUND;
+ }
+ omt_node *const n = &this->d.t.nodes[st.get_index()];
+ int hv = h(n->value, extra);
+ if (hv < 0) {
+ int r = this->find_internal_minus<omtcmp_t, h>(
+ n->right, extra, value, idxp);
+ if (r == 0) {
+ *idxp += this->nweight(n->left) + 1;
+ } else if (r == DB_NOTFOUND) {
+ *idxp = this->nweight(n->left);
+ if (value != nullptr) {
+ copyout(value, n);
+ }
+ r = 0;
+ }
+ return r;
+ } else {
+ return this->find_internal_minus<omtcmp_t, h>(
+ n->left, extra, value, idxp);
+ }
+ }
+} // namespace toku
diff --git a/storage/tokudb/PerconaFT/util/omt.h b/storage/tokudb/PerconaFT/util/omt.h
index 36946401381..dc26b2d5718 100644
--- a/storage/tokudb/PerconaFT/util/omt.h
+++ b/storage/tokudb/PerconaFT/util/omt.h
@@ -32,6 +32,19 @@ Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved.
You should have received a copy of the GNU Affero General Public License
along with PerconaFT. If not, see <http://www.gnu.org/licenses/>.
+
+----------------------------------------
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
======= */
#ident "Copyright (c) 2006, 2015, Percona and/or its affiliates. All rights reserved."
diff --git a/storage/tokudb/ha_tokudb.cc b/storage/tokudb/ha_tokudb.cc
index b0f438b05bf..3224faf97c4 100644
--- a/storage/tokudb/ha_tokudb.cc
+++ b/storage/tokudb/ha_tokudb.cc
@@ -7241,6 +7241,16 @@ int ha_tokudb::create(
tokudb_trx_data *trx = NULL;
THD* thd = ha_thd();
+ String database_name, table_name, dictionary_name;
+ tokudb_split_dname(name, database_name, table_name, dictionary_name);
+ if (database_name.is_empty() || table_name.is_empty()) {
+ push_warning_printf(thd,
+ Sql_condition::WARN_LEVEL_WARN,
+ ER_TABLE_NAME,
+ "TokuDB: Table Name or Database Name is empty");
+ DBUG_RETURN(ER_TABLE_NAME);
+ }
+
memset(&kc_info, 0, sizeof(kc_info));
#if 100000 <= MYSQL_VERSION_ID && MYSQL_VERSION_ID <= 100999
diff --git a/storage/tokudb/hatoku_hton.cc b/storage/tokudb/hatoku_hton.cc
index b03b8c72f08..81355ea20ff 100644
--- a/storage/tokudb/hatoku_hton.cc
+++ b/storage/tokudb/hatoku_hton.cc
@@ -571,10 +571,10 @@ static int tokudb_init_func(void *p) {
db_env->set_update(db_env, tokudb_update_fun);
- db_env_set_direct_io(tokudb::sysvars::directio == TRUE);
+ db_env_set_direct_io(tokudb::sysvars::directio);
db_env_set_compress_buffers_before_eviction(
- tokudb::sysvars::compress_buffers_before_eviction == TRUE);
+ tokudb::sysvars::compress_buffers_before_eviction);
db_env->change_fsync_log_period(db_env, tokudb::sysvars::fsync_log_period);
diff --git a/storage/tokudb/hatoku_hton.h b/storage/tokudb/hatoku_hton.h
index e632a9afe88..816a66aa440 100644
--- a/storage/tokudb/hatoku_hton.h
+++ b/storage/tokudb/hatoku_hton.h
@@ -190,7 +190,6 @@ inline bool tokudb_killed_thd_callback(void* extra,
return thd_kill_level(thd) != 0;
}
-extern HASH tokudb_open_tables;
extern const char* tokudb_hton_name;
extern int tokudb_hton_initialized;
extern tokudb::thread::rwlock_t tokudb_hton_initialized_lock;
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result
new file mode 100644
index 00000000000..5bf7a270fe5
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/r/PS-4979.result
@@ -0,0 +1,2 @@
+CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
+ERROR 42000: Incorrect table name '#mysql50#q.q'
diff --git a/storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test
new file mode 100644
index 00000000000..cb902f6e52a
--- /dev/null
+++ b/storage/tokudb/mysql-test/tokudb_bugs/t/PS-4979.test
@@ -0,0 +1,13 @@
+--source include/have_tokudb.inc
+# PS-4979 : Dropping TokuDB table with non-alphanumeric characters could lead
+# to a crash
+#
+# `#mysql50#q.q` is an invalid table name, but the server side doesn't detect it
+# and complain. Instead it passes in an empty table name to the engine. The
+# engine expects a table name in the form of a relative path like
+# "./databasename/tablename". InnoDB detects this in parsing the table name
+# during the creation and returns an error.
+# MariaDB server detect above error.
+
+--error ER_WRONG_TABLE_NAME
+CREATE TABLE `#mysql50#q.q`(f1 INT KEY) ENGINE=TOKUDB;
diff --git a/storage/tokudb/tokudb_background.cc b/storage/tokudb/tokudb_background.cc
index 13e0e9321cc..19f03dbca65 100644
--- a/storage/tokudb/tokudb_background.cc
+++ b/storage/tokudb/tokudb_background.cc
@@ -182,14 +182,14 @@ void* job_manager_t::real_thread_func() {
if (res == tokudb::thread::semaphore_t::E_INTERRUPTED || _shutdown) {
break;
} else if (res == tokudb::thread::semaphore_t::E_SIGNALLED) {
-#if TOKUDB_DEBUG
+#if defined(TOKUDB_DEBUG)
if (TOKUDB_UNLIKELY(
tokudb::sysvars::debug_pause_background_job_manager)) {
_sem.signal();
tokudb::time::sleep_microsec(250000);
continue;
}
-#endif // TOKUDB_DEBUG
+#endif // defined(TOKUDB_DEBUG)
mutex_t_lock(_mutex);
assert_debug(_background_jobs.size() > 0);
diff --git a/storage/tokudb/tokudb_sysvars.cc b/storage/tokudb/tokudb_sysvars.cc
index c561fb65dc8..684a952750f 100644
--- a/storage/tokudb/tokudb_sysvars.cc
+++ b/storage/tokudb/tokudb_sysvars.cc
@@ -661,13 +661,13 @@ static MYSQL_THDVAR_ULONGLONG(
~0ULL,
1);
-static MYSQL_THDVAR_STR(
- last_lock_timeout,
- PLUGIN_VAR_MEMALLOC,
- "last lock timeout",
- NULL,
- NULL,
- NULL);
+static MYSQL_THDVAR_STR(last_lock_timeout,
+ PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_NOCMDOPT |
+ PLUGIN_VAR_READONLY,
+ "last lock timeout",
+ NULL,
+ NULL,
+ NULL);
static MYSQL_THDVAR_BOOL(
load_save_space,
diff --git a/storage/tokudb/tokudb_sysvars.h b/storage/tokudb/tokudb_sysvars.h
index 2454f8fefd2..23199baa7be 100644
--- a/storage/tokudb/tokudb_sysvars.h
+++ b/storage/tokudb/tokudb_sysvars.h
@@ -113,10 +113,10 @@ extern my_bool gdb_on_fatal;
extern my_bool check_jemalloc;
-#if TOKUDB_DEBUG
+#if defined(TOKUDB_DEBUG)
// used to control background job manager
extern my_bool debug_pause_background_job_manager;
-#endif // TOKUDB_DEBUG
+#endif // defined(TOKUDB_DEBUG)
// session/thread
my_bool alter_print_error(THD* thd);
diff --git a/support-files/mysql.server.sh b/support-files/mysql.server.sh
index e2054a8fb98..09f26d52129 100644
--- a/support-files/mysql.server.sh
+++ b/support-files/mysql.server.sh
@@ -185,7 +185,11 @@ fi
user='@MYSQLD_USER@'
su_kill() {
- su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
+ if test "$USER" = "$user"; then
+ kill $* >/dev/null 2>&1
+ else
+ su - $user -s /bin/sh -c "kill $*" >/dev/null 2>&1
+ fi
}
#
diff --git a/unittest/mysys/thr_template.c b/unittest/mysys/thr_template.c
index 3a57ed091e9..3606a253ae4 100644
--- a/unittest/mysys/thr_template.c
+++ b/unittest/mysys/thr_template.c
@@ -34,7 +34,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
bad= 0;
diag("Testing %s with %d threads, %d iterations... ", test, n, m);
- for (i= n; i; i--)
+ for (i= 0; i < n; i++)
{
if (pthread_create(&threads[i], 0, handler, &m) != 0)
{
@@ -43,7 +43,7 @@ void test_concurrently(const char *test, pthread_handler handler, int n, int m)
}
}
- for (i= n; i; i--)
+ for (i= 0; i < n; i++)
pthread_join(threads[i], 0);
now= my_interval_timer() - now;
diff --git a/unittest/sql/mf_iocache-t.cc b/unittest/sql/mf_iocache-t.cc
index 8397c539dd5..27c4b8d0e2a 100644
--- a/unittest/sql/mf_iocache-t.cc
+++ b/unittest/sql/mf_iocache-t.cc
@@ -372,10 +372,77 @@ void mdev17133()
}
+void mdev10963()
+{
+ int res;
+ uint n_checks= 8;
+ uchar buf[1024 * 512];
+ uint n_frag= sizeof(buf)/(2 * CACHE_SIZE);
+ FILE *file;
+ myf my_flags= MYF(MY_WME);
+ const char *file_name="cache.log";
+
+ memset(buf, FILL, sizeof(buf));
+ diag("MDEV-10963 Fragmented BINLOG query");
+
+ init_io_cache_encryption();
+ srand((uint) time(NULL));
+
+ /* copying source */
+ res= open_cached_file(&info, 0, 0, CACHE_SIZE, 0);
+ ok(res == 0, "open_cached_file" INFO_TAIL);
+ res= my_b_write(&info, buf, sizeof(buf));
+
+ ulonglong total_size= my_b_tell(&info);
+ ok(res == 0 && total_size == sizeof(buf), "cache is written");
+
+ /* destination */
+ file= my_fopen(file_name, O_RDWR | O_TRUNC | O_CREAT, my_flags);
+ ok(my_fileno(file) > 0, "opened file fd = %d", my_fileno(file));
+
+ /*
+ For n_checks times verify a sequence of copying with random fragment
+ size ranging from zero to about the double of the cache read buffer size.
+ */
+ for (; n_checks; n_checks--, rewind(file))
+ {
+ // copied size is an estimate can be incremeneted to greater than total_size
+ ulong copied_size= 0;
+
+ res= reinit_io_cache(&info, READ_CACHE, 0L, FALSE, FALSE);
+ ok(res == 0, "cache turned to read");
+
+ for (ulong i= 0, curr_size= 0; i < n_frag; i++, copied_size += curr_size)
+ {
+ curr_size= rand() % (2 * (total_size - copied_size) / (n_frag - i));
+
+ DBUG_ASSERT(curr_size <= total_size - copied_size || i == n_frag - 1);
+
+ res= my_b_copy_to_file(&info, file, curr_size);
+ ok(res == 0, "%lu of the cache copied to file", curr_size);
+ }
+ /*
+ Regardless of total_size <> copied_size the function succeeds:
+ when total_size < copied_size the huge overflowed value of the last
+ argument is ignored because nothing already left uncopied in the cache.
+ */
+ res= my_b_copy_to_file(&info, file, (size_t) total_size - copied_size);
+ ok(res == 0, "%llu of the cache copied to file", total_size - copied_size);
+ ok(my_ftell(file, my_flags) == sizeof(buf),
+ "file written in %d fragments", n_frag+1);
+
+ res= reinit_io_cache(&info, WRITE_CACHE, total_size, 0, 0);
+ ok(res == 0 && my_b_tell(&info) == sizeof(buf), "cache turned to write");
+ }
+ close_cached_file(&info);
+ my_fclose(file, my_flags);
+ my_delete(file_name, MYF(MY_WME));
+}
+
int main(int argc __attribute__((unused)),char *argv[])
{
MY_INIT(argv[0]);
- plan(114);
+ plan(277);
/* temp files with and without encryption */
encrypt_tmp_files= 1;
@@ -393,6 +460,7 @@ int main(int argc __attribute__((unused)),char *argv[])
mdev14014();
mdev17133();
+ mdev10963();
my_end(0);
return exit_status();
diff --git a/win/packaging/heidisql.cmake b/win/packaging/heidisql.cmake
index 6f325ca30af..72c059aa706 100644
--- a/win/packaging/heidisql.cmake
+++ b/win/packaging/heidisql.cmake
@@ -1,4 +1,4 @@
-SET(HEIDISQL_BASE_NAME "HeidiSQL_9.4_Portable")
+SET(HEIDISQL_BASE_NAME "HeidiSQL_9.5_Portable")
SET(HEIDISQL_ZIP "${HEIDISQL_BASE_NAME}.zip")
SET(HEIDISQL_URL "http://www.heidisql.com/downloads/releases/${HEIDISQL_ZIP}")
SET(HEIDISQL_DOWNLOAD_DIR ${THIRD_PARTY_DOWNLOAD_LOCATION}/${HEIDISQL_BASE_NAME})