From 21eed902f3415956cb3d5a4153459acc2e299402 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Fri, 14 Jun 2019 21:23:53 +0300 Subject: [PATCH 01/14] Updated list of unstable tests for 10.2.25 --- mysql-test/unstable-tests | 152 +++++++++++++++++++------------------- 1 file changed, 78 insertions(+), 74 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 18fb5cae559..9003dd2814c 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -24,21 +24,18 @@ ############################################################################## ############################################################################## -# Based on 10.2 1214674b712d855d7cd04f4daedb9a16c24fc63b +# Based on 10.2 b40c2d2c512ee947625f85e893089b4cac1da970 main.alter_table_trans : MDEV-12084 - timeout -main.analyze_stmt : Modified in 10.2.23 main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 main.bootstrap : Modified in 10.2.24 -main.check_constraint : Modified in 10.2.23 main.connect : MDEV-17282 - Wrong result main.connect2 : MDEV-13885 - Server crash main.constraints : Modified in 10.2.24 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result -main.create_drop_role : Modified in 10.2.23 main.cte_nonrecursive : Modified in 10.2.24 main.ctype_big5 : Modified in 10.2.24 main.ctype_euckr : Modified in 10.2.24 @@ -57,6 +54,7 @@ main.ctype_utf16le : Modified in 10.2.24 main.ctype_utf32 : Modified in 10.2.24 main.ctype_utf32_uca : Modified in 10.2.24 main.ctype_utf8 : Modified in 10.2.24 +main.ctype_utf8_def_upgrade : Added in 10.2.25 main.ctype_utf8mb4 : Modified in 10.2.24 main.ctype_utf8mb4_heap : Modified in 10.2.24 main.ctype_utf8mb4_innodb : Modified in 10.2.24 @@ -64,8 +62,10 @@ main.ctype_utf8mb4_myisam : Modified in 10.2.24 main.ddl_i18n_koi8r : Modified in 10.2.24 main.ddl_i18n_utf8 : Modified in 10.2.24 main.debug_sync : MDEV-10607 - internal error -main.derived_cond_pushdown : Modified in 10.2.23 +main.derived : Modified in 10.2.25 +main.derived_cond_pushdown : Modified in 10.2.25 main.derived_opt : MDEV-11768 - timeout +main.derived_view : Modified in 10.2.25 main.dirty_close : MDEV-19368 - mysqltest failed but provided no output main.distinct : MDEV-14194 - Crash main.drop_bad_db_type : MDEV-15676 - Wrong result @@ -77,12 +77,9 @@ main.events_slowlog : MDEV-12821 - Wrong result main.flush : MDEV-19368 - mysqltest failed but provided no output main.func_gconcat : Modified in 10.2.24 main.func_hybrid_type : Modified in 10.2.24 -main.func_json : Modified in 10.2.23 -main.func_math : Modified in 10.2.23 +main.func_json : Modified in 10.2.25 main.func_str : Modified in 10.2.24 -main.func_time : Modified in 10.2.23 main.gis : MDEV-13411 - wrong result on P8; modified in 10.2.24 -main.gis-loaddata : Added in 10.2.23 main.gis_notembedded : Added in 10.2.24 main.gis-precise : Modified in 10.2.24 main.grant4 : Modified in 10.2.24 @@ -92,27 +89,28 @@ main.index_merge_innodb : MDEV-7142 - Plan mismatch; modified in 10.2 main.index_merge_myisam : Modified in 10.2.24 main.information_schema_prepare : Added in 10.2.24 main.innodb_mysql_lock : MDEV-7861 - Wrong result +main.join_cache : Modified in 10.2.25 +main.join_nested : Modified in 10.2.25 +main.join_outer : Modified in 10.2.25 main.kill-2 : MDEV-13257 - Wrong result main.kill_processlist-6619 : MDEV-10793 - Wrong result -main.loaddata : Modified in 10.2.23 -main.loadxml : Modified in 10.2.23 -main.log_slow : MDEV-13263 - Wrong result; modified in 10.2.23 -main.log_slow_debug : Added in 10.2.23 +main.loaddata : MDEV-19368 - mysqltest failed but provided no output +main.log_slow : MDEV-13263 - Wrong result main.log_tables-big : MDEV-13408 - wrong result main.mdev_19276 : Added in 10.2.24 main.mdev-504 : MDEV-15171 - warning main.mdev375 : MDEV-10607 - sporadic "can't connect" main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update : Modified in 10.2.24 -main.multi_update_innodb : Modified in 10.2.24 +main.multi_update : Modified in 10.2.25 +main.multi_update_debug : Added in 10.2.25 +main.multi_update_innodb : Modified in 10.2.25 main.mysql : Modified in 10.2.24 main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2 main.mysql_client_test_comp : MDEV-16641 - Error in exec main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed main.mysql_upgrade_noengine : MDEV-14355 - Wrong result main.mysql_upgrade_ssl : MDEV-13492 - Unknown SSL error -main.mysqld--help : Modified in 10.2.23 -main.mysqldump : MDEV-14800 - Stack smashing detected +main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.2.25 main.mysqldump-compat : Modified in 10.2.24 main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug main.mysqlslap : MDEV-11801 - timeout @@ -123,13 +121,11 @@ main.openssl_1 : MDEV-13492 - Unknown SSL error main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 main.order_by : Modified in 10.2.24 main.order_by_optimizer_innodb : MDEV-10683 - Wrong result -main.partition : Modified in 10.2.23 main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock main.partition_innodb : Modified in 10.2.24 main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1 main.ps : MDEV-11017 - Wrong result; modified in 10.2.24 -main.reopen_temp_table : Modified in 10.2.23 main.query_cache : MDEV-16180 - Wrong result main.query_cache_debug : MDEV-15281 - Query cache is disabled main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away @@ -138,45 +134,41 @@ main.set_statement_notembedded : MDEV-19414 - Wrong result main.shm : MDEV-12727 - Mismatch, ERROR 2013 main.show_check : Modified in 10.2.24 main.show_explain : MDEV-10674 - Wrong result code -main.show_explain_ps : Modified in 10.2.23 main.sp : MDEV-7866 - Mismatch; modified in 10.2.24 -main.sp_notembedded : MDEV-10607 - internal error; modified in 10.2.23 +main.sp_notembedded : MDEV-10607 - internal error main.sp-security : MDEV-10607 - sporadic "can't connect" -main.sp_trans : Modified in 10.2.23 -main.sp-ucs2 : Modified in 10.2.23 main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_ca : MDEV-10895 - SSL connection error on Power main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 main.ssl_connect : MDEV-13492 - Unknown SSL error -main.ssl_crl : MDEV-19119 - Wrong error code; modified in 10.2.23 -main.ssl_crl_clients : Modified in 10.2.23 +main.ssl_crl : MDEV-19119 - Wrong error code main.ssl_timeout : MDEV-11244 - Crash main.ssl_verify_ip : Added in 10.2.24 -main.stat_tables : Modified in 10.2.24 +main.stat_tables : Modified in 10.2.25 main.stat_tables_par : MDEV-13266 - Wrong result main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding main.statistics : Modified in 10.2.24 main.status : MDEV-13255 - Wrong result main.status2 : Modified in 10.2.24 main.subselect_innodb : MDEV-10614 - Sporadic wrong results -main.subselect_sj : Modified in 10.2.23 -main.subselect_sj_mat : Modified in 10.2.23 +main.subselect_no_semijoin : Modified in 10.2.25 +main.subselect_sj : Modified in 10.2.25 +main.subselect_sj_mat : Modified in 10.2.25 main.tc_heuristic_recover : MDEV-14189 - Wrong result +main.temp_table : Modified in 10.2.25 main.timezone2 : Modified in 10.2.24 main.trigger : Modified in 10.2.24 +main.trigger_null-8605 : Modified in 10.2.25 main.type_bit : Modified in 10.2.24 main.type_blob : MDEV-15195 - Wrong result; modified in 10.2.24 main.type_date : Modified in 10.2.24 main.type_datetime_hires : MDEV-10687 - Timeout main.type_decimal : Modified in 10.2.24 -main.type_year : Modified in 10.2.23 -main.update : Modified in 10.2.23 main.update_innodb : Modified in 10.2.24 -main.userstat : MDEV-12904 - SSL errors; modified in 10.2.23 -main.view : Modified in 10.2.23 +main.userstat : MDEV-12904 - SSL errors main.view_grant : Modified in 10.2.24 main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query -main.win : Modified in 10.2.24 +main.win : Modified in 10.2.25 main.xa : MDEV-11769 - lock wait timeout #---------------------------------------------------------------- @@ -194,9 +186,11 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed binlog.binlog_commit_wait : MDEV-10150 - Mismatch binlog.binlog_innodb_stm : Added in 10.2.24 binlog.binlog_killed : MDEV-12925 - Wrong result +binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown binlog.binlog_mysqlbinlog2 : Modified in 10.2.24 binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint binlog.flashback : Modified in 10.2.24 +binlog.flashback-largebinlog : MDEV-19764 - Out of memory; added in 10.2.25 binlog.load_data_stm_view : MDEV-16948 - Wrong result #---------------------------------------------------------------- @@ -222,12 +216,12 @@ binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL serv connect.pivot : MDEV-14803 - Failed to discover table connect.vcol : MDEV-12374 - Fails on Windows -connect.xml : MDEV-19409 - Result length mismatch connect.zip : MDEV-13884 - Wrong result #---------------------------------------------------------------- -encryption.corrupted_during_recovery : Added in 10.2.24 +encryption.compressed_import_tablespace : Added in 10.2.25 +encryption.corrupted_during_recovery : Modified in 10.2.25 encryption.create_or_replace : MDEV-12694 - Timeout; MDEV-16115 - Trying to access tablespace encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result @@ -237,23 +231,22 @@ encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect th encryption.innodb-checksum-algorithm : MDEV-12898 - Deadlock of threads; MDEV-16896 - Server crash encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate; modified in 10.2.24 encryption.innodb-discard-import : MDEV-19113 - Timeout -encryption.innodb_encrypt_key_rotation_age : Added in 10.2.24 +encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout; added in 10.2.24 encryption.innodb_encrypt_log : MDEV-13725 - Wrong result encryption.innodb_encryption : MDEV-15675 - Timeout -encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout; modified in 10.2.23 +encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout encryption.innodb-encryption-disable : Modified in 10.2.24 encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result encryption.innodb_encryption-page-compression : MDEV-12630 - crash or assertion failure encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash encryption.innodb_first_page : MDEV-10689 - Crash encryption.innodb-first-page-read : MDEV-14356 - Timeout in wait condition -encryption.innodb-force-corrupt : MDEV-17286 - SSL error; modified in 10.2.24 +encryption.innodb-force-corrupt : MDEV-17286 - SSL error; modified in 10.2.25 encryption.innodb-key-rotation-disable : Modified in 10.2.24 encryption.innodb-missing-key : Modified in 10.2.24 encryption.innodb_onlinealter_encryption : MDEV-17287 - SIGABRT on server restart encryption.innodb-page_encryption : MDEV-10641 - mutex problem encryption.innodb-read-only : MDEV-16563 - Crash on startup -encryption.innodb-redo-badkey : MDEV-13893 - Page cannot be decrypted encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing @@ -297,29 +290,27 @@ gcol.gcol_rollback : MDEV-16954 - Unknown storage engine 'Inno gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion; modified in 10.2.24 gcol.innodb_virtual_debug : Modified in 10.2.24 gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result +gcol.innodb_virtual_purge : Modified in 10.2.25 #---------------------------------------------------------------- innodb.101_compatibility : MDEV-13891 - Wrong result innodb.alter_copy : MDEV-16181 - Assertion failure -innodb.alter_crash : MDEV-16944 - The process cannot access the file; modified in 10.2.23 +innodb.alter_crash : MDEV-16944 - The process cannot access the file innodb.alter_kill : Modified in 10.2.24 -innodb.alter_table : Modified in 10.2.23 innodb.autoinc_persist : MDEV-15282 - Assertion failure innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.corrupted_during_recovery : Added in 10.2.24 -innodb.doublewrite : MDEV-12905 - Server crash; modified in 10.2.23 +innodb.corrupted_during_recovery : Modified in 10.2.25 +innodb.doublewrite : MDEV-12905 - Server crash innodb.drop_table_background : Modified in 10.2.24 innodb.foreign_key : Modified in 10.2.24 -innodb.foreign-keys : Modified in 10.2.23 +innodb.foreign-keys : Modified in 10.2.25 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure innodb.ibuf_not_empty : MDEV-19021 - Wrong result -innodb.innodb : MDEV-19408 - Assertion failure innodb.innodb-32k-crash : MDEV-16953 - Corrupt log record found -innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup +innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup; modified in 10.2.25 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS -innodb.innodb-alter-nullable : Modified in 10.2.23 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout innodb.innodb-alter-tempfile : MDEV-15285 - Table already exists innodb.innodb-blob : MDEV-12053 - Client crash @@ -330,13 +321,14 @@ innodb.innodb_bug48024 : MDEV-14352 - Assertion failure innodb.innodb_bug59641 : MDEV-13830 - Assertion failure innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to start innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query -innodb.innodb-corrupted-table : Modified in 10.2.23 innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown +innodb.innodb_force_recovery : Modified in 10.2.25 innodb.innodb-get-fk : MDEV-13276 - Server crash innodb.innodb-index : Modified in 10.2.24 innodb.innodb-index-online : MDEV-14809 - Cannot save statistics innodb.innodb_information_schema : MDEV-8851 - Wrong result +innodb.leaf_page_corrupted_during_recovery : Added in 10.2.25 innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result innodb.innodb_monitor : MDEV-10939 - Testcase timeout @@ -353,15 +345,14 @@ innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find innodb.log_alter_table : Modified in 10.2.24 innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start -innodb.log_file_name : MDEV-14193 - Exception; modified in 10.2.23 +innodb.log_file_name : MDEV-14193 - Exception innodb.log_file_size : MDEV-15668 - Not found pattern -innodb.monitor : MDEV-16179 - Wrong result +innodb.monitor : MDEV-16179 - Wrong result; modified in 10.2.25 innodb.page_reorganize : Added in 10.2.24 innodb.purge_secondary : MDEV-15681 - Wrong result innodb.purge_thread_shutdown : MDEV-13792 - Wrong result innodb.read_only_recovery : MDEV-13886 - Server crash -innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile; modified in 10.2.23 -innodb.restart : Modified in 10.2.23 +innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace innodb.table_definition_cache_debug : MDEV-14206 - Extra warning innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start @@ -369,31 +360,25 @@ innodb.temp_table_savepoint : MDEV-16182 - Wrong result innodb.temporary_table : MDEV-13265 - Wrong result innodb.update_time : MDEV-14804 - Wrong result innodb.undo_truncate : MDEV-17340 - Server hung -innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away; modified in 10.2.23 -innodb.xa_debug : MDEV-19408 - Assertion failure; added in 10.2.24 +innodb.undo_truncate_recover : MDEV-17679 - MySQL server has gone away +innodb.xa_debug : MDEV-19408 - Added in 10.2.24 innodb.xa_recovery : MDEV-15279 - mysqld got exception -innodb_fts.fulltext3 : Modified in 10.2.23 +innodb_fts.innodb_ft_aux_table : Added in 10.2.25 innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed innodb_fts.sync : MDEV-14808 - Wrong result -innodb_fts.sync_ddl : MDEV-17296 - Assertion failure innodb_gis.kill_server : MDEV-16941 - Checksum mismatch -innodb_gis.multi_pk : MDEV-13942 - AddressSanitizer: use-after-poison -innodb_gis.rtree_compress : MDEV-13942 - AddressSanitizer: use-after-poison -innodb_gis.rtree_compress2 : MDEV-13942 - AddressSanitizer: use-after-poison +innodb_gis.rtree_add_index : Added in 10.2.25 innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded -innodb_gis.rtree_debug : MDEV-13942 - AddressSanitizer: use-after-poison innodb_gis.rtree_purge : MDEV-15275 - Timeout innodb_gis.rtree_recovery : MDEV-15274 - Error on check -innodb_gis.rtree_rollback1 : MDEV-13942 - AddressSanitizer: use-after-poison innodb_gis.rtree_split : MDEV-14208 - Too many arguments innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed -innodb_gis.update_root : MDEV-13942 - AddressSanitizer: use-after-poison innodb_zip.cmp_per_index : MDEV-14490 - Table is marked as crashed innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings @@ -407,7 +392,6 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error maria.insert_select : MDEV-12757 - Timeout maria.insert_select-7314 : MDEV-16492 - Timeout maria.maria : MDEV-14430 - Extra warning -maria.maria-recovery : Modified in 10.2.23 #---------------------------------------------------------------- @@ -423,10 +407,8 @@ mariabackup.full_backup : MDEV-16571 - Wrong result mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future mariabackup.incremental_backup : MDEV-14192 - Assertion failure mariabackup.incremental_encrypted : MDEV-15667 - Timeout; MDEV-14192 - Assertion failure -mariabackup.incremental_rocksdb : Added in 10.2.23 mariabackup.innodb_log_optimize_ddl : MDEV-14192 - Assertion failure mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.page_compression_level : Added in 10.2.23 mariabackup.partial_exclude : MDEV-15270 - Error on exec mariabackup.rename_during_backup : MDEV-14192 - Assertion failure mariabackup.xbstream : MDEV-14192 - Crash @@ -440,7 +422,6 @@ mroonga/storage.column_datetime_32bit_2038 : Wrong resul mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha mroonga/storage.column_datetime_32bit_out_of_range : Wrong result on Alpha -mroonga/storage.column_generated_stored_add_column : Modified in 10.2.23 mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - Valgrind @@ -463,7 +444,6 @@ multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_ parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired parts.partition_auto_increment_maria : MDEV-14430 - Extra warning -parts.partition_auto_increment_max : Added in 10.2.23 parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind @@ -499,6 +479,7 @@ perfschema_stress.* : MDEV-10996 - Not maintained #---------------------------------------------------------------- +plugins.feedback_plugin_load : Modified in 10.2.25 plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such plugins.pam : Modified in 10.2.24 plugins.processlist : MDEV-16574 - Wrong result @@ -519,8 +500,29 @@ rocksdb.drop_index_inplace : MDEV-14162 - Crash on shutdown rocksdb.drop_table : MDEV-14308 - Timeout rocksdb.drop_table3 : MDEV-16949 - Server crash rocksdb.dup_key_update : MDEV-17284 - Wrong result -rocksdb.locking_issues : MDEV-14464 - Wrong result +rocksdb.locking_issues : MDEV-14464 - Wrong result; modified in 10.2.25 +rocksdb.locking_issues_case1_1_rc : Added in 10.2.25 +rocksdb.locking_issues_case1_1_rr : Added in 10.2.25 +rocksdb.locking_issues_case1_2_rc : Added in 10.2.25 +rocksdb.locking_issues_case1_2_rr : Added in 10.2.25 +rocksdb.locking_issues_case2_rc : Added in 10.2.25 +rocksdb.locking_issues_case2_rc_lsr : Added in 10.2.25 +rocksdb.locking_issues_case2_rr : Added in 10.2.25 +rocksdb.locking_issues_case2_rr_lsr : Added in 10.2.25 +rocksdb.locking_issues_case3_rc : Added in 10.2.25 +rocksdb.locking_issues_case3_rr : Added in 10.2.25 +rocksdb.locking_issues_case4_rc : Added in 10.2.25 +rocksdb.locking_issues_case4_rr : Added in 10.2.25 +rocksdb.locking_issues_case5_rc : Added in 10.2.25 +rocksdb.locking_issues_case5_rr : Added in 10.2.25 +rocksdb.locking_issues_case6_rc : Added in 10.2.25 +rocksdb.locking_issues_case6_rr : Added in 10.2.25 +rocksdb.locking_issues_case7_rc : Added in 10.2.25 +rocksdb.locking_issues_case7_rc_lsr : Added in 10.2.25 +rocksdb.locking_issues_case7_rr : Added in 10.2.25 +rocksdb.locking_issues_case7_rr_lsr : Added in 10.2.25 rocksdb.mariadb_ignore_dirs : MDEV-16639 - Server crash +rocksdb.mariadb_plugin : Modified in 10.2.25 rocksdb.mariadb_port_fixes : MDEV-16387 - Wrong plan rocksdb.max_open_files : MDEV-16639 - Server crash rocksdb.perf_context : MDEV-17285 - Wrong results @@ -554,8 +556,11 @@ rpl.last_insert_id : MDEV-10625 - warnings in error log rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log +rpl.rpl_binlog_dup_entry : Added in 10.2.25 rpl.rpl_binlog_errors : MDEV-12742 - Crash rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master +rpl.rpl_blackhole : Re-enabled in 10.2.25 +rpl.rpl_blackhole_row_annotate : Added in 10.2.25 rpl.rpl_colSize : MDEV-16112 - Server crash rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac rpl.rpl_ddl : MDEV-10417 - Fails on Mips @@ -608,11 +613,13 @@ rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed rpl.rpl_row_index_choice : MDEV-15196 - Slave crash +rpl.rpl_row_mysqlbinlog : Re-enabled in 10.2.25 rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x rpl.rpl_semi_sync : MDEV-11220 - Wrong result rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings +rpl.rpl_semi_sync_skip_repl : Modified in 10.2.25 rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning @@ -633,6 +640,7 @@ rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output rpl.rpl_trigger : MDEV-18055 - Wrong result +rpl.rpl_truncate_3innodb : MDEV-19454 - Sporadic syntax error rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result rpl/extra/rpl_tests.* : MDEV-10994 - Not maintained @@ -672,16 +680,12 @@ stress.ddl_innodb : MDEV-10635 - Testcase timeout sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error -sys_vars.innodb_ft_result_cache_limit_32 : MDEV-19387 - Fails on s390x +sys_vars.innodb_ft_result_cache_limit : Modified in 10.2.25 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion sys_vars.slow_query_log_func : MDEV-14273 - Wrong result -sys_vars.sql_buffer_result_func : Modified in 10.2.23 -sys_vars.sysvars_server_embedded : Include file modified in 10.2.23 -sys_vars.sysvars_server_notembedded : Include file modified in 10.2.23 sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result -sys_vars.thread_stack_basic : Modified in 10.2.23 sys_vars.transaction_prealloc_size_bug27322 : Modified in 10.2.24 sys_vars.wait_timeout_func : MDEV-12896 - Wrong result @@ -746,7 +750,6 @@ vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout vcol.vcol_keys_myisam : Modified in 10.2.24 vcol.vcol_misc : MDEV-16651 - Wrong error message; modified in 10.2.24 -vcol.wrong_arena : Modified in 10.2.23 #---------------------------------------------------------------- @@ -755,4 +758,5 @@ wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use wsrep.variables : MDEV-14311 - Wrong result; MDEV-17585 - Deadlock +wsrep_info.* : Config file modified in 10.2.25 wsrep_info.plugin : MDEV-13569 - No nodes coming from prim view From c02d6164fbdd5effe758a61d9bb709c581fefef1 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Sat, 15 Jun 2019 14:46:25 +0300 Subject: [PATCH 02/14] MDEV-19771 REPLACE on table with virtual_field can cause crash Fixes also MDEV-17837 Problem was that we did not ignore warnings from virtual fields when updated virtual fields for to-be-replaced row. --- mysql-test/suite/vcol/r/vcol_misc.result | 38 +++++++++++++++++++++ mysql-test/suite/vcol/t/vcol_misc.test | 42 +++++++++++++++++++++--- sql/sql_insert.cc | 3 ++ 3 files changed, 79 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 291a954baf6..8716e39eb82 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -423,5 +423,43 @@ ERROR HY000: Incorrect information in file: './test/t1.frm' ALTER TABLE t1; ERROR HY000: Incorrect information in file: './test/t1.frm' # +# MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status() + +create or replace table t1 (pk int primary key, col_bit bit(15) default null, +vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL); +replace INTO `t1` (`pk`,col_bit) VALUES (99,1000); +select pk, col_bit+0, vcol_bit+0 from t1; +pk col_bit+0 vcol_bit+0 +99 1000 1000 +replace INTO `t1` (`pk`,col_bit) VALUES (99,10000); +select pk, col_bit+0, vcol_bit+0 from t1; +pk col_bit+0 vcol_bit+0 +99 10000 1023 +REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99); +Warnings: +Warning 1264 Out of range value for column 'vcol_bit' at row 1 +drop table t1; +# +# MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status() +# +SET @old_sql_mode=@@sql_mode; +SET sql_mode= STRICT_ALL_TABLES; +CREATE TABLE t1 ( +pk INT, +i TINYINT, +vi TINYINT AS (i+1) PERSISTENT, +PRIMARY KEY(pk) +); +INSERT INTO t1 (pk,i) VALUES (1,1); +TRUNCATE TABLE t1; +INSERT IGNORE INTO t1 (pk,i) VALUES (1,127); +Warnings: +Warning 1264 Out of range value for column 'vi' at row 1 +REPLACE INTO t1 (pk,i) VALUES (1,2); +Warnings: +Warning 1264 Out of range value for column 'vi' at row 1 +DROP TABLE t1; +SET @sql_mode=@old_sql_mode; +# # End of 10.2 tests # diff --git a/mysql-test/suite/vcol/t/vcol_misc.test b/mysql-test/suite/vcol/t/vcol_misc.test index 255621845fb..1de2827efe6 100644 --- a/mysql-test/suite/vcol/t/vcol_misc.test +++ b/mysql-test/suite/vcol/t/vcol_misc.test @@ -215,12 +215,12 @@ drop table t1; create table t1 (a int, b int); insert into t1 values (3, 30), (4, 20), (1, 20); create table t2 (c int, d int, v int as (d+1), index idx(c)); -insert into t2(c,d) values +insert into t2(c,d) values (20, 100), (20, 300), (30, 100), (30, 200), (40, 500), - (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); -insert into t2(c,d) values + (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); +insert into t2(c,d) values (120, 100), (150, 300), (130, 100), (130, 200), (140, 500), - (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); + (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); set join_cache_level=6; explain @@ -391,6 +391,40 @@ SHOW CREATE TABLE t1; ALTER TABLE t1; --remove_file $MYSQLD_DATADIR/test/t1.frm +--echo # +--echo # MDEV-19771 REPLACE on table with virtual_field can cause crash in set_ok_status() +--echo + +create or replace table t1 (pk int primary key, col_bit bit(15) default null, + vcol_bit bit(10) GENERATED ALWAYS AS (`col_bit`) VIRTUAL); +replace INTO `t1` (`pk`,col_bit) VALUES (99,1000); +select pk, col_bit+0, vcol_bit+0 from t1; +replace INTO `t1` (`pk`,col_bit) VALUES (99,10000); +select pk, col_bit+0, vcol_bit+0 from t1; +REPLACE LOW_PRIORITY INTO `t1` (`pk`) VALUES (99); +drop table t1; + +--echo # +--echo # MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status() +--echo # + +SET @old_sql_mode=@@sql_mode; +SET sql_mode= STRICT_ALL_TABLES; + +CREATE TABLE t1 ( + pk INT, + i TINYINT, + vi TINYINT AS (i+1) PERSISTENT, + PRIMARY KEY(pk) +); + +INSERT INTO t1 (pk,i) VALUES (1,1); +TRUNCATE TABLE t1; +INSERT IGNORE INTO t1 (pk,i) VALUES (1,127); +REPLACE INTO t1 (pk,i) VALUES (1,2); +DROP TABLE t1; +SET @sql_mode=@old_sql_mode; + --echo # --echo # End of 10.2 tests --echo # diff --git a/sql/sql_insert.cc b/sql/sql_insert.cc index 2502be7e454..e2e7454803b 100644 --- a/sql/sql_insert.cc +++ b/sql/sql_insert.cc @@ -1747,12 +1747,15 @@ int write_record(THD *thd, TABLE *table,COPY_INFO *info) } if (table->vfield) { + my_bool abort_on_warning= thd->abort_on_warning; /* We have not yet called update_virtual_fields(VOL_UPDATE_FOR_READ) in handler methods for the just read row in record[1]. */ table->move_fields(table->field, table->record[1], table->record[0]); + thd->abort_on_warning= 0; table->update_virtual_fields(table->file, VCOL_UPDATE_FOR_REPLACE); + thd->abort_on_warning= abort_on_warning; table->move_fields(table->field, table->record[0], table->record[1]); } if (info->handle_duplicates == DUP_UPDATE) From 9dd72bbfb078fbd31676eb8685065b9ef2d72c18 Mon Sep 17 00:00:00 2001 From: Daniel Bartholomew Date: Sat, 15 Jun 2019 16:54:02 -0400 Subject: [PATCH 03/14] bump the VERSION --- VERSION | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/VERSION b/VERSION index 2143ac61009..748fcaa7c2b 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=2 -MYSQL_VERSION_PATCH=25 +MYSQL_VERSION_PATCH=26 From 2b0eb352b3850666950df03ccc5559e06bb646e6 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sun, 16 Jun 2019 12:12:00 +0300 Subject: [PATCH 04/14] Trivial test result update after fix for MDEV-19771 --- mysql-test/suite/vcol/r/vcol_misc.result | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mysql-test/suite/vcol/r/vcol_misc.result b/mysql-test/suite/vcol/r/vcol_misc.result index 8716e39eb82..d0fa2415b77 100644 --- a/mysql-test/suite/vcol/r/vcol_misc.result +++ b/mysql-test/suite/vcol/r/vcol_misc.result @@ -203,10 +203,10 @@ drop table t1; create table t1 (a int, b int); insert into t1 values (3, 30), (4, 20), (1, 20); create table t2 (c int, d int, v int as (d+1), index idx(c)); -insert into t2(c,d) values +insert into t2(c,d) values (20, 100), (20, 300), (30, 100), (30, 200), (40, 500), (70, 100), (40, 300), (60, 100), (40, 100), (70, 100); -insert into t2(c,d) values +insert into t2(c,d) values (120, 100), (150, 300), (130, 100), (130, 200), (140, 500), (170, 100), (180, 300), (160, 100), (40, 100), (170, 100); set join_cache_level=6; @@ -441,10 +441,10 @@ Warning 1264 Out of range value for column 'vcol_bit' at row 1 drop table t1; # # MDEV-17837 REPLACE on table with virtual_field can cause crash in set_ok_status() -# +# SET @old_sql_mode=@@sql_mode; SET sql_mode= STRICT_ALL_TABLES; -CREATE TABLE t1 ( +CREATE TABLE t1 ( pk INT, i TINYINT, vi TINYINT AS (i+1) PERSISTENT, From 93c84cc8f24d80a74919d1609d73cb97502fd885 Mon Sep 17 00:00:00 2001 From: Sergei Petrunia Date: Sat, 15 Jun 2019 19:55:57 +0300 Subject: [PATCH 05/14] MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. --- storage/rocksdb/ha_rocksdb.cc | 53 ++++++++++++++----- storage/rocksdb/ha_rocksdb.h | 26 +-------- .../rocksdb/r/mariadb_misc_binlog.result | 11 +++- .../mysql-test/rocksdb/r/rpl_statement.result | 4 +- .../rocksdb/t/mariadb_misc_binlog.test | 12 ++++- .../mysql-test/rocksdb/t/rpl_statement.test | 4 +- 6 files changed, 65 insertions(+), 45 deletions(-) diff --git a/storage/rocksdb/ha_rocksdb.cc b/storage/rocksdb/ha_rocksdb.cc index 3331b94c62c..cb289fb0077 100644 --- a/storage/rocksdb/ha_rocksdb.cc +++ b/storage/rocksdb/ha_rocksdb.cc @@ -11025,6 +11025,41 @@ void ha_rocksdb::read_thd_vars(THD *const thd) { m_checksums_pct = THDVAR(thd, checksums_pct); } +ulonglong ha_rocksdb::table_flags() const +{ + DBUG_ENTER_FUNC(); + + /* + HA_BINLOG_STMT_CAPABLE + Upstream: MyRocks advertises itself as it supports SBR, but has additional + checks in ha_rocksdb::external_lock()/ start_stmt() which will return an + error if one tries to run the statement. + Exceptions: @@rocksdb_unsafe_for_binlog or we are an SQL slave thread. + + MariaDB: Inform the upper layer we don't support SBR, so it switches to RBR + if possible. The exceptions are the same as with the upstream. + + HA_REC_NOT_IN_SEQ + If we don't set it, filesort crashes, because it assumes rowids are + 1..8 byte numbers + HA_PRIMARY_KEY_IN_READ_INDEX + This flag is always set, even for tables that: + - have no PK + - have some (or all) of PK that can't be decoded from the secondary + index. + */ + THD *thd= ha_thd(); + DBUG_RETURN(HA_BINLOG_ROW_CAPABLE | + ((thd && (THDVAR(thd, unsafe_for_binlog) ||thd->rgi_slave))? + HA_BINLOG_STMT_CAPABLE : 0) | + HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS | + HA_PRIMARY_KEY_IN_READ_INDEX | + HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | + HA_PARTIAL_COLUMN_READ | + HA_TABLE_SCAN_ON_INDEX); +} + + /** @return @@ -11037,6 +11072,9 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { DBUG_ASSERT(thd != nullptr); int res = HA_EXIT_SUCCESS; +#if 0 + // MariaDB uses a different way to implement this, see ha_rocksdb::table_flags + int binlog_format = my_core::thd_binlog_format(thd); bool unsafe_for_binlog = THDVAR(ha_thd(), unsafe_for_binlog); @@ -11065,6 +11103,7 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { my_error(ER_REQUIRE_ROW_BINLOG_FORMAT, MYF(0)); DBUG_RETURN(HA_ERR_UNSUPPORTED); } +#endif if (lock_type == F_UNLCK) { Rdb_transaction *const tx = get_tx_from_thd(thd); @@ -11167,20 +11206,6 @@ int ha_rocksdb::external_lock(THD *const thd, int lock_type) { int ha_rocksdb::start_stmt(THD *const thd, thr_lock_type lock_type) { DBUG_ENTER_FUNC(); - /* - MariaDB: the following is a copy of the check in ha_rocksdb::external_lock: - */ - int binlog_format = my_core::thd_binlog_format(thd); - bool unsafe_for_binlog = THDVAR(ha_thd(), unsafe_for_binlog); - if (lock_type >= TL_WRITE_ALLOW_WRITE && - !thd->rgi_slave && !unsafe_for_binlog && - binlog_format != BINLOG_FORMAT_ROW && - binlog_format != BINLOG_FORMAT_UNSPEC && - my_core::thd_binlog_filter_ok(thd)) { - my_error(ER_REQUIRE_ROW_BINLOG_FORMAT, MYF(0)); - DBUG_RETURN(HA_ERR_UNSUPPORTED); - } - DBUG_ASSERT(thd != nullptr); Rdb_transaction *const tx = get_or_create_tx(thd); diff --git a/storage/rocksdb/ha_rocksdb.h b/storage/rocksdb/ha_rocksdb.h index aae823fe4e1..a48d745fcf2 100644 --- a/storage/rocksdb/ha_rocksdb.h +++ b/storage/rocksdb/ha_rocksdb.h @@ -863,31 +863,7 @@ public: This is a list of flags that indicate what functionality the storage engine implements. The current table flags are documented in handler.h */ - ulonglong table_flags() const override { - DBUG_ENTER_FUNC(); - - /* - HA_BINLOG_STMT_CAPABLE - We are saying that this engine is just statement capable to have - an engine that can only handle statement-based logging. This is - used in testing. - HA_REC_NOT_IN_SEQ - If we don't set it, filesort crashes, because it assumes rowids are - 1..8 byte numbers - HA_PRIMARY_KEY_IN_READ_INDEX - This flag is always set, even for tables that: - - have no PK - - have some (or all) of PK that can't be decoded from the secondary - index. - */ - DBUG_RETURN(HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE | - HA_REC_NOT_IN_SEQ | HA_CAN_INDEX_BLOBS | - HA_PRIMARY_KEY_IN_READ_INDEX | - HA_PRIMARY_KEY_REQUIRED_FOR_POSITION | HA_NULL_IN_KEY | - HA_PARTIAL_COLUMN_READ | - HA_TABLE_SCAN_ON_INDEX); - } - + ulonglong table_flags() const override ; private: bool init_with_fields(); /* no 'override' in MariaDB */ public: diff --git a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result index e4ac62aa481..c37ab9461af 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/mariadb_misc_binlog.result @@ -18,7 +18,16 @@ set @tmp_bf= @@binlog_format; set binlog_format='STATEMENT'; lock tables t1 write; insert into t1 values(1); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. unlock tables; set @@binlog_format=@tmp_bf; drop table t1; +# +# MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. +# +set @tmp_bf= @@binlog_format; +set binlog_format='MIXED'; +create table t1 (pk int primary key) engine=rocksdb; +insert into t1 values (1); +drop table t1; +set @@binlog_format=@tmp_bf; diff --git a/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result b/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result index cdf0c37e339..df1a60519db 100644 --- a/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result +++ b/storage/rocksdb/mysql-test/rocksdb/r/rpl_statement.result @@ -8,7 +8,7 @@ select @@binlog_format; STATEMENT create table t1 (pk int primary key) engine=rocksdb; insert into t1 values (1),(2),(3); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. set session rocksdb_unsafe_for_binlog=on; insert into t1 values (1),(2),(3); select * from t1; @@ -19,7 +19,7 @@ pk delete from t1; set session rocksdb_unsafe_for_binlog=off; insert into t1 values (1),(2),(3); -ERROR HY000: Can't execute updates on master with binlog_format != ROW. +ERROR HY000: Cannot execute statement: impossible to write to binary log since BINLOG_FORMAT = STATEMENT and at least one table uses a storage engine limited to row-based logging. set binlog_format=row; insert into t1 values (1),(2),(3); include/sync_slave_sql_with_master.inc diff --git a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test index fb150f7a791..e32679e88a2 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/mariadb_misc_binlog.test @@ -21,10 +21,20 @@ unlock tables; set @tmp_bf= @@binlog_format; set binlog_format='STATEMENT'; lock tables t1 write; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values(1); unlock tables; set @@binlog_format=@tmp_bf; drop table t1; +--echo # +--echo # MDEV-17045: MyRocks tables cannot be updated when binlog_format=MIXED. +--echo # +set @tmp_bf= @@binlog_format; +set binlog_format='MIXED'; +create table t1 (pk int primary key) engine=rocksdb; +insert into t1 values (1); +drop table t1; +set @@binlog_format=@tmp_bf; + diff --git a/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test b/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test index 29671308e9c..cb5f5e04b00 100644 --- a/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test +++ b/storage/rocksdb/mysql-test/rocksdb/t/rpl_statement.test @@ -12,7 +12,7 @@ connection master; select @@binlog_format; create table t1 (pk int primary key) engine=rocksdb; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values (1),(2),(3); set session rocksdb_unsafe_for_binlog=on; @@ -21,7 +21,7 @@ select * from t1; delete from t1; set session rocksdb_unsafe_for_binlog=off; ---error ER_REQUIRE_ROW_BINLOG_FORMAT +--error ER_BINLOG_STMT_MODE_AND_ROW_ENGINE insert into t1 values (1),(2),(3); set binlog_format=row; From e9795d0208cd821e2aaef14681556a6e656f551f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sun, 16 Jun 2019 15:38:05 +0300 Subject: [PATCH 06/14] Add mtr_buf_t::for_each_block_in_reverse() const Avoid unnecessary creation of named objects for invoking mtr_buf_t::for_each_block_in_reverse(). --- storage/innobase/include/dyn0buf.h | 19 ++++++ storage/innobase/mtr/mtr0mtr.cc | 104 ++++++++++++++++------------- 2 files changed, 75 insertions(+), 48 deletions(-) diff --git a/storage/innobase/include/dyn0buf.h b/storage/innobase/include/dyn0buf.h index c7a5c96cd50..a7a8e1dea1e 100644 --- a/storage/innobase/include/dyn0buf.h +++ b/storage/innobase/include/dyn0buf.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 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 @@ -371,6 +372,24 @@ public: return(true); } + /** + Iterate over all the blocks in reverse and call the iterator + @return false if iteration was terminated. */ + template + bool for_each_block_in_reverse(const Functor& functor) const + { + for (block_t* block = UT_LIST_GET_LAST(m_list); + block != NULL; + block = UT_LIST_GET_PREV(m_node, block)) { + + if (!functor(block)) { + return(false); + } + } + + return(true); + } + /** @return the first block */ block_t* front() diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 6e9136df644..2d6b03c512c 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 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 @@ -37,16 +37,43 @@ Created 11/26/1995 Heikki Tuuri /** Iterate over a memo block in reverse. */ template -struct Iterate { +struct CIterate { + CIterate() : functor() {} - /** Release specific object */ - explicit Iterate(Functor& functor) - : - m_functor(functor) + CIterate(const Functor& functor) : functor(functor) {} + + /** @return false if the functor returns false. */ + bool operator()(mtr_buf_t::block_t* block) const { - /* Do nothing */ + const mtr_memo_slot_t* start = + reinterpret_cast( + block->begin()); + + mtr_memo_slot_t* slot = + reinterpret_cast( + block->end()); + + ut_ad(!(block->used() % sizeof(*slot))); + + while (slot-- != start) { + + if (!functor(slot)) { + return(false); + } + } + + return(true); } + Functor functor; +}; + +template +struct Iterate { + Iterate() : functor() {} + + Iterate(const Functor& functor) : functor(functor) {} + /** @return false if the functor returns false. */ bool operator()(mtr_buf_t::block_t* block) { @@ -62,7 +89,7 @@ struct Iterate { while (slot-- != start) { - if (!m_functor(slot)) { + if (!functor(slot)) { return(false); } } @@ -70,7 +97,7 @@ struct Iterate { return(true); } - Functor& m_functor; + Functor functor; }; /** Find specific object */ @@ -511,12 +538,7 @@ mtr_t::Command::release_resources() /* Currently only used in commit */ ut_ad(m_impl->m_state == MTR_STATE_COMMITTING); -#ifdef UNIV_DEBUG - DebugCheck release; - Iterate iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); -#endif /* UNIV_DEBUG */ + ut_d(m_impl->m_memo.for_each_block_in_reverse(CIterate())); /* Reset the mtr buffers */ m_impl->m_log.erase(); @@ -739,11 +761,10 @@ mtr_t::memo_release(const void* object, ulint type) middle of a mini-transaction. */ ut_ad(!m_impl.m_modifications || type != MTR_MEMO_PAGE_X_FIX); - Find find(object, type); - Iterate iterator(find); + Iterate iteration(Find(object, type)); - if (!m_impl.m_memo.for_each_block_in_reverse(iterator)) { - memo_slot_release(find.m_slot); + if (!m_impl.m_memo.for_each_block_in_reverse(iteration)) { + memo_slot_release(iteration.functor.m_slot); return(true); } @@ -763,11 +784,10 @@ mtr_t::release_page(const void* ptr, mtr_memo_type_t type) middle of a mini-transaction. */ ut_ad(!m_impl.m_modifications || type != MTR_MEMO_PAGE_X_FIX); - FindPage find(ptr, type); - Iterate iterator(find); + Iterate iteration(FindPage(ptr, type)); - if (!m_impl.m_memo.for_each_block_in_reverse(iterator)) { - memo_slot_release(find.get_slot()); + if (!m_impl.m_memo.for_each_block_in_reverse(iteration)) { + memo_slot_release(iteration.functor.get_slot()); return; } @@ -891,10 +911,7 @@ mtr_t::Command::finish_write( void mtr_t::Command::release_all() { - ReleaseAll release; - Iterate iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse(CIterate()); /* Note that we have released the latches. */ m_locks_released = 1; @@ -904,10 +921,7 @@ mtr_t::Command::release_all() void mtr_t::Command::release_latches() { - ReleaseLatches release; - Iterate iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse(CIterate()); /* Note that we have released the latches. */ m_locks_released = 1; @@ -917,10 +931,10 @@ mtr_t::Command::release_latches() void mtr_t::Command::release_blocks() { - ReleaseBlocks release(m_start_lsn, m_end_lsn, m_impl->m_flush_observer); - Iterate iterator(release); - - m_impl->m_memo.for_each_block_in_reverse(iterator); + m_impl->m_memo.for_each_block_in_reverse( + CIterate( + ReleaseBlocks(m_start_lsn, m_end_lsn, + m_impl->m_flush_observer))); } /** Write the redo log record, add dirty pages to the flush list and release @@ -997,10 +1011,8 @@ mtr_t::memo_contains( const void* object, ulint type) { - Find find(object, type); - Iterate iterator(find); - - if (memo->for_each_block_in_reverse(iterator)) { + Iterate iteration(Find(object, type)); + if (memo->for_each_block_in_reverse(iteration)) { return(false); } @@ -1089,10 +1101,8 @@ mtr_t::memo_contains_flagged(const void* ptr, ulint flags) const ut_ad(m_impl.m_magic_n == MTR_MAGIC_N); ut_ad(is_committing() || is_active()); - FlaggedCheck check(ptr, flags); - Iterate iterator(check); - - return(!m_impl.m_memo.for_each_block_in_reverse(iterator)); + return !m_impl.m_memo.for_each_block_in_reverse( + CIterate(FlaggedCheck(ptr, flags))); } /** Check if memo contains the given page. @@ -1106,11 +1116,9 @@ mtr_t::memo_contains_page_flagged( const byte* ptr, ulint flags) const { - FindPage check(ptr, flags); - Iterate iterator(check); - - return(m_impl.m_memo.for_each_block_in_reverse(iterator) - ? NULL : check.get_block()); + Iterate iteration(FindPage(ptr, flags)); + return m_impl.m_memo.for_each_block_in_reverse(iteration) + ? NULL : iteration.functor.get_block(); } /** Mark the given latched page as modified. From a94638f1553f5947db6d48bab9e4951356b362a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sun, 16 Jun 2019 15:54:14 +0300 Subject: [PATCH 07/14] Clarify the purpose of MTR_LOG_NONE --- storage/innobase/include/mtr0types.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/storage/innobase/include/mtr0types.h b/storage/innobase/include/mtr0types.h index 20864c88ac5..1179da6d926 100644 --- a/storage/innobase/include/mtr0types.h +++ b/storage/innobase/include/mtr0types.h @@ -38,7 +38,9 @@ enum mtr_log_t { /** Default mode: log all operations modifying disk-based data */ MTR_LOG_ALL = 21, - /** Log no operations and dirty pages are not added to the flush list */ + /** Log no operations and dirty pages are not added to the flush list. + Set when applying log in crash recovery or when a modification of a + ROW_FORMAT=COMPRESSED page is attempted. */ MTR_LOG_NONE = 22, /** Don't generate REDO log but add dirty pages to flush list */ From 2b660fb4c212973ba0f118b47336b608d091f327 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Sun, 16 Jun 2019 15:55:09 +0300 Subject: [PATCH 08/14] mtr_t::is_block_dirtied(): Define inline --- storage/innobase/include/mtr0mtr.h | 2 +- storage/innobase/include/mtr0mtr.ic | 16 +++++++++++++++- storage/innobase/mtr/mtr0mtr.cc | 14 -------------- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/storage/innobase/include/mtr0mtr.h b/storage/innobase/include/mtr0mtr.h index d1e0ad6f7a9..4f518071bfb 100644 --- a/storage/innobase/include/mtr0mtr.h +++ b/storage/innobase/include/mtr0mtr.h @@ -550,7 +550,7 @@ struct mtr_t { /** Check if this mini-transaction is dirtying a clean page. @param block block being x-fixed @return true if the mtr is dirtying a clean page. */ - static bool is_block_dirtied(const buf_block_t* block) + static inline bool is_block_dirtied(const buf_block_t* block) MY_ATTRIBUTE((warn_unused_result)); private: diff --git a/storage/innobase/include/mtr0mtr.ic b/storage/innobase/include/mtr0mtr.ic index 984b7b34bcf..574d0de24a5 100644 --- a/storage/innobase/include/mtr0mtr.ic +++ b/storage/innobase/include/mtr0mtr.ic @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, 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 @@ -26,6 +26,20 @@ Created 11/26/1995 Heikki Tuuri #include "buf0buf.h" +/** Check if a mini-transaction is dirtying a clean page. +@return true if the mtr is dirtying a clean page. */ +bool +mtr_t::is_block_dirtied(const buf_block_t* block) +{ + ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); + ut_ad(block->page.buf_fix_count > 0); + + /* It is OK to read oldest_modification because no + other thread can be performing a write of it and it + is only during write that the value is reset to 0. */ + return(block->page.oldest_modification == 0); +} + /** Pushes an object to an mtr memo stack. */ void diff --git a/storage/innobase/mtr/mtr0mtr.cc b/storage/innobase/mtr/mtr0mtr.cc index 2d6b03c512c..fc6f3321164 100644 --- a/storage/innobase/mtr/mtr0mtr.cc +++ b/storage/innobase/mtr/mtr0mtr.cc @@ -457,20 +457,6 @@ private: lsn_t m_end_lsn; }; -/** Check if a mini-transaction is dirtying a clean page. -@return true if the mtr is dirtying a clean page. */ -bool -mtr_t::is_block_dirtied(const buf_block_t* block) -{ - ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); - ut_ad(block->page.buf_fix_count > 0); - - /* It is OK to read oldest_modification because no - other thread can be performing a write of it and it - is only during write that the value is reset to 0. */ - return(block->page.oldest_modification == 0); -} - /** Write the block contents to the REDO log */ struct mtr_write_log_t { /** Append a block to the redo log buffer. From c8b5fa4afc6c233101b8163ef19c1abc1be0373d Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Mon, 17 Jun 2019 17:50:08 +0300 Subject: [PATCH 09/14] MDEV-19055 Failures with temporary tables and Aria There was two separate problems: - Aria pagecache didn't properly handle re-reading of blocks that have given errors before (this triggered an assert) - temporary tables that where opened several times where not properly closed in ALTER, REPAIR or OPTIMIZE table Other things - Added a couple of asserts that will make it easier to find problems like this in the future. --- mysql-test/suite/maria/alter.result | 43 +++++++++++++++++++++++++++++ mysql-test/suite/maria/alter.test | 35 +++++++++++++++++++++++ mysys/my_pread.c | 2 ++ sql/sql_admin.cc | 28 +++++++++++-------- sql/sql_table.cc | 2 ++ storage/maria/ma_blockrec.c | 2 ++ storage/maria/ma_pagecache.c | 3 +- 7 files changed, 101 insertions(+), 14 deletions(-) diff --git a/mysql-test/suite/maria/alter.result b/mysql-test/suite/maria/alter.result index c63688dddd6..ea72328a38f 100644 --- a/mysql-test/suite/maria/alter.result +++ b/mysql-test/suite/maria/alter.result @@ -47,3 +47,46 @@ t1 CREATE TABLE `t1` ( ) ENGINE=Aria DEFAULT CHARSET=latin1 PAGE_CHECKSUM=1 TRANSACTIONAL=1 CREATE TABLE t2 SELECT * FROM t1; DROP TABLE t1, t2; +# +# MDEV-19055 Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read +# +CREATE OR REPLACE TABLE t1 (x INT) ENGINE=Aria; +CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria; +ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE t2 ADD CHECK (b = 4); +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +ALTER IGNORE TABLE t2 ADD c INT; +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +DELETE FROM t2 ORDER BY c LIMIT 1; +INSERT IGNORE INTO t2 SELECT * FROM t2; +OPTIMIZE TABLE t2; +Table Op Msg_type Msg_text +test.t2 optimize status OK +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +INSERT IGNORE INTO t2 SELECT * FROM t2; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +ALTER TABLE t2 CHANGE IF EXISTS d c INT; +ERROR 22007: Incorrect datetime value: '4' +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT; +ALTER TABLE t1 MODIFY IF EXISTS xx INT; +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +SELECT count(a),sum(a) FROM t2; +count(a) sum(a) +0 NULL +check table t1; +Table Op Msg_type Msg_text +test.t1 check status OK +check table t2; +Table Op Msg_type Msg_text +test.t2 check status OK +DROP TABLE t1,t2; diff --git a/mysql-test/suite/maria/alter.test b/mysql-test/suite/maria/alter.test index 09672cdfa3b..ef21ab2e5d2 100644 --- a/mysql-test/suite/maria/alter.test +++ b/mysql-test/suite/maria/alter.test @@ -42,3 +42,38 @@ ALTER TABLE t1 ORDER BY unknown_column; SHOW CREATE TABLE t1; CREATE TABLE t2 SELECT * FROM t1; DROP TABLE t1, t2; + +--echo # +--echo # MDEV-19055 Assertion `(_my_thread_var())->thr_errno != 0' failed in pagecache_read +--echo # + +--disable_warnings +CREATE OR REPLACE TABLE t1 (x INT) ENGINE=Aria; +CREATE TEMPORARY TABLE t2 (a TIME) ENGINE=Aria; +ALTER TABLE t2 ADD b DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP; +ALTER TABLE t2 ADD CHECK (b = 4); +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +ALTER IGNORE TABLE t2 ADD c INT; +SELECT count(a),sum(a) FROM t2; +DELETE FROM t2 ORDER BY c LIMIT 1; +INSERT IGNORE INTO t2 SELECT * FROM t2; +OPTIMIZE TABLE t2; +SELECT count(a),sum(a) FROM t2; +INSERT IGNORE INTO t2 SELECT * FROM t2; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +SELECT count(a),sum(a) FROM t2; +--error ER_TRUNCATED_WRONG_VALUE +ALTER TABLE t2 CHANGE IF EXISTS d c INT; +SELECT count(a),sum(a) FROM t2; +ALTER IGNORE TABLE t2 ADD IF NOT EXISTS e BIT; +ALTER TABLE t1 MODIFY IF EXISTS xx INT; +INSERT IGNORE INTO t2 () VALUES (),(),(),(); +SELECT count(a),sum(a) FROM t2; +--enable_warnings +check table t1; +check table t2; +DROP TABLE t1,t2; + +# +# End of 10.2 tests +# diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 08285738528..15586d00a6f 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -68,6 +68,8 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, if (readbytes != Count) { + /* We should never read with wrong file descriptor! */ + DBUG_ASSERT(my_errno != 9); my_errno= errno; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index ed5ba93c3fe..ab95fdc340c 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -697,19 +697,23 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, MDL_SHARED_NO_READ_WRITE lock (MDL_SHARED_WRITE cannot be upgraded) by *not* having HA_CONCURRENT_OPTIMIZE table_flag. */ - if (lock_type == TL_WRITE && !table->table->s->tmp_table && - table->mdl_request.type > MDL_SHARED_WRITE) + if (lock_type == TL_WRITE && table->mdl_request.type > MDL_SHARED_WRITE) { - if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) - goto err; - DEBUG_SYNC(thd, "after_admin_flush"); - /* Flush entries in the query cache involving this table. */ - query_cache_invalidate3(thd, table->table, 0); - /* - XXX: hack: switch off open_for_modify to skip the - flush that is made later in the execution flow. - */ - open_for_modify= 0; + if (table->table->s->tmp_table) + thd->close_unused_temporary_table_instances(tables); + else + { + if (wait_while_table_is_used(thd, table->table, HA_EXTRA_NOT_USED)) + goto err; + DEBUG_SYNC(thd, "after_admin_flush"); + /* Flush entries in the query cache involving this table. */ + query_cache_invalidate3(thd, table->table, 0); + /* + XXX: hack: switch off open_for_modify to skip the + flush that is made later in the execution flow. + */ + open_for_modify= 0; + } } if (table->table->s->crashed && operator_func == &handler::ha_check) diff --git a/sql/sql_table.cc b/sql/sql_table.cc index a64e17e2d3b..522d18b3701 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -9536,6 +9536,8 @@ do_continue:; DEBUG_SYNC(thd, "alter_table_copy_after_lock_upgrade"); } + else + thd->close_unused_temporary_table_instances(table_list); // It's now safe to take the table level lock. if (lock_tables(thd, table_list, alter_ctx.tables_opened, 0)) diff --git a/storage/maria/ma_blockrec.c b/storage/maria/ma_blockrec.c index c38b27d0f6c..13323dcae55 100644 --- a/storage/maria/ma_blockrec.c +++ b/storage/maria/ma_blockrec.c @@ -5244,6 +5244,8 @@ my_bool _ma_scan_init_block_record(MARIA_HA *info) { MARIA_SHARE *share= info->s; DBUG_ENTER("_ma_scan_init_block_record"); + DBUG_ASSERT(info->dfile.file == share->bitmap.file.file); + /* bitmap_buff may already be allocated if this is the second call to rnd_init() without a rnd_end() in between, see sql/handler.h diff --git a/storage/maria/ma_pagecache.c b/storage/maria/ma_pagecache.c index 7b0f395f926..f8c83e12a18 100644 --- a/storage/maria/ma_pagecache.c +++ b/storage/maria/ma_pagecache.c @@ -3464,8 +3464,6 @@ restart: pagecache_pthread_mutex_lock(&pagecache->cache_lock); #endif } - if (status & PCBLOCK_ERROR) - my_errno= block->error; } remove_reader(block); @@ -3497,6 +3495,7 @@ restart: if (status & PCBLOCK_ERROR) { + my_errno= block->error; DBUG_ASSERT(my_errno != 0); DBUG_PRINT("error", ("Got error %d when doing page read", my_errno)); DBUG_RETURN((uchar *) 0); From 81f60e8adeb241ed845427e0792349f3a05af99b Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 17 Jun 2019 18:04:22 +0100 Subject: [PATCH 10/14] Portability fix. --- mysys/my_pread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 15586d00a6f..9713deebbe5 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -69,7 +69,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, if (readbytes != Count) { /* We should never read with wrong file descriptor! */ - DBUG_ASSERT(my_errno != 9); + DBUG_ASSERT(my_errno != EBADF); my_errno= errno; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) From 5804bb4ef0acd7ac42e628c2d8c404957dc86cf9 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 17 Jun 2019 09:56:00 +0100 Subject: [PATCH 11/14] MDEV-19750 mysql command wrong encoding Restore the detection of default charset in command line utilities. It worked up to 10.1, but was broken by Connector/C. Moved code for detection of default charset from sql-common/client.c to mysys, and make command line utilities to use this code if charset was not specified on the command line. --- client/mysql.cc | 4 +- client/mysqladmin.cc | 3 + client/mysqlcheck.c | 6 +- client/mysqlimport.c | 7 +- client/mysqlshow.c | 2 + include/my_sys.h | 1 + mysql-test/r/charset_client_win.result | 2 + mysql-test/t/charset_client_win.test | 2 + mysys/charset.c | 218 ++++++++++++++++++++- sql-common/client.c | 252 +------------------------ 10 files changed, 245 insertions(+), 252 deletions(-) create mode 100644 mysql-test/r/charset_client_win.result create mode 100644 mysql-test/t/charset_client_win.test diff --git a/client/mysql.cc b/client/mysql.cc index 06bf31e16ce..2247e93ca93 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -40,6 +40,7 @@ #include "my_readline.h" #include #include +#include #if defined(USE_LIBEDIT_INTERFACE) && defined(HAVE_LOCALE_H) #include @@ -4701,7 +4702,8 @@ sql_real_connect(char *host,char *database,char *user,char *password, select_limit,max_join_size); mysql_options(&mysql, MYSQL_INIT_COMMAND, init_command); } - + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (!do_connect(&mysql, host, user, password, database, diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index ef8cb27e672..a4e06b46d94 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -26,6 +26,7 @@ #include #include #include +#include #define ADMIN_VERSION "9.1" #define MAX_MYSQL_VAR 512 @@ -371,6 +372,8 @@ int main(int argc,char *argv[]) if (shared_memory_base_name) mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); error_flags= (myf)(opt_nobeep ? 0 : ME_BELL); diff --git a/client/mysqlcheck.c b/client/mysqlcheck.c index ae8ddeec59c..42c4cae5621 100644 --- a/client/mysqlcheck.c +++ b/client/mysqlcheck.c @@ -440,8 +440,10 @@ static int get_options(int *argc, char ***argv) else default_charset= (char*) MYSQL_AUTODETECT_CHARSET_NAME; } - if (strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME) && - !get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME))) + if (!strcmp(default_charset, MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); + + if (!get_charset_by_csname(default_charset, MY_CS_PRIMARY, MYF(MY_WME))) { printf("Unsupported character set: %s\n", default_charset); DBUG_RETURN(1); diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 722b23844d9..9d8239fe6db 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -30,6 +30,8 @@ #define IMPORT_VERSION "3.7" #include "client_priv.h" +#include + #include "mysql_version.h" #include /* ORACLE_WELCOME_COPYRIGHT_NOTICE */ @@ -472,8 +474,9 @@ static MYSQL *db_connect(char *host, char *database, if (opt_default_auth && *opt_default_auth) mysql_options(mysql, MYSQL_DEFAULT_AUTH, opt_default_auth); - - mysql_options(mysql, MYSQL_SET_CHARSET_NAME, default_charset); + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); + mysql_options(mysql, MYSQL_SET_CHARSET_NAME, my_default_csname()); mysql_options(mysql, MYSQL_OPT_CONNECT_ATTR_RESET, 0); mysql_options4(mysql, MYSQL_OPT_CONNECT_ATTR_ADD, "program_name", "mysqlimport"); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index 3fb2d371f2f..47dc7212ca2 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -135,6 +135,8 @@ int main(int argc, char **argv) if (shared_memory_base_name) mysql_options(&mysql,MYSQL_SHARED_MEMORY_BASE_NAME,shared_memory_base_name); #endif + if (!strcmp(default_charset,MYSQL_AUTODETECT_CHARSET_NAME)) + default_charset= (char *)my_default_csname(); mysql_options(&mysql, MYSQL_SET_CHARSET_NAME, default_charset); if (opt_plugin_dir && *opt_plugin_dir) diff --git a/include/my_sys.h b/include/my_sys.h index c1d81108a84..fe66aeef48c 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -1043,6 +1043,7 @@ extern char *get_tty_password(const char *opt_message); /* File system character set */ extern CHARSET_INFO *fs_character_set(void); #endif +extern const char *my_default_csname(void); extern size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, char *to, size_t to_length, const char *from, size_t length); diff --git a/mysql-test/r/charset_client_win.result b/mysql-test/r/charset_client_win.result new file mode 100644 index 00000000000..08a32b0b80f --- /dev/null +++ b/mysql-test/r/charset_client_win.result @@ -0,0 +1,2 @@ +@@character_set_client +cp1257 diff --git a/mysql-test/t/charset_client_win.test b/mysql-test/t/charset_client_win.test new file mode 100644 index 00000000000..b4a21d4f0a4 --- /dev/null +++ b/mysql-test/t/charset_client_win.test @@ -0,0 +1,2 @@ +--source include/windows.inc +--exec chcp 1257 > NUL && $MYSQL --default-character-set=auto -e "select @@character_set_client" diff --git a/mysys/charset.c b/mysys/charset.c index 51afbb16cf0..f44dc7606c1 100644 --- a/mysys/charset.c +++ b/mysys/charset.c @@ -20,7 +20,12 @@ #include #include #include - +#ifdef HAVE_LANGINFO_H +#include +#endif +#ifdef HAVE_LOCALE_H +#include +#endif /* The code below implements this functionality: @@ -1216,3 +1221,214 @@ size_t escape_quotes_for_mysql(CHARSET_INFO *charset_info, *to= 0; return overflow ? (ulong)~0 : (ulong) (to - to_start); } + + +typedef enum my_cs_match_type_enum +{ + /* MySQL and OS charsets are fully compatible */ + my_cs_exact, + /* MySQL charset is very close to OS charset */ + my_cs_approx, + /* + MySQL knows this charset, but it is not supported as client character set. + */ + my_cs_unsupp +} my_cs_match_type; + + +typedef struct str2str_st +{ + const char* os_name; + const char* my_name; + my_cs_match_type param; +} MY_CSET_OS_NAME; + +static const MY_CSET_OS_NAME charsets[] = +{ +#ifdef _WIN32 + {"cp437", "cp850", my_cs_approx}, + {"cp850", "cp850", my_cs_exact}, + {"cp852", "cp852", my_cs_exact}, + {"cp858", "cp850", my_cs_approx}, + {"cp866", "cp866", my_cs_exact}, + {"cp874", "tis620", my_cs_approx}, + {"cp932", "cp932", my_cs_exact}, + {"cp936", "gbk", my_cs_approx}, + {"cp949", "euckr", my_cs_approx}, + {"cp950", "big5", my_cs_exact}, + {"cp1200", "utf16le", my_cs_unsupp}, + {"cp1201", "utf16", my_cs_unsupp}, + {"cp1250", "cp1250", my_cs_exact}, + {"cp1251", "cp1251", my_cs_exact}, + {"cp1252", "latin1", my_cs_exact}, + {"cp1253", "greek", my_cs_exact}, + {"cp1254", "latin5", my_cs_exact}, + {"cp1255", "hebrew", my_cs_approx}, + {"cp1256", "cp1256", my_cs_exact}, + {"cp1257", "cp1257", my_cs_exact}, + {"cp10000", "macroman", my_cs_exact}, + {"cp10001", "sjis", my_cs_approx}, + {"cp10002", "big5", my_cs_approx}, + {"cp10008", "gb2312", my_cs_approx}, + {"cp10021", "tis620", my_cs_approx}, + {"cp10029", "macce", my_cs_exact}, + {"cp12001", "utf32", my_cs_unsupp}, + {"cp20107", "swe7", my_cs_exact}, + {"cp20127", "latin1", my_cs_approx}, + {"cp20866", "koi8r", my_cs_exact}, + {"cp20932", "ujis", my_cs_exact}, + {"cp20936", "gb2312", my_cs_approx}, + {"cp20949", "euckr", my_cs_approx}, + {"cp21866", "koi8u", my_cs_exact}, + {"cp28591", "latin1", my_cs_approx}, + {"cp28592", "latin2", my_cs_exact}, + {"cp28597", "greek", my_cs_exact}, + {"cp28598", "hebrew", my_cs_exact}, + {"cp28599", "latin5", my_cs_exact}, + {"cp28603", "latin7", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE + {"cp28605", "latin9", my_cs_exact}, +#endif + {"cp38598", "hebrew", my_cs_exact}, + {"cp51932", "ujis", my_cs_exact}, + {"cp51936", "gb2312", my_cs_exact}, + {"cp51949", "euckr", my_cs_exact}, + {"cp51950", "big5", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE + {"cp54936", "gb18030", my_cs_exact}, +#endif + {"cp65001", "utf8", my_cs_exact}, + +#else /* not Windows */ + + {"646", "latin1", my_cs_approx}, /* Default on Solaris */ + {"ANSI_X3.4-1968", "latin1", my_cs_approx}, + {"ansi1251", "cp1251", my_cs_exact}, + {"armscii8", "armscii8", my_cs_exact}, + {"armscii-8", "armscii8", my_cs_exact}, + {"ASCII", "latin1", my_cs_approx}, + {"Big5", "big5", my_cs_exact}, + {"cp1251", "cp1251", my_cs_exact}, + {"cp1255", "hebrew", my_cs_approx}, + {"CP866", "cp866", my_cs_exact}, + {"eucCN", "gb2312", my_cs_exact}, + {"euc-CN", "gb2312", my_cs_exact}, + {"eucJP", "ujis", my_cs_exact}, + {"euc-JP", "ujis", my_cs_exact}, + {"eucKR", "euckr", my_cs_exact}, + {"euc-KR", "euckr", my_cs_exact}, +#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE + {"gb18030", "gb18030", my_cs_exact}, +#endif + {"gb2312", "gb2312", my_cs_exact}, + {"gbk", "gbk", my_cs_exact}, + {"georgianps", "geostd8", my_cs_exact}, + {"georgian-ps", "geostd8", my_cs_exact}, + {"IBM-1252", "cp1252", my_cs_exact}, + + {"iso88591", "latin1", my_cs_approx}, + {"ISO_8859-1", "latin1", my_cs_approx}, + {"ISO8859-1", "latin1", my_cs_approx}, + {"ISO-8859-1", "latin1", my_cs_approx}, + + {"iso885913", "latin7", my_cs_exact}, + {"ISO_8859-13", "latin7", my_cs_exact}, + {"ISO8859-13", "latin7", my_cs_exact}, + {"ISO-8859-13", "latin7", my_cs_exact}, + +#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE + {"iso885915", "latin9", my_cs_exact}, + {"ISO_8859-15", "latin9", my_cs_exact}, + {"ISO8859-15", "latin9", my_cs_exact}, + {"ISO-8859-15", "latin9", my_cs_exact}, +#endif + + {"iso88592", "latin2", my_cs_exact}, + {"ISO_8859-2", "latin2", my_cs_exact}, + {"ISO8859-2", "latin2", my_cs_exact}, + {"ISO-8859-2", "latin2", my_cs_exact}, + + {"iso88597", "greek", my_cs_exact}, + {"ISO_8859-7", "greek", my_cs_exact}, + {"ISO8859-7", "greek", my_cs_exact}, + {"ISO-8859-7", "greek", my_cs_exact}, + + {"iso88598", "hebrew", my_cs_exact}, + {"ISO_8859-8", "hebrew", my_cs_exact}, + {"ISO8859-8", "hebrew", my_cs_exact}, + {"ISO-8859-8", "hebrew", my_cs_exact}, + + {"iso88599", "latin5", my_cs_exact}, + {"ISO_8859-9", "latin5", my_cs_exact}, + {"ISO8859-9", "latin5", my_cs_exact}, + {"ISO-8859-9", "latin5", my_cs_exact}, + + {"koi8r", "koi8r", my_cs_exact}, + {"KOI8-R", "koi8r", my_cs_exact}, + {"koi8u", "koi8u", my_cs_exact}, + {"KOI8-U", "koi8u", my_cs_exact}, + + {"roman8", "hp8", my_cs_exact}, /* Default on HP UX */ + + {"Shift_JIS", "sjis", my_cs_exact}, + {"SJIS", "sjis", my_cs_exact}, + {"shiftjisx0213", "sjis", my_cs_exact}, + + {"tis620", "tis620", my_cs_exact}, + {"tis-620", "tis620", my_cs_exact}, + + {"ujis", "ujis", my_cs_exact}, + + {"US-ASCII", "latin1", my_cs_approx}, + + {"utf8", "utf8", my_cs_exact}, + {"utf-8", "utf8", my_cs_exact}, +#endif + {NULL, NULL, 0} +}; + + +static const char* +my_os_charset_to_mysql_charset(const char* csname) +{ + const MY_CSET_OS_NAME* csp; + for (csp = charsets; csp->os_name; csp++) + { + if (!strcasecmp(csp->os_name, csname)) + { + switch (csp->param) + { + case my_cs_exact: + return csp->my_name; + + case my_cs_approx: + /* + Maybe we should print a warning eventually: + character set correspondence is not exact. + */ + return csp->my_name; + + default: + return NULL; + } + } + } + return NULL; +} + +const char* my_default_csname() +{ + const char* csname = NULL; +#ifdef _WIN32 + char cpbuf[64]; + int cp = GetConsoleCP(); + if (cp == 0) + cp = GetACP(); + snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); + csname = my_os_charset_to_mysql_charset(cpbuf); +#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) + if (setlocale(LC_CTYPE, "") && (csname = nl_langinfo(CODESET))) + csname = my_os_charset_to_mysql_charset(csname); +#endif + return csname ? csname : MYSQL_DEFAULT_CHARSET_NAME; +} \ No newline at end of file diff --git a/sql-common/client.c b/sql-common/client.c index 2ec5250d828..4624c6e0f6c 100644 --- a/sql-common/client.c +++ b/sql-common/client.c @@ -1927,250 +1927,13 @@ static MYSQL_METHODS client_methods= }; - -typedef enum my_cs_match_type_enum -{ - /* MySQL and OS charsets are fully compatible */ - my_cs_exact, - /* MySQL charset is very close to OS charset */ - my_cs_approx, - /* - MySQL knows this charset, but it is not supported as client character set. - */ - my_cs_unsupp -} my_cs_match_type; - - -typedef struct str2str_st -{ - const char *os_name; - const char *my_name; - my_cs_match_type param; -} MY_CSET_OS_NAME; - -const MY_CSET_OS_NAME charsets[]= -{ -#ifdef __WIN__ - {"cp437", "cp850", my_cs_approx}, - {"cp850", "cp850", my_cs_exact}, - {"cp852", "cp852", my_cs_exact}, - {"cp858", "cp850", my_cs_approx}, - {"cp866", "cp866", my_cs_exact}, - {"cp874", "tis620", my_cs_approx}, - {"cp932", "cp932", my_cs_exact}, - {"cp936", "gbk", my_cs_approx}, - {"cp949", "euckr", my_cs_approx}, - {"cp950", "big5", my_cs_exact}, - {"cp1200", "utf16le", my_cs_unsupp}, - {"cp1201", "utf16", my_cs_unsupp}, - {"cp1250", "cp1250", my_cs_exact}, - {"cp1251", "cp1251", my_cs_exact}, - {"cp1252", "latin1", my_cs_exact}, - {"cp1253", "greek", my_cs_exact}, - {"cp1254", "latin5", my_cs_exact}, - {"cp1255", "hebrew", my_cs_approx}, - {"cp1256", "cp1256", my_cs_exact}, - {"cp1257", "cp1257", my_cs_exact}, - {"cp10000", "macroman", my_cs_exact}, - {"cp10001", "sjis", my_cs_approx}, - {"cp10002", "big5", my_cs_approx}, - {"cp10008", "gb2312", my_cs_approx}, - {"cp10021", "tis620", my_cs_approx}, - {"cp10029", "macce", my_cs_exact}, - {"cp12001", "utf32", my_cs_unsupp}, - {"cp20107", "swe7", my_cs_exact}, - {"cp20127", "latin1", my_cs_approx}, - {"cp20866", "koi8r", my_cs_exact}, - {"cp20932", "ujis", my_cs_exact}, - {"cp20936", "gb2312", my_cs_approx}, - {"cp20949", "euckr", my_cs_approx}, - {"cp21866", "koi8u", my_cs_exact}, - {"cp28591", "latin1", my_cs_approx}, - {"cp28592", "latin2", my_cs_exact}, - {"cp28597", "greek", my_cs_exact}, - {"cp28598", "hebrew", my_cs_exact}, - {"cp28599", "latin5", my_cs_exact}, - {"cp28603", "latin7", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE - {"cp28605", "latin9", my_cs_exact}, -#endif - {"cp38598", "hebrew", my_cs_exact}, - {"cp51932", "ujis", my_cs_exact}, - {"cp51936", "gb2312", my_cs_exact}, - {"cp51949", "euckr", my_cs_exact}, - {"cp51950", "big5", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE - {"cp54936", "gb18030", my_cs_exact}, -#endif - {"cp65001", "utf8", my_cs_exact}, - -#else /* not Windows */ - - {"646", "latin1", my_cs_approx}, /* Default on Solaris */ - {"ANSI_X3.4-1968", "latin1", my_cs_approx}, - {"ansi1251", "cp1251", my_cs_exact}, - {"armscii8", "armscii8", my_cs_exact}, - {"armscii-8", "armscii8", my_cs_exact}, - {"ASCII", "latin1", my_cs_approx}, - {"Big5", "big5", my_cs_exact}, - {"cp1251", "cp1251", my_cs_exact}, - {"cp1255", "hebrew", my_cs_approx}, - {"CP866", "cp866", my_cs_exact}, - {"eucCN", "gb2312", my_cs_exact}, - {"euc-CN", "gb2312", my_cs_exact}, - {"eucJP", "ujis", my_cs_exact}, - {"euc-JP", "ujis", my_cs_exact}, - {"eucKR", "euckr", my_cs_exact}, - {"euc-KR", "euckr", my_cs_exact}, -#ifdef UNCOMMENT_THIS_WHEN_WL_WL_4024_IS_DONE - {"gb18030", "gb18030", my_cs_exact}, -#endif - {"gb2312", "gb2312", my_cs_exact}, - {"gbk", "gbk", my_cs_exact}, - {"georgianps", "geostd8", my_cs_exact}, - {"georgian-ps", "geostd8", my_cs_exact}, - {"IBM-1252", "cp1252", my_cs_exact}, - - {"iso88591", "latin1", my_cs_approx}, - {"ISO_8859-1", "latin1", my_cs_approx}, - {"ISO8859-1", "latin1", my_cs_approx}, - {"ISO-8859-1", "latin1", my_cs_approx}, - - {"iso885913", "latin7", my_cs_exact}, - {"ISO_8859-13", "latin7", my_cs_exact}, - {"ISO8859-13", "latin7", my_cs_exact}, - {"ISO-8859-13", "latin7", my_cs_exact}, - -#ifdef UNCOMMENT_THIS_WHEN_WL_4579_IS_DONE - {"iso885915", "latin9", my_cs_exact}, - {"ISO_8859-15", "latin9", my_cs_exact}, - {"ISO8859-15", "latin9", my_cs_exact}, - {"ISO-8859-15", "latin9", my_cs_exact}, -#endif - - {"iso88592", "latin2", my_cs_exact}, - {"ISO_8859-2", "latin2", my_cs_exact}, - {"ISO8859-2", "latin2", my_cs_exact}, - {"ISO-8859-2", "latin2", my_cs_exact}, - - {"iso88597", "greek", my_cs_exact}, - {"ISO_8859-7", "greek", my_cs_exact}, - {"ISO8859-7", "greek", my_cs_exact}, - {"ISO-8859-7", "greek", my_cs_exact}, - - {"iso88598", "hebrew", my_cs_exact}, - {"ISO_8859-8", "hebrew", my_cs_exact}, - {"ISO8859-8", "hebrew", my_cs_exact}, - {"ISO-8859-8", "hebrew", my_cs_exact}, - - {"iso88599", "latin5", my_cs_exact}, - {"ISO_8859-9", "latin5", my_cs_exact}, - {"ISO8859-9", "latin5", my_cs_exact}, - {"ISO-8859-9", "latin5", my_cs_exact}, - - {"koi8r", "koi8r", my_cs_exact}, - {"KOI8-R", "koi8r", my_cs_exact}, - {"koi8u", "koi8u", my_cs_exact}, - {"KOI8-U", "koi8u", my_cs_exact}, - - {"roman8", "hp8", my_cs_exact}, /* Default on HP UX */ - - {"Shift_JIS", "sjis", my_cs_exact}, - {"SJIS", "sjis", my_cs_exact}, - {"shiftjisx0213", "sjis", my_cs_exact}, - - {"tis620", "tis620", my_cs_exact}, - {"tis-620", "tis620", my_cs_exact}, - - {"ujis", "ujis", my_cs_exact}, - - {"US-ASCII", "latin1", my_cs_approx}, - - {"utf8", "utf8", my_cs_exact}, - {"utf-8", "utf8", my_cs_exact}, -#endif - {NULL, NULL, 0} -}; - - -static const char * -my_os_charset_to_mysql_charset(const char *csname) -{ - const MY_CSET_OS_NAME *csp; - for (csp= charsets; csp->os_name; csp++) - { - if (!my_strcasecmp(&my_charset_latin1, csp->os_name, csname)) - { - switch (csp->param) - { - case my_cs_exact: - return csp->my_name; - - case my_cs_approx: - /* - Maybe we should print a warning eventually: - character set correspondence is not exact. - */ - return csp->my_name; - - default: - my_printf_error(ER_UNKNOWN_ERROR, - "OS character set '%s'" - " is not supported by MySQL client", - MYF(0), csp->my_name); - goto def; - } - } - } - - my_printf_error(ER_UNKNOWN_ERROR, - "Unknown OS character set '%s'.", - MYF(0), csname); - -def: - csname= MYSQL_DEFAULT_CHARSET_NAME; - my_printf_error(ER_UNKNOWN_ERROR, - "Switching to the default character set '%s'.", - MYF(0), csname); - return csname; -} - - -#ifndef __WIN__ -#include /* for getenv() */ -#ifdef HAVE_LANGINFO_H -#include -#endif -#ifdef HAVE_LOCALE_H -#include -#endif -#endif /* __WIN__ */ - - +#include static int mysql_autodetect_character_set(MYSQL *mysql) { - const char *csname= MYSQL_DEFAULT_CHARSET_NAME; - -#ifdef __WIN__ - char cpbuf[64]; - { - UINT cp= GetConsoleCP(); - if (cp == 0) - cp= GetACP(); - my_snprintf(cpbuf, sizeof(cpbuf), "cp%d", (int)cp); - csname= my_os_charset_to_mysql_charset(cpbuf); - } -#elif defined(HAVE_SETLOCALE) && defined(HAVE_NL_LANGINFO) - { - if (setlocale(LC_CTYPE, "") && (csname= nl_langinfo(CODESET))) - csname= my_os_charset_to_mysql_charset(csname); - } -#endif - if (mysql->options.charset_name) my_free(mysql->options.charset_name); - if (!(mysql->options.charset_name= my_strdup(csname, MYF(MY_WME)))) + if (!(mysql->options.charset_name= my_strdup(my_default_csname(),MYF(MY_WME)))) return 1; return 0; } @@ -2211,16 +1974,13 @@ C_MODE_START int mysql_init_character_set(MYSQL *mysql) { /* Set character set */ - if (!mysql->options.charset_name) + if (!mysql->options.charset_name || + !strcmp(mysql->options.charset_name, + MYSQL_AUTODETECT_CHARSET_NAME)) { - if (!(mysql->options.charset_name= - my_strdup(MYSQL_DEFAULT_CHARSET_NAME,MYF(MY_WME)))) + if (mysql_autodetect_character_set(mysql)) return 1; } - else if (!strcmp(mysql->options.charset_name, - MYSQL_AUTODETECT_CHARSET_NAME) && - mysql_autodetect_character_set(mysql)) - return 1; mysql_set_character_set_with_default_collation(mysql); From 71eea0c3fb87f37f6377c9bdad9339b664b11d0f Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Mon, 17 Jun 2019 19:01:15 +0100 Subject: [PATCH 12/14] Fix debug assert to match its intention. Do not check my_errno before it is set, check errno instead. Also, do not check errno, if prior pread() did not fail. --- mysys/my_pread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mysys/my_pread.c b/mysys/my_pread.c index 9713deebbe5..9d3fdb3e0ee 100644 --- a/mysys/my_pread.c +++ b/mysys/my_pread.c @@ -69,7 +69,7 @@ size_t my_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset, if (readbytes != Count) { /* We should never read with wrong file descriptor! */ - DBUG_ASSERT(my_errno != EBADF); + DBUG_ASSERT(readbytes != (size_t)-1 || errno != EBADF); my_errno= errno; if (errno == 0 || (readbytes != (size_t) -1 && (MyFlags & (MY_NABP | MY_FNABP)))) From b23c82fef38839f9f6b758091dfb5064c017f608 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Tue, 18 Jun 2019 14:32:24 +0300 Subject: [PATCH 13/14] MDEV-18078 Assertion `trnman_has_locked_tables(trn) > 0' failed Problem was that in case of implicit rollback for alter table Aria did try to run commit twice. The test case for this is tricky to do in 10.2, so it will be added to 10.4 as part of BACKUP STAGE testing. --- storage/maria/ha_maria.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index f64ea4b1edb..5f0d023f42b 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -2743,7 +2743,8 @@ int ha_maria::external_lock(THD *thd, int lock_type) } else { - TRN *trn= (file->trn != &dummy_transaction_object ? file->trn : 0); + /* We have to test for THD_TRN to protect against implicit commits */ + TRN *trn= (file->trn != &dummy_transaction_object && THD_TRN ? file->trn : 0); /* End of transaction */ /* From 8acbf9c1f961aa1008ef509e059e1a09943f5ed3 Mon Sep 17 00:00:00 2001 From: Michael Widenius Date: Wed, 19 Jun 2019 00:35:44 +0300 Subject: [PATCH 14/14] MDEV-19595 fixed The test cases for the MDEV found several independent bugs in MariaDB server and Aria: - If a temporary table was marked as crashed, it could never be deleted. - Opening of a crashed temporary table gave an error message but the error was never forwarded to the caller which caused an assert() in my_ok() - init_read_record() did mmap of all temporary tables, which is probably not a good idea as this area can potentially be very big. Changed code to only mmap internal temporary tables. - mmap-ed tables where not unmapped in case of repair/optimize which caused bad data in table and crashes if the original table files where replaced with new ones (as the old mmap was still in place). Fixed by removing the mmap in case of repair. - Cleaned up usage of code that disabled mmap in Aria --- mysql-test/suite/maria/temporary.result | 23 +++++++++++++++++++++++ mysql-test/suite/maria/temporary.test | 20 ++++++++++++++++++++ sql/records.cc | 3 +-- sql/sql_parse.cc | 8 +++++++- sql/temporary_tables.cc | 5 ++++- storage/maria/ha_maria.cc | 4 +++- storage/maria/ma_close.c | 5 +---- storage/maria/ma_delete_all.c | 7 +++++-- storage/maria/ma_packrec.c | 9 +++++++-- storage/maria/maria_def.h | 8 ++++++++ 10 files changed, 79 insertions(+), 13 deletions(-) create mode 100644 mysql-test/suite/maria/temporary.result create mode 100644 mysql-test/suite/maria/temporary.test diff --git a/mysql-test/suite/maria/temporary.result b/mysql-test/suite/maria/temporary.result new file mode 100644 index 00000000000..2592e04be2b --- /dev/null +++ b/mysql-test/suite/maria/temporary.result @@ -0,0 +1,23 @@ +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (5); +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1); +DELETE FROM t1 LIMIT 2; +OPTIMIZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 optimize status OK +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +SELECT * FROM t1; +a +INSERT INTO t1 VALUES (1),(2); +CHECK TABLE t1; +Table Op Msg_type Msg_text +test.t1 check status OK +ALTER TABLE t1 CHANGE COLUMN IF EXISTS x x INT; +Warnings: +Note 1054 Unknown column 'x' in 't1' +ALTER TABLE t1; +DROP TEMPORARY TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/maria/temporary.test b/mysql-test/suite/maria/temporary.test new file mode 100644 index 00000000000..76f8e2526a4 --- /dev/null +++ b/mysql-test/suite/maria/temporary.test @@ -0,0 +1,20 @@ +# +# MDEV-19595 +# ER_CRASHED_ON_USAGE and Assertion `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' +# failed upon actions on temporary Aria table with ROW_FORMAT DYNAMIC +# + +CREATE TABLE t1 (b INT); +INSERT INTO t1 VALUES (5); +CREATE TEMPORARY TABLE t1 (a INT) ENGINE=Aria ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES (1); +DELETE FROM t1 LIMIT 2; +OPTIMIZE TABLE t1; +CHECK TABLE t1; +SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +CHECK TABLE t1; +ALTER TABLE t1 CHANGE COLUMN IF EXISTS x x INT; +ALTER TABLE t1; +DROP TEMPORARY TABLE t1; +DROP TABLE t1; diff --git a/sql/records.cc b/sql/records.cc index 3db34425e29..6a611d46ca4 100644 --- a/sql/records.cc +++ b/sql/records.cc @@ -197,8 +197,7 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table, info->forms= &info->table; /* Only one table */ info->addon_field= addon_field; - if ((table->s->tmp_table == INTERNAL_TMP_TABLE || - table->s->tmp_table == NON_TRANSACTIONAL_TMP_TABLE) && + if ((table->s->tmp_table == INTERNAL_TMP_TABLE) && !addon_field) (void) table->file->extra(HA_EXTRA_MMAP); diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 976cfe3df03..6e2c38ad053 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -779,7 +779,6 @@ void init_update_queries(void) Note that SQLCOM_RENAME_TABLE should not be in this list! */ sql_command_flags[SQLCOM_CREATE_TABLE]|= CF_PREOPEN_TMP_TABLES; - sql_command_flags[SQLCOM_DROP_TABLE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_CREATE_INDEX]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_ALTER_TABLE]|= CF_PREOPEN_TMP_TABLES; sql_command_flags[SQLCOM_TRUNCATE]|= CF_PREOPEN_TMP_TABLES; @@ -4459,7 +4458,14 @@ mysql_execute_command(THD *thd) } case SQLCOM_DROP_TABLE: { + int result; DBUG_ASSERT(first_table == all_tables && first_table != 0); + + thd->open_options|= HA_OPEN_FOR_REPAIR; + result= thd->open_temporary_tables(all_tables); + thd->open_options&= ~HA_OPEN_FOR_REPAIR; + if (result) + goto error; if (!lex->tmp_table()) { if (check_table_access(thd, DROP_ACL, all_tables, FALSE, UINT_MAX, FALSE)) diff --git a/sql/temporary_tables.cc b/sql/temporary_tables.cc index 15a81f4b375..ae7cb274843 100644 --- a/sql/temporary_tables.cc +++ b/sql/temporary_tables.cc @@ -382,6 +382,9 @@ bool THD::open_temporary_table(TABLE_LIST *tl) rgi_slave->is_parallel_exec && wait_for_prior_commit()) DBUG_RETURN(true); + + if (!table && is_error()) + DBUG_RETURN(true); // Error when opening table } if (!table) @@ -1103,7 +1106,7 @@ TABLE *THD::open_temporary_table(TMP_TABLE_SHARE *share, if (open_table_from_share(this, share, alias, open_in_engine ? (uint)HA_OPEN_KEYFILE : 0, - EXTRA_RECORD, ha_open_options, table, + EXTRA_RECORD, open_options | ha_open_options, table, open_in_engine ? false : true)) { my_free(table); diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 5f0d023f42b..887065ff825 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1301,6 +1301,7 @@ int ha_maria::check(THD * thd, HA_CHECK_OPT * check_opt) if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; + unmap_file(file); maria_chk_init(param); param->thd= thd; param->op_name= "check"; @@ -1521,6 +1522,7 @@ int ha_maria::zerofill(THD * thd, HA_CHECK_OPT *check_opt) if (!file || !param) return HA_ADMIN_INTERNAL_ERROR; + unmap_file(file); old_trn= file->trn; maria_chk_init(param); param->thd= thd; @@ -1619,6 +1621,7 @@ int ha_maria::repair(THD *thd, HA_CHECK *param, bool do_optimize) param->out_flag= 0; share->state.dupp_key= MI_MAX_KEY; strmov(fixed_name, share->open_file_name.str); + unmap_file(file); /* Don't lock tables if we have used LOCK TABLE or if we come from @@ -1798,7 +1801,6 @@ int ha_maria::assign_to_keycache(THD * thd, HA_CHECK_OPT *check_opt) TABLE_LIST *table_list= table->pos_in_table_list; DBUG_ENTER("ha_maria::assign_to_keycache"); - table->keys_in_use_for_query.clear_all(); if (table_list->process_index_hints(table)) diff --git a/storage/maria/ma_close.c b/storage/maria/ma_close.c index bd0a36c14c8..03501dc49cf 100644 --- a/storage/maria/ma_close.c +++ b/storage/maria/ma_close.c @@ -113,10 +113,7 @@ int maria_close(register MARIA_HA *info) if (flush_pagecache_blocks(share->pagecache, &share->kfile, share->deleting ? FLUSH_IGNORE_CHANGED : FLUSH_RELEASE)) error= my_errno; -#ifdef HAVE_MMAP - if (share->file_map) - _ma_unmap_file(info); -#endif + unmap_file(info); if (((share->changed && share->base.born_transactional) || maria_is_crashed(info) || (share->temporary && !share->deleting))) { diff --git a/storage/maria/ma_delete_all.c b/storage/maria/ma_delete_all.c index 1daf5f3ef80..c1019c01c66 100644 --- a/storage/maria/ma_delete_all.c +++ b/storage/maria/ma_delete_all.c @@ -38,6 +38,9 @@ int maria_delete_all_rows(MARIA_HA *info) MARIA_SHARE *share= info->s; my_bool log_record; LSN lsn; +#ifdef HAVE_MMAP + my_bool mmap_file= share->file_map != 0; +#endif DBUG_ENTER("maria_delete_all_rows"); if (share->options & HA_OPTION_READ_ONLY_DATA) @@ -95,7 +98,7 @@ int maria_delete_all_rows(MARIA_HA *info) */ #ifdef HAVE_MMAP - if (share->file_map) + if (mmap_file) _ma_unmap_file(info); #endif @@ -141,7 +144,7 @@ int maria_delete_all_rows(MARIA_HA *info) _ma_writeinfo(info, WRITEINFO_UPDATE_KEYFILE); #ifdef HAVE_MMAP /* Map again */ - if (share->file_map) + if (mmap_file) _ma_dynmap_file(info, (my_off_t) 0); #endif DBUG_RETURN(0); diff --git a/storage/maria/ma_packrec.c b/storage/maria/ma_packrec.c index 27c5538e51b..e2c1e353616 100644 --- a/storage/maria/ma_packrec.c +++ b/storage/maria/ma_packrec.c @@ -1564,8 +1564,13 @@ my_bool _ma_memmap_file(MARIA_HA *info) void _ma_unmap_file(MARIA_HA *info) { - my_munmap((char*) info->s->file_map, - (size_t) info->s->mmaped_length + MEMMAP_EXTRA_MARGIN); + MARIA_SHARE *share= info->s; + my_munmap((char*) share->file_map, + (size_t) share->mmaped_length + MEMMAP_EXTRA_MARGIN); + share->file_map= 0; + share->file_read= _ma_nommap_pread; + share->file_write= _ma_nommap_pwrite; + info->opt_flag&= ~MEMMAP_USED; } diff --git a/storage/maria/maria_def.h b/storage/maria/maria_def.h index f2c652c9286..a23e00a24a3 100644 --- a/storage/maria/maria_def.h +++ b/storage/maria/maria_def.h @@ -1431,3 +1431,11 @@ extern my_bool ma_yield_and_check_if_killed(MARIA_HA *info, int inx); extern my_bool ma_killed_standalone(MARIA_HA *); extern uint _ma_file_callback_to_id(void *callback_data); + +static inline void unmap_file(MARIA_HA *info __attribute__((unused))) +{ +#ifdef HAVE_MMAP + if (info->s->file_map) + _ma_unmap_file(info); +#endif +}