diff options
33 files changed, 243 insertions, 85 deletions
diff --git a/client/mysql.cc b/client/mysql.cc index d22a3d49b16..d66b7706f16 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -3577,6 +3577,7 @@ print_field_types(MYSQL_RES *result) BinaryStringBuffer<128> data_type_metadata_str; metadata.print_data_type_related_attributes(&data_type_metadata_str); tee_fprintf(PAGER, "Field %3u: `%s`\n" + "Org_field: `%s`\n" "Catalog: `%s`\n" "Database: `%s`\n" "Table: `%s`\n" @@ -3588,8 +3589,8 @@ print_field_types(MYSQL_RES *result) "Decimals: %u\n" "Flags: %s\n\n", ++i, - field->name, field->catalog, field->db, field->table, - field->org_table, fieldtype2str(field->type), + field->name, field->org_name, field->catalog, field->db, + field->table, field->org_table, fieldtype2str(field->type), data_type_metadata_str.length() ? " (" : "", data_type_metadata_str.length(), data_type_metadata_str.ptr(), data_type_metadata_str.length() ? ")" : "", diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index e741193cc46..46686827b94 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -22,12 +22,14 @@ if [[ $TRAVIS ]] || [[ $GITLAB_CI ]] then # On both Travis and Gitlab the output log must stay under 4MB so make the # build less verbose - # MCOL-4149: ColumnStore builds are so slow and big that they must be skipped on - # both Travis-CI and Gitlab-CI - sed -e 's|$(CMAKEFLAGS)|$(CMAKEFLAGS) -DPLUGIN_COLUMNSTORE=NO|' \ - -i debian/rules + sed '/Add support for verbose builds/,/^$/d' -i debian/rules elif [ -d storage/columnstore/columnstore/debian ] then + # ColumnStore is explicitly disabled in the native Debian build, so allow it + # now when build is triggered by autobake-deb.sh (MariaDB.org) and when the + # build is not running on Travis or Gitlab-CI + sed '/-DPLUGIN_COLUMNSTORE=NO/d' -i debian/rules + # Take the files and part of control from MCS directory cp -v storage/columnstore/columnstore/debian/mariadb-plugin-columnstore.* debian/ echo >> debian/control cat storage/columnstore/columnstore/debian/control >> debian/control diff --git a/debian/rules b/debian/rules index 9e8341c626d..192f98efcd6 100755 --- a/debian/rules +++ b/debian/rules @@ -38,6 +38,16 @@ else NUMJOBS = 1 endif +# RocksDB cannot build on 32-bit platforms +ifeq (32,$(DEB_HOST_ARCH_BITS)) + CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO +endif + +# ColumnStore can build only on amd64 and arm64 +ifneq (,$(filter $(DEB_HOST_ARCH_CPU),amd64 arm64)) + CMAKEFLAGS += -DPLUGIN_COLUMNSTORE=NO +endif + # Cross building requires stack direction instruction ifneq ($(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)) ifneq (,$(filter $(DEB_HOST_ARCH_CPU),alpha amd64 arm arm64 i386 ia64 m68k mips64el mipsel powerpc ppc64 ppc64el riscv64 s390x sh4 sparc64)) @@ -75,13 +85,15 @@ endif echo "server:Version=$(DEB_VERSION)" >> debian/substvars - # RocksDB and Column Store cannot build on 32-bit platforms + # Don't build ColumnStore as part of the native build as it does not meet the + # quality standards in Debian. Also building it requires an extra 4 GB of disk + # space which makes native Debian builds fail as the total disk space needed + # for MariaDB becomes over 10 GB. Only build CS via autobake-deb.sh. PATH=$${MYSQL_BUILD_PATH:-"/usr/lib/ccache:/usr/local/bin:/usr/bin:/bin"} \ NO_UPDATE_BUILD_VERSION=1 \ dh_auto_configure --builddirectory=$(BUILDDIR) -- \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ $(CMAKEFLAGS) \ - $(if $(findstring $(DEB_HOST_ARCH_BITS),32),-DPLUGIN_ROCKSDB=NO -DPLUGIN_COLUMNSTORE=NO) \ $(if $(filter $(DEB_BUILD_ARCH),$(DEB_HOST_ARCH)),,-DIMPORT_EXECUTABLES=$(CURDIR)/builddir-native/import_executables.cmake) \ -DCOMPILATION_COMMENT="mariadb.org binary distribution" \ -DMYSQL_SERVER_SUFFIX="-$(DEB_VERSION_REVISION)" \ @@ -90,6 +102,7 @@ endif -DBUILD_CONFIG=mysql_release \ -DCONC_DEFAULT_CHARSET=utf8mb4 \ -DPLUGIN_AWS_KEY_MANAGEMENT=NO \ + -DPLUGIN_COLUMNSTORE=NO \ -DIGNORE_AIO_CHECK=YES \ -DWITH_URING=yes \ -DDEB=$(DEB_VENDOR) diff --git a/debian/salsa-ci.yml b/debian/salsa-ci.yml index 26118f19b65..5f8175a0762 100644 --- a/debian/salsa-ci.yml +++ b/debian/salsa-ci.yml @@ -299,6 +299,8 @@ mariadb-10.1 Stretch to mariadb-10.6 upgrade: - apt-get install -y 'default-mysql*' 'mariadb-*' 'libmariadbd*' 'libmariadbclient*' # Verify installation of MariaDB from Stretch - *test-verify-initial + # Remove manpages 4.10 that conflicts with manpages-dev 5.10 on console_ioctl.4.gz + - apt-get remove -y manpages - *test-enable-sid-repos - *test-install - service mysql status @@ -507,28 +509,8 @@ default-libmysqlclient-dev Stretch upgrade: - *test-prepare-container - apt-get install -y pkg-config default-libmysqlclient-dev - pkg-config --list-all - - *test-enable-sid-repos - - *test-install-all-libs - - *test-verify-libs - except: - variables: - - $CI_COMMIT_TAG != null && $SALSA_CI_ENABLE_PIPELINE_ON_TAGS !~ /^(1|yes|true)$/ - -mariadb-connector-c Stretch upgrade: - stage: upgrade from Buster/Stretch - needs: - - job: build - artifacts: true - image: debian:stretch - artifacts: - when: always - name: "$CI_BUILD_NAME" - paths: - - ${WORKING_DIR}/debug - script: - - *test-prepare-container - - apt-get install -y pkg-config libmariadb2 libmariadb-dev libmariadb-dev-compat - - pkg-config --list-all + # Remove manpages 4.10 that conflicts with manpages-dev 5.10 on console_ioctl.4.gz + - apt-get remove -y manpages - *test-enable-sid-repos - *test-install-all-libs - *test-verify-libs @@ -732,7 +714,7 @@ mariadb.org-10.2 to mariadb-10.6 upgrade: # prepending with --defaults-file=/etc/mysql/debian.cnf is needed in upstream 5.5–10.3 - mysql --defaults-file=/etc/mysql/debian.cnf --skip-column-names -e "SELECT @@version, @@version_comment" - echo 'SHOW DATABASES;' | mysql --defaults-file=/etc/mysql/debian.cnf - - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.global_priv; SHOW CREATE USER root@localhost; SHOW CREATE USER 'mariadb.sys'@localhost" + - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.user; SHOW CREATE USER root@localhost" - mysql --defaults-file=/etc/mysql/debian.cnf -e "SELECT * FROM mysql.plugin; SHOW PLUGINS" - *test-install - service mysql status diff --git a/debian/source/lintian-overrides b/debian/source/lintian-overrides index 64bee5c674f..c52ff448bb6 100644 --- a/debian/source/lintian-overrides +++ b/debian/source/lintian-overrides @@ -22,3 +22,9 @@ version-substvar-for-external-package mariadb-client-10.6 -> mysql-client-core-8 version-substvar-for-external-package libmariadbd-dev -> libmariadbclient-dev # ColumnStore not used in Debian, safe to ignore. Reported upstream in https://jira.mariadb.org/browse/MDEV-24124 source-is-missing storage/columnstore/columnstore/utils/jemalloc/libjemalloc.so.2 +# Must be fixed upstream +source-is-missing storage/mroonga/vendor/groonga/examples/dictionary/html/js/jquery-ui-1.8.18.custom.js line 58 is 273 characters long (>256) +# Intentional control relationships +version-substvar-for-external-package Replaces (line 216) ${source:Version} libmariadbd-dev -> libmariadbclient-dev +version-substvar-for-external-package Replaces (line 66) ${source:Version} libmariadb-dev -> libmysqlclient-dev +version-substvar-for-external-package Replaces (line 66) ${source:Version} libmariadb-dev -> libmysqld-dev diff --git a/include/handler_ername.h b/include/handler_ername.h index d03790b8e64..026d7c8bb8c 100644 --- a/include/handler_ername.h +++ b/include/handler_ername.h @@ -78,3 +78,4 @@ { "HA_ERR_ABORTED_BY_USER", HA_ERR_ABORTED_BY_USER, "" }, { "HA_ERR_DISK_FULL", HA_ERR_DISK_FULL, "" }, { "HA_ERR_INCOMPATIBLE_DEFINITION", HA_ERR_INCOMPATIBLE_DEFINITION, "" }, +{ "HA_ERR_COMMIT_ERROR", HA_ERR_COMMIT_ERROR, "" }, diff --git a/include/my_base.h b/include/my_base.h index 053bf3fbb69..80ee527ccf0 100644 --- a/include/my_base.h +++ b/include/my_base.h @@ -527,7 +527,8 @@ enum ha_base_keytype { #define HA_ERR_TABLESPACE_MISSING 194 /* Missing Tablespace */ #define HA_ERR_SEQUENCE_INVALID_DATA 195 #define HA_ERR_SEQUENCE_RUN_OUT 196 -#define HA_ERR_LAST 196 /* Copy of last error nr * */ +#define HA_ERR_COMMIT_ERROR 197 +#define HA_ERR_LAST 197 /* Copy of last error nr * */ /* Number of different errors */ #define HA_ERR_ERRORS (HA_ERR_LAST - HA_ERR_FIRST + 1) diff --git a/include/my_handler_errors.h b/include/my_handler_errors.h index faf7b9f459e..69b1566557d 100644 --- a/include/my_handler_errors.h +++ b/include/my_handler_errors.h @@ -107,7 +107,8 @@ static const char *handler_error_messages[]= "Foreign key cascade delete/update exceeds max depth", "Tablespace is missing for a table", "Sequence has been run out", - "Sequence values are conflicting" + "Sequence values are conflicting", + "Error during commit" }; #endif /* MYSYS_MY_HANDLER_ERRORS_INCLUDED */ diff --git a/include/myisamchk.h b/include/myisamchk.h index f9a55ba467f..c494c672ec7 100644 --- a/include/myisamchk.h +++ b/include/myisamchk.h @@ -87,7 +87,7 @@ typedef struct st_handler_check_param /* Following is used to check if rows are visible */ ulonglong max_trid, max_found_trid; ulonglong not_visible_rows_found; - ulonglong sort_buffer_length; + ulonglong sort_buffer_length, orig_sort_buffer_length; ulonglong use_buffers; /* Used as param to getopt() */ size_t read_buffer_length, write_buffer_length, sort_key_blocks; time_t backup_time; /* To sign backup files */ diff --git a/mysql-test/main/alias.result b/mysql-test/main/alias.result index defd44f2548..d8bb211539f 100644 --- a/mysql-test/main/alias.result +++ b/mysql-test/main/alias.result @@ -218,3 +218,22 @@ DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ 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 't1 WHERE 1=1' at line 1 connection default; disconnect c1; +# +# MDEV-23519 +# +create or replace table t1 (a int); +create or replace table t2 (b int); +insert into t1 values(1),(2); +insert into t2 values(1),(2); +select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def test t1 t1 a a1 3 11 1 Y 32768 0 63 +a1 +1 +2 +1 +2 +drop table t1,t2; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/alias.test b/mysql-test/main/alias.test index c02ebe2f5ff..f0c4e13abfd 100644 --- a/mysql-test/main/alias.test +++ b/mysql-test/main/alias.test @@ -226,3 +226,18 @@ connection c1; DELETE ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ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ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZROM t1 WHERE 1=1; connection default; disconnect c1; +--echo # +--echo # MDEV-23519 +--echo # +create or replace table t1 (a int); +create or replace table t2 (b int); +insert into t1 values(1),(2); +insert into t2 values(1),(2); +--enable_metadata +select t1.a as a1 from t1 as t1,t2 order by t2.b,t1.a; +--disable_metadata +drop table t1,t2; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/mysql-metadata.result b/mysql-test/main/mysql-metadata.result index ce6c77ed7fa..51b3eb24f2b 100644 --- a/mysql-test/main/mysql-metadata.result +++ b/mysql-test/main/mysql-metadata.result @@ -13,6 +13,7 @@ SELECT * FROM t1 -------------- Field 1: `js0` +Org_field: `js0` Catalog: `def` Database: `test` Table: `t1` @@ -25,6 +26,7 @@ Decimals: 0 Flags: BLOB BINARY Field 2: `js1` +Org_field: `js1` Catalog: `def` Database: `test` Table: `t1` @@ -37,6 +39,7 @@ Decimals: 0 Flags: BLOB Field 3: `js2` +Org_field: `js2` Catalog: `def` Database: `test` Table: `t1` @@ -49,6 +52,7 @@ Decimals: 0 Flags: BLOB Field 4: `js3` +Org_field: `js3` Catalog: `def` Database: `test` Table: `t1` @@ -69,6 +73,7 @@ SELECT JSON_COMPACT(js0) FROM t1 -------------- Field 1: `JSON_COMPACT(js0)` +Org_field: `` Catalog: `def` Database: `` Table: `` diff --git a/mysql-test/suite/galera_sr/r/MDEV-21613.result b/mysql-test/suite/galera_sr/r/MDEV-21613.result new file mode 100644 index 00000000000..67af2d49331 --- /dev/null +++ b/mysql-test/suite/galera_sr/r/MDEV-21613.result @@ -0,0 +1,20 @@ +connection node_2; +connection node_1; +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); +connection node_1; +SET SESSION wsrep_trx_fragment_size = 1; +SET DEBUG_SYNC = "wsrep_before_fragment_removal SIGNAL fragment_removal_reached WAIT_FOR fragment_removal_continue"; +START TRANSACTION; +INSERT INTO t1 VALUES(1), (2); +COMMIT; +connect node_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_ctrl; +SET DEBUG_SYNC = "now WAIT_FOR fragment_removal_reached"; +connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1; +connection node_1a; +TRUNCATE TABLE t1; +connection node_1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +connection node_ctrl; +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/galera_sr/t/MDEV-21613.cnf b/mysql-test/suite/galera_sr/t/MDEV-21613.cnf new file mode 100644 index 00000000000..d8e3488f044 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-21613.cnf @@ -0,0 +1,7 @@ +# Set thread-handling as a workaround to avoid MDEV-26528. +# The file can be removed once fixed. + +!include ../galera_2nodes.cnf + +[mysqld.1] +thread-handling=pool-of-threads diff --git a/mysql-test/suite/galera_sr/t/MDEV-21613.test b/mysql-test/suite/galera_sr/t/MDEV-21613.test new file mode 100644 index 00000000000..8a1fea1b7f5 --- /dev/null +++ b/mysql-test/suite/galera_sr/t/MDEV-21613.test @@ -0,0 +1,36 @@ +# +# MDEV-21613 - galera_sr.GCF-1018B MTR failed: +# Failed to open table mysql.wsrep_streaming_log for writing +# +# A BF abort right before fragment removal caused this error to +# be logged to the error log. +# +--source include/galera_cluster.inc +--source include/have_debug_sync.inc + +CREATE TABLE t1 (f1 INTEGER PRIMARY KEY); + +--connection node_1 +SET SESSION wsrep_trx_fragment_size = 1; +SET DEBUG_SYNC = "wsrep_before_fragment_removal SIGNAL fragment_removal_reached WAIT_FOR fragment_removal_continue"; +START TRANSACTION; +INSERT INTO t1 VALUES(1), (2); +--send COMMIT + +--connect node_ctrl, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_ctrl +SET DEBUG_SYNC = "now WAIT_FOR fragment_removal_reached"; + + +--connect node_1a, 127.0.0.1, root, , test, $NODE_MYPORT_1 +--connection node_1a +TRUNCATE TABLE t1; + + +--connection node_1 +--error ER_LOCK_DEADLOCK +--reap + +--connection node_ctrl +SET DEBUG_SYNC = 'RESET'; +DROP TABLE t1; diff --git a/mysql-test/suite/perfschema/t/transaction_nested_events-master.opt b/mysql-test/suite/perfschema/t/transaction_nested_events-master.opt index d68f0498edf..0583801ec98 100644 --- a/mysql-test/suite/perfschema/t/transaction_nested_events-master.opt +++ b/mysql-test/suite/perfschema/t/transaction_nested_events-master.opt @@ -3,7 +3,7 @@ --loose-performance_schema_events_statements_history_size=20 --loose-performance_schema_events_statements_history_long_size=50 --loose-performance_schema_events_transactions_history_long_size=50 ---loose-performance_schema_max_thread_instances=30 +--loose-performance_schema_max_thread_instances=60 --loose-performance-schema-consumer-events-stages-current=OFF --loose-performance-schema-consumer-events-stages-history=OFF diff --git a/mysys/mf_tempfile.c b/mysys/mf_tempfile.c index 51a3efa05ad..0f1c6d6b1bc 100644 --- a/mysys/mf_tempfile.c +++ b/mysys/mf_tempfile.c @@ -121,7 +121,7 @@ File create_temp_file(char *to, const char *dir, const char *prefix, /* explictly don't use O_EXCL here has it has a different meaning with O_TMPFILE */ - if ((file= open(dir, mode | O_TMPFILE | O_CLOEXEC, + if ((file= open(dir, (mode & ~O_CREAT) | O_TMPFILE | O_CLOEXEC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP)) >= 0) { my_snprintf(to, FN_REFLEN, "%s/#sql/fd=%d", dir, file); diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result index 868b9902f5c..7ed7b5c4422 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6_mysql.result @@ -1,5 +1,6 @@ CREATE TABLE t1 (a INET6); Field 1: `a` +Org_field: `a` Catalog: `def` Database: `test` Table: `t1` @@ -12,6 +13,7 @@ Decimals: 0 Flags: UNSIGNED BINARY Field 2: `b` +Org_field: `` Catalog: `def` Database: `` Table: `` @@ -24,6 +26,7 @@ Decimals: 0 Flags: NOT_NULL UNSIGNED Field 3: `c` +Org_field: `` Catalog: `def` Database: `` Table: `` diff --git a/plugin/type_test/mysql-test/type_test/type_test_mysql.result b/plugin/type_test/mysql-test/type_test/type_test_mysql.result index 402e8265181..7dfbfce3340 100644 --- a/plugin/type_test/mysql-test/type_test/type_test_mysql.result +++ b/plugin/type_test/mysql-test/type_test/type_test_mysql.result @@ -1,5 +1,6 @@ CREATE TABLE t1 (a TEST_INT8, b TEST_DOUBLE); Field 1: `a` +Org_field: `a` Catalog: `def` Database: `test` Table: `t1` @@ -12,6 +13,7 @@ Decimals: 0 Flags: NUM Field 2: `b` +Org_field: `b` Catalog: `def` Database: `test` Table: `t1` diff --git a/sql/handler.cc b/sql/handler.cc index 7a220068a7c..cce50dc9289 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -4532,6 +4532,9 @@ void handler::print_error(int error, myf errflag) case HA_ERR_UNDO_REC_TOO_BIG: textno= ER_UNDO_RECORD_TOO_BIG; break; + case HA_ERR_COMMIT_ERROR: + textno= ER_ERROR_DURING_COMMIT; + break; default: { /* The error was "unknown" to this function. diff --git a/sql/sql_select.cc b/sql/sql_select.cc index ad44266ce7d..0c6f38ffa56 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -18283,7 +18283,14 @@ Field *Item_sum::create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) /** Create a temporary field for Item_field (or its descendant), either direct or referenced by an Item_ref. + + param->modify_item is set when we create a field for an internal temporary + table. In this case we have to ensure the new field name is identical to + the original field name as the field will info will be sent to the client. + In other cases, the field name is set from orig_item or name if org_item is + not set. */ + Field * Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, Item_ref *orig_item, @@ -18291,6 +18298,10 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, { DBUG_ASSERT(!is_result_field()); Field *result; + LEX_CSTRING *new_name= (orig_item ? &orig_item->name : + !param->modify_item() ? &name : + &field->field_name); + /* If item have to be able to store NULLs but underlaid field can't do it, create_tmp_field_from_field() can't be used for tmp field creation. @@ -18309,8 +18320,7 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, Record_addr rec(orig_item ? orig_item->maybe_null() : maybe_null()); const Type_handler *handler= type_handler()-> type_handler_for_tmp_table(this); - result= handler->make_and_init_table_field(root, - orig_item ? &orig_item->name : &name, + result= handler->make_and_init_table_field(root, new_name, rec, *this, new_table); } else if (param->table_cant_handle_bit_fields() && @@ -18318,18 +18328,17 @@ Item_field::create_tmp_field_from_item_field(MEM_ROOT *root, TABLE *new_table, { const Type_handler *handler= Type_handler::type_handler_long_or_longlong(max_char_length(), true); - result= handler->make_and_init_table_field(root, &name, + result= handler->make_and_init_table_field(root, new_name, Record_addr(maybe_null()), *this, new_table); } else { - LEX_CSTRING *tmp= orig_item ? &orig_item->name : &name; bool tmp_maybe_null= param->modify_item() ? maybe_null() : field->maybe_null(); result= field->create_tmp_field(root, new_table, tmp_maybe_null); - if (result) - result->field_name= *tmp; + if (result && ! param->modify_item()) + result->field_name= *new_name; } if (result && param->modify_item()) result_field= result; diff --git a/sql/wsrep_client_service.cc b/sql/wsrep_client_service.cc index a7480aaddb8..6ab2834a219 100644 --- a/sql/wsrep_client_service.cc +++ b/sql/wsrep_client_service.cc @@ -192,6 +192,7 @@ cleanup: int Wsrep_client_service::remove_fragments() { DBUG_ENTER("Wsrep_client_service::remove_fragments"); + DEBUG_SYNC(m_thd, "wsrep_before_fragment_removal"); if (wsrep_schema->remove_fragments(m_thd, Wsrep_server_state::instance().id(), m_thd->wsrep_trx().id(), diff --git a/sql/wsrep_schema.cc b/sql/wsrep_schema.cc index 1bfce7874ae..9d77577ed42 100644 --- a/sql/wsrep_schema.cc +++ b/sql/wsrep_schema.cc @@ -270,13 +270,7 @@ static int open_table(THD* thd, thd->lex->query_tables_own_last= 0; if (!open_n_lock_single_table(thd, &tables, tables.lock_type, flags)) { - if (thd->is_error()) { - WSREP_WARN("Can't lock table %s.%s : %d (%s)", - schema_name->str, table_name->str, - thd->get_stmt_da()->sql_errno(), thd->get_stmt_da()->message()); - } close_thread_tables(thd); - my_error(ER_NO_SUCH_TABLE, MYF(0), schema_name->str, table_name->str); DBUG_RETURN(1); } @@ -292,8 +286,15 @@ static int open_for_write(THD* thd, const char* table_name, TABLE** table) { LEX_CSTRING table_str= { table_name, strlen(table_name) }; if (Wsrep_schema_impl::open_table(thd, &schema_str, &table_str, TL_WRITE, table)) { - WSREP_ERROR("Failed to open table %s.%s for writing", - schema_str.str, table_name); + // No need to log an error if the query was bf aborted, + // thd client will get ER_LOCK_DEADLOCK in the end. + const bool interrupted= thd->killed || + (thd->is_error() && + (thd->get_stmt_da()->sql_errno() == ER_QUERY_INTERRUPTED)); + if (!interrupted) { + WSREP_ERROR("Failed to open table %s.%s for writing", + schema_str.str, table_name); + } return 1; } empty_record(*table); diff --git a/storage/connect/tabrest.h b/storage/connect/tabrest.h index 1f6a288c27d..901d9102e95 100644 --- a/storage/connect/tabrest.h +++ b/storage/connect/tabrest.h @@ -6,7 +6,7 @@ #pragma once #if defined(_WIN32) -#else // !__WIN__ +#else // !_WIN32 #define stricmp strcasecmp #endif // !_WIN32 diff --git a/storage/innobase/buf/buf0flu.cc b/storage/innobase/buf/buf0flu.cc index 71050760361..84b0287d535 100644 --- a/storage/innobase/buf/buf0flu.cc +++ b/storage/innobase/buf/buf0flu.cc @@ -2229,6 +2229,15 @@ furious_flush: unemployed: buf_flush_async_lsn= 0; buf_pool.page_cleaner_set_idle(true); + + DBUG_EXECUTE_IF("ib_log_checkpoint_avoid", continue;); + + mysql_mutex_unlock(&buf_pool.flush_list_mutex); + + if (!recv_recovery_is_on() && srv_operation == SRV_OPERATION_NORMAL) + log_checkpoint(); + + mysql_mutex_lock(&buf_pool.flush_list_mutex); continue; } diff --git a/storage/maria/aria_chk.c b/storage/maria/aria_chk.c index 728b574c98c..266b11d99f5 100644 --- a/storage/maria/aria_chk.c +++ b/storage/maria/aria_chk.c @@ -434,8 +434,8 @@ static struct my_option my_long_options[] = ~0UL, (long) MALLOC_OVERHEAD, (long) 1L, 0}, { "sort_buffer_size", OPT_SORT_BUFFER_SIZE, "Size of sort buffer. Used by --recover", - &check_param.sort_buffer_length, - &check_param.sort_buffer_length, 0, GET_ULL, REQUIRED_ARG, + &check_param.orig_sort_buffer_length, + &check_param.orig_sort_buffer_length, 0, GET_ULL, REQUIRED_ARG, SORT_BUFFER_INIT, MIN_SORT_BUFFER, SIZE_T_MAX, MALLOC_OVERHEAD, 1L, 0}, { "sort_key_blocks", OPT_SORT_KEY_BLOCKS, "Internal buffer for sorting keys; Don't touch :)", diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 38db0042a83..0cec0f088dd 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1489,7 +1489,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) param->testflag= ((check_opt->flags & ~(T_EXTEND)) | T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); - param->sort_buffer_length= THDVAR(thd, sort_buffer_size); + param->orig_sort_buffer_length= THDVAR(thd, sort_buffer_size); param->backup_time= check_opt->start_time; start_records= file->state->records; old_proc_info= thd_proc_info(thd, "Checking table"); @@ -1560,7 +1560,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) param->thd= thd; param->op_name= "zerofill"; param->testflag= check_opt->flags | T_SILENT | T_ZEROFILL; - param->sort_buffer_length= THDVAR(thd, sort_buffer_size); + param->orig_sort_buffer_length= THDVAR(thd, sort_buffer_size); param->db_name= table->s->db.str; param->table_name= table->alias.c_ptr(); @@ -1596,7 +1596,7 @@ int ha_maria::optimize(THD * thd, HA_CHECK_OPT *check_opt) param->op_name= "optimize"; param->testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE | T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX); - param->sort_buffer_length= THDVAR(thd, sort_buffer_size); + param->orig_sort_buffer_length= THDVAR(thd, sort_buffer_size); thd_progress_init(thd, 1); if ((error= repair(thd, param, 1)) && param->retry_repair) { @@ -2064,7 +2064,7 @@ int ha_maria::enable_indexes(uint mode) } param->myf_rw &= ~MY_WAIT_IF_FULL; - param->sort_buffer_length= THDVAR(thd,sort_buffer_size); + param->orig_sort_buffer_length= THDVAR(thd,sort_buffer_size); param->stats_method= (enum_handler_stats_method)THDVAR(thd,stats_method); param->tmpdir= &mysql_tmpdir_list; if ((error= (repair(thd, param, 0) != HA_ADMIN_OK)) && param->retry_repair) @@ -2913,7 +2913,7 @@ int ha_maria::external_lock(THD *thd, int lock_type) if (file->autocommit) { if (ma_commit(trn)) - result= HA_ERR_INTERNAL_ERROR; + result= HA_ERR_COMMIT_ERROR; thd_set_ha_data(thd, maria_hton, 0); } } @@ -3052,7 +3052,7 @@ int ha_maria::implicit_commit(THD *thd, bool new_trn) error= 0; if (unlikely(ma_commit(trn))) - error= 1; + error= HA_ERR_COMMIT_ERROR; if (!new_trn) { reset_thd_trn(thd, used_tables); @@ -3489,7 +3489,7 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)), THD *thd, bool all) { TRN *trn= THD_TRN; - int res; + int res= 0; MARIA_HA *used_instances; DBUG_ENTER("maria_commit"); @@ -3508,7 +3508,8 @@ static int maria_commit(handlerton *hton __attribute__ ((unused)), trnman_reset_locked_tables(trn, 0); trnman_set_flags(trn, trnman_get_flags(trn) & ~TRN_STATE_INFO_LOGGED); trn->used_instances= 0; - res= ma_commit(trn); + if (ma_commit(trn)) + res= HA_ERR_COMMIT_ERROR; reset_thd_trn(thd, used_instances); thd_set_ha_data(thd, maria_hton, 0); DBUG_RETURN(res); diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index c097c6d1e2e..20baa429d76 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -114,7 +114,7 @@ void maria_chk_init(HA_CHECK *param) param->use_buffers= PAGE_BUFFER_INIT; param->read_buffer_length=READ_BUFFER_INIT; param->write_buffer_length=READ_BUFFER_INIT; - param->sort_buffer_length=SORT_BUFFER_INIT; + param->orig_sort_buffer_length=SORT_BUFFER_INIT; param->sort_key_blocks=BUFFERS_WHEN_SORTING; param->tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL; param->myf_rw=MYF(MY_NABP | MY_WME | MY_WAIT_IF_FULL); @@ -2485,6 +2485,8 @@ static int initialize_variables_for_repair(HA_CHECK *param, tmp= (size_t) MY_MIN(sort_info->filelength, (my_off_t) (SIZE_T_MAX/10/threads)); tmp= MY_MAX(tmp * 8 * threads, (size_t) 65536); /* Some margin */ + param->sort_buffer_length= MY_MIN(param->orig_sort_buffer_length, + tmp); set_if_smaller(param->sort_buffer_length, tmp); /* Protect against too big sort buffer length */ #if SIZEOF_SIZE_T >= 8 diff --git a/storage/maria/ma_checkpoint.c b/storage/maria/ma_checkpoint.c index 3af808478e4..2741f54d7d7 100644 --- a/storage/maria/ma_checkpoint.c +++ b/storage/maria/ma_checkpoint.c @@ -153,8 +153,10 @@ end: static int really_execute_checkpoint(void) { uint i, error= 0; + int error_errno= 0; /** @brief checkpoint_start_log_horizon will be stored there */ char *ptr; + const char *error_place= 0; LEX_STRING record_pieces[4]; /**< only malloc-ed pieces */ LSN min_page_rec_lsn, min_trn_rec_lsn, min_first_undo_lsn; TRANSLOG_ADDRESS checkpoint_start_log_horizon; @@ -191,13 +193,19 @@ static int really_execute_checkpoint(void) &record_pieces[1], &min_trn_rec_lsn, &min_first_undo_lsn))) + { + error_place= "trnman_collect_transaction"; goto err; + } /* STEP 3: fetch information about table files */ if (unlikely(collect_tables(&record_pieces[2], checkpoint_start_log_horizon))) + { + error_place= "collect_tables"; goto err; + } /* STEP 4: fetch information about dirty pages */ @@ -211,7 +219,10 @@ static int really_execute_checkpoint(void) if (unlikely(pagecache_collect_changed_blocks_with_lsn(maria_pagecache, &record_pieces[3], &min_page_rec_lsn))) + { + error_place= "collect_pages"; goto err; + } /* LAST STEP: now write the checkpoint log record */ @@ -240,7 +251,10 @@ static int really_execute_checkpoint(void) sizeof(log_array)/sizeof(log_array[0]), log_array, NULL, NULL) || translog_flush(lsn))) + { + error_place= "translog_write_record"; goto err; + } translog_lock(); /* This cannot be done as a inwrite_rec_hook of LOGREC_CHECKPOINT, because @@ -251,6 +265,8 @@ static int really_execute_checkpoint(void) max_trid_in_control_file, recovery_failures))) { + error_place= "ma_control_file_write"; + error_errno= my_errno; translog_unlock(); goto err; } @@ -287,7 +303,9 @@ static int really_execute_checkpoint(void) err: error= 1; - ma_message_no_user(0, "checkpoint failed"); + my_printf_error(HA_ERR_GENERIC, "Aria engine: checkpoint failed at %s with " + "error %d", MYF(ME_ERROR_LOG), + error_place, (error_errno ? error_errno : my_errno)); /* we were possibly not able to determine what pages to flush */ pages_to_flush_before_next_checkpoint= 0; diff --git a/storage/perfschema/pfs_engine_table.cc b/storage/perfschema/pfs_engine_table.cc index d2a42bd7f98..283ca28100b 100644 --- a/storage/perfschema/pfs_engine_table.cc +++ b/storage/perfschema/pfs_engine_table.cc @@ -226,7 +226,7 @@ bool PFS_table_context::is_item_set(ulong n) { ulong word= n / m_word_size; ulong bit= n % m_word_size; - return (m_map[word] & (1 << bit)); + return (m_map[word] & (1UL << bit)); } diff --git a/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result b/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result index 47f7bb923ba..01fa9dac7fd 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/corrupted_data_reads_debug.result @@ -20,7 +20,7 @@ set @tmp1=@@rocksdb_verify_row_debug_checksums; set rocksdb_verify_row_debug_checksums=1; set session debug_dbug= "+d,myrocks_simulate_bad_row_read1"; select * from t1 where pk=1; -ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB +ERROR HY000: Got error 203 'Found data corruption.' from ROCKSDB set session debug_dbug= "-d,myrocks_simulate_bad_row_read1"; set rocksdb_verify_row_debug_checksums=@tmp1; select * from t1 where pk=1; @@ -28,11 +28,11 @@ pk col1 1 1 set session debug_dbug= "+d,myrocks_simulate_bad_row_read2"; select * from t1 where pk=1; -ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB +ERROR HY000: Got error 203 'Found data corruption.' from ROCKSDB set session debug_dbug= "-d,myrocks_simulate_bad_row_read2"; set session debug_dbug= "+d,myrocks_simulate_bad_row_read3"; select * from t1 where pk=1; -ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB +ERROR HY000: Got error 203 'Found data corruption.' from ROCKSDB set session debug_dbug= "-d,myrocks_simulate_bad_row_read3"; insert into t1 values(4,'0123456789'); select * from t1; @@ -56,7 +56,7 @@ pk col1 ABCD 1 set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1"; select * from t2; -ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB +ERROR HY000: Got error 203 'Found data corruption.' from ROCKSDB set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1"; drop table t2; create table t2 ( @@ -69,6 +69,6 @@ pk col1 ABCD 1 set session debug_dbug= "+d,myrocks_simulate_bad_pk_read1"; select * from t2; -ERROR HY000: Got error 202 'Found data corruption.' from ROCKSDB +ERROR HY000: Got error 203 'Found data corruption.' from ROCKSDB set session debug_dbug= "-d,myrocks_simulate_bad_pk_read1"; drop table t2; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result index d96c40127a8..9de77014593 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/index_merge_rocksdb2.result @@ -63,7 +63,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 ALL i1 NULL NULL NULL # Using where explain select * from t0 where (key1 < 3 or key2 <4) and key3 = 50; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL # Using sort_union(i1,i2); Using where +1 SIMPLE t0 ref i1,i2,i3 i3 4 const # Using where explain select * from t0 use index (i1,i2) where (key1 < 2 or key2 <3) and key3 = 50; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t0 index_merge i1,i2 i1,i2 4,4 NULL # Using sort_union(i1,i2); Using where @@ -121,11 +121,11 @@ id select_type table type possible_keys key key_len ref rows Extra explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 70); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL # Using sort_union(i1,i2); Using where +1 SIMPLE t0 range i1,i2,i3 i3 4 NULL # Using index condition; Using where explain select * from t0 where (key1 < 3 or key2 < 3) and (key3 < 1000); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t0 index_merge i1,i2,i3 i1,i2 4,4 NULL # Using sort_union(i1,i2); Using where +1 SIMPLE t0 range i1,i2,i3 i3 4 NULL # Using index condition; Using where explain select * from t0 where ((key1 < 3 or key2 < 3) and (key2 <4 or key3 < 3)) or @@ -287,7 +287,7 @@ id select_type table type possible_keys key key_len ref rows Extra NULL UNION RESULT <union1,2> ALL NULL NULL NULL NULL NULL explain select * from (select * from t1 where key1 = 3 or key2 =3) as Z where key8 >5; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 index_merge i1,i2,i8 i1,i2 4,4 NULL 4 Using union(i1,i2); Using where +1 SIMPLE t1 range i1,i2,i8 i8 4 NULL 2 Using index condition; Using where create table t3 like t0; insert into t3 select * from t0; alter table t3 add key9 int not null, add index i9(key9); diff --git a/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result b/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result index 95dae68b4e6..90f163b7d4b 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/tbl_opt_data_index_dir.result @@ -1,16 +1,16 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb DATA DIRECTORY = '/foo/bar/data'; -ERROR HY000: Can't create table `test`.`t1` (errno: 198 "Unknown error 198") +ERROR HY000: Can't create table `test`.`t1` (errno: 199 "Unknown error 199") show warnings; Level Code Message -Error 1005 Can't create table `test`.`t1` (errno: 198 "Unknown error 198") -Warning 1296 Got error 198 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB +Error 1005 Can't create table `test`.`t1` (errno: 199 "Unknown error 199") +Warning 1296 Got error 199 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB CREATE TABLE t1 (a INT PRIMARY KEY, b CHAR(8)) ENGINE=rocksdb INDEX DIRECTORY = '/foo/bar/index'; -ERROR HY000: Can't create table `test`.`t1` (errno: 199 "Unknown error 199") +ERROR HY000: Can't create table `test`.`t1` (errno: 200 "Unknown error 200") show warnings; Level Code Message -Error 1005 Can't create table `test`.`t1` (errno: 199 "Unknown error 199") -Warning 1296 Got error 199 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB +Error 1005 Can't create table `test`.`t1` (errno: 200 "Unknown error 200") +Warning 1296 Got error 200 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB CREATE TABLE t1 (id INT NOT NULL PRIMARY KEY) ENGINE=rocksdb PARTITION BY RANGE (id) ( PARTITION P0 VALUES LESS THAN (1000) @@ -19,11 +19,11 @@ PARTITION P1 VALUES LESS THAN (2000) DATA DIRECTORY = '/foo/bar/data/', PARTITION P2 VALUES LESS THAN (MAXVALUE) ); -ERROR HY000: Can't create table `test`.`t1` (errno: 198 "Unknown error 198") +ERROR HY000: Can't create table `test`.`t1` (errno: 199 "Unknown error 199") show warnings; Level Code Message -Error 1005 Can't create table `test`.`t1` (errno: 198 "Unknown error 198") -Warning 1296 Got error 198 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB +Error 1005 Can't create table `test`.`t1` (errno: 199 "Unknown error 199") +Warning 1296 Got error 199 'Specifying DATA DIRECTORY for an individual table is not supported.' from ROCKSDB Error 6 Error on delete of './test/t1.par' (Errcode: 2 "No such file or directory") CREATE TABLE t1 (id int not null primary key) ENGINE=rocksdb PARTITION BY RANGE (id) ( @@ -33,9 +33,9 @@ PARTITION P1 VALUES LESS THAN (2000) INDEX DIRECTORY = '/foo/bar/data/', PARTITION P2 VALUES LESS THAN (MAXVALUE) ); -ERROR HY000: Can't create table `test`.`t1` (errno: 199 "Unknown error 199") +ERROR HY000: Can't create table `test`.`t1` (errno: 200 "Unknown error 200") show warnings; Level Code Message -Error 1005 Can't create table `test`.`t1` (errno: 199 "Unknown error 199") -Warning 1296 Got error 199 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB +Error 1005 Can't create table `test`.`t1` (errno: 200 "Unknown error 200") +Warning 1296 Got error 200 'Specifying INDEX DIRECTORY for an individual table is not supported.' from ROCKSDB Error 6 Error on delete of './test/t1.par' (Errcode: 2 "No such file or directory") |