From c83663e574ecd338cf9b86b21f3e198c5ec06d47 Mon Sep 17 00:00:00 2001 From: Elena Stepanova Date: Wed, 24 Jul 2019 00:43:21 +0300 Subject: [PATCH 01/13] List of unstable tests for 10.1.41 release --- mysql-test/unstable-tests | 620 ++++++++++++++++++++------------------ 1 file changed, 327 insertions(+), 293 deletions(-) diff --git a/mysql-test/unstable-tests b/mysql-test/unstable-tests index 87f836a84e1..0c7756d70ae 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -22,17 +22,14 @@ # To use the list, run MTR with --skip-test-list=unstable-tests option. # ############################################################################## - -# Based on 10.1 5b035c84567b60c2ca680de96f5179a6dd3d9e61 +# +# Based on 10.1 1f498f901b394e869c430b777fdc233ab98d428f main.alter_table_trans : MDEV-12084 - timeout main.analyze_stmt : Modified in 10.1.39 main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result main.auth_named_pipe : MDEV-14724 - System error 2 -main.auto_increment_ranges_innodb : Modified in 10.1.38 -main.bigint : Modified in 10.1.38 -main.bootstrap : MDEV-19199 - error: 34304, status: 134, errno: 2 -main.connect : Modified in 10.1.38 +main.bootstrap : Modified in 10.1.41 main.count_distinct2 : MDEV-11768 - timeout main.create_delayed : MDEV-10605 - failed with timeout main.create_drop_event : MDEV-16271 - Wrong result @@ -48,11 +45,12 @@ main.ctype_uca : Include file modified in 10.1.39 main.ctype_ucs : Include file modified in 10.1.39 main.ctype_ujis : Include file modified in 10.1.39 main.ctype_utf16 : MDEV-10675: timeout or extra warnings; include file modified in 10.1.39 -main.ctype_utf16le : Include file modified in 10.1.39 main.ctype_utf16_uca : Include file modified in 10.1.39 +main.ctype_utf16le : Include file modified in 10.1.39 main.ctype_utf32 : Include file modified in 10.1.39 main.ctype_utf32_uca : Include file modified in 10.1.39 main.ctype_utf8 : Include file modified in 10.1.39 +main.ctype_utf8_def_upgrade : Added in 10.1.41 main.ctype_utf8mb4 : Include file modified in 10.1.39 main.ctype_utf8mb4_heap : Include file modified in 10.1.39 main.ctype_utf8mb4_innodb : Include file modified in 10.1.39 @@ -60,38 +58,36 @@ main.ctype_utf8mb4_myisam : Include file modified in 10.1.39 main.ddl_i18n_koi8r : Modified in 10.1.39 main.ddl_i18n_utf8 : Modified in 10.1.39 main.debug_sync : MDEV-10607 - internal error +main.derived : Modified in 10.1.41 main.derived_opt : MDEV-11768 - timeout +main.derived_view : Modified in 10.1.41 main.dirty_close : MDEV-19368 - mysqltest failed but provided no output main.events_1 : Modified in 10.1.39 main.events_2 : MDEV-13277 - Server crash main.events_bugs : MDEV-12892 - Crash in fill_schema_processlist -main.events_slowlog : MDEV-12821 - Wrong result main.events_restart : MDEV-12236 - Server shutdown problem -main.flush : Modified in 10.1.38 +main.events_slowlog : MDEV-12821 - Wrong result +main.flush : MDEV-19368 - mysqltest failed but provided no output main.func_gconcat : Modified in 10.1.39 -main.func_group_innodb : Modified in 10.1.38 main.func_hybrid_type : Modified in 10.1.39 main.func_math : Modified in 10.1.39 -main.func_misc : Modified in 10.1.38 main.func_str : Modified in 10.1.39 main.func_time : Modified in 10.1.39 main.gis : MDEV-13411 - wrong result on P8; modified in 10.1.39 main.gis-precise : Modified in 10.1.39 main.gis_notembedded : Added in 10.1.39 main.grant4 : Modified in 10.1.39 -main.grant5 : Modified in 10.1.38 main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown -main.huge_frm-6224 : Modified in 10.1.38 main.index_intersect_innodb : MDEV-10643 - failed with timeout main.index_merge_innodb : MDEV-7142 - Wrong execution plan, timeout with valgrind; modified in 10.1.39 main.index_merge_myisam : Include files modified in 10.1.39 main.information_schema_prepare : Added in 10.1.39 main.innodb_mysql_lock : MDEV-7861 - sporadic lock detection failure +main.join_cache : Modified in 10.1.41 +main.join_nested : Modified in 10.1.41 +main.join_outer : Modified in 10.1.41 main.kill_processlist-6619 : MDEV-10793 - wrong result in processlist; modified in 10.1.39 main.loaddata : MDEV-19368 - mysqltest failed but provided no output; modified in 10.1.39 -main.lock : Modified in 10.1.38 -main.lock_multi : Modified in 10.1.38 -main.lock_sync : Modified in 10.1.38 main.log_slow : MDEV-13263 - Wrong result; modified in 10.1.39 main.log_slow_debug : Added in 10.1.39 main.log_tables-big : MDEV-13408 - wrong result @@ -99,16 +95,17 @@ main.mdev-504 : MDEV-10607 - sporadic "can't connect" main.mdev375 : MDEV-10607 - sporadic "can't connect" main.mdev_19276 : Added in 10.1.39 main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update : Modified in 10.1.39 +main.multi_update : Modified in 10.1.41 main.multi_update_big : Added in 10.1.39 +main.multi_update_debug : MDEV-20136 - Debug sync point wait timed out; added in 10.1.41 +main.multi_update_innodb : Modified in 10.1.41 main.mysql : Modified in 10.1.39 main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2 main.mysql_client_test_comp : MDEV-19369 - error: 5888, status: 23, errno: 2 main.mysql_client_test_nonblock : MDEV-15096 - exec failed main.mysql_upgrade_noengine : MDEV-14355 - Plugin is busy -main.mysqlbinlog_row_minimal : Modified in 10.1.38 -main.mysqld--help : Modified in 10.1.39 -main.mysqldump : Modified in 10.1.38 +main.mysqld--help : Modified in 10.1.41 +main.mysqldump : Modified in 10.1.41 main.mysqldump-compat : Modified in 10.1.39 main.mysqlhotcopy_myisam : MDEV-10995 - test hangs on debug build main.mysqlslap : MDEV-11801 - timeout @@ -123,36 +120,34 @@ main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.1.39 main.query_cache : MDEV-12895 - Wrong result main.query_cache_debug : MDEV-15281 - Resize or similar command in progress -main.range_innodb : Modified in 10.1.38 main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away -main.read_only : Modified in 10.1.38 -main.row-checksum : Modified in 10.1.38 +main.repair_symlink-5543 : Modified in 10.1.41 main.set_statement : MDEV-13183 - Wrong result main.show_explain : MDEV-10674 - sporadic failure -main.sp : Modified in 10.1.39 -main.sp_notembedded : MDEV-10607 - internal error; modified in 10.1.39 +main.sp : Modified in 10.1.41 main.sp-security : MDEV-10607 - sporadic "can't connect" -main.sp_trans : Modified in 10.1.39 main.sp-ucs2 : Modified in 10.1.39 +main.sp_notembedded : MDEV-10607 - internal error; modified in 10.1.39 +main.sp_trans : Modified in 10.1.39 main.ssl_verify_ip : Added in 10.1.39 -main.statistics : Modified in 10.1.39 -main.stat_tables : Modified in 10.1.39 +main.stat_tables : Modified in 10.1.41 main.stat_tables_par_innodb : MDEV-14155 - wrong rounding +main.statistics : Modified in 10.1.39 main.status : MDEV-8510 - sporadic wrong result main.status2 : Modified in 10.1.39 main.subselect_innodb : MDEV-10614 - sporadic wrong results -main.subselect_mat : Modified in 10.1.38 -main.subselect_sj : Modified in 10.1.39 -main.subselect2 : Modified in 10.1.38 +main.subselect_sj : Modified in 10.1.41 +main.subselect_sj_mat : Modified in 10.1.41 main.tc_heuristic_recover : MDEV-15200 - wrong error on mysqld_stub_cmd main.timezone2 : Modified in 10.1.39 +main.trigger_null-8605 : Modified in 10.1.41 main.type_bit : Modified in 10.1.39 main.type_blob : MDEV-15195 - Wrong result main.type_date : Modified in 10.1.39 +main.type_datetime : Modified in 10.1.41 main.type_datetime_hires : MDEV-10687 - timeout main.type_decimal : Modified in 10.1.39 main.type_year : Modified in 10.1.39 -main.union : Modified in 10.1.38 main.update_innodb : Modified in 10.1.39 main.userstat : Modified in 10.1.39 main.view : Modified in 10.1.39 @@ -160,7 +155,7 @@ main.view_grant : Modified in 10.1.39 main.wait_timeout : Lost connection to MySQL server during query main.xa : MDEV-11769 - lock wait timeout -#---------------------------------------------------------------- +#----------------------------------------------------------------------- archive.archive_bitfield : MDEV-11771 - Extra warning archive.archive_eits : Added in 10.1.39 @@ -168,66 +163,74 @@ archive.archive_symlink : MDEV-12170 - unexpected error on rmdir archive.discover : MDEV-10510 - Table is marked as crashed archive.mysqlhotcopy_archive : MDEV-14726 - Table is marked as crashed +#----------------------------------------------------------------------- + archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -binlog.binlog_base64_flag : Modified in 10.1.38 -binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed -binlog.binlog_innodb_stm : Added in 10.1.39 -binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_mysqlbinlog2 : Modified in 10.1.39 -binlog.binlog_mysqlbinlog_row_frag : Added in 10.1.38 -binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint +binlog.binlog_commit_wait : MDEV-10150 - Error: too much time elapsed +binlog.binlog_innodb_stm : Added in 10.1.39 +binlog.binlog_killed : MDEV-12925 - Wrong result +binlog.binlog_mysqlbinlog2 : Modified in 10.1.39 +binlog.binlog_mysqlbinlog_stop_never : Added in 10.1.41 +binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint +binlog.load_data_stm_view : MDEV-16948 - Wrong result -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint -binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync -binlog_encryption.rpl_parallel : MDEV-10653 - Timeout -binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout -binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning -binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4 +binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint +binlog_encryption.encrypted_master : MDEV-12906 - Failed to sync +binlog_encryption.rpl_parallel : MDEV-10653 - Timeout +binlog_encryption.rpl_relayrotate : MDEV-15194 - Timeout +binlog_encryption.rpl_semi_sync : MDEV-11220 - Wrong result, MDEV-11673 - Valgrind warning +binlog_encryption.rpl_ssl : MDEV-14507 - Timeout on SLES 11.4 binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Test assertion failed in assertion.inc -binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query -binlog.load_data_stm_view : MDEV-16948 - Wrong result +binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -connect.part_table : Modified in 10.1.38 -connect.pivot : MDEV-14803 - failed to discover table -connect.zip : MDEV-13884 - Wrong result +connect.pivot : MDEV-14803 - failed to discover table +connect.zip : MDEV-13884 - Wrong result -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -encryption.create_or_replace : MDEV-16115 - Trying to access tablespace -encryption.debug_key_management : MDEV-13841 - Timeout on wait condition -encryption.encrypt_and_grep : MDEV-13765 - Wrong result -encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket -encryption.innodb-checksum-algorithm : Modified in 10.1.38 -encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate -encryption.innodb-encryption-alter : Modified in 10.1.39 -encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result +disks.disks_notembedded : Added in 10.1.41 + +#----------------------------------------------------------------------- + +encryption.create_or_replace : MDEV-16115 - Trying to access tablespace +encryption.debug_key_management : MDEV-13841 - Timeout on wait condition +encryption.encrypt_and_grep : MDEV-13765 - Wrong result +encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect through socket +encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate +encryption.innodb-encryption-alter : Modified in 10.1.39 +encryption.innodb-first-page-read : MDEV-14356 - Timeout on wait condition +encryption.innodb-page_encryption : MDEV-10641 - mutex problem +encryption.innodb-read-only : MDEV-14728 - Unable to get certificate; MDEV-16563 - Crash on startup +encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup +encryption.innodb-remove-encryption : MDEV-16493 - Timeout in wait condition 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 on wait condition -encryption.innodb-force-corrupt : Modified in 10.1.38 -encryption.innodb-page_encryption : MDEV-10641 - mutex problem -encryption.innodb-read-only : MDEV-14728 - Unable to get certificate; MDEV-16563 - Crash on startup -encryption.innodb-redo-badkey : MDEV-12898 - Server hang on startup -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 -encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing +encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result +encryption.innodb_encryption_row_compressed : MDEV-16113 - Crash +encryption.innodb_first_page : MDEV-10689 - Crash +encryption.innodb_scrub : MDEV-8139 - scrubbing tests need fixing +encryption.innodb_scrub_background : MDEV-8139 - scrubbing tests need fixing +encryption.innodb_scrub_compressed : MDEV-8139 - scrubbing tests need fixing -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -engines/iuds.* : Not maintained in timely manner -engines/funcs.* : Not maintained in timely manner -engines/rr_trx.* : MDEV-10998 - tests not maintained +engines/funcs.* : Not maintained in timely manner -#---------------------------------------------------------------- +#----------------------------------------------------------------------- + +engines/iuds.* : Not maintained in timely manner + +#----------------------------------------------------------------------- + +engines/rr_trx.* : MDEV-10998 - tests not maintained + +#----------------------------------------------------------------------- federated.federated_bug_35333 : MDEV-13410 - Wrong result federated.federated_bug_585688 : MDEV-12907 - Valgrind, MDEV-14805 - server crash @@ -236,7 +239,7 @@ federated.federated_partition : MDEV-10417 - Fails on Mips federated.federated_transactions : MDEV-10617, MDEV-10417 - Wrong checksum, timeouts, fails on Mips federated.federatedx : MDEV-10617 - Wrong checksum, timeouts -#---------------------------------------------------------------- +#----------------------------------------------------------------------- funcs_1.memory_views : MDEV-11773 - timeout funcs_1.processlist_priv_no_prot : Include file modified in 10.1.39 @@ -244,84 +247,90 @@ funcs_1.processlist_priv_ps : Include file modified in 10.1.39 funcs_1.processlist_val_no_prot : MDEV-11223 - Wrong result; include file modified in 10.1.39 funcs_1.processlist_val_ps : MDEV-12175 - Wrong plan; include file modified in 10.1.39 -funcs_2.memory_charset : MDEV-10290 - Timeout -funcs_2.myisam_charset : MDEV-11535 - Timeout -funcs_2/charset.* : MDEV-10999 - test not maintained +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +funcs_2.memory_charset : MDEV-10290 - Timeout +funcs_2.myisam_charset : MDEV-11535 - Timeout -galera.* : The suite was enabled in 10.1.27 and is still unstable -galera_3nodes.* : The suite has not been stabilized yet +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +funcs_2/charset.* : MDEV-10999 - test not maintained -innodb.alter_candidate_key : Added in 10.1.38 -innodb.alter_crash : Added in 10.1.39 -innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server -innodb.foreign-keys : Modified in 10.1.39 -innodb.foreign_key : Modified in 10.1.39 -innodb.group_commit_crash : MDEV-11770 - checksum mismatch -innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - checksum mismatch -innodb.innodb_28867993 : Added in 10.1.38 -innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup -innodb.innodb-alter : Modified in 10.1.38 -innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.1.38 -innodb.innodb-alter-nullable : Modified in 10.1.39 -innodb.innodb-alter-table : MDEV-10619 - Testcase timeout -innodb.innodb-blob : MDEV-12053 - Client crash -innodb.innodb_bug14147491 : MDEV-11808 - wrong error codes -innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan -innodb.innodb_bug48024 : MDEV-14352 - Assertion failure -innodb.innodb-corrupted-table : Modified in 10.1.39 -innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown -innodb.innodb-index : Modified in 10.1.39 -innodb.innodb_max_recordsize_64k : MDEV-15203 - wrong result -innodb.innodb_monitor : MDEV-10939 - Testcase timeout -innodb.innodb-page_compression_default : MDEV-14121 - Assertion failure -innodb.innodb-page_compression_lzma : MDEV-14353 - wrong result on Fedora 25 -innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem -innodb.innodb_simulate_comp_failures : MDEV-18417 - ASAN failures -innodb.innodb_stats : MDEV-10682 - wrong result -innodb.innodb_sys_semaphore_waits : MDEV-10331 - wrong result -innodb.innodb-table-online : Modified in 10.1.38 -innodb.innodb-truncate : Modified in 10.1.39 -innodb.innodb-virtual-columns : Modified in 10.1.38 -innodb.innodb_zip_innochecksum : Modified in 10.1.38 -innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks -innodb.log_file_size : MDEV-15668 - Not found pattern -innodb.recovery_shutdown : MDEV-15671 - Warning: database page corruption -innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace -innodb.table_definition_cache_debug : MDEV-14206 - Extra warning -innodb.table_flags : MDEV-19374 - Server failed to restart -innodb.xa_debug : Added in 10.1.39 -innodb.xa_recovery : MDEV-15279 - mysqld got exception +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +galera.* : The suite was enabled in 10.1.27 and is still unstable -innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure -innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +galera_3nodes.* : The suite has not been stabilized yet -maria.insert_select : MDEV-12757 - Timeout -maria.insert_select-7314 : MDEV-16492 - Timeout -maria.maria : MDEV-14430 - Wrong result +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +innodb.alter_crash : Added in 10.1.39 +innodb.binlog_consistent : MDEV-10618 - Server fails to start +innodb.check_ibd_filesize : Added in 10.1.41 +innodb.create_select : Added in 10.1.41 +innodb.doublewrite : MDEV-12905 - Lost connection to MySQL server +innodb.foreign-keys : Modified in 10.1.41 +innodb.foreign_key : Modified in 10.1.39 +innodb.group_commit_crash : MDEV-11770 - Checksum mismatch +innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch +innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup +innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS +innodb.innodb-alter-nullable : Modified in 10.1.39 +innodb.innodb-alter-table : MDEV-10619 - Testcase timeout +innodb.innodb-blob : MDEV-12053 - Client crash +innodb.innodb-corrupted-table : Modified in 10.1.39 +innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown +innodb.innodb-index : Modified in 10.1.39 +innodb.innodb-page_compression_default : MDEV-14121 - Assertion failure +innodb.innodb-page_compression_lzma : MDEV-14353 - Wrong result on Fedora 25 +innodb.innodb-page_compression_zip : MDEV-10641 - Mutex problem +innodb.innodb-system-table-view : Added in 10.1.41 +innodb.innodb-truncate : Modified in 10.1.39 +innodb.innodb-wl5980-debug : Added in 10.1.41 +innodb.innodb_bug14147491 : MDEV-11808 - Wrong error codes +innodb.innodb_bug30423 : MDEV-7311 - Wrong number of rows in the plan +innodb.innodb_bug48024 : MDEV-14352 - Assertion failure +innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result +innodb.innodb_monitor : MDEV-10939 - Testcase timeout +innodb.innodb_mysql : MDEV-19873 - Wrong result +innodb.innodb_stats : MDEV-10682 - Wrong result +innodb.innodb_sys_semaphore_waits : MDEV-10331 - Wrong result +innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks +innodb.log_file_size : MDEV-15668 - Not found pattern +innodb.recovery_shutdown : MDEV-15671 - Warning: database page corruption +innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace +innodb.table_definition_cache_debug : MDEV-14206 - Extra warning +innodb.table_flags : MDEV-19374 - Server failed to restart +innodb.trx_id_future : MDEV-20138 - Table doesn't exist in engine; added in 10.1.41 +innodb.xa_debug : Added in 10.1.39 +innodb.xa_recovery : MDEV-15279 - mysqld got exception -mariabackup.absolute_ibdata_paths : Modified in 10.1.39 -mariabackup.encrypted_page_compressed : Added in 10.1.38 -mariabackup.encrypted_page_corruption : Added in 10.1.38 -mariabackup.huge_lsn : Opt file modified in 10.1.38 -mariabackup.incremental_encrypted : MDEV-15667 - Timeout -mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.page_compression_level : Added in 10.1.39 -mariabackup.unencrypted_page_compressed : Added in 10.1.38 -mariabackup.xb_compressed_encrypted : MDEV-14812 - Segfault -mariabackup.xb_partition : MDEV-17584 - Crash on shutdown +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +innodb_fts.innodb-fts-fic : MDEV-14154 - Assertion failure +innodb_fts.innodb_ft_aux_table : Added in 10.1.41 +innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning + +#----------------------------------------------------------------------- + +maria.insert_select : MDEV-12757 - Timeout +maria.insert_select-7314 : MDEV-16492 - Timeout +maria.maria : MDEV-14430 - Wrong result + +#----------------------------------------------------------------------- + +mariabackup.absolute_ibdata_paths : Modified in 10.1.39 +mariabackup.apply-log-only : MDEV-20135 - Timeout +mariabackup.huge_lsn : MDEV-17286 - SSL error +mariabackup.incremental_encrypted : MDEV-15667 - Timeout +mariabackup.mdev-14447 : MDEV-15201 - Timeout +mariabackup.page_compression_level : Added in 10.1.39 +mariabackup.xb_compressed_encrypted : MDEV-14812 - Segfault +mariabackup.xb_partition : MDEV-17584 - Crash on shutdown + +#----------------------------------------------------------------------- mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha @@ -332,231 +341,256 @@ mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong resul mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - valgrind warnings mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result, MDEV-14807 - wrong error message -mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message + +#----------------------------------------------------------------------- multi_source.gtid : MDEV-10417 - Fails on Mips multi_source.info_logs : MDEV-10042 - Wrong result, MDEV-12629 - Valgrind warnings +multi_source.mdev-8874 : Added in 10.1.41 multi_source.multisource : MDEV-10417 - Fails on Mips multi_source.reset_slave : MDEV-10690 - wrong result multi_source.simple : MDEV-4633 - Wrong slave status output multi_source.status_vars : MDEV-4632 - failed while waiting for Slave_received_heartbeats -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query +parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query parts.partition_auto_increment_archive : MDEV-16491 - Table marked as crashed -parts.partition_auto_increment_maria : MDEV-14430 - Wrong result -parts.partition_auto_increment_max : Added in 10.1.39 -parts.partition_exch_qa_10 : MDEV-11765 - wrong result -parts.partition_innodb_status_file : MDEV-12901 - Valgrind +parts.partition_auto_increment_maria : MDEV-14430 - Wrong result +parts.partition_auto_increment_max : Added in 10.1.39 +parts.partition_exch_qa_10 : MDEV-11765 - wrong result +parts.partition_innodb_status_file : MDEV-12901 - Valgrind -#---------------------------------------------------------------- +#----------------------------------------------------------------------- perfschema.connect_attrs : MDEV-17283 - Wrong result -perfschema.dml_setup_instruments : Modified in 10.1.38 perfschema.func_file_io : MDEV-5708 - fails for s390x perfschema.func_mutex : MDEV-5708 - fails for s390x perfschema.hostcache_ipv6_ssl : MDEV-10696 - crash on shutdown perfschema.privilege_table_io : MDEV-13184 - Extra lines perfschema.rpl_gtid_func : MDEV-16897 - Wrong result -perfschema.socket_connect : Modified in 10.1.38 perfschema.socket_summary_by_event_name_func : MDEV-10622 - Socket summary tables do not match perfschema.stage_mdl_global : MDEV-11803 - wrong result on slow builders perfschema.stage_mdl_procedure : MDEV-11545 - Wrong result perfschema.stage_mdl_table : MDEV-12638 - Wrong result perfschema.threads_mysql : MDEV-10677 - sporadic wrong result -perfschema_stress.* : MDEV-10996 - tests not maintained +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +perfschema_stress.* : MDEV-10996 - tests not maintained + +#----------------------------------------------------------------------- plugins.feedback_plugin_send : MDEV-7932 - ssl failed for url plugins.pam : Modified in 10.1.39 plugins.server_audit : MDEV-9562 - crashes on sol10-sparc plugins.thread_pool_server_audit : MDEV-9562 - crashes on sol10-sparc -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -roles.create_and_grant_role : MDEV-11772 - wrong result -roles.flush_roles-17898 : Modified in 10.1.39 +roles.create_and_grant_role : MDEV-11772 - wrong result +roles.flush_roles-17898 : Modified in 10.1.39 -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free -rpl.kill_race_condition : MDEV-19370 - Wrong value for slave parameter; added in 10.1.39 -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_index : MDEV-9501 - Warning: failed registering on master -rpl.rpl_colSize : MDEV-16112 - Server crash -rpl.rpl_ddl : MDEV-10417 - Fails on Mips -rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result -rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors -rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Warnings/errors -rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start -rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output -rpl.rpl_gtid_basic : MDEV-10681 - server startup problem -rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master -rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout in include -rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings -rpl.rpl_gtid_reconnect : MDEV-14497 - Timeout -rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings -rpl.rpl_gtid_until : MDEV-10625 - warnings in error log -rpl.rpl_idempotency : Modified in 10.1.38 -rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips -rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_insert_id : MDEV-15197 - Wrong result -rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure -rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query -rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips -rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog -rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors -rpl.rpl_mdev6020 : MDEV-10417 - Fails on Mips -rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free +rpl.create_select : MDEV-14121 - Assertion failure +rpl.kill_race_condition : Modified in 10.1.41 +rpl.last_insert_id : MDEV-10625 - warnings in error log +rpl.mdev_17588 : MDEV-20137 - Table doesn't exist; added in 10.1.41 +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_index : MDEV-9501 - Warning: failed registering on master +rpl.rpl_blackhole : Modified in 10.1.41 +rpl.rpl_blackhole_row_annotate : Added in 10.1.41 +rpl.rpl_colSize : MDEV-16112 - Server crash +rpl.rpl_ddl : MDEV-10417 - Fails on Mips +rpl.rpl_domain_id_filter_io_crash : MDEV-14357 - Wrong result +rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Warnings/errors +rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Warnings/errors +rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start +rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output +rpl.rpl_gtid_basic : MDEV-10681 - server startup problem +rpl.rpl_gtid_crash : MDEV-9501 - Warning: failed registering on master +rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout in include +rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings +rpl.rpl_gtid_reconnect : MDEV-14497 - Timeout +rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings +rpl.rpl_gtid_until : MDEV-10625 - warnings in error log +rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips +rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_id : MDEV-15197 - Wrong result +rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure +rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query +rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_mariadb_slave_capability : MDEV-11018 - sporadic wrong events in binlog +rpl.rpl_mdev12179 : MDEV-19043 - Warnings/errors +rpl.rpl_mdev6020 : MDEV-10417 - Fails on Mips +rpl.rpl_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed rpl.rpl_non_direct_mixed_mixing_engines : MDEV-14489 - Sync slave with master failed -rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master pos wait -rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Sync slave with master failed -rpl.rpl_parallel : MDEV-10653 - Timeouts -rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure -rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout -rpl.rpl_parallel_optimistic : MDEV-10511 - Timeout -rpl.rpl_parallel_retry : MDEV-11119 - Server crash -rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables -rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips -rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings -rpl.rpl_rewrt_db : Modified in 10.1.39 -rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start -rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_big_table_id : Added in 10.1.38 -rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result -rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_img_eng_min : MDEV-13875 - command "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_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_uninstall_plugin : MDEV-7140 - Wrong plugin status -rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition -rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem -rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha -rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock -rpl.rpl_slave_invalid_external_user : Added in 10.1.39 -rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure -rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed -rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion -rpl.rpl_sync : MDEV-10633 - Database page corruption -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.sec_behind_master-5114 : MDEV-13878 - Wrong result +rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master pos wait +rpl.rpl_non_direct_stm_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_parallel : MDEV-10653 - Timeouts +rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure +rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout +rpl.rpl_parallel_optimistic : MDEV-10511 - Timeout +rpl.rpl_parallel_retry : MDEV-11119 - Server crash +rpl.rpl_parallel_temptable : MDEV-10356 - Crash in close_thread_tables +rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips +rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings +rpl.rpl_rewrt_db : Modified in 10.1.39 +rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start +rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result +rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_img_eng_min : MDEV-13875 - command "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 : Modified in 10.1.41 +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.1.41 +rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Wrong plugin status; modified in 10.1.41 +rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition +rpl.rpl_show_slave_hosts : MDEV-10681 - server startup problem +rpl.rpl_skip_replication : MDEV-9268 - Fails with timeout in sync_slave_with_master on Alpha +rpl.rpl_slave_grp_exec : MDEV-10514 - Unexpected deadlock +rpl.rpl_slave_invalid_external_user : Added in 10.1.39 +rpl.rpl_start_stop_slave : MDEV-13567 - Replication failure +rpl.rpl_stm_mixing_engines : MDEV-14489 - Sync slave with master failed +rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion +rpl.rpl_sync : MDEV-10633 - Database page corruption +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 - Syntax error in test +rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result -rpl/extra/rpl_tests.* : MDEV-10994 - tests not maintained +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc + +#----------------------------------------------------------------------- + +rpl/extra/rpl_tests.* : MDEV-10994 - tests not maintained + +#----------------------------------------------------------------------- + +sphinx.* : MDEV-10986 - Tests have not been maintained + +#----------------------------------------------------------------------- spider.* : MDEV-9329 - tests are too memory-consuming +#----------------------------------------------------------------------- + spider/bg.direct_aggregate : MDEV-7098 - Trying to unlock mutex that wasn't locked spider/bg.direct_aggregate_part : MDEV-7098 - Trying to unlock mutex that wasn't locked spider/bg.ha : MDEV-9329 - failures on s390x spider/bg.ha_part : MDEV-9329 - Fails on Ubuntu/s390x +spider/bg.spider3_fixes : MDEV-12639 - Packets out of order spider/bg.spider_fixes : MDEV-7098 -Mutex problem, MDEV-9329 - failures on s390x spider/bg.spider_fixes_part : MDEV-7098 - Trying to unlock mutex that wasn't locked -spider/bg.spider3_fixes : MDEV-12639 - Packets out of order spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x -spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained -sphinx.* : MDEV-10986 - Tests have not been maintained +#----------------------------------------------------------------------- -#---------------------------------------------------------------- +storage_engine.* : Tests are not always timely maintained -storage_engine* : Tests are not always timely maintained - -#---------------------------------------------------------------- +#----------------------------------------------------------------------- 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; modified in 10.1.38 -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 - wrong results -sys_vars.sql_low_priority_updates_func : Modified in 10.1.38 -sys_vars.table_definition_cache_basic : Modified in 10.1.38 -sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result -sys_vars.thread_stack_basic : Modified in 10.1.39 -sys_vars.transaction_prealloc_size_bug27322 : Modified in 10.1.39 -sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -sys_vars.wsrep_sst_method_basic : Modified in 10.1.38 +sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x +sys_vars.delayed_insert_limit_func : MDEV-17683 - Wrong result +sys_vars.innodb_ft_result_cache_limit_32 : Modified in 10.1.41 +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 - wrong results +sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result +sys_vars.thread_stack_basic : Modified in 10.1.39 +sys_vars.transaction_prealloc_size_bug27322 : Modified in 10.1.39 +sys_vars.wait_timeout_func : MDEV-12896 - Wrong result -#---------------------------------------------------------------- +#----------------------------------------------------------------------- -tokudb.change_column_all_1000_10 : MDEV-12640 - Crash -tokudb.change_column_bin : MDEV-12640 - Crash -tokudb.change_column_char : MDEV-12822 - Lost connection to MySQL server -tokudb.cluster_filter : MDEV-10678 - Wrong execution plan -tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan -tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan -tokudb.dir_per_db : MDEV-11537 - Wrong result +tokudb.change_column_all_1000_10 : MDEV-12640 - Crash +tokudb.change_column_bin : MDEV-12640 - Crash +tokudb.change_column_char : MDEV-12822 - Lost connection to MySQL server +tokudb.cluster_filter : MDEV-10678 - Wrong execution plan +tokudb.cluster_filter_hidden : MDEV-10678 - Wrong execution plan +tokudb.cluster_filter_unpack_varchar : MDEV-10636 - Wrong execution plan +tokudb.dir_per_db : MDEV-11537 - Wrong result tokudb.dir_per_db_rename_to_nonexisting_schema : MDEV-14359 - Directory not empty -tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash -tokudb.hotindex-insert-0 : MDEV-15271 - Timeout -tokudb.hotindex-insert-1 : MDEV-13870 - Lost connection to MySQL server -tokudb.hotindex-update-0 : MDEV-15198 - Timeout -tokudb.hotindex-update-1 : MDEV-12640 - Crash -tokudb.locks-select-update-1 : MDEV-13406 - Lock wait timeout -tokudb.rows-32m-rand-insert : MDEV-12640 - Crash -tokudb.rows-32m-seq-insert : MDEV-12640 - Crash -tokudb.savepoint-5 : MDEV-15280 - Wrong result -tokudb.type_datetime : MDEV-15193 - Wrong result +tokudb.hotindex-insert-0 : MDEV-15271 - Timeout +tokudb.hotindex-insert-1 : MDEV-13870 - Lost connection to MySQL server +tokudb.hotindex-insert-bigchar : MDEV-12640 - Crash +tokudb.hotindex-update-0 : MDEV-15198 - Timeout +tokudb.hotindex-update-1 : MDEV-12640 - Crash +tokudb.locks-select-update-1 : MDEV-13406 - Lock wait timeout +tokudb.rows-32m-rand-insert : MDEV-12640 - Crash +tokudb.rows-32m-seq-insert : MDEV-12640 - Crash +tokudb.savepoint-5 : MDEV-15280 - Wrong result +tokudb.type_datetime : MDEV-15193 - Wrong result -tokudb_backup.* : MDEV-11001 - tests don't work +#----------------------------------------------------------------------- -tokudb_bugs.PS-4979 : Added in 10.1.38 -tokudb_bugs.PS-5158 : Added in 10.1.39 -tokudb_bugs.PS-5163 : Added in 10.1.39 -tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output -tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output -tokudb_bugs.frm_store : MDEV-12823 - Valgrind -tokudb_bugs.frm_store2 : MDEV-12823 - Valgrind -tokudb_bugs.frm_store3 : MDEV-12823 - Valgrind -tokudb_bugs.xa : MDEV-11804 - Lock wait timeout +tokudb_backup.* : MDEV-11001 - tests don't work -tokudb_rpl.* : MDEV-11001 - tests don't work -tokudb_sys_vars.* : MDEV-11001 - tests don't work +#----------------------------------------------------------------------- -rpl-tokudb.* : MDEV-14354 - Tests fail with tcmalloc +tokudb_bugs.PS-5158 : Added in 10.1.39 +tokudb_bugs.PS-5163 : Added in 10.1.39 +tokudb_bugs.checkpoint_lock : MDEV-10637 - Wrong processlist output +tokudb_bugs.checkpoint_lock_3 : MDEV-10637 - Wrong processlist output +tokudb_bugs.frm_store : MDEV-12823 - Valgrind +tokudb_bugs.frm_store2 : MDEV-12823 - Valgrind +tokudb_bugs.frm_store3 : MDEV-12823 - Valgrind +tokudb_bugs.xa : MDEV-11804 - Lock wait timeout -#---------------------------------------------------------------- +#----------------------------------------------------------------------- + +tokudb_rpl.* : MDEV-11001 - tests don't work + +#----------------------------------------------------------------------- + +tokudb_sys_vars.* : MDEV-11001 - tests don't work + +#----------------------------------------------------------------------- unit.ma_pagecache_consist_64kRD : MDEV-19367 - AddressSanitizer CHECK failed unit.ma_pagecache_consist_64kWR : MDEV-19367 - AddressSanitizer CHECK failed unit.ma_test_loghandler : MDEV-10638 - record read not ok -#---------------------------------------------------------------- +#----------------------------------------------------------------------- vcol.not_supported : MDEV-10639 - Testcase timeout vcol.vcol_keys_innodb : MDEV-10639 - Testcase timeout vcol.vcol_misc : MDEV-16651 - Wrong error message vcol.wrong_arena : Modified in 10.1.39 -#---------------------------------------------------------------- +#----------------------------------------------------------------------- wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Failure upon check-testcase wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use wsrep.variables : MDEV-17585 - Deadlock -wsrep_info.plugin : MDEV-12909 - Wrong result +#----------------------------------------------------------------------- + +wsrep_info.* : Cnf file modified in 10.1.41 +wsrep_info.plugin : MDEV-12909 - Wrong result From 86767f4ac15db953c85a94ed81cd374c653e79dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 19:41:59 +0300 Subject: [PATCH 02/13] Remove unused ut_get_year_month_day() --- storage/innobase/include/ut0ut.h | 10 +-------- storage/innobase/ut/ut0ut.cc | 37 -------------------------------- storage/xtradb/include/ut0ut.h | 10 +-------- storage/xtradb/ut/ut0ut.cc | 37 -------------------------------- 4 files changed, 2 insertions(+), 92 deletions(-) diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index c087e70444d..b6e4d56d121 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2017, 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 @@ -343,15 +344,6 @@ void ut_sprintf_timestamp_without_extra_chars( /*=====================================*/ char* buf); /*!< in: buffer where to sprintf */ -/**********************************************************//** -Returns current year, month, day. */ -UNIV_INTERN -void -ut_get_year_month_day( -/*==================*/ - ulint* year, /*!< out: current year */ - ulint* month, /*!< out: month */ - ulint* day); /*!< out: day */ #else /* UNIV_HOTBACKUP */ /*************************************************************//** Runs an idle loop on CPU. The argument gives the desired delay diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 92250bf0ebf..a95a0c09726 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -344,43 +344,6 @@ ut_sprintf_timestamp_without_extra_chars( cal_tm_ptr->tm_sec); #endif } - -/**********************************************************//** -Returns current year, month, day. */ -UNIV_INTERN -void -ut_get_year_month_day( -/*==================*/ - ulint* year, /*!< out: current year */ - ulint* month, /*!< out: month */ - ulint* day) /*!< out: day */ -{ -#ifdef __WIN__ - SYSTEMTIME cal_tm; - - GetLocalTime(&cal_tm); - - *year = (ulint) cal_tm.wYear; - *month = (ulint) cal_tm.wMonth; - *day = (ulint) cal_tm.wDay; -#else - struct tm* cal_tm_ptr; - time_t tm; - -#ifdef HAVE_LOCALTIME_R - struct tm cal_tm; - time(&tm); - localtime_r(&tm, &cal_tm); - cal_tm_ptr = &cal_tm; -#else - time(&tm); - cal_tm_ptr = localtime(&tm); -#endif - *year = (ulint) cal_tm_ptr->tm_year + 1900; - *month = (ulint) cal_tm_ptr->tm_mon + 1; - *day = (ulint) cal_tm_ptr->tm_mday; -#endif -} #endif /* UNIV_HOTBACKUP */ #ifndef UNIV_HOTBACKUP diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h index 8bef1540255..1a378815c95 100644 --- a/storage/xtradb/include/ut0ut.h +++ b/storage/xtradb/include/ut0ut.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1994, 2017, 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 @@ -343,15 +344,6 @@ void ut_sprintf_timestamp_without_extra_chars( /*=====================================*/ char* buf); /*!< in: buffer where to sprintf */ -/**********************************************************//** -Returns current year, month, day. */ -UNIV_INTERN -void -ut_get_year_month_day( -/*==================*/ - ulint* year, /*!< out: current year */ - ulint* month, /*!< out: month */ - ulint* day); /*!< out: day */ #else /* UNIV_HOTBACKUP */ /*************************************************************//** Runs an idle loop on CPU. The argument gives the desired delay diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc index eda3921c5de..2aca4d4a3e0 100644 --- a/storage/xtradb/ut/ut0ut.cc +++ b/storage/xtradb/ut/ut0ut.cc @@ -368,43 +368,6 @@ ut_sprintf_timestamp_without_extra_chars( cal_tm_ptr->tm_sec); #endif } - -/**********************************************************//** -Returns current year, month, day. */ -UNIV_INTERN -void -ut_get_year_month_day( -/*==================*/ - ulint* year, /*!< out: current year */ - ulint* month, /*!< out: month */ - ulint* day) /*!< out: day */ -{ -#ifdef __WIN__ - SYSTEMTIME cal_tm; - - GetLocalTime(&cal_tm); - - *year = (ulint) cal_tm.wYear; - *month = (ulint) cal_tm.wMonth; - *day = (ulint) cal_tm.wDay; -#else - struct tm* cal_tm_ptr; - time_t tm; - -#ifdef HAVE_LOCALTIME_R - struct tm cal_tm; - time(&tm); - localtime_r(&tm, &cal_tm); - cal_tm_ptr = &cal_tm; -#else - time(&tm); - cal_tm_ptr = localtime(&tm); -#endif - *year = (ulint) cal_tm_ptr->tm_year + 1900; - *month = (ulint) cal_tm_ptr->tm_mon + 1; - *day = (ulint) cal_tm_ptr->tm_mday; -#endif -} #endif /* UNIV_HOTBACKUP */ #ifndef UNIV_HOTBACKUP From ab6dd774082c57f48d998e03655c06b672799b2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 19:43:37 +0300 Subject: [PATCH 03/13] MDEV-14154: Remove ut_time_us() Use microsecond_interval_timer() or my_interval_timer() [in nanoseconds] instead. --- storage/innobase/buf/buf0buddy.cc | 7 ++--- storage/innobase/fil/fil0crypt.cc | 21 +++++++-------- storage/innobase/handler/ha_innodb.cc | 15 ++++++----- storage/innobase/include/srv0mon.h | 4 +-- storage/innobase/include/ut0ut.h | 26 ------------------ storage/innobase/page/page0cur.cc | 10 +++---- storage/innobase/page/page0zip.cc | 12 ++++----- storage/innobase/srv/srv0srv.cc | 10 +++---- storage/innobase/trx/trx0i_s.cc | 38 ++++++++------------------- storage/innobase/ut/ut0ut.cc | 20 -------------- storage/xtradb/buf/buf0buddy.cc | 7 ++--- storage/xtradb/fil/fil0crypt.cc | 21 +++++++-------- storage/xtradb/handler/ha_innodb.cc | 15 ++++++----- storage/xtradb/include/srv0mon.h | 4 +-- storage/xtradb/include/ut0ut.h | 26 ------------------ storage/xtradb/page/page0cur.cc | 10 +++---- storage/xtradb/page/page0zip.cc | 12 ++++----- storage/xtradb/srv/srv0srv.cc | 10 +++---- storage/xtradb/trx/trx0i_s.cc | 37 ++++++++------------------ storage/xtradb/ut/ut0ut.cc | 20 -------------- 20 files changed, 94 insertions(+), 231 deletions(-) diff --git a/storage/innobase/buf/buf0buddy.cc b/storage/innobase/buf/buf0buddy.cc index df8cafd43dd..bcb935ff211 100644 --- a/storage/innobase/buf/buf0buddy.cc +++ b/storage/innobase/buf/buf0buddy.cc @@ -594,7 +594,7 @@ buf_buddy_relocate( if (buf_page_can_relocate(bpage)) { /* Relocate the compressed page. */ - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); ut_a(bpage->zip.data == src); @@ -612,11 +612,8 @@ buf_buddy_relocate( reinterpret_cast(src), i); buf_buddy_stat_t* buddy_stat = &buf_pool->buddy_stat[i]; - ++buddy_stat->relocated; - - buddy_stat->relocated_usec += ut_time_us(NULL) - usec; - + buddy_stat->relocated_usec+= (my_interval_timer() - ns) / 1000; return(true); } diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc index 4c1608d8788..43a3bd8ff29 100644 --- a/storage/innobase/fil/fil0crypt.cc +++ b/storage/innobase/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 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 @@ -1698,19 +1698,18 @@ fil_crypt_get_page_throttle_func( state->crypt_stat.pages_read_from_disk++; - ullint start = ut_time_us(NULL); + const ulonglong start = my_interval_timer(); block = buf_page_get_gen(space->id, zip_size, offset, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, file, line, mtr); - ullint end = ut_time_us(NULL); - - if (end < start) { - end = start; // safety... - } + const ulonglong end = my_interval_timer(); state->cnt_waited++; - state->sum_waited_us += (end - start); + + if (end > start) { + state->sum_waited_us += (end - start) / 1000; + } /* average page load */ ulint add_sleeptime_ms = 0; @@ -2032,7 +2031,7 @@ fil_crypt_flush_space( bool success = false; ulint n_pages = 0; ulint sum_pages = 0; - ullint start = ut_time_us(NULL); + const ulonglong start = my_interval_timer(); do { success = buf_flush_list(ULINT_MAX, end_lsn, &n_pages); @@ -2040,11 +2039,11 @@ fil_crypt_flush_space( sum_pages += n_pages; } while (!success && !space->is_stopping()); - ullint end = ut_time_us(NULL); + const ulonglong end = my_interval_timer(); if (sum_pages && end > start) { state->cnt_waited += sum_pages; - state->sum_waited_us += (end - start); + state->sum_waited_us += (end - start) / 1000; /* statistics */ state->crypt_stat.pages_flushed += sum_pages; diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index de9096c8fcb..b14fe261c13 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -1685,13 +1685,14 @@ innobase_srv_conc_enter_innodb( } else if (trx->mysql_thd != NULL && thd_is_replication_slave_thread(trx->mysql_thd)) { - - UT_WAIT_FOR( - srv_conc_get_active_threads() - < srv_thread_concurrency, - srv_replication_delay * 1000); - - } else { + const ulonglong end = my_interval_timer() + + ulonglong(srv_replication_delay) * 1000000; + while (srv_conc_get_active_threads() + >= srv_thread_concurrency + || my_interval_timer() >= end) { + os_thread_sleep(2000 /* 2 ms */); + } + } else { srv_conc_enter_innodb(trx); } } diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index 64a79bd4ed7..f321248f68a 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -2,7 +2,7 @@ Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -761,7 +761,7 @@ monitor counter MONITOR_CHECK_DEFINED(value); \ if (MONITOR_IS_ON(monitor)) { \ ullint old_time = (value); \ - value = ut_time_us(NULL); \ + value = microsecond_interval_timer(); \ MONITOR_VALUE(monitor) += (mon_type_t) (value - old_time);\ } diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index b6e4d56d121..42b70ae53f2 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -112,22 +112,6 @@ private: # define UT_LOW_PRIORITY_CPU() ((void)0) # define UT_RESUME_PRIORITY_CPU() ((void)0) # endif - -/*********************************************************************//** -Delays execution for at most max_wait_us microseconds or returns earlier -if cond becomes true. -@param cond in: condition to wait for; evaluated every 2 ms -@param max_wait_us in: maximum delay to wait, in microseconds */ -#define UT_WAIT_FOR(cond, max_wait_us) \ -do { \ - ullint start_us; \ - start_us = ut_time_us(NULL); \ - while (!(cond) \ - && ut_time_us(NULL) - start_us < (max_wait_us)) {\ - \ - os_thread_sleep(2000 /* 2 ms */); \ - } \ -} while (0) #endif /* !UNIV_HOTBACKUP */ template T ut_min(T a, T b) { return(a < b ? a : b); } @@ -274,16 +258,6 @@ ut_usectime( ulint* ms); /*!< out: microseconds since the Epoch+*sec */ /**********************************************************//** -Returns the number of microseconds since epoch. Similar to -time(3), the return value is also stored in *tloc, provided -that tloc is non-NULL. -@return us since epoch */ -UNIV_INTERN -ullint -ut_time_us( -/*=======*/ - ullint* tloc); /*!< out: us since epoch, if non-NULL */ -/**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic purposes. diff --git a/storage/innobase/page/page0cur.cc b/storage/innobase/page/page0cur.cc index 767ae5cbf88..e9ac4b4bb04 100644 --- a/storage/innobase/page/page0cur.cc +++ b/storage/innobase/page/page0cur.cc @@ -48,7 +48,7 @@ number between 0 and 2^64-1 inclusive. The formula and the constants being used are: X[n+1] = (a * X[n] + c) mod m where: -X[0] = ut_time_us(NULL) +X[0] = my_interval_timer() a = 1103515245 (3^5 * 5 * 7 * 129749) c = 12345 (3 * 5 * 823) m = 18446744073709551616 (2^64) @@ -61,12 +61,10 @@ page_cur_lcg_prng(void) { #define LCG_a 1103515245 #define LCG_c 12345 - static ib_uint64_t lcg_current = 0; - static ibool initialized = FALSE; + static uint64_t lcg_current; - if (!initialized) { - lcg_current = (ib_uint64_t) ut_time_us(NULL); - initialized = TRUE; + if (!lcg_current) { + lcg_current = my_interval_timer(); } /* no need to "% 2^64" explicitly because lcg_current is diff --git a/storage/innobase/page/page0zip.cc b/storage/innobase/page/page0zip.cc index a66b6d2c36c..233ccaa6a90 100644 --- a/storage/innobase/page/page0zip.cc +++ b/storage/innobase/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 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 @@ -1234,7 +1234,7 @@ page_zip_compress( ulint n_blobs = 0; byte* storage;/* storage of uncompressed columns */ #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ #ifdef PAGE_ZIP_COMPRESS_DBG FILE* logfile = NULL; @@ -1483,7 +1483,7 @@ err_exit: dict_index_zip_failure(index); } - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -1551,7 +1551,7 @@ err_exit: } #endif /* PAGE_ZIP_COMPRESS_DBG */ #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_ok++; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -3000,7 +3000,7 @@ page_zip_decompress( mem_heap_t* heap; ulint* offsets; #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ ut_ad(page_zip_simple_validate(page_zip)); @@ -3186,7 +3186,7 @@ err_exit: page_zip_fields_free(index); mem_heap_free(heap); #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const uint64_t time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].decompressed++; page_zip_stat[page_zip->ssize - 1].decompressed_usec += time_diff; diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 306249905c5..733d2c44692 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -2232,7 +2232,7 @@ srv_master_do_active_tasks(void) /*============================*/ { ib_time_t cur_time = ut_time(); - ullint counter_time = ut_time_us(NULL); + ulonglong counter_time = microsecond_interval_timer(); ulint n_evicted = 0; /* First do the tasks that we are suppose to do at each @@ -2261,7 +2261,7 @@ srv_master_do_active_tasks(void) /* Do an ibuf merge */ srv_main_thread_op_info = "doing insert buffer merge"; - counter_time = ut_time_us(NULL); + counter_time = microsecond_interval_timer(); ibuf_merge_in_background(false); MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time); @@ -2323,9 +2323,7 @@ void srv_master_do_idle_tasks(void) /*==========================*/ { - ullint counter_time; ulint n_evicted = 0; - ++srv_main_idle_loops; MONITOR_INC(MONITOR_MASTER_IDLE_LOOPS); @@ -2334,7 +2332,7 @@ srv_master_do_idle_tasks(void) /* ALTER TABLE in MySQL requires on Unix that the table handler can drop tables lazily after there no longer are SELECT queries to them. */ - counter_time = ut_time_us(NULL); + ulonglong counter_time = microsecond_interval_timer(); srv_main_thread_op_info = "doing background drop tables"; row_drop_tables_for_mysql_in_background(); MONITOR_INC_TIME_IN_MICRO_SECS( @@ -2351,7 +2349,7 @@ srv_master_do_idle_tasks(void) log_free_check(); /* Do an ibuf merge */ - counter_time = ut_time_us(NULL); + counter_time = microsecond_interval_timer(); srv_main_thread_op_info = "doing insert buffer merge"; ibuf_merge_in_background(true); MONITOR_INC_TIME_IN_MICRO_SECS( diff --git a/storage/innobase/trx/trx0i_s.cc b/storage/innobase/trx/trx0i_s.cc index 755a27fc521..57057f2f81e 100644 --- a/storage/innobase/trx/trx0i_s.cc +++ b/storage/innobase/trx/trx0i_s.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2012, 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 @@ -152,9 +153,8 @@ struct i_s_table_cache_t { struct trx_i_s_cache_t { rw_lock_t rw_lock; /*!< read-write lock protecting the rest of this structure */ - ullint last_read; /*!< last time the cache was read; - measured in microseconds since - epoch */ + ulonglong last_read; /*!< last time the cache was read; + measured in nanoseconds */ i_s_table_cache_t innodb_trx; /*!< innodb_trx table */ i_s_table_cache_t innodb_locks; /*!< innodb_locks table */ i_s_table_cache_t innodb_lock_waits;/*!< innodb_lock_waits table */ @@ -475,7 +475,7 @@ fill_trx_row( ut_ad(lock_mutex_own()); row->trx_id = trx->id; - row->trx_started = (ib_time_t) trx->start_time; + row->trx_started = trx->start_time; row->trx_state = trx_get_que_state_str(trx); row->requested_lock_row = requested_lock_row; ut_ad(requested_lock_row == NULL @@ -484,7 +484,7 @@ fill_trx_row( if (trx->lock.wait_lock != NULL) { ut_a(requested_lock_row != NULL); - row->trx_wait_started = (ib_time_t) trx->lock.wait_started; + row->trx_wait_started = trx->lock.wait_started; } else { ut_a(requested_lock_row == NULL); row->trx_wait_started = 0; @@ -1217,33 +1217,20 @@ add_trx_relevant_locks_to_cache( } /** The minimum time that a cache must not be updated after it has been -read for the last time; measured in microseconds. We use this technique +read for the last time; measured in nanoseconds. We use this technique to ensure that SELECTs which join several INFORMATION SCHEMA tables read the same version of the cache. */ -#define CACHE_MIN_IDLE_TIME_US 100000 /* 0.1 sec */ +#define CACHE_MIN_IDLE_TIME_NS 100000000 /* 0.1 sec */ /*******************************************************************//** Checks if the cache can safely be updated. -@return TRUE if can be updated */ -static -ibool -can_cache_be_updated( -/*=================*/ - trx_i_s_cache_t* cache) /*!< in: cache */ +@return whether the cache can be updated */ +static bool can_cache_be_updated(trx_i_s_cache_t* cache) { - ullint now; - #ifdef UNIV_SYNC_DEBUG ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX)); #endif - - now = ut_time_us(NULL); - if (now - cache->last_read > CACHE_MIN_IDLE_TIME_US) { - - return(TRUE); - } - - return(FALSE); + return my_interval_timer() - cache->last_read > CACHE_MIN_IDLE_TIME_NS; } /*******************************************************************//** @@ -1375,8 +1362,6 @@ trx_i_s_possibly_fetch_data_into_cache( /*===================================*/ trx_i_s_cache_t* cache) /*!< in/out: cache */ { - ullint now; - #ifdef UNIV_SYNC_DEBUG ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX)); #endif @@ -1399,8 +1384,7 @@ trx_i_s_possibly_fetch_data_into_cache( lock_mutex_exit(); /* update cache last read time */ - now = ut_time_us(NULL); - cache->last_read = now; + cache->last_read = my_interval_timer(); return(0); } diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index a95a0c09726..775d79de6ac 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -155,26 +155,6 @@ ut_usectime( return(ret); } -/**********************************************************//** -Returns the number of microseconds since epoch. Similar to -time(3), the return value is also stored in *tloc, provided -that tloc is non-NULL. -@return us since epoch */ -UNIV_INTERN -ullint -ut_time_us( -/*=======*/ - ullint* tloc) /*!< out: us since epoch, if non-NULL */ -{ - ullint us = my_interval_timer() / 1000; - - if (tloc != NULL) { - *tloc = us; - } - - return(us); -} - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic diff --git a/storage/xtradb/buf/buf0buddy.cc b/storage/xtradb/buf/buf0buddy.cc index a06d56a8d72..68629844067 100644 --- a/storage/xtradb/buf/buf0buddy.cc +++ b/storage/xtradb/buf/buf0buddy.cc @@ -612,7 +612,7 @@ buf_buddy_relocate( if (buf_page_can_relocate(bpage)) { /* Relocate the compressed page. */ - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); ut_a(bpage->zip.data == src); @@ -630,11 +630,8 @@ buf_buddy_relocate( reinterpret_cast(src), i); buf_buddy_stat_t* buddy_stat = &buf_pool->buddy_stat[i]; - ++buddy_stat->relocated; - - buddy_stat->relocated_usec += ut_time_us(NULL) - usec; - + buddy_stat->relocated_usec+= (my_interval_timer() - ns) / 1000; return(true); } diff --git a/storage/xtradb/fil/fil0crypt.cc b/storage/xtradb/fil/fil0crypt.cc index 4c1608d8788..43a3bd8ff29 100644 --- a/storage/xtradb/fil/fil0crypt.cc +++ b/storage/xtradb/fil/fil0crypt.cc @@ -1,6 +1,6 @@ /***************************************************************************** Copyright (C) 2013, 2015, Google Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2014, 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 @@ -1698,19 +1698,18 @@ fil_crypt_get_page_throttle_func( state->crypt_stat.pages_read_from_disk++; - ullint start = ut_time_us(NULL); + const ulonglong start = my_interval_timer(); block = buf_page_get_gen(space->id, zip_size, offset, RW_X_LATCH, NULL, BUF_GET_POSSIBLY_FREED, file, line, mtr); - ullint end = ut_time_us(NULL); - - if (end < start) { - end = start; // safety... - } + const ulonglong end = my_interval_timer(); state->cnt_waited++; - state->sum_waited_us += (end - start); + + if (end > start) { + state->sum_waited_us += (end - start) / 1000; + } /* average page load */ ulint add_sleeptime_ms = 0; @@ -2032,7 +2031,7 @@ fil_crypt_flush_space( bool success = false; ulint n_pages = 0; ulint sum_pages = 0; - ullint start = ut_time_us(NULL); + const ulonglong start = my_interval_timer(); do { success = buf_flush_list(ULINT_MAX, end_lsn, &n_pages); @@ -2040,11 +2039,11 @@ fil_crypt_flush_space( sum_pages += n_pages; } while (!success && !space->is_stopping()); - ullint end = ut_time_us(NULL); + const ulonglong end = my_interval_timer(); if (sum_pages && end > start) { state->cnt_waited += sum_pages; - state->sum_waited_us += (end - start); + state->sum_waited_us += (end - start) / 1000; /* statistics */ state->crypt_stat.pages_flushed += sum_pages; diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 495bf729744..2a0f1d5535b 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -1948,13 +1948,14 @@ innobase_srv_conc_enter_innodb( } else if (trx->mysql_thd != NULL && thd_is_replication_slave_thread(trx->mysql_thd)) { - - UT_WAIT_FOR( - srv_conc_get_active_threads() - < srv_thread_concurrency, - srv_replication_delay * 1000); - - } else { + const ulonglong end = my_interval_timer() + + ulonglong(srv_replication_delay) * 1000000; + while (srv_conc_get_active_threads() + >= srv_thread_concurrency + || my_interval_timer() >= end) { + os_thread_sleep(2000 /* 2 ms */); + } + } else { srv_conc_enter_innodb(trx); } } diff --git a/storage/xtradb/include/srv0mon.h b/storage/xtradb/include/srv0mon.h index 8d5bfad6f50..7a7902c3083 100644 --- a/storage/xtradb/include/srv0mon.h +++ b/storage/xtradb/include/srv0mon.h @@ -2,7 +2,7 @@ Copyright (c) 2010, 2013, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the @@ -761,7 +761,7 @@ monitor counter MONITOR_CHECK_DEFINED(value); \ if (MONITOR_IS_ON(monitor)) { \ ullint old_time = (value); \ - value = ut_time_us(NULL); \ + value = microsecond_interval_timer(); \ MONITOR_VALUE(monitor) += (mon_type_t) (value - old_time);\ } diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h index 1a378815c95..c5168acf3b2 100644 --- a/storage/xtradb/include/ut0ut.h +++ b/storage/xtradb/include/ut0ut.h @@ -109,22 +109,6 @@ private: # define UT_LOW_PRIORITY_CPU() ((void)0) # define UT_RESUME_PRIORITY_CPU() ((void)0) # endif - -/*********************************************************************//** -Delays execution for at most max_wait_us microseconds or returns earlier -if cond becomes true. -@param cond in: condition to wait for; evaluated every 2 ms -@param max_wait_us in: maximum delay to wait, in microseconds */ -#define UT_WAIT_FOR(cond, max_wait_us) \ -do { \ - ullint start_us; \ - start_us = ut_time_us(NULL); \ - while (!(cond) \ - && ut_time_us(NULL) - start_us < (max_wait_us)) {\ - \ - os_thread_sleep(2000 /* 2 ms */); \ - } \ -} while (0) #endif /* !UNIV_HOTBACKUP */ template T ut_min(T a, T b) { return(a < b ? a : b); } @@ -266,16 +250,6 @@ ut_usectime( ulint* ms); /*!< out: microseconds since the Epoch+*sec */ /**********************************************************//** -Returns the number of microseconds since epoch. Similar to -time(3), the return value is also stored in *tloc, provided -that tloc is non-NULL. -@return us since epoch */ -UNIV_INTERN -ullint -ut_time_us( -/*=======*/ - ullint* tloc); /*!< out: us since epoch, if non-NULL */ -/**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic purposes. diff --git a/storage/xtradb/page/page0cur.cc b/storage/xtradb/page/page0cur.cc index 767ae5cbf88..e9ac4b4bb04 100644 --- a/storage/xtradb/page/page0cur.cc +++ b/storage/xtradb/page/page0cur.cc @@ -48,7 +48,7 @@ number between 0 and 2^64-1 inclusive. The formula and the constants being used are: X[n+1] = (a * X[n] + c) mod m where: -X[0] = ut_time_us(NULL) +X[0] = my_interval_timer() a = 1103515245 (3^5 * 5 * 7 * 129749) c = 12345 (3 * 5 * 823) m = 18446744073709551616 (2^64) @@ -61,12 +61,10 @@ page_cur_lcg_prng(void) { #define LCG_a 1103515245 #define LCG_c 12345 - static ib_uint64_t lcg_current = 0; - static ibool initialized = FALSE; + static uint64_t lcg_current; - if (!initialized) { - lcg_current = (ib_uint64_t) ut_time_us(NULL); - initialized = TRUE; + if (!lcg_current) { + lcg_current = my_interval_timer(); } /* no need to "% 2^64" explicitly because lcg_current is diff --git a/storage/xtradb/page/page0zip.cc b/storage/xtradb/page/page0zip.cc index 852807dc239..0c7f9b6feff 100644 --- a/storage/xtradb/page/page0zip.cc +++ b/storage/xtradb/page/page0zip.cc @@ -2,7 +2,7 @@ Copyright (c) 2005, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 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 @@ -1240,7 +1240,7 @@ page_zip_compress( ulint n_blobs = 0; byte* storage;/* storage of uncompressed columns */ #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ #ifdef PAGE_ZIP_COMPRESS_DBG FILE* logfile = NULL; @@ -1489,7 +1489,7 @@ err_exit: dict_index_zip_failure(index); } - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -1557,7 +1557,7 @@ err_exit: } #endif /* PAGE_ZIP_COMPRESS_DBG */ #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const ullint time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].compressed_ok++; page_zip_stat[page_zip->ssize - 1].compressed_usec += time_diff; if (cmp_per_index_enabled) { @@ -3006,7 +3006,7 @@ page_zip_decompress( mem_heap_t* heap; ulint* offsets; #ifndef UNIV_HOTBACKUP - ullint usec = ut_time_us(NULL); + const ulonglong ns = my_interval_timer(); #endif /* !UNIV_HOTBACKUP */ ut_ad(page_zip_simple_validate(page_zip)); @@ -3192,7 +3192,7 @@ err_exit: page_zip_fields_free(index); mem_heap_free(heap); #ifndef UNIV_HOTBACKUP - ullint time_diff = ut_time_us(NULL) - usec; + const uint64_t time_diff = (my_interval_timer() - ns) / 1000; page_zip_stat[page_zip->ssize - 1].decompressed++; page_zip_stat[page_zip->ssize - 1].decompressed_usec += time_diff; diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index 2ea0d4ec110..f6e69618313 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -2903,7 +2903,7 @@ srv_master_do_active_tasks(void) /*============================*/ { ib_time_t cur_time = ut_time(); - ullint counter_time = ut_time_us(NULL); + ulonglong counter_time = microsecond_interval_timer(); ulint n_evicted = 0; /* First do the tasks that we are suppose to do at each @@ -2932,7 +2932,7 @@ srv_master_do_active_tasks(void) /* Do an ibuf merge */ srv_main_thread_op_info = "doing insert buffer merge"; - counter_time = ut_time_us(NULL); + counter_time = microsecond_interval_timer(); ibuf_merge_in_background(false); MONITOR_INC_TIME_IN_MICRO_SECS( MONITOR_SRV_IBUF_MERGE_MICROSECOND, counter_time); @@ -2994,9 +2994,7 @@ void srv_master_do_idle_tasks(void) /*==========================*/ { - ullint counter_time; ulint n_evicted = 0; - ++srv_main_idle_loops; MONITOR_INC(MONITOR_MASTER_IDLE_LOOPS); @@ -3005,7 +3003,7 @@ srv_master_do_idle_tasks(void) /* ALTER TABLE in MySQL requires on Unix that the table handler can drop tables lazily after there no longer are SELECT queries to them. */ - counter_time = ut_time_us(NULL); + ulonglong counter_time = microsecond_interval_timer(); srv_main_thread_op_info = "doing background drop tables"; row_drop_tables_for_mysql_in_background(); MONITOR_INC_TIME_IN_MICRO_SECS( @@ -3022,7 +3020,7 @@ srv_master_do_idle_tasks(void) log_free_check(); /* Do an ibuf merge */ - counter_time = ut_time_us(NULL); + counter_time = microsecond_interval_timer(); srv_main_thread_op_info = "doing insert buffer merge"; ibuf_merge_in_background(true); MONITOR_INC_TIME_IN_MICRO_SECS( diff --git a/storage/xtradb/trx/trx0i_s.cc b/storage/xtradb/trx/trx0i_s.cc index fc6a1a1919a..16b91a6b2a8 100644 --- a/storage/xtradb/trx/trx0i_s.cc +++ b/storage/xtradb/trx/trx0i_s.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2012, 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 @@ -152,9 +153,8 @@ struct i_s_table_cache_t { struct trx_i_s_cache_t { rw_lock_t rw_lock; /*!< read-write lock protecting the rest of this structure */ - ullint last_read; /*!< last time the cache was read; - measured in microseconds since - epoch */ + ulonglong last_read; /*!< last time the cache was read; + measured in nanoseconds */ ib_mutex_t last_read_mutex;/*!< mutex protecting the last_read member - it is updated inside a shared lock of the @@ -479,7 +479,7 @@ fill_trx_row( ut_ad(lock_mutex_own()); row->trx_id = trx->id; - row->trx_started = (ib_time_t) trx->start_time; + row->trx_started = trx->start_time; row->trx_state = trx_get_que_state_str(trx); row->requested_lock_row = requested_lock_row; ut_ad(requested_lock_row == NULL @@ -488,7 +488,7 @@ fill_trx_row( if (trx->lock.wait_lock != NULL) { ut_a(requested_lock_row != NULL); - row->trx_wait_started = (ib_time_t) trx->lock.wait_started; + row->trx_wait_started = trx->lock.wait_started; } else { ut_a(requested_lock_row == NULL); row->trx_wait_started = 0; @@ -1221,22 +1221,16 @@ add_trx_relevant_locks_to_cache( } /** The minimum time that a cache must not be updated after it has been -read for the last time; measured in microseconds. We use this technique +read for the last time; measured in nanoseconds. We use this technique to ensure that SELECTs which join several INFORMATION SCHEMA tables read the same version of the cache. */ -#define CACHE_MIN_IDLE_TIME_US 100000 /* 0.1 sec */ +#define CACHE_MIN_IDLE_TIME_NS 100000000 /* 0.1 sec */ /*******************************************************************//** Checks if the cache can safely be updated. -@return TRUE if can be updated */ -static -ibool -can_cache_be_updated( -/*=================*/ - trx_i_s_cache_t* cache) /*!< in: cache */ +@return whether the cache can be updated */ +static bool can_cache_be_updated(trx_i_s_cache_t* cache) { - ullint now; - /* Here we read cache->last_read without acquiring its mutex because last_read is only updated when a shared rw lock on the whole cache is being held (see trx_i_s_cache_end_read()) and @@ -1247,14 +1241,7 @@ can_cache_be_updated( #ifdef UNIV_SYNC_DEBUG ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_EX)); #endif - - now = ut_time_us(NULL); - if (now - cache->last_read > CACHE_MIN_IDLE_TIME_US) { - - return(TRUE); - } - - return(FALSE); + return my_interval_timer() - cache->last_read > CACHE_MIN_IDLE_TIME_NS; } /*******************************************************************//** @@ -1497,14 +1484,12 @@ trx_i_s_cache_end_read( /*===================*/ trx_i_s_cache_t* cache) /*!< in: cache */ { - ullint now; - #ifdef UNIV_SYNC_DEBUG ut_a(rw_lock_own(&cache->rw_lock, RW_LOCK_SHARED)); #endif /* update cache last read time */ - now = ut_time_us(NULL); + const ulonglong now = my_interval_timer(); mutex_enter(&cache->last_read_mutex); cache->last_read = now; mutex_exit(&cache->last_read_mutex); diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc index 2aca4d4a3e0..0cdc618a8c4 100644 --- a/storage/xtradb/ut/ut0ut.cc +++ b/storage/xtradb/ut/ut0ut.cc @@ -179,26 +179,6 @@ ut_usectime( return(ret); } -/**********************************************************//** -Returns the number of microseconds since epoch. Similar to -time(3), the return value is also stored in *tloc, provided -that tloc is non-NULL. -@return us since epoch */ -UNIV_INTERN -ullint -ut_time_us( -/*=======*/ - ullint* tloc) /*!< out: us since epoch, if non-NULL */ -{ - ullint us = my_interval_timer() / 1000; - - if (tloc != NULL) { - *tloc = us; - } - - return(us); -} - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic From e764d5bc012beacc1ed26c9022829423829b621d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 19:48:38 +0300 Subject: [PATCH 04/13] Correct the type of a parameter --- storage/innobase/include/ut0wqueue.h | 2 +- storage/innobase/ut/ut0wqueue.cc | 2 +- storage/xtradb/include/ut0wqueue.h | 2 +- storage/xtradb/ut/ut0wqueue.cc | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/storage/innobase/include/ut0wqueue.h b/storage/innobase/include/ut0wqueue.h index f42b444160c..b81b78530ca 100644 --- a/storage/innobase/include/ut0wqueue.h +++ b/storage/innobase/include/ut0wqueue.h @@ -89,7 +89,7 @@ ib_wqueue_timedwait( /*================*/ /* out: work item or NULL on timeout*/ ib_wqueue_t* wq, /* in: work queue */ - ib_time_t wait_in_usecs); /* in: wait time in micro seconds */ + ulint wait_in_usecs); /* in: wait time in micro seconds */ /******************************************************************** Return first item on work queue or NULL if queue is empty diff --git a/storage/innobase/ut/ut0wqueue.cc b/storage/innobase/ut/ut0wqueue.cc index e6fff7aa044..f8ba9fd3035 100644 --- a/storage/innobase/ut/ut0wqueue.cc +++ b/storage/innobase/ut/ut0wqueue.cc @@ -127,7 +127,7 @@ ib_wqueue_timedwait( /*================*/ /* out: work item or NULL on timeout*/ ib_wqueue_t* wq, /* in: work queue */ - ib_time_t wait_in_usecs) /* in: wait time in micro seconds */ + ulint wait_in_usecs) /* in: wait time in micro seconds */ { ib_list_node_t* node = NULL; diff --git a/storage/xtradb/include/ut0wqueue.h b/storage/xtradb/include/ut0wqueue.h index 4d177538c69..9bd58609205 100644 --- a/storage/xtradb/include/ut0wqueue.h +++ b/storage/xtradb/include/ut0wqueue.h @@ -89,7 +89,7 @@ ib_wqueue_timedwait( /*================*/ /* out: work item or NULL on timeout*/ ib_wqueue_t* wq, /* in: work queue */ - ib_time_t wait_in_usecs); /* in: wait time in micro seconds */ + ulint wait_in_usecs); /* in: wait time in micro seconds */ /******************************************************************** Return first item on work queue or NULL if queue is empty diff --git a/storage/xtradb/ut/ut0wqueue.cc b/storage/xtradb/ut/ut0wqueue.cc index e6fff7aa044..f8ba9fd3035 100644 --- a/storage/xtradb/ut/ut0wqueue.cc +++ b/storage/xtradb/ut/ut0wqueue.cc @@ -127,7 +127,7 @@ ib_wqueue_timedwait( /*================*/ /* out: work item or NULL on timeout*/ ib_wqueue_t* wq, /* in: work queue */ - ib_time_t wait_in_usecs) /* in: wait time in micro seconds */ + ulint wait_in_usecs) /* in: wait time in micro seconds */ { ib_list_node_t* node = NULL; From 10ee1b95b80ef1dc2fd3142e04f6031cc8be9e9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 20:02:07 +0300 Subject: [PATCH 05/13] Remove ut_usectime(), ut_gettimeofday() Replace ut_usectime() with my_interval_timer(), which is equivalent, but monotonically counting nanoseconds instead of counting the microseconds of real time. os_event_wait_time_low(): Use my_hrtime() instead of ut_usectime(). FIXME: Set a clock attribute on the condition variable that allows a monotonic clock to be chosen as the time base, so that the wait is immune to adjustments of the system clock. --- storage/innobase/include/ut0ut.h | 13 --- storage/innobase/lock/lock0wait.cc | 46 ++++------- storage/innobase/os/os0sync.cc | 26 +----- storage/innobase/ut/ut0ut.cc | 96 ---------------------- storage/xtradb/buf/buf0buf.cc | 51 ++++-------- storage/xtradb/handler/ha_innodb.cc | 8 -- storage/xtradb/include/trx0trx.h | 2 +- storage/xtradb/include/ut0ut.h | 22 ----- storage/xtradb/lock/lock0lock.cc | 10 +-- storage/xtradb/lock/lock0wait.cc | 46 ++++------- storage/xtradb/os/os0file.cc | 26 ++---- storage/xtradb/os/os0sync.cc | 26 +----- storage/xtradb/que/que0que.cc | 10 +-- storage/xtradb/srv/srv0conc.cc | 16 ++-- storage/xtradb/trx/trx0trx.cc | 14 +--- storage/xtradb/ut/ut0ut.cc | 119 ---------------------------- 16 files changed, 74 insertions(+), 457 deletions(-) diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 42b70ae53f2..675cca9afd2 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -244,19 +244,6 @@ ib_time_t ut_time(void); /*=========*/ #ifndef UNIV_HOTBACKUP -/**********************************************************//** -Returns system time. -Upon successful completion, the value 0 is returned; otherwise the -value -1 is returned and the global variable errno is set to indicate the -error. -@return 0 on success, -1 otherwise */ -UNIV_INTERN -int -ut_usectime( -/*========*/ - ulint* sec, /*!< out: seconds since the Epoch */ - ulint* ms); /*!< out: microseconds since the Epoch+*sec */ - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 218c27ed121..5d6db2f171a 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 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 @@ -230,10 +230,6 @@ lock_wait_suspend_thread( trx_t* trx; ulint had_dict_lock; ibool was_declared_inside_innodb; - ib_int64_t start_time = 0; - ib_int64_t finish_time; - ulint sec; - ulint ms; ulong lock_wait_timeout; trx = thr_get_trx(thr); @@ -279,15 +275,12 @@ lock_wait_suspend_thread( lock_wait_mutex_exit(); trx_mutex_exit(trx); + ulonglong start_time = 0; + if (thr->lock_state == QUE_THR_LOCK_ROW) { srv_stats.n_lock_wait_count.inc(); srv_stats.n_lock_wait_current_count.inc(); - - if (ut_usectime(&sec, &ms) == -1) { - start_time = -1; - } else { - start_time = (ib_int64_t) sec * 1000000 + ms; - } + start_time = my_interval_timer(); } ulint lock_type = ULINT_UNDEFINED; @@ -374,32 +367,25 @@ lock_wait_suspend_thread( lock_wait_table_release_slot(slot); if (thr->lock_state == QUE_THR_LOCK_ROW) { - ulint diff_time; - - if (ut_usectime(&sec, &ms) == -1) { - finish_time = -1; - } else { - finish_time = (ib_int64_t) sec * 1000000 + ms; - } - - diff_time = (finish_time > start_time) ? - (ulint) (finish_time - start_time) : 0; - srv_stats.n_lock_wait_current_count.dec(); - srv_stats.n_lock_wait_time.add(diff_time); - /* Only update the variable if we successfully - retrieved the start and finish times. See Bug#36819. */ - if (diff_time > lock_sys->n_lock_max_wait_time - && start_time != -1 - && finish_time != -1) { + const ulonglong finish_time = my_interval_timer(); + ulint diff_time; - lock_sys->n_lock_max_wait_time = diff_time; + if (finish_time < start_time) { + diff_time = 0; + } else { + diff_time = ulint((finish_time - start_time) / 1000); + srv_stats.n_lock_wait_time.add(diff_time); + /* Only update the variable if we successfully + retrieved the start and finish times. See Bug#36819. */ + if (diff_time > lock_sys->n_lock_max_wait_time) { + lock_sys->n_lock_max_wait_time = diff_time; + } } /* Record the lock wait time for this thread */ thd_set_lock_wait_time(trx->mysql_thd, diff_time); - } if (lock_wait_timeout < 100000000 diff --git a/storage/innobase/os/os0sync.cc b/storage/innobase/os/os0sync.cc index 0fd2935a2ae..fadc9e877ba 100644 --- a/storage/innobase/os/os0sync.cc +++ b/storage/innobase/os/os0sync.cc @@ -72,9 +72,6 @@ UNIV_INTERN ulint os_event_count = 0; UNIV_INTERN ulint os_mutex_count = 0; UNIV_INTERN ulint os_fast_mutex_count = 0; -/* The number of microsecnds in a second. */ -static const ulint MICROSECS_IN_A_SECOND = 1000000; - #ifdef UNIV_PFS_MUTEX UNIV_INTERN mysql_pfs_key_t event_os_mutex_key; UNIV_INTERN mysql_pfs_key_t os_mutex_key; @@ -654,26 +651,9 @@ os_event_wait_time_low( struct timespec abstime; if (time_in_usec != OS_SYNC_INFINITE_TIME) { - struct timeval tv; - int ret; - ulint sec; - ulint usec; - - ret = ut_usectime(&sec, &usec); - ut_a(ret == 0); - - tv.tv_sec = sec; - tv.tv_usec = usec; - - tv.tv_usec += time_in_usec; - - if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) { - tv.tv_sec += tv.tv_usec / MICROSECS_IN_A_SECOND; - tv.tv_usec %= MICROSECS_IN_A_SECOND; - } - - abstime.tv_sec = tv.tv_sec; - abstime.tv_nsec = tv.tv_usec * 1000; + ulonglong usec = ulonglong(time_in_usec) + my_hrtime().val; + abstime.tv_sec = usec / 1000000; + abstime.tv_nsec = (usec % 1000000) * 1000; } else { abstime.tv_nsec = 999999999; abstime.tv_sec = (time_t) ULINT_MAX; diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 775d79de6ac..95a7957579e 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -46,60 +46,6 @@ Created 5/11/1994 Heikki Tuuri # include #endif /* UNIV_HOTBACKUP */ -#ifdef __WIN__ -typedef VOID(WINAPI *time_fn)(LPFILETIME); -static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime; - -/*****************************************************************//** -NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix -epoch starts from 1970/1/1. For selection of constant see: -http://support.microsoft.com/kb/167296/ */ -#define WIN_TO_UNIX_DELTA_USEC ((ib_int64_t) 11644473600000000ULL) - - -/*****************************************************************//** -This is the Windows version of gettimeofday(2). -@return 0 if all OK else -1 */ -static -int -ut_gettimeofday( -/*============*/ - struct timeval* tv, /*!< out: Values are relative to Unix epoch */ - void* tz) /*!< in: not used */ -{ - FILETIME ft; - ib_int64_t tm; - - if (!tv) { - errno = EINVAL; - return(-1); - } - - ut_get_system_time_as_file_time(&ft); - - tm = (ib_int64_t) ft.dwHighDateTime << 32; - tm |= ft.dwLowDateTime; - - ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10 - does not work */ - - tm /= 10; /* Convert from 100 nsec periods to usec */ - - /* If we don't convert to the Unix epoch the value for - struct timeval::tv_sec will overflow.*/ - tm -= WIN_TO_UNIX_DELTA_USEC; - - tv->tv_sec = (long) (tm / 1000000L); - tv->tv_usec = (long) (tm % 1000000L); - - return(0); -} -#else -/** An alias for gettimeofday(2). On Microsoft Windows, we have to -reimplement this function. */ -#define ut_gettimeofday gettimeofday -#endif - /**********************************************************//** Returns system time. We do not specify the format of the time returned: the only way to manipulate it is to use the function ut_difftime. @@ -113,48 +59,6 @@ ut_time(void) } #ifndef UNIV_HOTBACKUP -/**********************************************************//** -Returns system time. -Upon successful completion, the value 0 is returned; otherwise the -value -1 is returned and the global variable errno is set to indicate the -error. -@return 0 on success, -1 otherwise */ -UNIV_INTERN -int -ut_usectime( -/*========*/ - ulint* sec, /*!< out: seconds since the Epoch */ - ulint* ms) /*!< out: microseconds since the Epoch+*sec */ -{ - struct timeval tv; - int ret; - int errno_gettimeofday; - int i; - - for (i = 0; i < 10; i++) { - - ret = ut_gettimeofday(&tv, NULL); - - if (ret == -1) { - errno_gettimeofday = errno; - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: gettimeofday(): %s\n", - strerror(errno_gettimeofday)); - os_thread_sleep(100000); /* 0.1 sec */ - errno = errno_gettimeofday; - } else { - break; - } - } - - if (ret != -1) { - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; - } - - return(ret); -} - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 3326f734e45..0f83e7ce011 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -2485,10 +2485,6 @@ buf_page_get_zip( ibool discard_attempted = FALSE; ibool must_read; trx_t* trx = NULL; - ulint sec; - ulint ms; - ib_uint64_t start_time; - ib_uint64_t finish_time; buf_pool_t* buf_pool = buf_pool_get(space, offset); if (UNIV_UNLIKELY(innobase_get_slow_log())) { @@ -2607,14 +2603,10 @@ got_block: if (must_read) { /* Let us wait until the read operation completes */ - - if (UNIV_UNLIKELY(trx && trx->take_stats)) - { - ut_usectime(&sec, &ms); - start_time = (ib_uint64_t)sec * 1000000 + ms; - } else { - start_time = 0; - } + const ulonglong start_time = UNIV_UNLIKELY(trx + && trx->take_stats) + ? my_interval_timer() + : 0; for (;;) { enum buf_io_fix io_fix; @@ -2629,11 +2621,9 @@ got_block: break; } } - if (UNIV_UNLIKELY(start_time != 0)) - { - ut_usectime(&sec, &ms); - finish_time = (ib_uint64_t)sec * 1000000 + ms; - trx->io_reads_wait_timer += (ulint)(finish_time - start_time); + if (UNIV_UNLIKELY(start_time != 0)) { + trx->io_reads_wait_timer += ulint( + (my_interval_timer() - start_time) / 1000); } } @@ -3013,21 +3003,13 @@ buf_wait_for_read(buf_block_t* block, trx_t* trx) if (buf_block_get_io_fix_unlocked(block) == BUF_IO_READ) { - ib_uint64_t start_time; - ulint sec; - ulint ms; - /* Wait until the read operation completes */ ib_mutex_t* mutex = buf_page_get_mutex(&block->page); - - if (UNIV_UNLIKELY(trx && trx->take_stats)) - { - ut_usectime(&sec, &ms); - start_time = (ib_uint64_t)sec * 1000000 + ms; - } else { - start_time = 0; - } + const ulonglong start_time = UNIV_UNLIKELY(trx + && trx->take_stats) + ? my_interval_timer() + : 0; for (;;) { buf_io_fix io_fix; @@ -3047,15 +3029,10 @@ buf_wait_for_read(buf_block_t* block, trx_t* trx) } } - if (UNIV_UNLIKELY(start_time != 0)) - { - ut_usectime(&sec, &ms); - ib_uint64_t finish_time - = (ib_uint64_t)sec * 1000000 + ms; - trx->io_reads_wait_timer - += (ulint)(finish_time - start_time); + if (UNIV_UNLIKELY(start_time != 0)) { + trx->io_reads_wait_timer += ulint( + (my_interval_timer() - start_time) / 1000); } - } } diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 2a0f1d5535b..4a39a0a9c4d 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -4577,14 +4577,6 @@ innobase_change_buffering_inited_ok: /* Turn on monitor counters that are default on */ srv_mon_default_on(); -#ifndef UNIV_HOTBACKUP -#ifdef _WIN32 - if (ut_win_init_time()) { - goto mem_free_and_error; - } -#endif /* _WIN32 */ -#endif /* !UNIV_HOTBACKUP */ - DBUG_RETURN(FALSE); error: DBUG_RETURN(TRUE); diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index 4b9662ada1e..f355ef4fcf4 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -1102,7 +1102,7 @@ struct trx_t{ ulint io_reads; ib_uint64_t io_read; ulint io_reads_wait_timer; - ib_uint64_t lock_que_wait_ustarted; + ulonglong lock_que_wait_nstarted; ulint lock_que_wait_timer; ulint innodb_que_wait_timer; ulint distinct_page_access; diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h index c5168acf3b2..db05fd7ce13 100644 --- a/storage/xtradb/include/ut0ut.h +++ b/storage/xtradb/include/ut0ut.h @@ -236,19 +236,6 @@ ib_time_t ut_time(void); /*=========*/ #ifndef UNIV_HOTBACKUP -/**********************************************************//** -Returns system time. -Upon successful completion, the value 0 is returned; otherwise the -value -1 is returned and the global variable errno is set to indicate the -error. -@return 0 on success, -1 otherwise */ -UNIV_INTERN -int -ut_usectime( -/*========*/ - ulint* sec, /*!< out: seconds since the Epoch */ - ulint* ms); /*!< out: microseconds since the Epoch+*sec */ - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic @@ -258,15 +245,6 @@ UNIV_INTERN ulint ut_time_ms(void); /*============*/ -#ifdef _WIN32 -/**********************************************************//** -Initialise highest available time resolution API on Windows -@return 0 if all OK else -1 */ -int -ut_win_init_time(); - -#endif /* _WIN32 */ - #endif /* !UNIV_HOTBACKUP */ /**********************************************************//** diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 41fda2df0d8..27a857b26a8 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -2448,8 +2448,6 @@ lock_rec_enqueue_waiting( trx_t* trx; lock_t* lock; trx_id_t victim_trx_id; - ulint sec; - ulint ms; ulint space; ulint page_no; dberr_t err; @@ -2535,8 +2533,7 @@ lock_rec_enqueue_waiting( trx->lock.wait_started = ut_time(); if (UNIV_UNLIKELY(trx->take_stats)) { - ut_usectime(&sec, &ms); - trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms; + trx->lock_que_wait_nstarted = my_interval_timer(); } ut_a(que_thr_stop(thr)); @@ -5205,8 +5202,6 @@ lock_table_enqueue_waiting( trx_t* trx; lock_t* lock; trx_id_t victim_trx_id; - ulint sec; - ulint ms; ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); @@ -5290,8 +5285,7 @@ lock_table_enqueue_waiting( trx->n_table_lock_waits++; if (UNIV_UNLIKELY(trx->take_stats)) { - ut_usectime(&sec, &ms); - trx->lock_que_wait_ustarted = (ib_uint64_t)sec * 1000000 + ms; + trx->lock_que_wait_nstarted = my_interval_timer(); } ut_a(que_thr_stop(thr)); diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index c65b127f339..e9ef6d9d605 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2014, 2017, MariaDB Corporation. +Copyright (c) 2014, 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 @@ -284,10 +284,6 @@ lock_wait_suspend_thread( trx_t* trx; ulint had_dict_lock; ibool was_declared_inside_innodb; - ib_int64_t start_time = 0; - ib_int64_t finish_time; - ulint sec; - ulint ms; ulong lock_wait_timeout; blocking_trx_info blocking[MAX_BLOCKING_TRX_IN_REPORT]; size_t blocking_count = 0; @@ -335,15 +331,12 @@ lock_wait_suspend_thread( lock_wait_mutex_exit(); trx_mutex_exit(trx); + ulonglong start_time = 0; + if (thr->lock_state == QUE_THR_LOCK_ROW) { srv_stats.n_lock_wait_count.inc(); srv_stats.n_lock_wait_current_count.inc(); - - if (ut_usectime(&sec, &ms) == -1) { - start_time = -1; - } else { - start_time = (ib_int64_t) sec * 1000000 + ms; - } + start_time = my_interval_timer(); } ulint lock_type = ULINT_UNDEFINED; @@ -430,32 +423,25 @@ lock_wait_suspend_thread( lock_wait_table_release_slot(slot); if (thr->lock_state == QUE_THR_LOCK_ROW) { - ulint diff_time; - - if (ut_usectime(&sec, &ms) == -1) { - finish_time = -1; - } else { - finish_time = (ib_int64_t) sec * 1000000 + ms; - } - - diff_time = (finish_time > start_time) ? - (ulint) (finish_time - start_time) : 0; - srv_stats.n_lock_wait_current_count.dec(); - srv_stats.n_lock_wait_time.add(diff_time); - /* Only update the variable if we successfully - retrieved the start and finish times. See Bug#36819. */ - if (diff_time > lock_sys->n_lock_max_wait_time - && start_time != -1 - && finish_time != -1) { + const ulonglong finish_time = my_interval_timer(); + ulint diff_time; - lock_sys->n_lock_max_wait_time = diff_time; + if (finish_time < start_time) { + diff_time = 0; + } else { + diff_time = ulint((finish_time - start_time) / 1000); + srv_stats.n_lock_wait_time.add(diff_time); + /* Only update the variable if we successfully + retrieved the start and finish times. See Bug#36819. */ + if (diff_time > lock_sys->n_lock_max_wait_time) { + lock_sys->n_lock_max_wait_time = diff_time; + } } /* Record the lock wait time for this thread */ thd_set_lock_wait_time(trx->mysql_thd, diff_time); - } if (lock_wait_timeout < 100000000 diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index da5e8927320..0cd5aff4e94 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -2968,10 +2968,6 @@ os_file_pread( trx_t* trx) { off_t offs; - ulint sec; - ulint ms; - ib_uint64_t start_time; - ib_uint64_t finish_time; ut_ad(n); @@ -2988,15 +2984,9 @@ os_file_pread( os_n_file_reads++; - if (UNIV_UNLIKELY(trx && trx->take_stats)) - { - trx->io_reads++; - trx->io_read += n; - ut_usectime(&sec, &ms); - start_time = (ib_uint64_t)sec * 1000000 + ms; - } else { - start_time = 0; - } + const ulonglong start_time = UNIV_UNLIKELY(trx && trx->take_stats) + ? my_interval_timer() + : 0; const bool monitor = MONITOR_IS_ON(MONITOR_OS_PENDING_READS); #ifdef HAVE_PREAD @@ -3022,9 +3012,8 @@ os_file_pread( if (UNIV_UNLIKELY(start_time != 0)) { - ut_usectime(&sec, &ms); - finish_time = (ib_uint64_t)sec * 1000000 + ms; - trx->io_reads_wait_timer += (ulint)(finish_time - start_time); + trx->io_reads_wait_timer += ulint((my_interval_timer() + - start_time) / 1000); } return(n_bytes); @@ -3071,9 +3060,8 @@ os_file_pread( if (UNIV_UNLIKELY(start_time != 0) { - ut_usectime(&sec, &ms); - finish_time = (ib_uint64_t)sec * 1000000 + ms; - trx->io_reads_wait_timer += (ulint)(finish_time - start_time); + trx->io_reads_wait_timer += ulint( + (my_interval_timer() - start_time) / 1000); } return(ret); diff --git a/storage/xtradb/os/os0sync.cc b/storage/xtradb/os/os0sync.cc index e8597554170..e409529f132 100644 --- a/storage/xtradb/os/os0sync.cc +++ b/storage/xtradb/os/os0sync.cc @@ -59,9 +59,6 @@ UNIV_INTERN ulint os_event_count = 0; UNIV_INTERN ulint os_mutex_count = 0; UNIV_INTERN ulint os_fast_mutex_count = 0; -/* The number of microsecnds in a second. */ -static const ulint MICROSECS_IN_A_SECOND = 1000000; - #ifdef UNIV_PFS_MUTEX UNIV_INTERN mysql_pfs_key_t event_os_mutex_key; UNIV_INTERN mysql_pfs_key_t os_mutex_key; @@ -539,26 +536,9 @@ os_event_wait_time_low( struct timespec abstime; if (time_in_usec != OS_SYNC_INFINITE_TIME) { - struct timeval tv; - int ret; - ulint sec; - ulint usec; - - ret = ut_usectime(&sec, &usec); - ut_a(ret == 0); - - tv.tv_sec = sec; - tv.tv_usec = usec; - - tv.tv_usec += time_in_usec; - - if ((ulint) tv.tv_usec >= MICROSECS_IN_A_SECOND) { - tv.tv_sec += tv.tv_usec / MICROSECS_IN_A_SECOND; - tv.tv_usec %= MICROSECS_IN_A_SECOND; - } - - abstime.tv_sec = tv.tv_sec; - abstime.tv_nsec = tv.tv_usec * 1000; + ulonglong usec = ulonglong(time_in_usec) + my_hrtime().val; + abstime.tv_sec = usec / 1000000; + abstime.tv_nsec = (usec % 1000000) * 1000; } else { abstime.tv_nsec = 999999999; abstime.tv_sec = (time_t) ULINT_MAX; diff --git a/storage/xtradb/que/que0que.cc b/storage/xtradb/que/que0que.cc index 8cf66049088..090c5091a8d 100644 --- a/storage/xtradb/que/que0que.cc +++ b/storage/xtradb/que/que0que.cc @@ -204,9 +204,6 @@ que_thr_end_lock_wait( { que_thr_t* thr; ibool was_active; - ulint sec; - ulint ms; - ib_uint64_t now; ut_ad(lock_mutex_own()); ut_ad(trx_mutex_own(trx)); @@ -224,10 +221,9 @@ que_thr_end_lock_wait( que_thr_move_to_run_state(thr); if (UNIV_UNLIKELY(trx->take_stats)) { - ut_usectime(&sec, &ms); - now = (ib_uint64_t)sec * 1000000 + ms; - trx->lock_que_wait_timer - += (ulint)(now - trx->lock_que_wait_ustarted); + trx->lock_que_wait_timer += static_cast( + (my_interval_timer() - trx->lock_que_wait_nstarted) + / 1000); } trx->lock.que_state = TRX_QUE_RUNNING; diff --git a/storage/xtradb/srv/srv0conc.cc b/storage/xtradb/srv/srv0conc.cc index 3adef3a058f..3433d968eb2 100644 --- a/storage/xtradb/srv/srv0conc.cc +++ b/storage/xtradb/srv/srv0conc.cc @@ -401,8 +401,6 @@ srv_conc_enter_innodb_without_atomics( ulint i; srv_conc_slot_t* slot = NULL; ibool has_slept = FALSE; - ib_uint64_t start_time = 0L; - ib_uint64_t finish_time = 0L; ulint sec; ulint ms; @@ -537,12 +535,9 @@ retry: ut_ad(!sync_thread_levels_nonempty_trx(trx->has_search_latch)); #endif /* UNIV_SYNC_DEBUG */ - if (UNIV_UNLIKELY(trx->take_stats)) { - ut_usectime(&sec, &ms); - start_time = (ib_uint64_t)sec * 1000000 + ms; - } else { - start_time = 0; - } + const ulonglong start_time = UNIV_UNLIKELY(trx->take_stats) + ? my_interval_timer() + : 0; trx->op_info = "waiting in InnoDB queue"; @@ -557,9 +552,8 @@ retry: trx->op_info = ""; if (UNIV_UNLIKELY(start_time != 0)) { - ut_usectime(&sec, &ms); - finish_time = (ib_uint64_t)sec * 1000000 + ms; - trx->innodb_que_wait_timer += (ulint)(finish_time - start_time); + trx->innodb_que_wait_timer += ulint((my_interval_timer() + - start_time) / 1000); } os_fast_mutex_lock(&srv_conc_mutex); diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index fc979a9bff8..3e0d81df8b5 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -1795,21 +1795,15 @@ trx_commit_or_rollback_prepare( query thread to the suspended state */ if (trx->lock.que_state == TRX_QUE_LOCK_WAIT) { - - ulint sec; - ulint ms; - ib_uint64_t now; - ut_a(trx->lock.wait_thr != NULL); trx->lock.wait_thr->state = QUE_THR_SUSPENDED; trx->lock.wait_thr = NULL; if (UNIV_UNLIKELY(trx->take_stats)) { - ut_usectime(&sec, &ms); - now = (ib_uint64_t)sec * 1000000 + ms; - trx->lock_que_wait_timer - += (ulint) - (now - trx->lock_que_wait_ustarted); + trx->lock_que_wait_timer += static_cast( + (my_interval_timer() + - trx->lock_que_wait_nstarted) + / 1000); } trx->lock.que_state = TRX_QUE_RUNNING; diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc index 0cdc618a8c4..8a339627cfb 100644 --- a/storage/xtradb/ut/ut0ut.cc +++ b/storage/xtradb/ut/ut0ut.cc @@ -47,83 +47,6 @@ Created 5/11/1994 Heikki Tuuri # include #endif /* UNIV_HOTBACKUP */ -#ifdef __WIN__ -#include /* For sql_print_error */ -typedef VOID(WINAPI *time_fn)(LPFILETIME); -static time_fn ut_get_system_time_as_file_time = GetSystemTimeAsFileTime; - -/*****************************************************************//** -NOTE: The Windows epoch starts from 1601/01/01 whereas the Unix -epoch starts from 1970/1/1. For selection of constant see: -http://support.microsoft.com/kb/167296/ */ -#define WIN_TO_UNIX_DELTA_USEC ((ib_int64_t) 11644473600000000ULL) - - -/** -Initialise highest available time resolution API on Windows -@return 0 if all OK else -1 */ -int -ut_win_init_time() -{ - HMODULE h = LoadLibrary("kernel32.dll"); - if (h != NULL) - { - time_fn pfn = (time_fn)GetProcAddress(h, "GetSystemTimePreciseAsFileTime"); - if (pfn != NULL) - { - ut_get_system_time_as_file_time = pfn; - } - return false; - } - DWORD error = GetLastError(); - sql_print_error( - "LoadLibrary(\"kernel32.dll\") failed: GetLastError returns %lu", error); - return(-1); -} - -/*****************************************************************//** -This is the Windows version of gettimeofday(2). -@return 0 if all OK else -1 */ -static -int -ut_gettimeofday( -/*============*/ - struct timeval* tv, /*!< out: Values are relative to Unix epoch */ - void* tz) /*!< in: not used */ -{ - FILETIME ft; - ib_int64_t tm; - - if (!tv) { - errno = EINVAL; - return(-1); - } - - ut_get_system_time_as_file_time(&ft); - - tm = (ib_int64_t) ft.dwHighDateTime << 32; - tm |= ft.dwLowDateTime; - - ut_a(tm >= 0); /* If tm wraps over to negative, the quotient / 10 - does not work */ - - tm /= 10; /* Convert from 100 nsec periods to usec */ - - /* If we don't convert to the Unix epoch the value for - struct timeval::tv_sec will overflow.*/ - tm -= WIN_TO_UNIX_DELTA_USEC; - - tv->tv_sec = (long) (tm / 1000000L); - tv->tv_usec = (long) (tm % 1000000L); - - return(0); -} -#else -/** An alias for gettimeofday(2). On Microsoft Windows, we have to -reimplement this function. */ -#define ut_gettimeofday gettimeofday -#endif - /**********************************************************//** Returns system time. We do not specify the format of the time returned: the only way to manipulate it is to use the function ut_difftime. @@ -137,48 +60,6 @@ ut_time(void) } #ifndef UNIV_HOTBACKUP -/**********************************************************//** -Returns system time. -Upon successful completion, the value 0 is returned; otherwise the -value -1 is returned and the global variable errno is set to indicate the -error. -@return 0 on success, -1 otherwise */ -UNIV_INTERN -int -ut_usectime( -/*========*/ - ulint* sec, /*!< out: seconds since the Epoch */ - ulint* ms) /*!< out: microseconds since the Epoch+*sec */ -{ - struct timeval tv; - int ret; - int errno_gettimeofday; - int i; - - for (i = 0; i < 10; i++) { - - ret = ut_gettimeofday(&tv, NULL); - - if (ret == -1) { - errno_gettimeofday = errno; - ut_print_timestamp(stderr); - fprintf(stderr, " InnoDB: gettimeofday(): %s\n", - strerror(errno_gettimeofday)); - os_thread_sleep(100000); /* 0.1 sec */ - errno = errno_gettimeofday; - } else { - break; - } - } - - if (ret != -1) { - *sec = (ulint) tv.tv_sec; - *ms = (ulint) tv.tv_usec; - } - - return(ret); -} - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic From 10727b69530da609c26d61294ec4f6870b62a09a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 20:43:24 +0300 Subject: [PATCH 06/13] Always initialize trx_t::start_time_micro This affects the function has_higher_priority() for internal or recovered transactions. --- storage/innobase/include/trx0trx.h | 9 +++++---- storage/innobase/lock/lock0lock.cc | 5 +---- storage/innobase/trx/trx0purge.cc | 3 ++- storage/innobase/trx/trx0trx.cc | 11 +++++++---- storage/xtradb/include/trx0trx.h | 9 +++++---- storage/xtradb/lock/lock0lock.cc | 5 +---- storage/xtradb/trx/trx0purge.cc | 3 ++- storage/xtradb/trx/trx0trx.cc | 11 +++++++---- 8 files changed, 30 insertions(+), 26 deletions(-) diff --git a/storage/innobase/include/trx0trx.h b/storage/innobase/include/trx0trx.h index 69b6fcdf809..0291140a982 100644 --- a/storage/innobase/include/trx0trx.h +++ b/storage/innobase/include/trx0trx.h @@ -867,10 +867,11 @@ struct trx_t{ when trx->in_rw_trx_list. Initially set to TRX_ID_MAX. */ - time_t start_time; /*!< time the trx state last time became - TRX_STATE_ACTIVE */ - ib_uint64_t start_time_micro; /*!< start time of transaction in - microseconds */ + /** wall-clock time of the latest transition to TRX_STATE_ACTIVE; + used for diagnostic purposes only */ + time_t start_time; + /** microsecond_interval_timer() of transaction start */ + ulonglong start_time_micro; trx_id_t id; /*!< transaction id */ XID xid; /*!< X/Open XA transaction identification to identify a diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index be645afa32a..c0933ee7fdf 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -2279,10 +2279,7 @@ If neither of them is wait lock, the first one has higher priority. If only one of them is a wait lock, it has lower priority. Otherwise, the one with an older transaction has higher priority. @returns true if lock1 has higher priority, false otherwise. */ -bool -has_higher_priority( - lock_t *lock1, - lock_t *lock2) +static bool has_higher_priority(lock_t *lock1, lock_t *lock2) { if (lock1 == NULL) { return false; diff --git a/storage/innobase/trx/trx0purge.cc b/storage/innobase/trx/trx0purge.cc index 3616ce1b004..bd61bc85961 100644 --- a/storage/innobase/trx/trx0purge.cc +++ b/storage/innobase/trx/trx0purge.cc @@ -146,7 +146,8 @@ trx_purge_sys_create( here only because the query threads code requires it. It is otherwise quite unnecessary. We should get rid of it eventually. */ purge_sys->trx->id = 0; - purge_sys->trx->start_time = ut_time(); + purge_sys->trx->start_time = time(NULL); + purge_sys->trx->start_time_micro = microsecond_interval_timer(); purge_sys->trx->state = TRX_STATE_ACTIVE; purge_sys->trx->op_info = "purge trx"; diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index ef12f118711..884e2fa887d 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -570,7 +570,8 @@ trx_resurrect_insert( /* trx_start_low() is not called with resurrect, so need to initialize start time here.*/ if (trx->state != TRX_STATE_COMMITTED_IN_MEMORY) { - trx->start_time = ut_time(); + trx->start_time = time(NULL); + trx->start_time_micro = microsecond_interval_timer(); } if (undo->dict_operation) { @@ -656,7 +657,8 @@ trx_resurrect_update( start time here.*/ if (trx->state == TRX_STATE_ACTIVE || trx->state == TRX_STATE_PREPARED) { - trx->start_time = ut_time(); + trx->start_time = time(NULL); + trx->start_time_micro = microsecond_interval_timer(); } if (undo->dict_operation) { @@ -907,8 +909,9 @@ trx_start_low( trx->start_time = ut_time(); - trx->start_time_micro = - trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) : 0; + trx->start_time_micro = trx->mysql_thd + ? thd_query_start_micro(trx->mysql_thd) + : microsecond_interval_timer(); MONITOR_INC(MONITOR_TRX_ACTIVE); } diff --git a/storage/xtradb/include/trx0trx.h b/storage/xtradb/include/trx0trx.h index f355ef4fcf4..448b2429126 100644 --- a/storage/xtradb/include/trx0trx.h +++ b/storage/xtradb/include/trx0trx.h @@ -917,10 +917,11 @@ struct trx_t{ when trx->in_rw_trx_list. Initially set to TRX_ID_MAX. */ - time_t start_time; /*!< time the trx state last time became - TRX_STATE_ACTIVE */ - ib_uint64_t start_time_micro; /*!< start time of transaction in - microseconds */ + /** wall-clock time of the latest transition to TRX_STATE_ACTIVE; + used for diagnostic purposes only */ + time_t start_time; + /** microsecond_interval_timer() of transaction start */ + ulonglong start_time_micro; trx_id_t id; /*!< transaction id */ XID xid; /*!< X/Open XA transaction identification to identify a diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 27a857b26a8..061813cd8ab 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -2077,10 +2077,7 @@ If neither of them is wait lock, the first one has higher priority. If only one of them is a wait lock, it has lower priority. Otherwise, the one with an older transaction has higher priority. @returns true if lock1 has higher priority, false otherwise. */ -bool -has_higher_priority( - lock_t *lock1, - lock_t *lock2) +static bool has_higher_priority(lock_t *lock1, lock_t *lock2) { if (lock1 == NULL) { return false; diff --git a/storage/xtradb/trx/trx0purge.cc b/storage/xtradb/trx/trx0purge.cc index 16f985833b5..f4e4d2f42ea 100644 --- a/storage/xtradb/trx/trx0purge.cc +++ b/storage/xtradb/trx/trx0purge.cc @@ -146,7 +146,8 @@ trx_purge_sys_create( here only because the query threads code requires it. It is otherwise quite unnecessary. We should get rid of it eventually. */ purge_sys->trx->id = 0; - purge_sys->trx->start_time = ut_time(); + purge_sys->trx->start_time = time(NULL); + purge_sys->trx->start_time_micro = microsecond_interval_timer(); purge_sys->trx->state = TRX_STATE_ACTIVE; purge_sys->trx->op_info = "purge trx"; diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index 3e0d81df8b5..f0229cf7ff5 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -749,7 +749,8 @@ trx_resurrect_insert( /* trx_start_low() is not called with resurrect, so need to initialize start time here.*/ if (trx->state != TRX_STATE_COMMITTED_IN_MEMORY) { - trx->start_time = ut_time(); + trx->start_time = time(NULL); + trx->start_time_micro = microsecond_interval_timer(); } if (undo->dict_operation) { @@ -835,7 +836,8 @@ trx_resurrect_update( start time here.*/ if (trx->state == TRX_STATE_ACTIVE || trx->state == TRX_STATE_PREPARED) { - trx->start_time = ut_time(); + trx->start_time = time(NULL); + trx->start_time_micro = microsecond_interval_timer(); } if (undo->dict_operation) { @@ -1106,8 +1108,9 @@ trx_start_low( trx->start_time = ut_time(); - trx->start_time_micro = - trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) : 0; + trx->start_time_micro = trx->mysql_thd + ? thd_query_start_micro(trx->mysql_thd) + : microsecond_interval_timer(); MONITOR_INC(MONITOR_TRX_ACTIVE); } From 2b5bc761d3a2a9b460b4cbb8e8a9ce0d50e63371 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 13:55:59 +0300 Subject: [PATCH 07/13] MDEV-14154: Document some time_t fields better srv_slot_t::suspend_time, os_aio_slot_t::reservation_time, sync_cell_t::reservation_time: Explain what could happen if the system time has is being adjusted. fts_sync_t::start_time: Document that the field is mostly unused. --- storage/innobase/include/fts0types.h | 4 +++- storage/innobase/sync/sync0arr.cc | 6 ++++-- storage/xtradb/include/fts0types.h | 4 +++- storage/xtradb/include/srv0srv.h | 11 ++++++----- storage/xtradb/os/os0file.cc | 5 ++++- storage/xtradb/sync/sync0arr.cc | 6 ++++-- 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/storage/innobase/include/fts0types.h b/storage/innobase/include/fts0types.h index 0da9fe47955..3cb01a92df0 100644 --- a/storage/innobase/include/fts0types.h +++ b/storage/innobase/include/fts0types.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 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 @@ -122,7 +123,8 @@ struct fts_sync_t { doc_id_t max_doc_id; /*!< The doc id at which the cache was noted as being full, we use this to set the upper_limit field */ - ib_time_t start_time; /*!< SYNC start time */ + time_t start_time; /*!< SYNC start time; only used if + fts_enable_diag_print */ bool in_progress; /*!< flag whether sync is in progress.*/ bool unlock_cache; /*!< flag whether unlock cache when write fts node */ diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index 8f83f2e0919..91a07a9a4c0 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -122,8 +122,10 @@ struct sync_cell_t { has not been signalled in the period between the reset and wait call. */ - time_t reservation_time;/*!< time when the thread reserved - the wait cell */ + /** time(NULL) when the wait cell was reserved. + FIXME: sync_array_print_long_waits_low() may display bogus + warnings when the system time is adjusted to the past! */ + time_t reservation_time; }; /* NOTE: It is allowed for a thread to wait diff --git a/storage/xtradb/include/fts0types.h b/storage/xtradb/include/fts0types.h index 0da9fe47955..3cb01a92df0 100644 --- a/storage/xtradb/include/fts0types.h +++ b/storage/xtradb/include/fts0types.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 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 @@ -122,7 +123,8 @@ struct fts_sync_t { doc_id_t max_doc_id; /*!< The doc id at which the cache was noted as being full, we use this to set the upper_limit field */ - ib_time_t start_time; /*!< SYNC start time */ + time_t start_time; /*!< SYNC start time; only used if + fts_enable_diag_print */ bool in_progress; /*!< flag whether sync is in progress.*/ bool unlock_cache; /*!< flag whether unlock cache when write fts node */ diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index 9c01bb0148d..e8dd1954797 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -3,7 +3,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved. Copyright (c) 2008, 2009, Google Inc. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2017, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -1329,10 +1329,11 @@ struct srv_slot_t{ ibool suspended; /*!< TRUE if the thread is waiting for the event of this slot */ - ib_time_t suspend_time; /*!< time when the thread was - suspended. Initialized by - lock_wait_table_reserve_slot() - for lock wait */ + /** time(NULL) when the thread was suspended. + FIXME: Use my_interval_timer() or similar, to avoid bogus + timeouts in lock_wait_check_and_cancel() or lock_wait_suspend_thread() + when the system time is adjusted to the past! */ + time_t suspend_time; ulong wait_timeout; /*!< wait time that if exceeded the thread will be timed out. Initialized by diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 0cd5aff4e94..9c9c41c86e7 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -214,7 +214,10 @@ struct os_aio_slot_t{ ulint pos; /*!< index of the slot in the aio array */ ibool reserved; /*!< TRUE if this slot is reserved */ - time_t reservation_time;/*!< time when reserved */ + /** time(NULL) when reserved. + FIXME: os_aio_simulated_handle() may malfunction if + the system time is adjusted! */ + time_t reservation_time; ulint len; /*!< length of the block to read or write */ byte* buf; /*!< buffer used in i/o */ diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc index 170adaab3a6..a1aac98d5ef 100644 --- a/storage/xtradb/sync/sync0arr.cc +++ b/storage/xtradb/sync/sync0arr.cc @@ -123,8 +123,10 @@ struct sync_cell_t { has not been signalled in the period between the reset and wait call. */ - time_t reservation_time;/*!< time when the thread reserved - the wait cell */ + /** time(NULL) when the wait cell was reserved. + FIXME: sync_array_print_long_waits_low() may display bogus + warnings when the system time is adjusted to the past! */ + time_t reservation_time; }; /* NOTE: It is allowed for a thread to wait From 9e5df96751d2d13e0f9042f6235666f6dd65b1e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 20:50:59 +0300 Subject: [PATCH 08/13] Reduce the amount of time(NULL) calls for lock processing lock_t::requested_time: Document what the field is used for. lock_t::wait_time: Document that the field is only used for diagnostics and may be garbage if the system time is being adjusted. srv_slot_t::suspend_time: Document that this is duplicating trx_lock_t::wait_started. lock_table_print(), lock_rec_print(): Declare in static scope. Add a parameter for the current time. lock_deadlock_check_and_resolve(), lock_deadlock_lock_print(), lock_deadlock_joining_trx_print(): Add a parameter for the current time. --- storage/innobase/include/lock0lock.h | 16 -- storage/innobase/include/lock0priv.h | 12 +- storage/innobase/include/srv0srv.h | 12 +- storage/innobase/include/trx0i_s.h | 3 +- storage/innobase/lock/lock0lock.cc | 233 +++++++++++++------------- storage/innobase/lock/lock0wait.cc | 15 +- storage/xtradb/include/lock0lock.h | 16 -- storage/xtradb/include/lock0priv.h | 12 +- storage/xtradb/include/srv0srv.h | 5 +- storage/xtradb/include/trx0i_s.h | 3 +- storage/xtradb/lock/lock0lock.cc | 236 ++++++++++++++------------- storage/xtradb/lock/lock0wait.cc | 15 +- 12 files changed, 284 insertions(+), 294 deletions(-) diff --git a/storage/innobase/include/lock0lock.h b/storage/innobase/include/lock0lock.h index 615ebec16d3..2628cdfc461 100644 --- a/storage/innobase/include/lock0lock.h +++ b/storage/innobase/include/lock0lock.h @@ -615,22 +615,6 @@ lock_report_trx_id_insanity( trx_id_t max_trx_id) /*!< in: trx_sys_get_max_trx_id() */ MY_ATTRIBUTE((nonnull)); /*********************************************************************//** -Prints info of a table lock. */ -UNIV_INTERN -void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: table type lock */ -/*********************************************************************//** -Prints info of a record lock. */ -UNIV_INTERN -void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: record type lock */ -/*********************************************************************//** Prints info of locks for all transactions. @return FALSE if not able to obtain lock mutex and exits without printing info */ diff --git a/storage/innobase/include/lock0priv.h b/storage/innobase/include/lock0priv.h index eee46e0a1bd..ef502be9044 100644 --- a/storage/innobase/include/lock0priv.h +++ b/storage/innobase/include/lock0priv.h @@ -74,10 +74,14 @@ struct lock_t { lock */ dict_index_t* index; /*!< index for a record lock */ - /* Statistics for how long lock has been held and time - how long this lock had to be waited before it was granted */ - time_t requested_time; /*!< Lock request time */ - ulint wait_time; /*!< Time waited this lock or 0 */ + /** time(NULL) of the lock request creation. + Used for computing wait_time and diagnostics only. + Note: bogus durations may be reported + when the system time is adjusted! */ + time_t requested_time; + /** Cumulated wait time in seconds. + Note: may be bogus when the system time is adjusted! */ + ulint wait_time; union { lock_table_t tab_lock;/*!< table lock */ diff --git a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h index 7e83f9fa725..37e249f3f07 100644 --- a/storage/innobase/include/srv0srv.h +++ b/storage/innobase/include/srv0srv.h @@ -1078,10 +1078,14 @@ struct srv_slot_t{ ibool suspended; /*!< TRUE if the thread is waiting for the event of this slot */ - ib_time_t suspend_time; /*!< time when the thread was - suspended. Initialized by - lock_wait_table_reserve_slot() - for lock wait */ + /** time(NULL) when the thread was suspended. + FIXME: Use my_interval_timer() or similar, to avoid bogus + timeouts in lock_wait_check_and_cancel() or lock_wait_suspend_thread() + when the system time is adjusted to the past! + + FIXME: This is duplicating trx_lock_t::wait_started, + which is being used for diagnostic purposes only. */ + time_t suspend_time; ulong wait_timeout; /*!< wait time that if exceeded the thread will be timed out. Initialized by diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h index 3ee2ad63ab5..2d0b7f01f7e 100644 --- a/storage/innobase/include/trx0i_s.h +++ b/storage/innobase/include/trx0i_s.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2011, 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 @@ -133,7 +134,7 @@ struct i_s_trx_row_t { /*!< pointer to a row in innodb_locks if trx is waiting, or NULL */ - ib_time_t trx_wait_started; /*!< trx_t::wait_started */ + time_t trx_wait_started; /*!< trx->lock.wait_started */ ullint trx_weight; /*!< TRX_WEIGHT() */ ulint trx_mysql_thread_id; /*!< thd_get_thread_id() */ const char* trx_query; /*!< MySQL statement being diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index c0933ee7fdf..ab2b536a7d7 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -383,6 +383,20 @@ struct lock_stack_t { ulint heap_no; /*!< heap number if rec lock */ }; +/** Pretty-print a table lock. +@param[in,out] file output stream +@param[in] lock table lock +@param[in] now current time */ +static void lock_table_print(FILE* file, const lock_t* lock, time_t now); + +/** Pretty-print a record lock. +@param[in,out] file output stream +@param[in] lock record lock +@param[in] now current time +@param[in,out] mtr mini-transaction */ +static void lock_rec_print(FILE* file, const lock_t* lock, time_t now, + mtr_t* mtr = NULL); + /*********************************************************************//** Checks if a waiting record lock request still has to wait in a queue. @return lock that is causing the wait */ @@ -466,20 +480,18 @@ UNIV_INTERN ibool lock_deadlock_found = FALSE; /** Only created if !srv_read_only_mode */ static FILE* lock_latest_err_file; -/********************************************************************//** -Checks if a joining lock request results in a deadlock. If a deadlock is +/** Check if a joining lock request results in a deadlock. If a deadlock is found this function will resolve the dadlock by choosing a victim transaction -and rolling it back. It will attempt to resolve all deadlocks. The returned -transaction id will be the joining transaction id or 0 if some other -transaction was chosen as a victim and rolled back or no deadlock found. - -@return id of transaction chosen as victim or 0 */ -static -trx_id_t -lock_deadlock_check_and_resolve( -/*===========================*/ - const lock_t* lock, /*!< in: lock the transaction is requesting */ - const trx_t* trx); /*!< in: transaction */ +and rolling it back. It will attempt to resolve all deadlocks. +@param[in] trx joining transaction +@param[in] lock the requested lock +@param[in] now current time +@return trx->id of the victim transaction +@retval 0 if some other transaction was chosen as a victim and +rolled back, or no deadlock was found. */ +static trx_id_t lock_deadlock_check_and_resolve(const trx_t* trx, + const lock_t* lock, + time_t now); /*********************************************************************//** Gets the nth bit of a record lock. @@ -1135,12 +1147,11 @@ lock_rec_has_to_wait( thread, we need to look at trx ordering and lock types */ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) && wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) { - if (wsrep_debug) { fprintf(stderr, "BF-BF lock conflict, locking: %lu\n", for_locking); - lock_rec_print(stderr, lock2); + lock_rec_print(stderr, lock2, time(NULL)); } if (wsrep_trx_order_before(trx->mysql_thd, @@ -1159,7 +1170,8 @@ lock_rec_has_to_wait( "conflicts states: my %d locked %d\n", wsrep_thd_conflict_state(trx->mysql_thd, FALSE), wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) ); - lock_rec_print(stderr, lock2); + lock_rec_print(stderr, lock2, + time(NULL)); if (for_locking) return FALSE; //abort(); } @@ -1786,10 +1798,12 @@ wsrep_kill_victim( fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", stderr); + time_t now = time(NULL); + if (lock_get_type(lock) == LOCK_REC) { - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, now); } else { - lock_table_print(stderr, lock); + lock_table_print(stderr, lock, now); } } @@ -2032,16 +2046,20 @@ wsrep_print_wait_locks( { if (wsrep_debug && c_lock->trx->lock.wait_lock != c_lock) { fprintf(stderr, "WSREP: c_lock != wait lock\n"); + time_t now = time(NULL); + if (lock_get_type_low(c_lock) & LOCK_TABLE) { - lock_table_print(stderr, c_lock); + lock_table_print(stderr, c_lock, now); } else { - lock_rec_print(stderr, c_lock); + lock_rec_print(stderr, c_lock, now); } if (lock_get_type_low(c_lock->trx->lock.wait_lock) & LOCK_TABLE) { - lock_table_print(stderr, c_lock->trx->lock.wait_lock); + lock_table_print(stderr, c_lock->trx->lock.wait_lock, + now); } else { - lock_rec_print(stderr, c_lock->trx->lock.wait_lock); + lock_rec_print(stderr, c_lock->trx->lock.wait_lock, + now); } } } @@ -2477,7 +2495,8 @@ lock_rec_enqueue_waiting( trx_mutex_exit(trx); - victim_trx_id = lock_deadlock_check_and_resolve(lock, trx); + const time_t now = time(NULL); + victim_trx_id = lock_deadlock_check_and_resolve(trx, lock, now); trx_mutex_enter(trx); @@ -2501,7 +2520,7 @@ lock_rec_enqueue_waiting( trx->lock.que_state = TRX_QUE_LOCK_WAIT; trx->lock.was_chosen_as_deadlock_victim = FALSE; - trx->lock.wait_started = ut_time(); + trx->lock.wait_started = now; ut_a(que_thr_stop(thr)); @@ -2642,7 +2661,8 @@ lock_rec_add_to_queue( "BF skipping wait: " TRX_ID_FMT "\n", trx->id); - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, + time(NULL)); } } else #endif @@ -2958,13 +2978,14 @@ lock_rec_has_to_wait_in_queue( if (wsrep_thd_is_BF(wait_lock->trx->mysql_thd, FALSE) && wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE)) { if (wsrep_debug) { + time_t now = time(NULL); fprintf(stderr, "BF-BF lock conflict " TRX_ID_FMT " : " TRX_ID_FMT "\n", wait_lock->trx->id, lock->trx->id); - lock_rec_print(stderr, wait_lock); - lock_rec_print(stderr, lock); + lock_rec_print(stderr, wait_lock, now); + lock_rec_print(stderr, lock, now); } /* don't wait for another BF lock */ continue; @@ -4293,28 +4314,26 @@ lock_deadlock_trx_print( mutex_exit(&trx_sys->mutex); } -/*********************************************************************//** -Print lock data to the deadlock file and possibly to stderr. */ -UNIV_INLINE -void -lock_deadlock_lock_print( -/*=====================*/ - const lock_t* lock) /*!< in: record or table type lock */ +/** Print lock data to the deadlock file and possibly to stderr. +@param[in] lock record or table lock +@param[in] now current time */ +static void lock_deadlock_lock_print(const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); if (lock_get_type_low(lock) == LOCK_REC) { - lock_rec_print(lock_latest_err_file, lock); + mtr_t mtr; + lock_rec_print(lock_latest_err_file, lock, now, &mtr); if (srv_print_all_deadlocks) { - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, now, &mtr); } } else { - lock_table_print(lock_latest_err_file, lock); + lock_table_print(lock_latest_err_file, lock, now); if (srv_print_all_deadlocks) { - lock_table_print(stderr, lock); + lock_table_print(stderr, lock, now); } } } @@ -4427,6 +4446,8 @@ lock_deadlock_notify( ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); + const time_t now = time(NULL); + lock_deadlock_start_print(); lock_deadlock_fputs("\n*** (1) TRANSACTION:\n"); @@ -4435,7 +4456,7 @@ lock_deadlock_notify( lock_deadlock_fputs("*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(ctx->wait_lock); + lock_deadlock_lock_print(ctx->wait_lock, now); lock_deadlock_fputs("*** (2) TRANSACTION:\n"); @@ -4443,7 +4464,7 @@ lock_deadlock_notify( lock_deadlock_fputs("*** (2) HOLDS THE LOCK(S):\n"); - lock_deadlock_lock_print(lock); + lock_deadlock_lock_print(lock, now); /* It is possible that the joining transaction was granted its lock when we rolled back some other waiting transaction. */ @@ -4452,7 +4473,7 @@ lock_deadlock_notify( lock_deadlock_fputs( "*** (2) WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(ctx->start->lock.wait_lock); + lock_deadlock_lock_print(ctx->start->lock.wait_lock, now); } #ifdef UNIV_DEBUG @@ -4700,14 +4721,12 @@ lock_deadlock_search( return(0); } -/********************************************************************//** -Print info about transaction that was rolled back. */ -static -void -lock_deadlock_joining_trx_print( -/*============================*/ - const trx_t* trx, /*!< in: transaction rolled back */ - const lock_t* lock) /*!< in: lock trx wants */ +/** Print info about transaction that was rolled back. +@param[in] trx victim transaction +@param[in] lock the requested lock +@param[in] now current time */ +static void lock_deadlock_joining_trx_print(const trx_t* trx, + const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); @@ -4727,7 +4746,7 @@ lock_deadlock_joining_trx_print( lock_deadlock_fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(lock); + lock_deadlock_lock_print(lock, now); } /********************************************************************//** @@ -4797,20 +4816,17 @@ lock_report_waiters_to_mysql( } -/********************************************************************//** -Checks if a joining lock request results in a deadlock. If a deadlock is +/** Check if a joining lock request results in a deadlock. If a deadlock is found this function will resolve the dadlock by choosing a victim transaction -and rolling it back. It will attempt to resolve all deadlocks. The returned -transaction id will be the joining transaction id or 0 if some other -transaction was chosen as a victim and rolled back or no deadlock found. - -@return id of transaction chosen as victim or 0 */ -static -trx_id_t -lock_deadlock_check_and_resolve( -/*============================*/ - const lock_t* lock, /*!< in: lock the transaction is requesting */ - const trx_t* trx) /*!< in: transaction */ +and rolling it back. It will attempt to resolve all deadlocks. +@param[in] trx joining transaction +@param[in] lock the requested lock +@param[in] now current time +@return trx->id of the victim transaction +@retval 0 if some other transaction was chosen as a victim and +rolled back, or no deadlock was found. */ +static trx_id_t lock_deadlock_check_and_resolve(const trx_t* trx, + const lock_t* lock, time_t now) { trx_id_t victim_trx_id; struct thd_wait_reports waitee_buf; @@ -4862,17 +4878,12 @@ lock_deadlock_check_and_resolve( ut_a(victim_trx_id == trx->id); #ifdef WITH_WSREP - if (!wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)) - { + if (!wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)); else #endif /* WITH_WSREP */ - if (!srv_read_only_mode) { - lock_deadlock_joining_trx_print(trx, lock); - } -#ifdef WITH_WSREP - } else { - /* BF processor */; + if (!srv_read_only_mode) { + lock_deadlock_joining_trx_print(trx, lock, + now); } -#endif /* WITH_WSREP */ MONITOR_INC(MONITOR_DEADLOCK); @@ -5218,7 +5229,9 @@ lock_table_enqueue_waiting( trx_mutex_exit(trx); - victim_trx_id = lock_deadlock_check_and_resolve(lock, trx); + const time_t now = time(NULL); + + victim_trx_id = lock_deadlock_check_and_resolve(trx, lock, now); trx_mutex_enter(trx); @@ -5240,7 +5253,7 @@ lock_table_enqueue_waiting( trx->lock.que_state = TRX_QUE_LOCK_WAIT; - trx->lock.wait_started = ut_time(); + trx->lock.wait_started = now; trx->lock.was_chosen_as_deadlock_victim = FALSE; trx->n_table_lock_waits++; @@ -5984,14 +5997,11 @@ lock_remove_all_on_table( /*===================== VALIDATION AND DEBUGGING ====================*/ -/*********************************************************************//** -Prints info of a table lock. */ -UNIV_INTERN -void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: table type lock */ +/** Pretty-print a table lock. +@param[in,out] file output stream +@param[in] lock table lock +@param[in] now current time */ +static void lock_table_print(FILE* file, const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_a(lock_get_type_low(lock) == LOCK_TABLE); @@ -6021,30 +6031,22 @@ lock_table_print( } fprintf(file, " lock hold time %lu wait time before grant %lu ", - (ulint)difftime(ut_time(), lock->requested_time), + (ulint)difftime(now, lock->requested_time), lock->wait_time); putc('\n', file); } -/*********************************************************************//** -Prints info of a record lock. */ -UNIV_INTERN -void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: record type lock */ +/** Pretty-print a record lock. +@param[in,out] file output stream +@param[in] lock record lock +@param[in] now current time +@param[in,out] mtr mini-transaction */ +static void lock_rec_print(FILE* file, const lock_t* lock, time_t now, + mtr_t* mtr) { - const buf_block_t* block; ulint space; ulint page_no; - ulint i; - mtr_t mtr; - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; - rec_offs_init(offsets_); ut_ad(lock_mutex_own()); ut_a(lock_get_type_low(lock) == LOCK_REC); @@ -6089,17 +6091,25 @@ lock_rec_print( fputs(" waiting", file); } - mtr_start(&mtr); - fprintf(file, " lock hold time %lu wait time before grant %lu ", - (ulint)difftime(ut_time(), lock->requested_time), + (ulint)difftime(now, lock->requested_time), lock->wait_time); putc('\n', file); - block = buf_page_try_get(space, page_no, &mtr); + if (!mtr) { + return; + } - for (i = 0; i < lock_rec_get_n_bits(lock); ++i) { + mem_heap_t* heap = NULL; + ulint offsets_[REC_OFFS_NORMAL_SIZE]; + ulint* offsets = offsets_; + rec_offs_init(offsets_); + + mtr_start(mtr); + const buf_block_t* block = buf_page_try_get(space, page_no, mtr); + + for (ulint i = 0; i < lock_rec_get_n_bits(lock); ++i) { if (!lock_rec_get_nth_bit(lock, i)) { continue; @@ -6124,7 +6134,7 @@ lock_rec_print( putc('\n', file); } - mtr_commit(&mtr); + mtr_commit(mtr); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } @@ -6280,6 +6290,8 @@ lock_print_info_all_transactions( ut_ad(lock_mutex_own()); + const time_t now = time(NULL); + mutex_enter(&trx_sys->mutex); /* First print info on non-active transactions */ @@ -6366,13 +6378,14 @@ loop: fprintf(file, "------- TRX HAS BEEN WAITING %lu SEC" " FOR THIS LOCK TO BE GRANTED:\n", - (ulong) difftime(ut_time(), - trx->lock.wait_started)); + (ulong) difftime(now, trx->lock.wait_started)); if (lock_get_type_low(trx->lock.wait_lock) == LOCK_REC) { - lock_rec_print(file, trx->lock.wait_lock); + lock_rec_print(file, trx->lock.wait_lock, now, + &mtr); } else { - lock_table_print(file, trx->lock.wait_lock); + lock_table_print(file, trx->lock.wait_lock, + now); } fputs("------------------\n", file); @@ -6457,11 +6470,11 @@ loop: } print_rec: - lock_rec_print(file, lock); + lock_rec_print(file, lock, now, &mtr); } else { ut_ad(lock_get_type_low(lock) & LOCK_TABLE); - lock_table_print(file, lock); + lock_table_print(file, lock, now); } load_page_first = TRUE; diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 5d6db2f171a..2be579bf644 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -226,7 +226,6 @@ lock_wait_suspend_thread( user OS thread */ { srv_slot_t* slot; - double wait_time; trx_t* trx; ulint had_dict_lock; ibool was_declared_inside_innodb; @@ -360,7 +359,7 @@ lock_wait_suspend_thread( row_mysql_freeze_data_dictionary(trx); } - wait_time = ut_difftime(ut_time(), slot->suspend_time); + double wait_time = difftime(time(NULL), slot->suspend_time); /* Release the slot for others to use */ @@ -451,19 +450,12 @@ lock_wait_check_and_cancel( const srv_slot_t* slot) /*!< in: slot reserved by a user thread when the wait started */ { - trx_t* trx; - double wait_time; - ib_time_t suspend_time = slot->suspend_time; - ut_ad(lock_wait_mutex_own()); - ut_ad(slot->in_use); - ut_ad(slot->suspended); - wait_time = ut_difftime(ut_time(), suspend_time); - - trx = thr_get_trx(slot->thr); + double wait_time = difftime(time(NULL), slot->suspend_time); + trx_t* trx = thr_get_trx(slot->thr); if (trx_is_interrupted(trx) || (slot->wait_timeout < 100000000 @@ -497,7 +489,6 @@ lock_wait_check_and_cancel( trx_mutex_exit(trx); } - } /*********************************************************************//** diff --git a/storage/xtradb/include/lock0lock.h b/storage/xtradb/include/lock0lock.h index c57c25ae827..878a42ea81b 100644 --- a/storage/xtradb/include/lock0lock.h +++ b/storage/xtradb/include/lock0lock.h @@ -629,22 +629,6 @@ lock_report_trx_id_insanity( trx_id_t max_trx_id) /*!< in: trx_sys_get_max_trx_id() */ MY_ATTRIBUTE((nonnull)); /*********************************************************************//** -Prints info of a table lock. */ -UNIV_INTERN -void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: table type lock */ -/*********************************************************************//** -Prints info of a record lock. */ -UNIV_INTERN -void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock); /*!< in: record type lock */ -/*********************************************************************//** Prints info of locks for all transactions. @return FALSE if not able to obtain lock mutex and exits without printing info */ diff --git a/storage/xtradb/include/lock0priv.h b/storage/xtradb/include/lock0priv.h index 0107d7cd2ba..3b2c7f08020 100644 --- a/storage/xtradb/include/lock0priv.h +++ b/storage/xtradb/include/lock0priv.h @@ -74,10 +74,14 @@ struct lock_t { lock */ dict_index_t* index; /*!< index for a record lock */ - /* Statistics for how long lock has been held and time - how long this lock had to be waited before it was granted */ - time_t requested_time; /*!< Lock request time */ - ulint wait_time; /*!< Time waited this lock or 0 */ + /** time(NULL) of the lock request creation. + Used for computing wait_time and diagnostics only. + Note: bogus durations may be reported + when the system time is adjusted! */ + time_t requested_time; + /** Cumulated wait time in seconds. + Note: may be bogus when the system time is adjusted! */ + ulint wait_time; union { lock_table_t tab_lock;/*!< table lock */ diff --git a/storage/xtradb/include/srv0srv.h b/storage/xtradb/include/srv0srv.h index e8dd1954797..c222c419f9d 100644 --- a/storage/xtradb/include/srv0srv.h +++ b/storage/xtradb/include/srv0srv.h @@ -1332,7 +1332,10 @@ struct srv_slot_t{ /** time(NULL) when the thread was suspended. FIXME: Use my_interval_timer() or similar, to avoid bogus timeouts in lock_wait_check_and_cancel() or lock_wait_suspend_thread() - when the system time is adjusted to the past! */ + when the system time is adjusted to the past! + + FIXME: This is duplicating trx_lock_t::wait_started, + which is being used for diagnostic purposes only. */ time_t suspend_time; ulong wait_timeout; /*!< wait time that if exceeded the thread will be timed out. diff --git a/storage/xtradb/include/trx0i_s.h b/storage/xtradb/include/trx0i_s.h index c71def52b61..96646613847 100644 --- a/storage/xtradb/include/trx0i_s.h +++ b/storage/xtradb/include/trx0i_s.h @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 2007, 2011, 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 @@ -133,7 +134,7 @@ struct i_s_trx_row_t { /*!< pointer to a row in innodb_locks if trx is waiting, or NULL */ - ib_time_t trx_wait_started; /*!< trx_t::wait_started */ + time_t trx_wait_started; /*!< trx->lock.wait_started */ ullint trx_weight; /*!< TRX_WEIGHT() */ ulint trx_mysql_thread_id; /*!< thd_get_thread_id() */ const char* trx_query; /*!< MySQL statement being diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index 061813cd8ab..b0ab3e7a540 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -383,6 +383,20 @@ struct lock_stack_t { ulint heap_no; /*!< heap number if rec lock */ }; +/** Pretty-print a table lock. +@param[in,out] file output stream +@param[in] lock table lock +@param[in] now current time */ +static void lock_table_print(FILE* file, const lock_t* lock, time_t now); + +/** Pretty-print a record lock. +@param[in,out] file output stream +@param[in] lock record lock +@param[in] now current time +@param[in,out] mtr mini-transaction */ +static void lock_rec_print(FILE* file, const lock_t* lock, time_t now, + mtr_t* mtr = NULL); + /*********************************************************************//** Checks if a waiting record lock request still has to wait in a queue. @return lock that is causing the wait */ @@ -466,20 +480,18 @@ UNIV_INTERN ibool lock_deadlock_found = FALSE; /** Only created if !srv_read_only_mode */ static FILE* lock_latest_err_file; -/********************************************************************//** -Checks if a joining lock request results in a deadlock. If a deadlock is +/** Check if a joining lock request results in a deadlock. If a deadlock is found this function will resolve the dadlock by choosing a victim transaction -and rolling it back. It will attempt to resolve all deadlocks. The returned -transaction id will be the joining transaction id or 0 if some other -transaction was chosen as a victim and rolled back or no deadlock found. - -@return id of transaction chosen as victim or 0 */ -static -trx_id_t -lock_deadlock_check_and_resolve( -/*===========================*/ - const lock_t* lock, /*!< in: lock the transaction is requesting */ - const trx_t* trx); /*!< in: transaction */ +and rolling it back. It will attempt to resolve all deadlocks. +@param[in] trx joining transaction +@param[in] lock the requested lock +@param[in] now current time +@return trx->id of the victim transaction +@retval 0 if some other transaction was chosen as a victim and +rolled back, or no deadlock was found. */ +static trx_id_t lock_deadlock_check_and_resolve(const trx_t* trx, + const lock_t* lock, + time_t now); /*********************************************************************//** Gets the nth bit of a record lock. @@ -1147,12 +1159,11 @@ lock_rec_has_to_wait( thread, we need to look at trx ordering and lock types */ if (wsrep_thd_is_BF(trx->mysql_thd, FALSE) && wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) { - if (wsrep_debug) { fprintf(stderr, "BF-BF lock conflict, locking: %lu\n", for_locking); - lock_rec_print(stderr, lock2); + lock_rec_print(stderr, lock2, time(NULL)); } if (wsrep_trx_order_before(trx->mysql_thd, @@ -1171,7 +1182,8 @@ lock_rec_has_to_wait( "conflicts states: my %d locked %d\n", wsrep_thd_conflict_state(trx->mysql_thd, FALSE), wsrep_thd_conflict_state(lock2->trx->mysql_thd, FALSE) ); - lock_rec_print(stderr, lock2); + lock_rec_print(stderr, lock2, + time(NULL)); if (for_locking) return FALSE; //abort(); } @@ -1797,10 +1809,12 @@ wsrep_kill_victim( fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n", stderr); + time_t now = time(NULL); + if (lock_get_type(lock) == LOCK_REC) { - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, now); } else { - lock_table_print(stderr, lock); + lock_table_print(stderr, lock, now); } } @@ -2055,16 +2069,20 @@ wsrep_print_wait_locks( { if (wsrep_debug && c_lock->trx->lock.wait_lock != c_lock) { fprintf(stderr, "WSREP: c_lock != wait lock\n"); + time_t now = time(NULL); + if (lock_get_type_low(c_lock) & LOCK_TABLE) { - lock_table_print(stderr, c_lock); + lock_table_print(stderr, c_lock, now); } else { - lock_rec_print(stderr, c_lock); + lock_rec_print(stderr, c_lock, now); } if (lock_get_type_low(c_lock->trx->lock.wait_lock) & LOCK_TABLE) { - lock_table_print(stderr, c_lock->trx->lock.wait_lock); + lock_table_print(stderr, c_lock->trx->lock.wait_lock, + now); } else { - lock_rec_print(stderr, c_lock->trx->lock.wait_lock); + lock_rec_print(stderr, c_lock->trx->lock.wait_lock, + now); } } } @@ -2503,7 +2521,8 @@ lock_rec_enqueue_waiting( trx_mutex_exit(trx); - victim_trx_id = lock_deadlock_check_and_resolve(lock, trx); + const time_t now = time(NULL); + victim_trx_id = lock_deadlock_check_and_resolve(trx, lock, now); trx_mutex_enter(trx); @@ -2527,7 +2546,7 @@ lock_rec_enqueue_waiting( trx->lock.que_state = TRX_QUE_LOCK_WAIT; trx->lock.was_chosen_as_deadlock_victim = FALSE; - trx->lock.wait_started = ut_time(); + trx->lock.wait_started = now; if (UNIV_UNLIKELY(trx->take_stats)) { trx->lock_que_wait_nstarted = my_interval_timer(); @@ -2672,7 +2691,8 @@ lock_rec_add_to_queue( "BF skipping wait: " TRX_ID_FMT "\n", trx->id); - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, + time(NULL)); } } else #endif @@ -2991,13 +3011,14 @@ lock_rec_has_to_wait_in_queue( if (wsrep_thd_is_BF(wait_lock->trx->mysql_thd, FALSE) && wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE)) { if (wsrep_debug) { + time_t now = time(NULL); fprintf(stderr, "BF-BF lock conflict " TRX_ID_FMT " : " TRX_ID_FMT "\n", wait_lock->trx->id, lock->trx->id); - lock_rec_print(stderr, wait_lock); - lock_rec_print(stderr, lock); + lock_rec_print(stderr, wait_lock, now); + lock_rec_print(stderr, lock, now); } /* don't wait for another BF lock */ continue; @@ -4328,28 +4349,26 @@ lock_deadlock_trx_print( mutex_exit(&trx_sys->mutex); } -/*********************************************************************//** -Print lock data to the deadlock file and possibly to stderr. */ -UNIV_INLINE -void -lock_deadlock_lock_print( -/*=====================*/ - const lock_t* lock) /*!< in: record or table type lock */ +/** Print lock data to the deadlock file and possibly to stderr. +@param[in] lock record or table lock +@param[in] now current time */ +static void lock_deadlock_lock_print(const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); if (lock_get_type_low(lock) == LOCK_REC) { - lock_rec_print(lock_latest_err_file, lock); + mtr_t mtr; + lock_rec_print(lock_latest_err_file, lock, now, &mtr); if (srv_print_all_deadlocks) { - lock_rec_print(stderr, lock); + lock_rec_print(stderr, lock, now, &mtr); } } else { - lock_table_print(lock_latest_err_file, lock); + lock_table_print(lock_latest_err_file, lock, now); if (srv_print_all_deadlocks) { - lock_table_print(stderr, lock); + lock_table_print(stderr, lock, now); } } } @@ -4462,6 +4481,8 @@ lock_deadlock_notify( ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); + const time_t now = time(NULL); + lock_deadlock_start_print(); lock_deadlock_fputs("\n*** (1) TRANSACTION:\n"); @@ -4470,7 +4491,7 @@ lock_deadlock_notify( lock_deadlock_fputs("*** (1) WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(ctx->wait_lock); + lock_deadlock_lock_print(ctx->wait_lock, now); lock_deadlock_fputs("*** (2) TRANSACTION:\n"); @@ -4478,7 +4499,7 @@ lock_deadlock_notify( lock_deadlock_fputs("*** (2) HOLDS THE LOCK(S):\n"); - lock_deadlock_lock_print(lock); + lock_deadlock_lock_print(lock, now); /* It is possible that the joining transaction was granted its lock when we rolled back some other waiting transaction. */ @@ -4487,7 +4508,7 @@ lock_deadlock_notify( lock_deadlock_fputs( "*** (2) WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(ctx->start->lock.wait_lock); + lock_deadlock_lock_print(ctx->start->lock.wait_lock, now); } #ifdef UNIV_DEBUG @@ -4736,14 +4757,12 @@ lock_deadlock_search( return(0); } -/********************************************************************//** -Print info about transaction that was rolled back. */ -static -void -lock_deadlock_joining_trx_print( -/*============================*/ - const trx_t* trx, /*!< in: transaction rolled back */ - const lock_t* lock) /*!< in: lock trx wants */ +/** Print info about transaction that was rolled back. +@param[in] trx victim transaction +@param[in] lock the requested lock +@param[in] now current time */ +static void lock_deadlock_joining_trx_print(const trx_t* trx, + const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_ad(!srv_read_only_mode); @@ -4763,7 +4782,7 @@ lock_deadlock_joining_trx_print( lock_deadlock_fputs("*** WAITING FOR THIS LOCK TO BE GRANTED:\n"); - lock_deadlock_lock_print(lock); + lock_deadlock_lock_print(lock, now); } /********************************************************************//** @@ -4833,20 +4852,17 @@ lock_report_waiters_to_mysql( } -/********************************************************************//** -Checks if a joining lock request results in a deadlock. If a deadlock is +/** Check if a joining lock request results in a deadlock. If a deadlock is found this function will resolve the dadlock by choosing a victim transaction -and rolling it back. It will attempt to resolve all deadlocks. The returned -transaction id will be the joining transaction id or 0 if some other -transaction was chosen as a victim and rolled back or no deadlock found. - -@return id of transaction chosen as victim or 0 */ -static -trx_id_t -lock_deadlock_check_and_resolve( -/*============================*/ - const lock_t* lock, /*!< in: lock the transaction is requesting */ - const trx_t* trx) /*!< in: transaction */ +and rolling it back. It will attempt to resolve all deadlocks. +@param[in] trx joining transaction +@param[in] lock the requested lock +@param[in] now current time +@return trx->id of the victim transaction +@retval 0 if some other transaction was chosen as a victim and +rolled back, or no deadlock was found. */ +static trx_id_t lock_deadlock_check_and_resolve(const trx_t* trx, + const lock_t* lock, time_t now) { trx_id_t victim_trx_id; struct thd_wait_reports waitee_buf; @@ -4898,18 +4914,12 @@ lock_deadlock_check_and_resolve( ut_a(victim_trx_id == trx->id); #ifdef WITH_WSREP - if (!wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)) - { + if (wsrep_thd_is_BF(ctx.start->mysql_thd, TRUE)); else #endif /* WITH_WSREP */ - if (!srv_read_only_mode) { - lock_deadlock_joining_trx_print(trx, lock); - } -#ifdef WITH_WSREP - } else { - /* BF processor */; + if (!srv_read_only_mode) { + lock_deadlock_joining_trx_print(trx, lock, + now); } -#endif /* WITH_WSREP */ - } else if (victim_trx_id != 0 && victim_trx_id != trx->id) { ut_ad(victim_trx_id == ctx.wait_lock->trx->id); @@ -5255,7 +5265,9 @@ lock_table_enqueue_waiting( trx_mutex_exit(trx); - victim_trx_id = lock_deadlock_check_and_resolve(lock, trx); + const time_t now = time(NULL); + + victim_trx_id = lock_deadlock_check_and_resolve(trx, lock, now); trx_mutex_enter(trx); @@ -5277,7 +5289,7 @@ lock_table_enqueue_waiting( trx->lock.que_state = TRX_QUE_LOCK_WAIT; - trx->lock.wait_started = ut_time(); + trx->lock.wait_started = now; trx->lock.was_chosen_as_deadlock_victim = FALSE; trx->n_table_lock_waits++; @@ -6029,14 +6041,11 @@ lock_remove_all_on_table( /*===================== VALIDATION AND DEBUGGING ====================*/ -/*********************************************************************//** -Prints info of a table lock. */ -UNIV_INTERN -void -lock_table_print( -/*=============*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: table type lock */ +/** Pretty-print a table lock. +@param[in,out] file output stream +@param[in] lock table lock +@param[in] now current time */ +static void lock_table_print(FILE* file, const lock_t* lock, time_t now) { ut_ad(lock_mutex_own()); ut_a(lock_get_type_low(lock) == LOCK_TABLE); @@ -6066,30 +6075,22 @@ lock_table_print( } fprintf(file, " lock hold time %lu wait time before grant %lu ", - (ulint)difftime(ut_time(), lock->requested_time), + (ulint)difftime(now, lock->requested_time), lock->wait_time); putc('\n', file); } -/*********************************************************************//** -Prints info of a record lock. */ -UNIV_INTERN -void -lock_rec_print( -/*===========*/ - FILE* file, /*!< in: file where to print */ - const lock_t* lock) /*!< in: record type lock */ +/** Pretty-print a record lock. +@param[in,out] file output stream +@param[in] lock record lock +@param[in] now current time +@param[in,out] mtr mini-transaction */ +static void lock_rec_print(FILE* file, const lock_t* lock, time_t now, + mtr_t* mtr) { - const buf_block_t* block; ulint space; ulint page_no; - ulint i; - mtr_t mtr; - mem_heap_t* heap = NULL; - ulint offsets_[REC_OFFS_NORMAL_SIZE]; - ulint* offsets = offsets_; - rec_offs_init(offsets_); ut_ad(lock_mutex_own()); ut_a(lock_get_type_low(lock) == LOCK_REC); @@ -6134,18 +6135,25 @@ lock_rec_print( fputs(" waiting", file); } - mtr_start(&mtr); - fprintf(file, " lock hold time %lu wait time before grant %lu ", - (ulint)difftime(ut_time(), lock->requested_time), + (ulint)difftime(now, lock->requested_time), lock->wait_time); putc('\n', file); - if ( srv_show_verbose_locks ) { - block = buf_page_try_get(space, page_no, &mtr); + if (!srv_show_verbose_locks || !mtr) { + return; + } - for (i = 0; i < lock_rec_get_n_bits(lock); ++i) { + mem_heap_t* heap = NULL; + ulint offsets_[REC_OFFS_NORMAL_SIZE]; + ulint* offsets = offsets_; + rec_offs_init(offsets_); + + mtr_start(mtr); + const buf_block_t* block = buf_page_try_get(space, page_no, mtr); + + for (ulint i = 0; i < lock_rec_get_n_bits(lock); ++i) { if (!lock_rec_get_nth_bit(lock, i)) { continue; @@ -6169,9 +6177,8 @@ lock_rec_print( putc('\n', file); } - } - mtr_commit(&mtr); + mtr_commit(mtr); if (UNIV_LIKELY_NULL(heap)) { mem_heap_free(heap); } @@ -6327,6 +6334,8 @@ lock_print_info_all_transactions( ut_ad(lock_mutex_own()); + const time_t now = time(NULL); + mutex_enter(&trx_sys->mutex); /* First print info on non-active transactions */ @@ -6413,13 +6422,14 @@ loop: fprintf(file, "------- TRX HAS BEEN WAITING %lu SEC" " FOR THIS LOCK TO BE GRANTED:\n", - (ulong) difftime(ut_time(), - trx->lock.wait_started)); + (ulong) difftime(now, trx->lock.wait_started)); if (lock_get_type_low(trx->lock.wait_lock) == LOCK_REC) { - lock_rec_print(file, trx->lock.wait_lock); + lock_rec_print(file, trx->lock.wait_lock, now, + &mtr); } else { - lock_table_print(file, trx->lock.wait_lock); + lock_table_print(file, trx->lock.wait_lock, + now); } fputs("------------------\n", file); @@ -6508,11 +6518,11 @@ loop: } print_rec: - lock_rec_print(file, lock); + lock_rec_print(file, lock, now, &mtr); } else { ut_ad(lock_get_type_low(lock) & LOCK_TABLE); - lock_table_print(file, lock); + lock_table_print(file, lock, now); } load_page_first = TRUE; diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index e9ef6d9d605..b1ee2f7ca12 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -280,7 +280,6 @@ lock_wait_suspend_thread( user OS thread */ { srv_slot_t* slot; - double wait_time; trx_t* trx; ulint had_dict_lock; ibool was_declared_inside_innodb; @@ -416,7 +415,7 @@ lock_wait_suspend_thread( row_mysql_freeze_data_dictionary(trx); } - wait_time = ut_difftime(ut_time(), slot->suspend_time); + double wait_time = difftime(time(NULL), slot->suspend_time); /* Release the slot for others to use */ @@ -509,19 +508,12 @@ lock_wait_check_and_cancel( const srv_slot_t* slot) /*!< in: slot reserved by a user thread when the wait started */ { - trx_t* trx; - double wait_time; - ib_time_t suspend_time = slot->suspend_time; - ut_ad(lock_wait_mutex_own()); - ut_ad(slot->in_use); - ut_ad(slot->suspended); - wait_time = ut_difftime(ut_time(), suspend_time); - - trx = thr_get_trx(slot->thr); + double wait_time = difftime(time(NULL), slot->suspend_time); + trx_t* trx = thr_get_trx(slot->thr); if (trx_is_interrupted(trx) || (slot->wait_timeout < 100000000 @@ -555,7 +547,6 @@ lock_wait_check_and_cancel( trx_mutex_exit(trx); } - } /*********************************************************************//** From c663a9414b3fda92faeb5f7fefc866c55cf06dbd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 21:07:48 +0300 Subject: [PATCH 09/13] MDEV-14154: Failing assertion: slot->last_run <= current_time in fts0opt.cc The FTS optimizer thread made a false assumption that time(NULL) is monotonic. The system clock can be adjusted to the past, for example if the hardware clock was drifting to the future, and it was adjusted by NTP. fts_slot_t::interval_time: Replace with the constant FTS_OPTIMIZE_INTERVAL_IN_SECS. fts_slot_t::last_run, fts_slot_t::completed: Clarify the documentation. fts_optimize_get_time_limit(): Remove a type cast, and add a FIXME comment about domain mismatch. fts_optimize_compact(), fts_optimize_words(): Limit the time also when the current time has been moved to the past. fts_optimize_table_bk(): Check for wrap-around. fts_optimize_how_many(): Check for wrap-around, and remove the failing assertions. fts_is_sync_needed(): Remove a redundant call to time(NULL). --- storage/innobase/fts/fts0opt.cc | 99 ++++++++++++++++----------------- storage/xtradb/fts/fts0opt.cc | 99 ++++++++++++++++----------------- 2 files changed, 96 insertions(+), 102 deletions(-) diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 881b106f570..45248df72c5 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -59,7 +59,7 @@ static bool fts_opt_start_shutdown = false; static const ulint FTS_WORD_NODES_INIT_SIZE = 64; /** Last time we did check whether system need a sync */ -static ib_time_t last_check_sync_time; +static time_t last_check_sync_time; /** FTS optimize thread message types. */ enum fts_msg_type_t { @@ -181,12 +181,11 @@ struct fts_slot_t { ulint deleted; /*!< Number of doc ids deleted since the last time this table was optimized */ - ib_time_t last_run; /*!< Time last run completed */ + /** time(NULL) of completing fts_optimize_table_bk() */ + time_t last_run; - ib_time_t completed; /*!< Optimize finish time */ - - ib_time_t interval_time; /*!< Minimum time to wait before - optimizing the table again. */ + /** time(NULL) of latest successful fts_optimize_table() */ + time_t completed; }; /** A table remove message for the FTS optimize thread. */ @@ -223,8 +222,8 @@ UNIV_INTERN char fts_enable_diag_print; /** ZLib compressed block size.*/ static ulint FTS_ZIP_BLOCK_SIZE = 1024; -/** The amount of time optimizing in a single pass, in milliseconds. */ -static ib_time_t fts_optimize_time_limit = 0; +/** The amount of time optimizing in a single pass, in seconds. */ +static ulint fts_optimize_time_limit; /** It's defined in fts0fts.cc */ extern const char* fts_common_tables[]; @@ -1553,7 +1552,7 @@ fts_optimize_compact( /*=================*/ fts_optimize_t* optim, /*!< in: optimize state data */ dict_index_t* index, /*!< in: current FTS being optimized */ - ib_time_t start_time) /*!< in: optimize start time */ + time_t start_time) /*!< in: optimize start time */ { ulint i; dberr_t error = DB_SUCCESS; @@ -1586,8 +1585,11 @@ fts_optimize_compact( /* Free the word that was optimized. */ fts_word_free(word); + ulint interval = ulint(time(NULL) - start_time); + if (fts_optimize_time_limit > 0 - && (ut_time() - start_time) > fts_optimize_time_limit) { + && (lint(interval) < 0 + || interval > fts_optimize_time_limit)) { optim->done = TRUE; } @@ -1678,7 +1680,7 @@ fts_optimize_get_index_end_time( /*============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t* end_time) /*!< out: time in secs */ + time_t* end_time) /*!< out: time in secs */ { return(fts_config_get_index_ulint( trx, index, FTS_OPTIMIZE_END_TIME, (ulint*) end_time)); @@ -1693,7 +1695,7 @@ fts_optimize_set_index_end_time( /*============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t end_time) /*!< in: end time */ + time_t end_time) /*!< in: end time */ { return(fts_config_set_index_ulint( trx, index, FTS_OPTIMIZE_END_TIME, (ulint) end_time)); @@ -1755,22 +1757,23 @@ fts_optimize_free( Get the max time optimize should run in millisecs. @return max optimize time limit in millisecs. */ static -ib_time_t +ulint fts_optimize_get_time_limit( /*========================*/ trx_t* trx, /*!< in: transaction */ fts_table_t* fts_table) /*!< in: aux table */ { - ib_time_t time_limit = 0; + ulint time_limit = 0; fts_config_get_ulint( trx, fts_table, - FTS_OPTIMIZE_LIMIT_IN_SECS, (ulint*) &time_limit); + FTS_OPTIMIZE_LIMIT_IN_SECS, &time_limit); + /* FIXME: This is returning milliseconds, while the variable + is being stored and interpreted as seconds! */ return(time_limit * 1000); } - /**********************************************************************//** Run OPTIMIZE on the given table. Note: this can take a very long time (hours). */ @@ -1783,7 +1786,6 @@ fts_optimize_words( fts_string_t* word) /*!< in: the starting word to optimize */ { fts_fetch_t fetch; - ib_time_t start_time; que_t* graph = NULL; CHARSET_INFO* charset = optim->fts_index_table.charset; @@ -1793,7 +1795,7 @@ fts_optimize_words( fts_optimize_time_limit = fts_optimize_get_time_limit( optim->trx, &optim->fts_common_table); - start_time = ut_time(); + const time_t start_time = time(NULL); /* Setup the callback to use for fetching the word ilist etc. */ fetch.read_arg = optim->words; @@ -2314,8 +2316,8 @@ fts_optimize_indexes( dict_index_t* index; #ifdef FTS_OPTIMIZE_DEBUG - ib_time_t end_time; - ib_time_t start_time; + time_t end_time; + time_t start_time; /* Get the start and end optimize times for this index. */ error = fts_optimize_get_index_start_time( @@ -2443,11 +2445,13 @@ fts_optimize_table_bk( /*==================*/ fts_slot_t* slot) /*!< in: table to optimiza */ { - dberr_t error; + const time_t now = time(NULL); + const ulint interval = ulint(now - slot->last_run); /* Avoid optimizing tables that were optimized recently. */ if (slot->last_run > 0 - && (ut_time() - slot->last_run) < slot->interval_time) { + && lint(interval) >= 0 + && interval < FTS_OPTIMIZE_INTERVAL_IN_SECS) { return(DB_SUCCESS); } @@ -2455,7 +2459,14 @@ fts_optimize_table_bk( dict_table_t* table = dict_table_open_on_id( slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); - if (table && fil_table_accessible(table) + if (!table) { + slot->last_run = now; + return DB_SUCCESS; + } + + dberr_t error; + + if (fil_table_accessible(table) && table->fts && table->fts->cache && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { error = fts_optimize_table(table); @@ -2468,7 +2479,7 @@ fts_optimize_table_bk( } } else { /* Note time this run completed. */ - slot->last_run = ut_time(); + slot->last_run = now; error = DB_SUCCESS; } @@ -2720,7 +2731,6 @@ static bool fts_optimize_new_table(dict_table_t* table) slot->table_id = table->id; slot->running = false; - slot->interval_time = FTS_OPTIMIZE_INTERVAL_IN_SECS; return(TRUE); } @@ -2757,37 +2767,23 @@ Calculate how many tables in fts_slots need to be optimized. @return no. of tables to optimize */ static ulint fts_optimize_how_many() { - ulint i; - ib_time_t delta; - ulint n_tables = 0; - ib_time_t current_time; + ulint n_tables = 0; + const time_t current_time = time(NULL); - current_time = ut_time(); - - for (i = 0; i < ib_vector_size(fts_slots); ++i) { + for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { const fts_slot_t* slot = static_cast( ib_vector_get_const(fts_slots, i)); if (slot->table_id == 0) { continue; } - if (!slot->running) { - ut_a(slot->completed <= current_time); + const time_t end = slot->running + ? slot->last_run : slot->completed; + ulint interval = ulint(current_time - end); - delta = current_time - slot->completed; - - /* Skip slots that have been optimized recently. */ - if (delta >= slot->interval_time) { - ++n_tables; - } - } else { - ut_a(slot->last_run <= current_time); - - delta = current_time - slot->last_run; - - if (delta > slot->interval_time) { - ++n_tables; - } + if (lint(interval) < 0 + || interval >= FTS_OPTIMIZE_INTERVAL_IN_SECS) { + ++n_tables; } } @@ -2800,13 +2796,14 @@ Check if the total memory used by all FTS table exceeds the maximum limit. static bool fts_is_sync_needed() { ulint total_memory = 0; - double time_diff = difftime(ut_time(), last_check_sync_time); + const time_t now = time(NULL); + double time_diff = difftime(now, last_check_sync_time); - if (fts_need_sync || time_diff < 5) { + if (fts_need_sync || (time_diff >= 0 && time_diff < 5)) { return(false); } - last_check_sync_time = ut_time(); + last_check_sync_time = now; for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { const fts_slot_t* slot = static_cast( diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc index 881b106f570..45248df72c5 100644 --- a/storage/xtradb/fts/fts0opt.cc +++ b/storage/xtradb/fts/fts0opt.cc @@ -59,7 +59,7 @@ static bool fts_opt_start_shutdown = false; static const ulint FTS_WORD_NODES_INIT_SIZE = 64; /** Last time we did check whether system need a sync */ -static ib_time_t last_check_sync_time; +static time_t last_check_sync_time; /** FTS optimize thread message types. */ enum fts_msg_type_t { @@ -181,12 +181,11 @@ struct fts_slot_t { ulint deleted; /*!< Number of doc ids deleted since the last time this table was optimized */ - ib_time_t last_run; /*!< Time last run completed */ + /** time(NULL) of completing fts_optimize_table_bk() */ + time_t last_run; - ib_time_t completed; /*!< Optimize finish time */ - - ib_time_t interval_time; /*!< Minimum time to wait before - optimizing the table again. */ + /** time(NULL) of latest successful fts_optimize_table() */ + time_t completed; }; /** A table remove message for the FTS optimize thread. */ @@ -223,8 +222,8 @@ UNIV_INTERN char fts_enable_diag_print; /** ZLib compressed block size.*/ static ulint FTS_ZIP_BLOCK_SIZE = 1024; -/** The amount of time optimizing in a single pass, in milliseconds. */ -static ib_time_t fts_optimize_time_limit = 0; +/** The amount of time optimizing in a single pass, in seconds. */ +static ulint fts_optimize_time_limit; /** It's defined in fts0fts.cc */ extern const char* fts_common_tables[]; @@ -1553,7 +1552,7 @@ fts_optimize_compact( /*=================*/ fts_optimize_t* optim, /*!< in: optimize state data */ dict_index_t* index, /*!< in: current FTS being optimized */ - ib_time_t start_time) /*!< in: optimize start time */ + time_t start_time) /*!< in: optimize start time */ { ulint i; dberr_t error = DB_SUCCESS; @@ -1586,8 +1585,11 @@ fts_optimize_compact( /* Free the word that was optimized. */ fts_word_free(word); + ulint interval = ulint(time(NULL) - start_time); + if (fts_optimize_time_limit > 0 - && (ut_time() - start_time) > fts_optimize_time_limit) { + && (lint(interval) < 0 + || interval > fts_optimize_time_limit)) { optim->done = TRUE; } @@ -1678,7 +1680,7 @@ fts_optimize_get_index_end_time( /*============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t* end_time) /*!< out: time in secs */ + time_t* end_time) /*!< out: time in secs */ { return(fts_config_get_index_ulint( trx, index, FTS_OPTIMIZE_END_TIME, (ulint*) end_time)); @@ -1693,7 +1695,7 @@ fts_optimize_set_index_end_time( /*============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t end_time) /*!< in: end time */ + time_t end_time) /*!< in: end time */ { return(fts_config_set_index_ulint( trx, index, FTS_OPTIMIZE_END_TIME, (ulint) end_time)); @@ -1755,22 +1757,23 @@ fts_optimize_free( Get the max time optimize should run in millisecs. @return max optimize time limit in millisecs. */ static -ib_time_t +ulint fts_optimize_get_time_limit( /*========================*/ trx_t* trx, /*!< in: transaction */ fts_table_t* fts_table) /*!< in: aux table */ { - ib_time_t time_limit = 0; + ulint time_limit = 0; fts_config_get_ulint( trx, fts_table, - FTS_OPTIMIZE_LIMIT_IN_SECS, (ulint*) &time_limit); + FTS_OPTIMIZE_LIMIT_IN_SECS, &time_limit); + /* FIXME: This is returning milliseconds, while the variable + is being stored and interpreted as seconds! */ return(time_limit * 1000); } - /**********************************************************************//** Run OPTIMIZE on the given table. Note: this can take a very long time (hours). */ @@ -1783,7 +1786,6 @@ fts_optimize_words( fts_string_t* word) /*!< in: the starting word to optimize */ { fts_fetch_t fetch; - ib_time_t start_time; que_t* graph = NULL; CHARSET_INFO* charset = optim->fts_index_table.charset; @@ -1793,7 +1795,7 @@ fts_optimize_words( fts_optimize_time_limit = fts_optimize_get_time_limit( optim->trx, &optim->fts_common_table); - start_time = ut_time(); + const time_t start_time = time(NULL); /* Setup the callback to use for fetching the word ilist etc. */ fetch.read_arg = optim->words; @@ -2314,8 +2316,8 @@ fts_optimize_indexes( dict_index_t* index; #ifdef FTS_OPTIMIZE_DEBUG - ib_time_t end_time; - ib_time_t start_time; + time_t end_time; + time_t start_time; /* Get the start and end optimize times for this index. */ error = fts_optimize_get_index_start_time( @@ -2443,11 +2445,13 @@ fts_optimize_table_bk( /*==================*/ fts_slot_t* slot) /*!< in: table to optimiza */ { - dberr_t error; + const time_t now = time(NULL); + const ulint interval = ulint(now - slot->last_run); /* Avoid optimizing tables that were optimized recently. */ if (slot->last_run > 0 - && (ut_time() - slot->last_run) < slot->interval_time) { + && lint(interval) >= 0 + && interval < FTS_OPTIMIZE_INTERVAL_IN_SECS) { return(DB_SUCCESS); } @@ -2455,7 +2459,14 @@ fts_optimize_table_bk( dict_table_t* table = dict_table_open_on_id( slot->table_id, FALSE, DICT_TABLE_OP_NORMAL); - if (table && fil_table_accessible(table) + if (!table) { + slot->last_run = now; + return DB_SUCCESS; + } + + dberr_t error; + + if (fil_table_accessible(table) && table->fts && table->fts->cache && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { error = fts_optimize_table(table); @@ -2468,7 +2479,7 @@ fts_optimize_table_bk( } } else { /* Note time this run completed. */ - slot->last_run = ut_time(); + slot->last_run = now; error = DB_SUCCESS; } @@ -2720,7 +2731,6 @@ static bool fts_optimize_new_table(dict_table_t* table) slot->table_id = table->id; slot->running = false; - slot->interval_time = FTS_OPTIMIZE_INTERVAL_IN_SECS; return(TRUE); } @@ -2757,37 +2767,23 @@ Calculate how many tables in fts_slots need to be optimized. @return no. of tables to optimize */ static ulint fts_optimize_how_many() { - ulint i; - ib_time_t delta; - ulint n_tables = 0; - ib_time_t current_time; + ulint n_tables = 0; + const time_t current_time = time(NULL); - current_time = ut_time(); - - for (i = 0; i < ib_vector_size(fts_slots); ++i) { + for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { const fts_slot_t* slot = static_cast( ib_vector_get_const(fts_slots, i)); if (slot->table_id == 0) { continue; } - if (!slot->running) { - ut_a(slot->completed <= current_time); + const time_t end = slot->running + ? slot->last_run : slot->completed; + ulint interval = ulint(current_time - end); - delta = current_time - slot->completed; - - /* Skip slots that have been optimized recently. */ - if (delta >= slot->interval_time) { - ++n_tables; - } - } else { - ut_a(slot->last_run <= current_time); - - delta = current_time - slot->last_run; - - if (delta > slot->interval_time) { - ++n_tables; - } + if (lint(interval) < 0 + || interval >= FTS_OPTIMIZE_INTERVAL_IN_SECS) { + ++n_tables; } } @@ -2800,13 +2796,14 @@ Check if the total memory used by all FTS table exceeds the maximum limit. static bool fts_is_sync_needed() { ulint total_memory = 0; - double time_diff = difftime(ut_time(), last_check_sync_time); + const time_t now = time(NULL); + double time_diff = difftime(now, last_check_sync_time); - if (fts_need_sync || time_diff < 5) { + if (fts_need_sync || (time_diff >= 0 && time_diff < 5)) { return(false); } - last_check_sync_time = ut_time(); + last_check_sync_time = now; for (ulint i = 0; i < ib_vector_size(fts_slots); ++i) { const fts_slot_t* slot = static_cast( From 0c7c61019d89aae46632016f83562b72406dc49b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Wed, 24 Jul 2019 21:43:19 +0300 Subject: [PATCH 10/13] Remove the wrappers ut_time(), ut_difftime(), ib_time_t --- storage/innobase/buf/buf0buf.cc | 4 +-- storage/innobase/dict/dict0mem.cc | 2 +- storage/innobase/dict/dict0stats.cc | 12 ++++---- storage/innobase/dict/dict0stats_bg.cc | 4 +-- storage/innobase/eval/eval0eval.cc | 3 +- storage/innobase/fts/fts0fts.cc | 14 ++++----- storage/innobase/fts/fts0opt.cc | 16 +++++----- storage/innobase/include/dict0mem.h | 4 +-- storage/innobase/include/log0recv.h | 4 +-- storage/innobase/include/srv0mon.h | 6 ++-- storage/innobase/include/trx0i_s.h | 2 +- storage/innobase/include/ut0ut.h | 35 ---------------------- storage/innobase/lock/lock0lock.cc | 12 ++++---- storage/innobase/lock/lock0wait.cc | 4 +-- storage/innobase/log/log0log.cc | 4 +-- storage/innobase/log/log0recv.cc | 6 ++-- storage/innobase/os/os0file.cc | 10 +++---- storage/innobase/srv/srv0srv.cc | 39 +++++++++++------------- storage/innobase/sync/sync0arr.cc | 4 +-- storage/innobase/trx/trx0roll.cc | 4 +-- storage/innobase/trx/trx0trx.cc | 2 +- storage/innobase/ut/ut0ut.cc | 29 ------------------ storage/xtradb/buf/buf0buf.cc | 4 +-- storage/xtradb/dict/dict0mem.cc | 2 +- storage/xtradb/dict/dict0stats.cc | 12 ++++---- storage/xtradb/dict/dict0stats_bg.cc | 4 +-- storage/xtradb/eval/eval0eval.cc | 3 +- storage/xtradb/fil/fil0fil.cc | 9 +++--- storage/xtradb/fts/fts0fts.cc | 14 ++++----- storage/xtradb/fts/fts0opt.cc | 16 +++++----- storage/xtradb/include/dict0mem.h | 4 +-- storage/xtradb/include/log0recv.h | 4 +-- storage/xtradb/include/srv0mon.h | 6 ++-- storage/xtradb/include/trx0i_s.h | 2 +- storage/xtradb/include/ut0ut.h | 22 -------------- storage/xtradb/lock/lock0lock.cc | 12 ++++---- storage/xtradb/lock/lock0wait.cc | 4 +-- storage/xtradb/log/log0log.cc | 5 ++-- storage/xtradb/log/log0recv.cc | 6 ++-- storage/xtradb/os/os0file.cc | 10 +++---- storage/xtradb/srv/srv0srv.cc | 41 ++++++++++++-------------- storage/xtradb/sync/sync0arr.cc | 4 +-- storage/xtradb/trx/trx0roll.cc | 4 +-- storage/xtradb/trx/trx0trx.cc | 2 +- storage/xtradb/ut/ut0ut.cc | 29 ------------------ 45 files changed, 162 insertions(+), 277 deletions(-) diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index 73c757569ad..4d5b3f29f82 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -1688,7 +1688,7 @@ buf_pool_init_instance( buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size); - buf_pool->last_printout_time = ut_time(); + buf_pool->last_printout_time = time(NULL); } /* 2. Initialize flushing fields -------------------------------- */ @@ -6160,7 +6160,7 @@ buf_refresh_io_stats( /*=================*/ buf_pool_t* buf_pool) /*!< in: buffer pool instance */ { - buf_pool->last_printout_time = ut_time(); + buf_pool->last_printout_time = time(NULL); buf_pool->old_stat = buf_pool->stat; } diff --git a/storage/innobase/dict/dict0mem.cc b/storage/innobase/dict/dict0mem.cc index 3d32cf2479c..c5f845d14b1 100644 --- a/storage/innobase/dict/dict0mem.cc +++ b/storage/innobase/dict/dict0mem.cc @@ -750,7 +750,7 @@ void dict_mem_init(void) { /* Initialize a randomly distributed temporary file number */ - ib_uint32_t now = static_cast(ut_time()); + ib_uint32_t now = static_cast(time(NULL)); const byte* buf = reinterpret_cast(&now); ut_ad(ut_crc32 != NULL); diff --git a/storage/innobase/dict/dict0stats.cc b/storage/innobase/dict/dict0stats.cc index 3cbd88c0f0a..59c661514f5 100644 --- a/storage/innobase/dict/dict0stats.cc +++ b/storage/innobase/dict/dict0stats.cc @@ -45,7 +45,7 @@ Created Jan 06, 2010 Vasil Dimov #include "trx0trx.h" /* trx_create() */ #include "trx0roll.h" /* trx_rollback_to_savepoint() */ #include "ut0rnd.h" /* ut_rnd_interval() */ -#include "ut0ut.h" /* ut_format_name(), ut_time() */ +#include "ut0ut.h" /* ut_format_name() */ #include #include @@ -1000,7 +1000,7 @@ dict_stats_update_transient( table->stat_sum_of_other_index_sizes = sum_of_index_sizes - index->stat_index_size; - table->stats_last_recalc = ut_time(); + table->stats_last_recalc = time(NULL); table->stat_modified_counter = 0; @@ -2325,7 +2325,7 @@ dict_stats_update_persistent( += index->stat_index_size; } - table->stats_last_recalc = ut_time(); + table->stats_last_recalc = time(NULL); table->stat_modified_counter = 0; @@ -2535,7 +2535,7 @@ dict_stats_save( /* MySQL's timestamp is 4 byte, so we use pars_info_add_int4_literal() which takes a lint arg, so "now" is lint */ - now = (lint) ut_time(); + now = (lint) time(NULL); pinfo = pars_info_create(); @@ -3980,7 +3980,7 @@ dict_stats_save_defrag_summary( dict_index_t* index) /*!< in: index */ { dberr_t ret; - lint now = (lint) ut_time(); + lint now = (lint) time(NULL); if (dict_index_is_univ(index)) { return DB_SUCCESS; } @@ -4017,7 +4017,7 @@ dict_stats_save_defrag_stats( return DB_SUCCESS; } - lint now = (lint) ut_time(); + lint now = (lint) time(NULL); mtr_t mtr; ulint n_leaf_pages; ulint n_leaf_reserved; diff --git a/storage/innobase/dict/dict0stats_bg.cc b/storage/innobase/dict/dict0stats_bg.cc index dad768a7c3b..b4923364cac 100644 --- a/storage/innobase/dict/dict0stats_bg.cc +++ b/storage/innobase/dict/dict0stats_bg.cc @@ -437,14 +437,14 @@ dict_stats_process_entry_from_recalc_pool() mutex_exit(&dict_sys->mutex); - /* ut_time() could be expensive, the current function + /* time() could be expensive, the current function is called once every time a table has been changed more than 10% and on a system with lots of small tables, this could become hot. If we find out that this is a problem, then the check below could eventually be replaced with something else, though a time interval is the natural approach. */ - if (ut_difftime(ut_time(), table->stats_last_recalc) + if (difftime(time(NULL), table->stats_last_recalc) < MIN_RECALC_INTERVAL) { /* Stats were (re)calculated not long ago. To avoid diff --git a/storage/innobase/eval/eval0eval.cc b/storage/innobase/eval/eval0eval.cc index ccb995f9d4f..d62febd466d 100644 --- a/storage/innobase/eval/eval0eval.cc +++ b/storage/innobase/eval/eval0eval.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2011, 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 @@ -858,7 +859,7 @@ eval_predefined( dfield_get_data(que_node_get_val(arg1))); } else if (func == PARS_SYSDATE_TOKEN) { - int_val = (lint) ut_time(); + int_val = (lint) time(NULL); } else { eval_predefined_2(func_node); diff --git a/storage/innobase/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index beed1b99d6c..264c520bb1e 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -77,8 +77,8 @@ UNIV_INTERN ulong fts_min_token_size; // FIXME: testing -ib_time_t elapsed_time = 0; -ulint n_nodes = 0; +static time_t elapsed_time; +static ulint n_nodes; /** Error condition reported by fts_utf8_decode() */ const ulint UTF8_ERROR = 0xFFFFFFFF; @@ -3798,7 +3798,7 @@ fts_write_node( pars_info_t* info; dberr_t error; ib_uint32_t doc_count; - ib_time_t start_time; + time_t start_time; doc_id_t last_doc_id; doc_id_t first_doc_id; char table_name[MAX_FULL_NAME_LEN]; @@ -3845,9 +3845,9 @@ fts_write_node( " :last_doc_id, :doc_count, :ilist);"); } - start_time = ut_time(); + start_time = time(NULL); error = fts_eval_sql(trx, *graph); - elapsed_time += ut_time() - start_time; + elapsed_time += time(NULL) - start_time; ++n_nodes; return(error); @@ -4298,7 +4298,7 @@ fts_sync_begin( n_nodes = 0; elapsed_time = 0; - sync->start_time = ut_time(); + sync->start_time = time(NULL); sync->trx = trx_allocate_for_background(); @@ -4457,7 +4457,7 @@ fts_sync_commit( "SYNC for table %s: SYNC time : %lu secs: " "elapsed %lf ins/sec", sync->table->name, - (ulong) (ut_time() - sync->start_time), + (ulong) (time(NULL) - sync->start_time), (double) n_nodes/ (double) elapsed_time); } diff --git a/storage/innobase/fts/fts0opt.cc b/storage/innobase/fts/fts0opt.cc index 45248df72c5..2f8739d3d2c 100644 --- a/storage/innobase/fts/fts0opt.cc +++ b/storage/innobase/fts/fts0opt.cc @@ -1648,7 +1648,7 @@ fts_optimize_get_index_start_time( /*==============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t* start_time) /*!< out: time in secs */ + time_t* start_time) /*!< out: time in secs */ { return(fts_config_get_index_ulint( trx, index, FTS_OPTIMIZE_START_TIME, @@ -1664,7 +1664,7 @@ fts_optimize_set_index_start_time( /*==============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t start_time) /*!< in: start time */ + time_t start_time) /*!< in: start time */ { return(fts_config_set_index_ulint( trx, index, FTS_OPTIMIZE_START_TIME, @@ -1918,7 +1918,7 @@ fts_optimize_index_completed( dberr_t error; byte buf[sizeof(ulint)]; #ifdef FTS_OPTIMIZE_DEBUG - ib_time_t end_time = ut_time(); + time_t end_time = time(NULL); error = fts_optimize_set_index_end_time(optim->trx, index, end_time); #endif @@ -2337,14 +2337,14 @@ fts_optimize_indexes( /* Start time will be 0 only for the first time or after completing the optimization of all FTS indexes. */ if (start_time == 0) { - start_time = ut_time(); + start_time = time(NULL); error = fts_optimize_set_index_start_time( optim->trx, index, start_time); } /* Check if this index needs to be optimized or not. */ - if (ut_difftime(end_time, start_time) < 0) { + if (difftime(end_time, start_time) < 0) { error = fts_optimize_index(optim, index); if (error != DB_SUCCESS) { @@ -2416,7 +2416,7 @@ fts_optimize_reset_start_time( for (uint i = 0; i < ib_vector_size(fts->indexes); ++i) { dict_index_t* index; - ib_time_t start_time = 0; + time_t start_time = 0; /* Reset the start time to 0 for this index. */ error = fts_optimize_set_index_start_time( @@ -2471,7 +2471,7 @@ fts_optimize_table_bk( && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { error = fts_optimize_table(table); - slot->last_run = ut_time(); + slot->last_run = time(NULL); if (error == DB_SUCCESS) { slot->running = false; @@ -3001,7 +3001,7 @@ fts_optimize_init(void) fts_optimize_wq = ib_wqueue_create(); ut_a(fts_optimize_wq != NULL); - last_check_sync_time = ut_time(); + last_check_sync_time = time(NULL); os_thread_create(fts_optimize_thread, fts_optimize_wq, NULL); } diff --git a/storage/innobase/include/dict0mem.h b/storage/innobase/include/dict0mem.h index b6d03e16a52..505d4925324 100644 --- a/storage/innobase/include/dict0mem.h +++ b/storage/innobase/include/dict0mem.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1181,7 +1181,7 @@ struct dict_table_t{ goes to zero. If it's -1, means there's DDL on the table, DML from memcached will be blocked. */ - ib_time_t stats_last_recalc; + time_t stats_last_recalc; /*!< Timestamp of last recalc of the stats */ ib_uint32_t stat_persistent; /*!< The two bits below are set in the diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h index e24b0e961cf..f030881edc9 100644 --- a/storage/innobase/include/log0recv.h +++ b/storage/innobase/include/log0recv.h @@ -426,7 +426,7 @@ struct recv_sys_t{ log record, or there is a log parsing buffer overflow */ /** the time when progress was last reported */ - ib_time_t progress_time; + time_t progress_time; #ifdef UNIV_LOG_ARCHIVE log_group_t* archive_group; /*!< in archive recovery: the log group whose @@ -444,7 +444,7 @@ struct recv_sys_t{ @param[in] time the current time @return whether progress should be reported (the last report was at least 15 seconds ago) */ - bool report(ib_time_t time) + bool report(time_t time) { if (time - progress_time < 15) { return false; diff --git a/storage/innobase/include/srv0mon.h b/storage/innobase/include/srv0mon.h index f321248f68a..736a1a66aa4 100644 --- a/storage/innobase/include/srv0mon.h +++ b/storage/innobase/include/srv0mon.h @@ -58,9 +58,9 @@ create the internal counter ID in "monitor_id_t". */ /** Structure containing the actual values of a monitor counter. */ struct monitor_value_t { - ib_time_t mon_start_time; /*!< Start time of monitoring */ - ib_time_t mon_stop_time; /*!< Stop time of monitoring */ - ib_time_t mon_reset_time; /*!< Time counter resetted */ + time_t mon_start_time; /*!< Start time of monitoring */ + time_t mon_stop_time; /*!< Stop time of monitoring */ + time_t mon_reset_time; /*!< Time of resetting the counter */ mon_type_t mon_value; /*!< Current counter Value */ mon_type_t mon_max_value; /*!< Current Max value */ mon_type_t mon_min_value; /*!< Current Min value */ diff --git a/storage/innobase/include/trx0i_s.h b/storage/innobase/include/trx0i_s.h index 2d0b7f01f7e..77ab4f406cb 100644 --- a/storage/innobase/include/trx0i_s.h +++ b/storage/innobase/include/trx0i_s.h @@ -129,7 +129,7 @@ struct i_s_trx_row_t { trx_id_t trx_id; /*!< transaction identifier */ const char* trx_state; /*!< transaction state from trx_get_que_state_str() */ - ib_time_t trx_started; /*!< trx_t::start_time */ + time_t trx_started; /*!< trx_t::start_time */ const i_s_locks_row_t* requested_lock_row; /*!< pointer to a row in innodb_locks if trx diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 675cca9afd2..da94e78d6bd 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -53,9 +53,6 @@ Created 1/20/1994 Heikki Tuuri /** Index name prefix in fast index creation, as a string constant */ #define TEMP_INDEX_PREFIX_STR "\377" -/** Time stamp */ -typedef time_t ib_time_t; - /* In order to call a piece of code, when a function returns or when the scope ends, use this utility class. It will invoke the given function object in its destructor. */ @@ -235,27 +232,6 @@ store the given number of bits. #define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) #ifndef UNIV_INNOCHECKSUM -/**********************************************************//** -Returns system time. We do not specify the format of the time returned: -the only way to manipulate it is to use the function ut_difftime. -@return system time */ -UNIV_INTERN -ib_time_t -ut_time(void); -/*=========*/ -#ifndef UNIV_HOTBACKUP -/**********************************************************//** -Returns the number of milliseconds since some epoch. The -value may wrap around. It should only be used for heuristic -purposes. -@return ms since epoch */ -UNIV_INTERN -ulint -ut_time_ms(void); -/*============*/ - -#endif /* !UNIV_HOTBACKUP */ - /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic @@ -265,17 +241,6 @@ UNIV_INTERN ulint ut_time_ms(void); /*============*/ - -/**********************************************************//** -Returns the difference of two times in seconds. -@return time2 - time1 expressed in seconds */ -UNIV_INTERN -double -ut_difftime( -/*========*/ - ib_time_t time2, /*!< in: time */ - ib_time_t time1); /*!< in: time */ - #endif /* !UNIV_INNOCHECKSUM */ /**********************************************************//** diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc index ab2b536a7d7..0fade62e7aa 100644 --- a/storage/innobase/lock/lock0lock.cc +++ b/storage/innobase/lock/lock0lock.cc @@ -2171,7 +2171,7 @@ lock_rec_create( /* Set the bit corresponding to rec */ lock_rec_set_nth_bit(lock, heap_no); - lock->requested_time = ut_time(); + lock->requested_time = time(NULL); lock->wait_time = 0; index->table->n_rec_locks++; @@ -3052,16 +3052,18 @@ lock_grant( } } + const time_t now = time(NULL); + /* Cumulate total lock wait time for statistics */ if (lock_get_type_low(lock) & LOCK_TABLE) { lock->trx->total_table_lock_wait_time += - (ulint)difftime(ut_time(), lock->trx->lock.wait_started); + (ulint)difftime(now, lock->trx->lock.wait_started); } else { lock->trx->total_rec_lock_wait_time += - (ulint)difftime(ut_time(), lock->trx->lock.wait_started); + (ulint)difftime(now, lock->trx->lock.wait_started); } - lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time); + lock->wait_time = (ulint)difftime(now, lock->requested_time); if (!owns_trx_mutex) { trx_mutex_exit(lock->trx); @@ -4961,7 +4963,7 @@ lock_table_create( lock->type_mode = type_mode | LOCK_TABLE; lock->trx = trx; - lock->requested_time = ut_time(); + lock->requested_time = time(NULL); lock->wait_time = 0; lock->un_member.tab_lock.table = table; diff --git a/storage/innobase/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 2be579bf644..ca697ab8be5 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -60,7 +60,7 @@ lock_wait_table_print(void) (ulong) slot->in_use, (ulong) slot->suspended, slot->wait_timeout, - (ulong) difftime(ut_time(), slot->suspend_time)); + (ulong) difftime(time(NULL), slot->suspend_time)); } } @@ -157,7 +157,7 @@ lock_wait_table_reserve_slot( os_event_reset(slot->event); slot->suspended = TRUE; - slot->suspend_time = ut_time(); + slot->suspend_time = time(NULL); slot->wait_timeout = wait_timeout; if (slot == lock_sys->last_slot) { diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc index 6f4592079bc..86d483ae6f7 100644 --- a/storage/innobase/log/log0log.cc +++ b/storage/innobase/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -2340,7 +2340,7 @@ loop: start_lsn += len; buf += len; - if (recv_sys->report(ut_time())) { + if (recv_sys->report(time(NULL))) { ib_logf(IB_LOG_LEVEL_INFO, "Read redo log up to LSN=" LSN_PF, start_lsn); service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc index d68f9236610..3b3c7c23224 100644 --- a/storage/innobase/log/log0recv.cc +++ b/storage/innobase/log/log0recv.cc @@ -423,7 +423,7 @@ recv_sys_init( recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE)); recv_sys->found_corrupt_log = FALSE; - recv_sys->progress_time = ut_time(); + recv_sys->progress_time = time(NULL); recv_max_page_lsn = 0; @@ -1702,7 +1702,7 @@ recv_recover_page_func( mtr_commit(&mtr); - ib_time_t time = ut_time(); + time_t now = time(NULL); mutex_enter(&recv_sys->mutex); @@ -1714,7 +1714,7 @@ recv_recover_page_func( ut_a(recv_sys->n_addrs > 0); if (ulint n = --recv_sys->n_addrs) { - if (recv_sys->report(time)) { + if (recv_sys->report(now)) { ib_logf(IB_LOG_LEVEL_INFO, "To recover: " ULINTPF " pages from log", n); service_manager_extend_timeout( diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index 1d20e6a2f28..3a403f880c1 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -4208,7 +4208,7 @@ os_aio_init( os_aio_validate(); - os_last_printout = ut_time(); + os_last_printout = time(NULL); if (srv_use_native_aio) { return(TRUE); @@ -4521,7 +4521,7 @@ found: } slot->reserved = TRUE; - slot->reservation_time = ut_time(); + slot->reservation_time = time(NULL); slot->message1 = message1; slot->message2 = message2; slot->file = file; @@ -5600,7 +5600,7 @@ restart: if (slot->reserved) { age = (ulint) difftime( - ut_time(), slot->reservation_time); + time(NULL), slot->reservation_time); if ((age >= 2 && age > biggest_age) || (age >= 2 && age == biggest_age @@ -6014,7 +6014,7 @@ os_aio_print( } putc('\n', file); - current_time = ut_time(); + current_time = time(NULL); time_elapsed = 0.001 + difftime(current_time, os_last_printout); fprintf(file, diff --git a/storage/innobase/srv/srv0srv.cc b/storage/innobase/srv/srv0srv.cc index 733d2c44692..af9474dd9b3 100644 --- a/storage/innobase/srv/srv0srv.cc +++ b/storage/innobase/srv/srv0srv.cc @@ -1716,10 +1716,11 @@ DECLARE_THREAD(srv_monitor_thread)(void*) pfs_register_thread(srv_monitor_thread_key); #endif /* UNIV_PFS_THREAD */ - srv_last_monitor_time = ut_time(); - last_table_monitor_time = ut_time(); - last_tablespace_monitor_time = ut_time(); - last_monitor_time = ut_time(); + current_time = time(NULL); + srv_last_monitor_time = current_time; + last_table_monitor_time = current_time; + last_tablespace_monitor_time = current_time; + last_monitor_time = current_time; mutex_skipped = 0; last_srv_print_monitor = srv_print_innodb_monitor; loop: @@ -1730,12 +1731,12 @@ loop: os_event_wait_time_low(srv_monitor_event, 5000000, sig_count); - current_time = ut_time(); + current_time = time(NULL); time_elapsed = difftime(current_time, last_monitor_time); if (time_elapsed > 15) { - last_monitor_time = ut_time(); + last_monitor_time = current_time; if (srv_print_innodb_monitor) { /* Reset mutex_skipped counter everytime @@ -1782,7 +1783,7 @@ loop: if (srv_print_innodb_tablespace_monitor && difftime(current_time, last_tablespace_monitor_time) > 60) { - last_tablespace_monitor_time = ut_time(); + last_tablespace_monitor_time = current_time; fputs("========================" "========================\n", @@ -1808,7 +1809,7 @@ loop: if (srv_print_innodb_table_monitor && difftime(current_time, last_table_monitor_time) > 60) { - last_table_monitor_time = ut_time(); + last_table_monitor_time = current_time; fprintf(stderr, "Warning: %s\n", DEPRECATED_MSG_INNODB_TABLE_MONITOR); @@ -2183,20 +2184,16 @@ static void srv_shutdown_print_master_pending( /*==============================*/ - ib_time_t* last_print_time, /*!< last time the function + time_t* last_print_time, /*!< last time the function print the message */ ulint n_tables_to_drop, /*!< number of tables to be dropped */ ulint n_bytes_merged) /*!< number of change buffer just merged */ { - ib_time_t current_time; - double time_elapsed; + time_t current_time = time(NULL); - current_time = ut_time(); - time_elapsed = ut_difftime(current_time, *last_print_time); - - if (time_elapsed > 60) { + if (difftime(current_time, *last_print_time) > 60) { *last_print_time = current_time; if (n_tables_to_drop) { @@ -2231,7 +2228,7 @@ void srv_master_do_active_tasks(void) /*============================*/ { - ib_time_t cur_time = ut_time(); + time_t cur_time = time(NULL); ulonglong counter_time = microsecond_interval_timer(); ulint n_evicted = 0; @@ -2390,7 +2387,7 @@ srv_shutdown(bool ibuf_merge) { ulint n_bytes_merged = 0; ulint n_tables_to_drop; - ib_time_t now = ut_time(); + time_t now = time(NULL); do { ut_ad(!srv_read_only_mode); @@ -2539,10 +2536,10 @@ srv_purge_should_exit(ulint n_purged) /* Slow shutdown was requested. */ if (n_purged) { #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY - static ib_time_t progress_time; - ib_time_t time = ut_time(); - if (time - progress_time >= 15) { - progress_time = time; + static time_t progress_time; + time_t now = time(NULL); + if (now - progress_time >= 15) { + progress_time = now; service_manager_extend_timeout( INNODB_EXTEND_TIMEOUT_INTERVAL, "InnoDB: to purge " ULINTPF " transactions", diff --git a/storage/innobase/sync/sync0arr.cc b/storage/innobase/sync/sync0arr.cc index 91a07a9a4c0..9af6cfe5f0c 100644 --- a/storage/innobase/sync/sync0arr.cc +++ b/storage/innobase/sync/sync0arr.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -405,7 +405,7 @@ sync_array_reserve_cell( event = sync_cell_get_event(cell); cell->signal_count = os_event_reset(event); - cell->reservation_time = ut_time(); + cell->reservation_time = time(NULL); cell->thread = os_thread_get_curr_id(); diff --git a/storage/innobase/trx/trx0roll.cc b/storage/innobase/trx/trx0roll.cc index eda6b81fef5..de673208d32 100644 --- a/storage/innobase/trx/trx0roll.cc +++ b/storage/innobase/trx/trx0roll.cc @@ -738,11 +738,11 @@ trx_roll_must_shutdown() return true; } - ib_time_t time = ut_time(); + time_t now = time(NULL); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); - if (recv_sys->report(time)) { + if (recv_sys->report(now)) { ulint n_trx = 0; ulonglong n_rows = 0; for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list); diff --git a/storage/innobase/trx/trx0trx.cc b/storage/innobase/trx/trx0trx.cc index 884e2fa887d..06de737a5b3 100644 --- a/storage/innobase/trx/trx0trx.cc +++ b/storage/innobase/trx/trx0trx.cc @@ -907,7 +907,7 @@ trx_start_low( mutex_exit(&trx_sys->mutex); - trx->start_time = ut_time(); + trx->start_time = time(NULL); trx->start_time_micro = trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 95a7957579e..6e4061bc7dd 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -44,21 +44,6 @@ Created 5/11/1994 Heikki Tuuri # include "ha_prototypes.h" # include "mysql_com.h" /* NAME_LEN */ # include -#endif /* UNIV_HOTBACKUP */ - -/**********************************************************//** -Returns system time. We do not specify the format of the time returned: -the only way to manipulate it is to use the function ut_difftime. -@return system time */ -UNIV_INTERN -ib_time_t -ut_time(void) -/*=========*/ -{ - return(time(NULL)); -} - -#ifndef UNIV_HOTBACKUP /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic @@ -72,20 +57,6 @@ ut_time_ms(void) return static_cast(my_interval_timer() / 1000000); } #endif /* !UNIV_HOTBACKUP */ - -/**********************************************************//** -Returns the difference of two times in seconds. -@return time2 - time1 expressed in seconds */ -UNIV_INTERN -double -ut_difftime( -/*========*/ - ib_time_t time2, /*!< in: time */ - ib_time_t time1) /*!< in: time */ -{ - return(difftime(time2, time1)); -} - #endif /* !UNIV_INNOCHECKSUM */ /**********************************************************//** diff --git a/storage/xtradb/buf/buf0buf.cc b/storage/xtradb/buf/buf0buf.cc index 0f83e7ce011..09db5188245 100644 --- a/storage/xtradb/buf/buf0buf.cc +++ b/storage/xtradb/buf/buf0buf.cc @@ -1700,7 +1700,7 @@ buf_pool_init_instance( buf_pool->zip_hash = hash_create(2 * buf_pool->curr_size); - buf_pool->last_printout_time = ut_time(); + buf_pool->last_printout_time = time(NULL); } /* 2. Initialize flushing fields -------------------------------- */ @@ -6200,7 +6200,7 @@ buf_refresh_io_stats( /*=================*/ buf_pool_t* buf_pool) /*!< in: buffer pool instance */ { - buf_pool->last_printout_time = ut_time(); + buf_pool->last_printout_time = time(NULL); buf_pool->old_stat = buf_pool->stat; } diff --git a/storage/xtradb/dict/dict0mem.cc b/storage/xtradb/dict/dict0mem.cc index c009ef0ca11..f4bbc5c8f06 100644 --- a/storage/xtradb/dict/dict0mem.cc +++ b/storage/xtradb/dict/dict0mem.cc @@ -751,7 +751,7 @@ void dict_mem_init(void) { /* Initialize a randomly distributed temporary file number */ - ib_uint32_t now = static_cast(ut_time()); + ib_uint32_t now = static_cast(time(NULL)); const byte* buf = reinterpret_cast(&now); ut_ad(ut_crc32 != NULL); diff --git a/storage/xtradb/dict/dict0stats.cc b/storage/xtradb/dict/dict0stats.cc index 3cbd88c0f0a..59c661514f5 100644 --- a/storage/xtradb/dict/dict0stats.cc +++ b/storage/xtradb/dict/dict0stats.cc @@ -45,7 +45,7 @@ Created Jan 06, 2010 Vasil Dimov #include "trx0trx.h" /* trx_create() */ #include "trx0roll.h" /* trx_rollback_to_savepoint() */ #include "ut0rnd.h" /* ut_rnd_interval() */ -#include "ut0ut.h" /* ut_format_name(), ut_time() */ +#include "ut0ut.h" /* ut_format_name() */ #include #include @@ -1000,7 +1000,7 @@ dict_stats_update_transient( table->stat_sum_of_other_index_sizes = sum_of_index_sizes - index->stat_index_size; - table->stats_last_recalc = ut_time(); + table->stats_last_recalc = time(NULL); table->stat_modified_counter = 0; @@ -2325,7 +2325,7 @@ dict_stats_update_persistent( += index->stat_index_size; } - table->stats_last_recalc = ut_time(); + table->stats_last_recalc = time(NULL); table->stat_modified_counter = 0; @@ -2535,7 +2535,7 @@ dict_stats_save( /* MySQL's timestamp is 4 byte, so we use pars_info_add_int4_literal() which takes a lint arg, so "now" is lint */ - now = (lint) ut_time(); + now = (lint) time(NULL); pinfo = pars_info_create(); @@ -3980,7 +3980,7 @@ dict_stats_save_defrag_summary( dict_index_t* index) /*!< in: index */ { dberr_t ret; - lint now = (lint) ut_time(); + lint now = (lint) time(NULL); if (dict_index_is_univ(index)) { return DB_SUCCESS; } @@ -4017,7 +4017,7 @@ dict_stats_save_defrag_stats( return DB_SUCCESS; } - lint now = (lint) ut_time(); + lint now = (lint) time(NULL); mtr_t mtr; ulint n_leaf_pages; ulint n_leaf_reserved; diff --git a/storage/xtradb/dict/dict0stats_bg.cc b/storage/xtradb/dict/dict0stats_bg.cc index dad768a7c3b..b4923364cac 100644 --- a/storage/xtradb/dict/dict0stats_bg.cc +++ b/storage/xtradb/dict/dict0stats_bg.cc @@ -437,14 +437,14 @@ dict_stats_process_entry_from_recalc_pool() mutex_exit(&dict_sys->mutex); - /* ut_time() could be expensive, the current function + /* time() could be expensive, the current function is called once every time a table has been changed more than 10% and on a system with lots of small tables, this could become hot. If we find out that this is a problem, then the check below could eventually be replaced with something else, though a time interval is the natural approach. */ - if (ut_difftime(ut_time(), table->stats_last_recalc) + if (difftime(time(NULL), table->stats_last_recalc) < MIN_RECALC_INTERVAL) { /* Stats were (re)calculated not long ago. To avoid diff --git a/storage/xtradb/eval/eval0eval.cc b/storage/xtradb/eval/eval0eval.cc index ccb995f9d4f..d62febd466d 100644 --- a/storage/xtradb/eval/eval0eval.cc +++ b/storage/xtradb/eval/eval0eval.cc @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1997, 2011, 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 @@ -858,7 +859,7 @@ eval_predefined( dfield_get_data(que_node_get_val(arg1))); } else if (func == PARS_SYSDATE_TOKEN) { - int_val = (lint) ut_time(); + int_val = (lint) time(NULL); } else { eval_predefined_2(func_node); diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc index 254d0954397..766e9d91cfb 100644 --- a/storage/xtradb/fil/fil0fil.cc +++ b/storage/xtradb/fil/fil0fil.cc @@ -5128,7 +5128,7 @@ fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*)) ulint dbpath_len = 100; ulint files_read = 0; ulint files_read_at_last_check = 0; - ib_time_t prev_report_time = ut_time(); + time_t prev_report_time = time(NULL); os_file_dir_t dir; os_file_dir_t dbdir; os_file_stat_t dbinfo; @@ -5228,11 +5228,10 @@ fil_load_single_table_tablespaces(ibool (*pred)(const char*, const char*)) files_read++; if (files_read - files_read_at_last_check > CHECK_TIME_EVERY_N_FILES) { - ib_time_t cur_time= ut_time(); + time_t cur_time= time(NULL); files_read_at_last_check= files_read; - double time_elapsed= ut_difftime(cur_time, - prev_report_time); - if (time_elapsed > 15) { + if (cur_time - prev_report_time + > 15) { ib_logf(IB_LOG_LEVEL_INFO, "Processed %ld .ibd/.isl files", files_read); diff --git a/storage/xtradb/fts/fts0fts.cc b/storage/xtradb/fts/fts0fts.cc index beed1b99d6c..264c520bb1e 100644 --- a/storage/xtradb/fts/fts0fts.cc +++ b/storage/xtradb/fts/fts0fts.cc @@ -77,8 +77,8 @@ UNIV_INTERN ulong fts_min_token_size; // FIXME: testing -ib_time_t elapsed_time = 0; -ulint n_nodes = 0; +static time_t elapsed_time; +static ulint n_nodes; /** Error condition reported by fts_utf8_decode() */ const ulint UTF8_ERROR = 0xFFFFFFFF; @@ -3798,7 +3798,7 @@ fts_write_node( pars_info_t* info; dberr_t error; ib_uint32_t doc_count; - ib_time_t start_time; + time_t start_time; doc_id_t last_doc_id; doc_id_t first_doc_id; char table_name[MAX_FULL_NAME_LEN]; @@ -3845,9 +3845,9 @@ fts_write_node( " :last_doc_id, :doc_count, :ilist);"); } - start_time = ut_time(); + start_time = time(NULL); error = fts_eval_sql(trx, *graph); - elapsed_time += ut_time() - start_time; + elapsed_time += time(NULL) - start_time; ++n_nodes; return(error); @@ -4298,7 +4298,7 @@ fts_sync_begin( n_nodes = 0; elapsed_time = 0; - sync->start_time = ut_time(); + sync->start_time = time(NULL); sync->trx = trx_allocate_for_background(); @@ -4457,7 +4457,7 @@ fts_sync_commit( "SYNC for table %s: SYNC time : %lu secs: " "elapsed %lf ins/sec", sync->table->name, - (ulong) (ut_time() - sync->start_time), + (ulong) (time(NULL) - sync->start_time), (double) n_nodes/ (double) elapsed_time); } diff --git a/storage/xtradb/fts/fts0opt.cc b/storage/xtradb/fts/fts0opt.cc index 45248df72c5..2f8739d3d2c 100644 --- a/storage/xtradb/fts/fts0opt.cc +++ b/storage/xtradb/fts/fts0opt.cc @@ -1648,7 +1648,7 @@ fts_optimize_get_index_start_time( /*==============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t* start_time) /*!< out: time in secs */ + time_t* start_time) /*!< out: time in secs */ { return(fts_config_get_index_ulint( trx, index, FTS_OPTIMIZE_START_TIME, @@ -1664,7 +1664,7 @@ fts_optimize_set_index_start_time( /*==============================*/ trx_t* trx, /*!< in: transaction */ dict_index_t* index, /*!< in: FTS index */ - ib_time_t start_time) /*!< in: start time */ + time_t start_time) /*!< in: start time */ { return(fts_config_set_index_ulint( trx, index, FTS_OPTIMIZE_START_TIME, @@ -1918,7 +1918,7 @@ fts_optimize_index_completed( dberr_t error; byte buf[sizeof(ulint)]; #ifdef FTS_OPTIMIZE_DEBUG - ib_time_t end_time = ut_time(); + time_t end_time = time(NULL); error = fts_optimize_set_index_end_time(optim->trx, index, end_time); #endif @@ -2337,14 +2337,14 @@ fts_optimize_indexes( /* Start time will be 0 only for the first time or after completing the optimization of all FTS indexes. */ if (start_time == 0) { - start_time = ut_time(); + start_time = time(NULL); error = fts_optimize_set_index_start_time( optim->trx, index, start_time); } /* Check if this index needs to be optimized or not. */ - if (ut_difftime(end_time, start_time) < 0) { + if (difftime(end_time, start_time) < 0) { error = fts_optimize_index(optim, index); if (error != DB_SUCCESS) { @@ -2416,7 +2416,7 @@ fts_optimize_reset_start_time( for (uint i = 0; i < ib_vector_size(fts->indexes); ++i) { dict_index_t* index; - ib_time_t start_time = 0; + time_t start_time = 0; /* Reset the start time to 0 for this index. */ error = fts_optimize_set_index_start_time( @@ -2471,7 +2471,7 @@ fts_optimize_table_bk( && table->fts->cache->deleted >= FTS_OPTIMIZE_THRESHOLD) { error = fts_optimize_table(table); - slot->last_run = ut_time(); + slot->last_run = time(NULL); if (error == DB_SUCCESS) { slot->running = false; @@ -3001,7 +3001,7 @@ fts_optimize_init(void) fts_optimize_wq = ib_wqueue_create(); ut_a(fts_optimize_wq != NULL); - last_check_sync_time = ut_time(); + last_check_sync_time = time(NULL); os_thread_create(fts_optimize_thread, fts_optimize_wq, NULL); } diff --git a/storage/xtradb/include/dict0mem.h b/storage/xtradb/include/dict0mem.h index f32400320e1..1dcc3ebdd0c 100644 --- a/storage/xtradb/include/dict0mem.h +++ b/storage/xtradb/include/dict0mem.h @@ -2,7 +2,7 @@ Copyright (c) 1996, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2012, Facebook Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1198,7 +1198,7 @@ struct dict_table_t{ goes to zero. If it's -1, means there's DDL on the table, DML from memcached will be blocked. */ - ib_time_t stats_last_recalc; + time_t stats_last_recalc; /*!< Timestamp of last recalc of the stats */ ib_uint32_t stat_persistent; /*!< The two bits below are set in the diff --git a/storage/xtradb/include/log0recv.h b/storage/xtradb/include/log0recv.h index bc28bf94ae3..afdc5ccd98e 100644 --- a/storage/xtradb/include/log0recv.h +++ b/storage/xtradb/include/log0recv.h @@ -431,7 +431,7 @@ struct recv_sys_t{ log record, or there is a log parsing buffer overflow */ /** the time when progress was last reported */ - ib_time_t progress_time; + time_t progress_time; #ifdef UNIV_LOG_ARCHIVE log_group_t* archive_group; /*!< in archive recovery: the log group whose @@ -449,7 +449,7 @@ struct recv_sys_t{ @param[in] time the current time @return whether progress should be reported (the last report was at least 15 seconds ago) */ - bool report(ib_time_t time) + bool report(time_t time) { if (time - progress_time < 15) { return false; diff --git a/storage/xtradb/include/srv0mon.h b/storage/xtradb/include/srv0mon.h index 7a7902c3083..90930656791 100644 --- a/storage/xtradb/include/srv0mon.h +++ b/storage/xtradb/include/srv0mon.h @@ -58,9 +58,9 @@ create the internal counter ID in "monitor_id_t". */ /** Structure containing the actual values of a monitor counter. */ struct monitor_value_t { - ib_time_t mon_start_time; /*!< Start time of monitoring */ - ib_time_t mon_stop_time; /*!< Stop time of monitoring */ - ib_time_t mon_reset_time; /*!< Time counter resetted */ + time_t mon_start_time; /*!< Start time of monitoring */ + time_t mon_stop_time; /*!< Stop time of monitoring */ + time_t mon_reset_time; /*!< Time of resetting the counter */ mon_type_t mon_value; /*!< Current counter Value */ mon_type_t mon_max_value; /*!< Current Max value */ mon_type_t mon_min_value; /*!< Current Min value */ diff --git a/storage/xtradb/include/trx0i_s.h b/storage/xtradb/include/trx0i_s.h index 96646613847..186b7069c09 100644 --- a/storage/xtradb/include/trx0i_s.h +++ b/storage/xtradb/include/trx0i_s.h @@ -129,7 +129,7 @@ struct i_s_trx_row_t { trx_id_t trx_id; /*!< transaction identifier */ const char* trx_state; /*!< transaction state from trx_get_que_state_str() */ - ib_time_t trx_started; /*!< trx_t::start_time */ + time_t trx_started; /*!< trx_t::start_time */ const i_s_locks_row_t* requested_lock_row; /*!< pointer to a row in innodb_locks if trx diff --git a/storage/xtradb/include/ut0ut.h b/storage/xtradb/include/ut0ut.h index db05fd7ce13..2dd79155770 100644 --- a/storage/xtradb/include/ut0ut.h +++ b/storage/xtradb/include/ut0ut.h @@ -51,9 +51,6 @@ Created 1/20/1994 Heikki Tuuri /** Index name prefix in fast index creation, as a string constant */ #define TEMP_INDEX_PREFIX_STR "\377" -/** Time stamp */ -typedef time_t ib_time_t; - /* In order to call a piece of code, when a function returns or when the scope ends, use this utility class. It will invoke the given function object in its destructor. */ @@ -227,14 +224,6 @@ store the given number of bits. @return number of bytes (octets) needed to represent b */ #define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) -/**********************************************************//** -Returns system time. We do not specify the format of the time returned: -the only way to manipulate it is to use the function ut_difftime. -@return system time */ -UNIV_INTERN -ib_time_t -ut_time(void); -/*=========*/ #ifndef UNIV_HOTBACKUP /**********************************************************//** Returns the number of milliseconds since some epoch. The @@ -256,17 +245,6 @@ UNIV_INTERN ulint ut_time_ms(void); /*============*/ - -/**********************************************************//** -Returns the difference of two times in seconds. -@return time2 - time1 expressed in seconds */ -UNIV_INTERN -double -ut_difftime( -/*========*/ - ib_time_t time2, /*!< in: time */ - ib_time_t time1); /*!< in: time */ - #endif /* !UNIV_INNOCHECKSUM */ /**********************************************************//** diff --git a/storage/xtradb/lock/lock0lock.cc b/storage/xtradb/lock/lock0lock.cc index b0ab3e7a540..c110c83cbe7 100644 --- a/storage/xtradb/lock/lock0lock.cc +++ b/storage/xtradb/lock/lock0lock.cc @@ -2310,7 +2310,7 @@ lock_rec_create( /* Set the bit corresponding to rec */ lock_rec_set_nth_bit(lock, heap_no); - lock->requested_time = ut_time(); + lock->requested_time = time(NULL); lock->wait_time = 0; index->table->n_rec_locks++; @@ -3085,16 +3085,18 @@ lock_grant( } } + const time_t now = time(NULL); + /* Cumulate total lock wait time for statistics */ if (lock_get_type_low(lock) & LOCK_TABLE) { lock->trx->total_table_lock_wait_time += - (ulint)difftime(ut_time(), lock->trx->lock.wait_started); + (ulint)difftime(now, lock->trx->lock.wait_started); } else { lock->trx->total_rec_lock_wait_time += - (ulint)difftime(ut_time(), lock->trx->lock.wait_started); + (ulint)difftime(now, lock->trx->lock.wait_started); } - lock->wait_time = (ulint)difftime(ut_time(), lock->requested_time); + lock->wait_time = (ulint)difftime(now, lock->requested_time); if (!owns_trx_mutex) { trx_mutex_exit(lock->trx); @@ -4997,7 +4999,7 @@ lock_table_create( lock->type_mode = type_mode | LOCK_TABLE; lock->trx = trx; - lock->requested_time = ut_time(); + lock->requested_time = time(NULL); lock->wait_time = 0; lock->un_member.tab_lock.table = table; diff --git a/storage/xtradb/lock/lock0wait.cc b/storage/xtradb/lock/lock0wait.cc index b1ee2f7ca12..3efc28967db 100644 --- a/storage/xtradb/lock/lock0wait.cc +++ b/storage/xtradb/lock/lock0wait.cc @@ -74,7 +74,7 @@ lock_wait_table_print(void) (ulong) slot->in_use, (ulong) slot->suspended, slot->wait_timeout, - (ulong) difftime(ut_time(), slot->suspend_time)); + (ulong) difftime(time(NULL), slot->suspend_time)); } } @@ -171,7 +171,7 @@ lock_wait_table_reserve_slot( os_event_reset(slot->event); slot->suspended = TRUE; - slot->suspend_time = ut_time(); + slot->suspend_time = time(NULL); slot->wait_timeout = wait_timeout; if (slot == lock_sys->last_slot) { diff --git a/storage/xtradb/log/log0log.cc b/storage/xtradb/log/log0log.cc index b5ae973bfcc..3e0c6ced14a 100644 --- a/storage/xtradb/log/log0log.cc +++ b/storage/xtradb/log/log0log.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Google Inc. -Copyright (c) 2014, 2018, MariaDB Corporation. +Copyright (c) 2014, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -2591,7 +2591,8 @@ loop: start_lsn += len; buf += len; - if (recv_recovery_is_on() && recv_sys && recv_sys->report(ut_time())) { + if (recv_recovery_is_on() && recv_sys + && recv_sys->report(time(NULL))) { ib_logf(IB_LOG_LEVEL_INFO, "Read redo log up to LSN=" LSN_PF, start_lsn); service_manager_extend_timeout(INNODB_EXTEND_TIMEOUT_INTERVAL, diff --git a/storage/xtradb/log/log0recv.cc b/storage/xtradb/log/log0recv.cc index 0bec6f9577d..dd55d31218a 100644 --- a/storage/xtradb/log/log0recv.cc +++ b/storage/xtradb/log/log0recv.cc @@ -419,7 +419,7 @@ recv_sys_init( recv_sys->last_block_buf_start, OS_FILE_LOG_BLOCK_SIZE)); recv_sys->found_corrupt_log = FALSE; - recv_sys->progress_time = ut_time(); + recv_sys->progress_time = time(NULL); recv_max_page_lsn = 0; @@ -1789,7 +1789,7 @@ recv_recover_page_func( mtr_commit(&mtr); - ib_time_t time = ut_time(); + time_t now = time(NULL); mutex_enter(&(recv_sys->mutex)); @@ -1801,7 +1801,7 @@ recv_recover_page_func( ut_a(recv_sys->n_addrs > 0); if (ulint n = --recv_sys->n_addrs) { - if (recv_sys->report(time)) { + if (recv_sys->report(now)) { ib_logf(IB_LOG_LEVEL_INFO, "To recover: " ULINTPF " pages from log", n); service_manager_extend_timeout( diff --git a/storage/xtradb/os/os0file.cc b/storage/xtradb/os/os0file.cc index 9c9c41c86e7..1e0f28d393f 100644 --- a/storage/xtradb/os/os0file.cc +++ b/storage/xtradb/os/os0file.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2009, Percona Inc. -Copyright (c) 2013, 2018, MariaDB Corporation. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Percona Inc.. Those modifications are @@ -4509,7 +4509,7 @@ os_aio_init( os_aio_validate(); - os_last_printout = ut_time(); + os_last_printout = time(NULL); #ifdef _WIN32 ut_a(completion_port == 0 && read_completion_port == 0); @@ -4837,7 +4837,7 @@ found: } slot->reserved = TRUE; - slot->reservation_time = ut_time(); + slot->reservation_time = time(NULL); slot->message1 = message1; slot->message2 = message2; slot->file = file; @@ -5979,7 +5979,7 @@ restart: if (slot->reserved) { age = (ulint) difftime( - ut_time(), slot->reservation_time); + time(NULL), slot->reservation_time); if ((age >= 2 && age > biggest_age) || (age >= 2 && age == biggest_age @@ -6392,7 +6392,7 @@ os_aio_print( } putc('\n', file); - current_time = ut_time(); + current_time = time(NULL); time_elapsed = 0.001 + difftime(current_time, os_last_printout); fprintf(file, diff --git a/storage/xtradb/srv/srv0srv.cc b/storage/xtradb/srv/srv0srv.cc index f6e69618313..bc7f6c948de 100644 --- a/storage/xtradb/srv/srv0srv.cc +++ b/storage/xtradb/srv/srv0srv.cc @@ -2168,10 +2168,11 @@ DECLARE_THREAD(srv_monitor_thread)(void*) pfs_register_thread(srv_monitor_thread_key); #endif /* UNIV_PFS_THREAD */ - srv_last_monitor_time = ut_time(); - last_table_monitor_time = ut_time(); - last_tablespace_monitor_time = ut_time(); - last_monitor_time = ut_time(); + current_time = time(NULL); + srv_last_monitor_time = current_time; + last_table_monitor_time = current_time; + last_tablespace_monitor_time = current_time; + last_monitor_time = current_time; mutex_skipped = 0; last_srv_print_monitor = srv_print_innodb_monitor; loop: @@ -2182,12 +2183,12 @@ loop: os_event_wait_time_low(srv_monitor_event, 5000000, sig_count); - current_time = ut_time(); + current_time = time(NULL); time_elapsed = difftime(current_time, last_monitor_time); if (time_elapsed > 15) { - last_monitor_time = ut_time(); + last_monitor_time = current_time; if (srv_print_innodb_monitor) { /* Reset mutex_skipped counter everytime @@ -2234,7 +2235,7 @@ loop: if (srv_print_innodb_tablespace_monitor && difftime(current_time, last_tablespace_monitor_time) > 60) { - last_tablespace_monitor_time = ut_time(); + last_tablespace_monitor_time = current_time; fputs("========================" "========================\n", @@ -2260,7 +2261,7 @@ loop: if (srv_print_innodb_table_monitor && difftime(current_time, last_table_monitor_time) > 60) { - last_table_monitor_time = ut_time(); + last_table_monitor_time = current_time; fprintf(stderr, "Warning: %s\n", DEPRECATED_MSG_INNODB_TABLE_MONITOR); @@ -2854,20 +2855,16 @@ static void srv_shutdown_print_master_pending( /*==============================*/ - ib_time_t* last_print_time, /*!< last time the function + time_t* last_print_time, /*!< last time the function print the message */ ulint n_tables_to_drop, /*!< number of tables to be dropped */ ulint n_bytes_merged) /*!< number of change buffer just merged */ { - ib_time_t current_time; - double time_elapsed; + time_t current_time = time(NULL); - current_time = ut_time(); - time_elapsed = ut_difftime(current_time, *last_print_time); - - if (time_elapsed > 60) { + if (difftime(current_time, *last_print_time) > 60) { *last_print_time = current_time; if (n_tables_to_drop) { @@ -2902,7 +2899,7 @@ void srv_master_do_active_tasks(void) /*============================*/ { - ib_time_t cur_time = ut_time(); + time_t cur_time = time(NULL); ulonglong counter_time = microsecond_interval_timer(); ulint n_evicted = 0; @@ -3058,7 +3055,7 @@ srv_master_do_idle_tasks(void) if (srv_log_arch_expire_sec) { srv_main_thread_op_info = "purging archived logs"; - purge_archived_logs(ut_time() - srv_log_arch_expire_sec, + purge_archived_logs(time(NULL) - srv_log_arch_expire_sec, 0); } } @@ -3071,7 +3068,7 @@ srv_shutdown(bool ibuf_merge) { ulint n_bytes_merged = 0; ulint n_tables_to_drop; - ib_time_t now = ut_time(); + time_t now = time(NULL); do { ut_ad(!srv_read_only_mode); @@ -3232,10 +3229,10 @@ srv_purge_should_exit(ulint n_purged) /* Slow shutdown was requested. */ if (n_purged) { #if defined HAVE_SYSTEMD && !defined EMBEDDED_LIBRARY - static ib_time_t progress_time; - ib_time_t time = ut_time(); - if (time - progress_time >= 15) { - progress_time = time; + static time_t progress_time; + time_t now = time(NULL); + if (now - progress_time >= 15) { + progress_time = now; service_manager_extend_timeout( INNODB_EXTEND_TIMEOUT_INTERVAL, "InnoDB: to purge " ULINTPF " transactions", diff --git a/storage/xtradb/sync/sync0arr.cc b/storage/xtradb/sync/sync0arr.cc index a1aac98d5ef..c085e8ebcf5 100644 --- a/storage/xtradb/sync/sync0arr.cc +++ b/storage/xtradb/sync/sync0arr.cc @@ -2,7 +2,7 @@ Copyright (c) 1995, 2015, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. -Copyright (c) 2013, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (c) 2013, 2019, MariaDB Corporation. Portions of this file contain modifications contributed and copyrighted by Google, Inc. Those modifications are gratefully acknowledged and are described @@ -414,7 +414,7 @@ sync_array_reserve_cell( event = sync_cell_get_event(cell); cell->signal_count = os_event_reset(event); - cell->reservation_time = ut_time(); + cell->reservation_time = time(NULL); cell->thread = os_thread_get_curr_id(); diff --git a/storage/xtradb/trx/trx0roll.cc b/storage/xtradb/trx/trx0roll.cc index 0d15fd77198..97f08d1fa0c 100644 --- a/storage/xtradb/trx/trx0roll.cc +++ b/storage/xtradb/trx/trx0roll.cc @@ -750,11 +750,11 @@ trx_roll_must_shutdown() return true; } - ib_time_t time = ut_time(); + time_t now = time(NULL); mutex_enter(&trx_sys->mutex); mutex_enter(&recv_sys->mutex); - if (recv_sys->report(time)) { + if (recv_sys->report(now)) { ulint n_trx = 0; ulonglong n_rows = 0; for (const trx_t* t = UT_LIST_GET_FIRST(trx_sys->rw_trx_list); diff --git a/storage/xtradb/trx/trx0trx.cc b/storage/xtradb/trx/trx0trx.cc index f0229cf7ff5..e072976d6cd 100644 --- a/storage/xtradb/trx/trx0trx.cc +++ b/storage/xtradb/trx/trx0trx.cc @@ -1106,7 +1106,7 @@ trx_start_low( mutex_exit(&trx_sys->mutex); - trx->start_time = ut_time(); + trx->start_time = time(NULL); trx->start_time_micro = trx->mysql_thd ? thd_query_start_micro(trx->mysql_thd) diff --git a/storage/xtradb/ut/ut0ut.cc b/storage/xtradb/ut/ut0ut.cc index 8a339627cfb..a9f24fcf18a 100644 --- a/storage/xtradb/ut/ut0ut.cc +++ b/storage/xtradb/ut/ut0ut.cc @@ -45,21 +45,6 @@ Created 5/11/1994 Heikki Tuuri # include "ha_prototypes.h" # include "mysql_com.h" /* NAME_LEN */ # include -#endif /* UNIV_HOTBACKUP */ - -/**********************************************************//** -Returns system time. We do not specify the format of the time returned: -the only way to manipulate it is to use the function ut_difftime. -@return system time */ -UNIV_INTERN -ib_time_t -ut_time(void) -/*=========*/ -{ - return(time(NULL)); -} - -#ifndef UNIV_HOTBACKUP /**********************************************************//** Returns the number of milliseconds since some epoch. The value may wrap around. It should only be used for heuristic @@ -73,20 +58,6 @@ ut_time_ms(void) return static_cast(my_interval_timer() / 1000000); } #endif /* !UNIV_HOTBACKUP */ - -/**********************************************************//** -Returns the difference of two times in seconds. -@return time2 - time1 expressed in seconds */ -UNIV_INTERN -double -ut_difftime( -/*========*/ - ib_time_t time2, /*!< in: time */ - ib_time_t time1) /*!< in: time */ -{ - return(difftime(time2, time1)); -} - #endif /* !UNIV_INNOCHECKSUM */ /**********************************************************//** From e32f29b7f31945d2e89d601cb030b3552c3bfde3 Mon Sep 17 00:00:00 2001 From: Sujatha Date: Tue, 23 Jul 2019 15:46:51 +0530 Subject: [PATCH 11/13] MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged MDEV-5589 commit set up a policy to skip DROP TEMPORARY TABLE binary logging in case the target table has not been "CREATEed" in binlog (no CREATE Query-log-event was logged into the binary log). It turns out that 1. the rule did not cover non-existing table DROPped with IF-EXISTS clause. The logged-create knowledge for the non-existing one does not even need MDEV-5589 patch, and 2. connection close disobeys it to trigger automatic DROP-IF-EXISTS binlogging. Either 1 or 2 or even both is/are also responsible for unexpected binlog records observed in MDEV-17863, actually rendering a referred @@global.read_only irrelevant as far as the described stored procedure definition *and* the ROW binlog-format are concerned. --- .../extra/binlog_tests/drop_temp_table.test | 24 +++--- .../rpl_tests/rpl_drop_create_temp_table.test | 4 + .../binlog_parallel_replication_marks.test | 9 +- ...nlog_parallel_replication_marks_row.result | 2 - .../binlog/r/binlog_row_drop_tmp_tbl.result | 8 -- .../r/binlog_row_mix_innodb_myisam.result | 2 - .../binlog/r/binlog_stm_drop_tmp_tbl.result | 4 - .../suite/rpl/r/create_or_replace_mix.result | 11 +++ .../suite/rpl/r/create_or_replace_row.result | 7 ++ .../rpl/r/create_or_replace_statement.result | 11 +++ .../r/rpl_row_drop_create_temp_table.result | 27 ------ .../rpl/r/rpl_row_drop_temp_table.result | 36 ++++++++ mysql-test/suite/rpl/t/create_or_replace.inc | 13 +++ .../suite/rpl/t/rpl_row_drop_temp_table.test | 54 ++++++++++++ sql/sql_base.cc | 82 ++++++++++--------- sql/sql_table.cc | 2 +- 16 files changed, 203 insertions(+), 93 deletions(-) create mode 100644 mysql-test/suite/rpl/r/rpl_row_drop_temp_table.result create mode 100644 mysql-test/suite/rpl/t/rpl_row_drop_temp_table.test diff --git a/mysql-test/extra/binlog_tests/drop_temp_table.test b/mysql-test/extra/binlog_tests/drop_temp_table.test index c852ee4c8a0..4241974d813 100644 --- a/mysql-test/extra/binlog_tests/drop_temp_table.test +++ b/mysql-test/extra/binlog_tests/drop_temp_table.test @@ -14,12 +14,8 @@ CREATE TEMPORARY TABLE `table:name` (a INT); CREATE TEMPORARY TABLE shortn2 (a INT); ############################################################################## -# BUG#46572 DROP TEMPORARY table IF EXISTS does not have a consistent behavior -# in ROW mode -# -# In RBR, 'DROP TEMPORARY TABLE ...' statement should never be binlogged no -# matter if the tables exist or not. In contrast, both in SBR and MBR, the -# statement should be always binlogged no matter if the tables exist or not. +# MDEV-20091: DROP TEMPORARY TABLE IF EXISTS statements will be written +# to binlog only if the corresponding temporary table exists. ############################################################################## CREATE TEMPORARY TABLE tmp(c1 int); CREATE TEMPORARY TABLE tmp1(c1 int); @@ -30,12 +26,12 @@ CREATE TABLE t(c1 int); DROP TEMPORARY TABLE IF EXISTS tmp; --disable_warnings -# Before fixing BUG#46572, 'DROP TEMPORARY TABLE IF EXISTS...' statement was -# binlogged when the table did not exist in RBR. +# Post MDEV-20091: Following DROP TEMPORARY TABLE statement should not be +# logged as the table is already dropped above. DROP TEMPORARY TABLE IF EXISTS tmp; -# In RBR, 'DROP TEMPORARY TABLE ...' statement is never binlogged no matter if -# the tables exist or not. +# Post MDEV-20091: Only DROP TEMPORARY TABLE statement should be written only +# for 'tmp1' table. DROP TEMPORARY TABLE IF EXISTS tmp, tmp1; DROP TEMPORARY TABLE tmp3; @@ -79,6 +75,12 @@ DROP DATABASE `drop-temp+table-test`; # if there are open temporary tables. As such the implicit drop # for temporary tables on session closing must be logged. # +# MDEV-20091: DROP TEMPORARY TABLE IF EXISTS statements will be written to +# binlog only if the corresponding temporary table exists. In row based +# replication temporary tables are not replicated hence their corresponding +# DROP TEMPORARY TABLE statement will be not be written to binary log upon +# session closure. +# RESET MASTER; @@ -92,8 +94,10 @@ SELECT @@session.binlog_format; --disconnect con1 -- connection default +if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { --let $wait_binlog_event= DROP --source include/wait_for_binlog_event.inc +} -- source include/show_binlog_events.inc RESET MASTER; diff --git a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test index ffd7fe1a5c4..f8b521e3abf 100644 --- a/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test +++ b/mysql-test/extra/rpl_tests/rpl_drop_create_temp_table.test @@ -32,6 +32,10 @@ # is any # Drop-Temp-TT-Temp - Drops two temporary T-tables if there is any # Drop-Temp-NN-Temp - Drops two temporary N-tables if there is any +# +# Note: MDEV-20091: DROP TEMPORARY TABLE IF EXISTS statements will be written +# to binlog only if the corresponding temporary table exists. +# # Drop-Temp-Xe-Temp - Tries to drop a temporary table that does not exist # Drop-Temp-NXe-Temp - Drops a temporary N-table if there is any and # a temporary table that does not exist diff --git a/mysql-test/include/binlog_parallel_replication_marks.test b/mysql-test/include/binlog_parallel_replication_marks.test index ff35875aece..4e673bd30c3 100644 --- a/mysql-test/include/binlog_parallel_replication_marks.test +++ b/mysql-test/include/binlog_parallel_replication_marks.test @@ -49,9 +49,16 @@ connection default; # We need to wait for the implicit DROP TEMPORARY TABLE to be logged after # tmp_con disconnect, otherwise we get sporadic test failures. +# MDEV-20091: DROP TEMPORARY TABLE IF EXISTS statements will be written to +# binlog only if the corresponding temporary table exists. In row based +# replication temporary tables are not replicated hence their corresponding +# DROP TEMPORARY TABLE statement will be not be written to binary log upon +# session closure. + +if (!`SELECT @@BINLOG_FORMAT = 'ROW'`) { --let $wait_condition= SELECT variable_value > $before_drop_pos FROM information_schema.global_status WHERE variable_name = 'binlog_snapshot_position' --source include/wait_condition.inc - +} --let $binlog_pos2=query_get_value(SHOW MASTER STATUS, Position, 1) --let $binlog_file= query_get_value(SHOW MASTER STATUS, File, 1) diff --git a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result index e9a744a748e..1dafeee47e2 100644 --- a/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result +++ b/mysql-test/suite/binlog/r/binlog_parallel_replication_marks_row.result @@ -89,6 +89,4 @@ BEGIN # server id 1 end_log_pos # Table_map: `test`.`t1` mapped to number # # server id 1 end_log_pos # Write_rows: table id # flags: STMT_END_F COMMIT/*!*/; -# server id 1 end_log_pos # GTID #-#-# ddl -DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t5` DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result index dce2cc1408c..01ee24b9d48 100644 --- a/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_row_drop_tmp_tbl.result @@ -30,15 +30,9 @@ master-bin.000001 # Query # # CREATE DATABASE `drop-temp+table-test` master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int) master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `t` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TABLE IF EXISTS `tmp2`,`t` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `drop-temp+table-test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `shortn2`,`table:name`,`shortn1` DROP DATABASE `drop-temp+table-test`; RESET MASTER; CREATE TABLE t1 ( i text ); @@ -56,7 +50,5 @@ master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.t1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `ttmp1` RESET MASTER; DROP TABLE t1; diff --git a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result index f8f4fa5ec31..37018da86a0 100644 --- a/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result +++ b/mysql-test/suite/binlog/r/binlog_row_mix_innodb_myisam.result @@ -303,8 +303,6 @@ master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t2 (n int) engine=innodb -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t1`,`ti` do release_lock("lock1"); drop table t0,t2; set autocommit=0; diff --git a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result index 127df219b02..4eeb8dd80c7 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result +++ b/mysql-test/suite/binlog/r/binlog_stm_drop_tmp_tbl.result @@ -46,12 +46,8 @@ master-bin.000001 # Query # # use `drop-temp+table-test`; CREATE TABLE t(c1 int) master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp1` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `drop-temp+table-test`; DROP TEMPORARY TABLE `tmp3` /* generated by server */ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `drop-temp+table-test`.`tmp2` /* generated by server */ diff --git a/mysql-test/suite/rpl/r/create_or_replace_mix.result b/mysql-test/suite/rpl/r/create_or_replace_mix.result index c6cce358799..2c85bb3d93b 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_mix.result +++ b/mysql-test/suite/rpl/r/create_or_replace_mix.result @@ -238,6 +238,13 @@ set binlog_format="STATEMENT"; ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables drop temporary table t8; set @@binlog_format=@org_binlog_format; +set @@session.binlog_format=default; +drop temporary table if exists t9; +Warnings: +Note 1051 Unknown table 'test.t9' +set session binlog_format=default; +create temporary table t9 (i int); +*** Must be no DROP logged for t9 when there was no CREATE, at disconnect too *** include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# @@ -248,5 +255,9 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create temporary table t7 (a int) master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create temporary table t9 (i int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t9` drop table t2; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/create_or_replace_row.result b/mysql-test/suite/rpl/r/create_or_replace_row.result index 8f032107db9..cbb47cc4aba 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_row.result +++ b/mysql-test/suite/rpl/r/create_or_replace_row.result @@ -260,6 +260,13 @@ set binlog_format="STATEMENT"; ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables drop temporary table t8; set @@binlog_format=@org_binlog_format; +set @@session.binlog_format=default; +drop temporary table if exists t9; +Warnings: +Note 1051 Unknown table 'test.t9' +set session binlog_format=default; +create temporary table t9 (i int); +*** Must be no DROP logged for t9 when there was no CREATE, at disconnect too *** include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# diff --git a/mysql-test/suite/rpl/r/create_or_replace_statement.result b/mysql-test/suite/rpl/r/create_or_replace_statement.result index 7bdbc64e9f2..6b47fafbe23 100644 --- a/mysql-test/suite/rpl/r/create_or_replace_statement.result +++ b/mysql-test/suite/rpl/r/create_or_replace_statement.result @@ -230,6 +230,13 @@ set binlog_format="STATEMENT"; ERROR HY000: Cannot switch out of the row-based binary log format when the session has open temporary tables drop temporary table t8; set @@binlog_format=@org_binlog_format; +set @@session.binlog_format=default; +drop temporary table if exists t9; +Warnings: +Note 1051 Unknown table 'test.t9' +set session binlog_format=default; +create temporary table t9 (i int); +*** Must be no DROP logged for t9 when there was no CREATE, at disconnect too *** include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# @@ -240,5 +247,9 @@ master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create temporary table t7 (a int) master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`t7` /* generated by server */ +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; create temporary table t9 (i int) +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; DROP /*!40005 TEMPORARY */ TABLE IF EXISTS `t9` drop table t2; include/rpl_end.inc diff --git a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result index 05b2c04e7ba..ec6d89551ae 100644 --- a/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_row_drop_create_temp_table.result @@ -83,9 +83,6 @@ Warnings: Note 1051 Unknown table 'test.tt_xx_1' -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TXe-Temp'; @@ -101,9 +98,6 @@ Warnings: Note 1051 Unknown table 'test.tt_1' -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-TXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-NXe-Temp'; @@ -119,9 +113,6 @@ Warnings: Note 1051 Unknown table 'test.tt_1' -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-NXe-Temp << -b-b-b-b-b-b-b-b-b-b-b- include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TN-Temp'; @@ -264,7 +255,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -289,8 +279,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -344,7 +332,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -369,8 +356,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -424,7 +409,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -449,8 +433,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -755,7 +737,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -782,8 +763,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -839,7 +818,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -866,8 +844,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -923,7 +899,6 @@ Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -950,8 +925,6 @@ master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Table_map # # table_id: # (test.tt_xx_1) master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_row_drop_temp_table.result b/mysql-test/suite/rpl/r/rpl_row_drop_temp_table.result new file mode 100644 index 00000000000..15b4d396522 --- /dev/null +++ b/mysql-test/suite/rpl/r/rpl_row_drop_temp_table.result @@ -0,0 +1,36 @@ +include/master-slave.inc +[connection master] +[connection slave] +SET GLOBAL read_only=1; +[connection master] +CREATE PROCEDURE testproc() +BEGIN +DROP TEMPORARY TABLE IF EXISTS t1_tmp; +DROP TEMPORARY TABLE IF EXISTS t2_tmp; +CREATE TEMPORARY TABLE IF NOT EXISTS t1_tmp ( t1 varchar(400) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TEMPORARY TABLE IF NOT EXISTS t2_tmp ( t2 varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +END| +SET GLOBAL read_only=1; +CALL testproc(); +******** None of the above DROP TEMPORARY TABLE statement should be found in binary log ******** +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE DEFINER=`root`@`localhost` PROCEDURE `testproc`() +BEGIN +DROP TEMPORARY TABLE IF EXISTS t1_tmp; +DROP TEMPORARY TABLE IF EXISTS t2_tmp; +CREATE TEMPORARY TABLE IF NOT EXISTS t1_tmp ( t1 varchar(400) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; +CREATE TEMPORARY TABLE IF NOT EXISTS t2_tmp ( t2 varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +END +SELECT @@read_only; +@@read_only +1 +======== CLEAN UP ========= +[connection master] +DROP TEMPORARY TABLE t1_tmp; +DROP TEMPORARY TABLE t2_tmp; +DROP PROCEDURE testproc; +SET GLOBAL read_only=0; +SET GLOBAL read_only=0; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/create_or_replace.inc b/mysql-test/suite/rpl/t/create_or_replace.inc index 7d0dc487061..35a6ead60ca 100644 --- a/mysql-test/suite/rpl/t/create_or_replace.inc +++ b/mysql-test/suite/rpl/t/create_or_replace.inc @@ -205,6 +205,19 @@ set binlog_format="STATEMENT"; drop temporary table t8; set @@binlog_format=@org_binlog_format; +# MDEV-20091: +# 1. No DROP should be logged for non-existing tmp table, nor +# 2. at the connection close when its creation has not been logged. +set @@session.binlog_format=default; +drop temporary table if exists t9; + +--connect(con1,localhost,root,,) +set session binlog_format=default; +create temporary table t9 (i int); +--echo *** Must be no DROP logged for t9 when there was no CREATE, at disconnect too *** +--disconnect con1 + +--connection server_1 --source include/show_binlog_events.inc # Clean up diff --git a/mysql-test/suite/rpl/t/rpl_row_drop_temp_table.test b/mysql-test/suite/rpl/t/rpl_row_drop_temp_table.test new file mode 100644 index 00000000000..5484928f383 --- /dev/null +++ b/mysql-test/suite/rpl/t/rpl_row_drop_temp_table.test @@ -0,0 +1,54 @@ +# ==== Purpose ==== +# +# Test verifies that plain DROP TEMPORARY TABLE IF EXISTS statements are not +# replicated during row based replication. +# +# ==== Implementation ==== +# +# Steps: +# 0 - Have a read_only master and slave. Binlog format should be "ROW". +# 1 - Create a procedure which executes DROP TEMPORARY TABLE IF EXISTS +# statements prior to CREATE TEMPORARY TABLE. +# 2 - Execute the procedure. +# 3 - Verify that the DROP TEMPORARY TABLE IF EXISTS statements within the +# procedure are not written to the binary log. +# +# ==== References ==== +# +# MDEV-20091: DROP TEMPORARY table is logged despite no CREATE was logged +# + +--source include/have_binlog_format_row.inc +--source include/have_innodb.inc +--source include/master-slave.inc + +--source include/rpl_connection_slave.inc +SET GLOBAL read_only=1; + +--source include/rpl_connection_master.inc +DELIMITER |; +CREATE PROCEDURE testproc() +BEGIN + DROP TEMPORARY TABLE IF EXISTS t1_tmp; + DROP TEMPORARY TABLE IF EXISTS t2_tmp; + CREATE TEMPORARY TABLE IF NOT EXISTS t1_tmp ( t1 varchar(400) DEFAULT NULL) ENGINE=InnoDB DEFAULT CHARSET=utf8; + CREATE TEMPORARY TABLE IF NOT EXISTS t2_tmp ( t2 varchar(16) NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; +END| +DELIMITER ;| +SET GLOBAL read_only=1; +CALL testproc(); +--echo ******** None of the above DROP TEMPORARY TABLE statement should be found in binary log ******** +--source include/show_binlog_events.inc +--sync_slave_with_master +SELECT @@read_only; + +--echo ======== CLEAN UP ========= +--source include/rpl_connection_master.inc +DROP TEMPORARY TABLE t1_tmp; +DROP TEMPORARY TABLE t2_tmp; +DROP PROCEDURE testproc; +SET GLOBAL read_only=0; +--sync_slave_with_master +SET GLOBAL read_only=0; + +--source include/rpl_end.inc diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 335d3a9dfce..e8bdff8b48f 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1205,7 +1205,7 @@ bool close_temporary_tables(THD *thd) my_thread_id save_pseudo_thread_id= thd->variables.pseudo_thread_id; char db_buf[FN_REFLEN]; String db(db_buf, sizeof(db_buf), system_charset_info); - + bool at_least_one_create_logged; /* Set pseudo_thread_id to be that of the processed table */ thd->variables.pseudo_thread_id= tmpkeyval(thd, table); @@ -1217,56 +1217,62 @@ bool close_temporary_tables(THD *thd) within the sublist of common pseudo_thread_id to create single DROP query */ - for (; + for (at_least_one_create_logged= false; table && is_user_table(table) && tmpkeyval(thd, table) == thd->variables.pseudo_thread_id && table->s->db.length == db.length() && memcmp(table->s->db.str, db.ptr(), db.length()) == 0; table= next) { - /* - We are going to add ` around the table names and possible more - due to special characters - */ - append_identifier(thd, &s_query, table->s->table_name.str, - strlen(table->s->table_name.str)); - s_query.append(','); + if (table->s->table_creation_was_logged) + { + at_least_one_create_logged= true; + /* + We are going to add ` around the table names and possible more + due to special characters + */ + append_identifier(thd, &s_query, table->s->table_name.str, + strlen(table->s->table_name.str)); + s_query.append(','); + } next= table->next; mysql_lock_remove(thd, thd->lock, table); close_temporary(table, 1, 1); } - thd->clear_error(); - CHARSET_INFO *cs_save= thd->variables.character_set_client; - thd->variables.character_set_client= system_charset_info; - thd->thread_specific_used= TRUE; - Query_log_event qinfo(thd, s_query.ptr(), - s_query.length() - 1 /* to remove trailing ',' */, - FALSE, TRUE, FALSE, 0); - qinfo.db= db.ptr(); - qinfo.db_len= db.length(); - thd->variables.character_set_client= cs_save; - - thd->get_stmt_da()->set_overwrite_status(true); - thd->transaction.stmt.mark_dropped_temp_table(); - if ((error= (mysql_bin_log.write(&qinfo) || error))) + if (at_least_one_create_logged) { - /* - If we're here following THD::cleanup, thence the connection - has been closed already. So lets print a message to the - error log instead of pushing yet another error into the - stmt_da. + thd->clear_error(); + CHARSET_INFO *cs_save= thd->variables.character_set_client; + thd->variables.character_set_client= system_charset_info; + thd->thread_specific_used= TRUE; + Query_log_event qinfo(thd, s_query.ptr(), + s_query.length() - 1 /* to remove trailing ',' */, + FALSE, TRUE, FALSE, 0); + qinfo.db= db.ptr(); + qinfo.db_len= db.length(); + thd->variables.character_set_client= cs_save; - Also, we keep the error flag so that we propagate the error - up in the stack. This way, if we're the SQL thread we notice - that close_temporary_tables failed. (Actually, the SQL - thread only calls close_temporary_tables while applying old - Start_log_event_v3 events.) - */ - sql_print_error("Failed to write the DROP statement for " - "temporary tables to binary log"); + thd->get_stmt_da()->set_overwrite_status(true); + thd->transaction.stmt.mark_dropped_temp_table(); + if ((error= (mysql_bin_log.write(&qinfo) || error))) + { + /* + If we're here following THD::cleanup, thence the connection + has been closed already. So lets print a message to the + error log instead of pushing yet another error into the + stmt_da. + + Also, we keep the error flag so that we propagate the error + up in the stack. This way, if we're the SQL thread we notice + that close_temporary_tables failed. (Actually, the SQL + thread only calls close_temporary_tables while applying old + Start_log_event_v3 events.) + */ + sql_print_error("Failed to write the DROP statement for " + "temporary tables to binary log"); + } + thd->get_stmt_da()->set_overwrite_status(false); } - thd->get_stmt_da()->set_overwrite_status(false); - thd->variables.pseudo_thread_id= save_pseudo_thread_id; thd->thread_specific_used= save_thread_specific_used; } diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 2696513d95f..25bbaf23617 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -2265,7 +2265,7 @@ int mysql_rm_table_no_locks(THD *thd, TABLE_LIST *tables, bool if_exists, for (table= tables; table; table= table->next_local) { bool is_trans= 0; - bool table_creation_was_logged= 1; + bool table_creation_was_logged= 0; char *db=table->db; size_t db_length= table->db_length; handlerton *table_type= 0; From f6ea0389a4ea61dd0accbc3f949ef6c6d9a91417 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marko=20M=C3=A4kel=C3=A4?= Date: Thu, 25 Jul 2019 10:30:28 +0300 Subject: [PATCH 12/13] Replace ut_timer() with my_interval_timer() The function pointer ut_timer() was only used by the InnoDB defragmenting thread. Let InnoDB use a single monotonic high-precision timer, my_interval_timer() [in nanoseconds], occasionally wrapped by microsecond_interval_timer(). srv_defragment_interval: Change from "timer" units to nanoseconds. This concludes the InnoDB time function cleanup that was motivated by MDEV-14154. Only ut_time_ms() will remain for now, wrapping my_interval_timer(). --- storage/innobase/CMakeLists.txt | 3 +- storage/innobase/btr/btr0defragment.cc | 17 +++-- storage/innobase/handler/ha_innodb.cc | 4 +- storage/innobase/include/ut0timer.h | 69 ------------------- storage/innobase/include/ut0timer.ic | 56 ---------------- storage/innobase/srv/srv0start.cc | 4 -- storage/innobase/ut/ut0timer.cc | 90 ------------------------- storage/xtradb/CMakeLists.txt | 3 +- storage/xtradb/btr/btr0defragment.cc | 16 ++--- storage/xtradb/handler/ha_innodb.cc | 4 +- storage/xtradb/include/ut0timer.h | 69 ------------------- storage/xtradb/include/ut0timer.ic | 56 ---------------- storage/xtradb/srv/srv0start.cc | 4 -- storage/xtradb/ut/ut0timer.cc | 91 -------------------------- 14 files changed, 19 insertions(+), 467 deletions(-) delete mode 100644 storage/innobase/include/ut0timer.h delete mode 100644 storage/innobase/include/ut0timer.ic delete mode 100644 storage/innobase/ut/ut0timer.cc delete mode 100644 storage/xtradb/include/ut0timer.h delete mode 100644 storage/xtradb/include/ut0timer.ic delete mode 100644 storage/xtradb/ut/ut0timer.cc diff --git a/storage/innobase/CMakeLists.txt b/storage/innobase/CMakeLists.txt index 9350cf3e02f..44db4552e74 100644 --- a/storage/innobase/CMakeLists.txt +++ b/storage/innobase/CMakeLists.txt @@ -497,8 +497,7 @@ SET(INNOBASE_SOURCES ut/ut0rnd.cc ut/ut0ut.cc ut/ut0vec.cc - ut/ut0wqueue.cc - ut/ut0timer.cc) + ut/ut0wqueue.cc) IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") enable_language(ASM) diff --git a/storage/innobase/btr/btr0defragment.cc b/storage/innobase/btr/btr0defragment.cc index 1cc452bb62f..070f6a9cc0a 100644 --- a/storage/innobase/btr/btr0defragment.cc +++ b/storage/innobase/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** -Copyright (C) 2013, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved. +Copyright (C) 2014, 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 @@ -35,7 +35,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com #include "ibuf0ibuf.h" #include "lock0lock.h" #include "srv0start.h" -#include "ut0timer.h" #include @@ -99,8 +98,7 @@ Initialize defragmentation. */ void btr_defragment_init() { - srv_defragment_interval = ut_microseconds_to_timer( - 1000000.0 / srv_defragment_frequency); + srv_defragment_interval = 1000000000ULL / srv_defragment_frequency; mutex_create(btr_defragment_mutex_key, &btr_defragment_mutex, SYNC_ANY_LATCH); } @@ -728,7 +726,7 @@ DECLARE_THREAD(btr_defragment_thread)(void*) } pcur = item->pcur; - ulonglong now = ut_timer_now(); + ulonglong now = my_interval_timer(); ulonglong elapsed = now - item->last_processed; if (elapsed < srv_defragment_interval) { @@ -738,11 +736,12 @@ DECLARE_THREAD(btr_defragment_thread)(void*) defragmentation of all indices queue up on a single thread, it's likely other indices that follow this one don't need to sleep again. */ - os_thread_sleep(((ulint)ut_timer_to_microseconds( - srv_defragment_interval - elapsed))); + os_thread_sleep(static_cast + ((srv_defragment_interval - elapsed) + / 1000)); } - now = ut_timer_now(); + now = my_interval_timer(); mtr_start(&mtr); btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, &mtr); cursor = btr_pcur_get_btr_cur(pcur); diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index b14fe261c13..081fcbd9c51 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -95,7 +95,6 @@ MYSQL_PLUGIN_IMPORT extern char mysql_unpacked_real_data_home[]; #include "dict0stats_bg.h" #include "ha_prototypes.h" #include "ut0mem.h" -#include "ut0timer.h" #include "ibuf0ibuf.h" #include "dict0dict.h" #include "srv0mon.h" @@ -18052,8 +18051,7 @@ innodb_defragment_frequency_update( from check function */ { srv_defragment_frequency = (*static_cast(save)); - srv_defragment_interval = ut_microseconds_to_timer( - 1000000.0 / srv_defragment_frequency); + srv_defragment_interval = 1000000000ULL / srv_defragment_frequency; } /****************************************************************//** diff --git a/storage/innobase/include/ut0timer.h b/storage/innobase/include/ut0timer.h deleted file mode 100644 index 405648fe3a2..00000000000 --- a/storage/innobase/include/ut0timer.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/ut0timer.h -Timer routines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ -#ifndef ut0timer_h -#define ut0timer_h - -#include "univ.i" - -/* Current timer stats */ -extern struct my_timer_unit_info ut_timer; - -/**************************************************************//** -Function pointer to point selected timer function. -@return timer current value */ -extern ulonglong (*ut_timer_now)(void); - -/**************************************************************//** -Sets up the data required for use of my_timer_* functions. -Selects the best timer by high frequency, and tight resolution. -Points my_timer_now() to the selected timer function. -Initializes my_timer struct to contain the info for selected timer.*/ -UNIV_INTERN -void ut_init_timer(void); - -/**************************************************************//** -Convert native timer units in a ulonglong into microseconds in a double -@return time in microseconds */ -UNIV_INLINE -double -ut_timer_to_microseconds( -/*=====================*/ - ulonglong when); /*!< in: time where to calculate */ -/**************************************************************//** -Convert microseconds in a double to native timer units in a ulonglong -@return time in microseconds */ -UNIV_INLINE -ulonglong -ut_microseconds_to_timer( -/*=====================*/ - ulonglong when); /*!< in: time where to calculate */ - -#ifndef UNIV_NONINL -#include "ut0timer.ic" -#endif - -#endif diff --git a/storage/innobase/include/ut0timer.ic b/storage/innobase/include/ut0timer.ic deleted file mode 100644 index 26cf0bd2fbe..00000000000 --- a/storage/innobase/include/ut0timer.ic +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/ut0timer.ic -Timer routines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ - -/**************************************************************//** -Convert native timer units in a ulonglong into microseconds in a double -@return time in microseconds */ -UNIV_INLINE -double -ut_timer_to_microseconds( -/*=====================*/ - ulonglong when) /*!< in: time where to calculate */ -{ - double ret = (double)(when); - ret *= 1000000.0; - ret /= (double)(ut_timer.frequency); - return ret; -} - -/**************************************************************//** -Convert microseconds in a double to native timer units in a ulonglong -@return time in microseconds */ -UNIV_INLINE -ulonglong -ut_microseconds_to_timer( -/*=====================*/ - ulonglong when) /*!< in: time where to calculate */ -{ - double ret = (double)when; - ret *= (double)(ut_timer.frequency); - ret /= 1000000.0; - return (ulonglong)ret; -} diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc index 3c63b28ed5b..a73e67e9f5b 100644 --- a/storage/innobase/srv/srv0start.cc +++ b/storage/innobase/srv/srv0start.cc @@ -43,7 +43,6 @@ Created 2/16/1996 Heikki Tuuri #include "pars0pars.h" #include "row0ftsort.h" #include "ut0mem.h" -#include "ut0timer.h" #include "mem0mem.h" #include "data0data.h" #include "data0type.h" @@ -1669,9 +1668,6 @@ innobase_start_or_create_for_mysql() os_fast_mutex_free(&srv_os_test_mutex); - /* This should be initialized early */ - ut_init_timer(); - if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) { srv_read_only_mode = 1; } diff --git a/storage/innobase/ut/ut0timer.cc b/storage/innobase/ut/ut0timer.cc deleted file mode 100644 index 9aefcafebc6..00000000000 --- a/storage/innobase/ut/ut0timer.cc +++ /dev/null @@ -1,90 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, SkySQL Ab. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file ut/ut0timer.cc -Timer rountines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ - -#include "data0type.h" -#include -#include - -/**************************************************************//** -Initial timer definition -@return 0 */ -static -ulonglong -ut_timer_none(void) -/*===============*/ -{ - return 0; -} - -/**************************************************************//** -Function pointer to point selected timer function. -@return timer current value */ -ulonglong (*ut_timer_now)(void) = &ut_timer_none; - -struct my_timer_unit_info ut_timer; -extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; - -/**************************************************************//** -Sets up the data required for use of my_timer_* functions. -Selects the best timer by high frequency, and tight resolution. -Points my_timer_now() to the selected timer function. -Initializes my_timer struct to contain the info for selected timer.*/ -UNIV_INTERN -void -ut_init_timer(void) -/*===============*/ -{ - if (sys_timer_info.cycles.frequency > 1000000 && - sys_timer_info.cycles.resolution == 1) { - ut_timer = sys_timer_info.cycles; - ut_timer_now = &my_timer_cycles; - } else if (sys_timer_info.nanoseconds.frequency > 1000000 && - sys_timer_info.nanoseconds.resolution == 1) { - ut_timer = sys_timer_info.nanoseconds; - ut_timer_now = &my_timer_nanoseconds; - } else if (sys_timer_info.microseconds.frequency >= 1000000 && - sys_timer_info.microseconds.resolution == 1) { - ut_timer = sys_timer_info.microseconds; - ut_timer_now = &my_timer_microseconds; - - } else if (sys_timer_info.milliseconds.frequency >= 1000 && - sys_timer_info.milliseconds.resolution == 1) { - ut_timer = sys_timer_info.milliseconds; - ut_timer_now = &my_timer_milliseconds; - } else if (sys_timer_info.ticks.frequency >= 1000 && - /* Will probably be false */ - sys_timer_info.ticks.resolution == 1) { - ut_timer = sys_timer_info.ticks; - ut_timer_now = &my_timer_ticks; - } else { - /* None are acceptable, so leave it as "None", and fill in struct */ - ut_timer.frequency = 1; /* Avoid div-by-zero */ - ut_timer.overhead = 0; /* Since it doesn't do anything */ - ut_timer.resolution = 10; /* Another sign it's bad */ - ut_timer.routine = 0; /* None */ - } -} diff --git a/storage/xtradb/CMakeLists.txt b/storage/xtradb/CMakeLists.txt index 62825a54152..cc269b44201 100644 --- a/storage/xtradb/CMakeLists.txt +++ b/storage/xtradb/CMakeLists.txt @@ -493,8 +493,7 @@ SET(INNOBASE_SOURCES ut/ut0rnd.cc ut/ut0ut.cc ut/ut0vec.cc - ut/ut0wqueue.cc - ut/ut0timer.cc) + ut/ut0wqueue.cc) IF(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64le") enable_language(ASM) diff --git a/storage/xtradb/btr/btr0defragment.cc b/storage/xtradb/btr/btr0defragment.cc index 51efe6775b2..070f6a9cc0a 100644 --- a/storage/xtradb/btr/btr0defragment.cc +++ b/storage/xtradb/btr/btr0defragment.cc @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved. -Copyright (C) 2014, 2015, MariaDB Corporation. All Rights Reserved. +Copyright (C) 2014, 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 @@ -35,8 +35,6 @@ Modified 30/07/2014 Jan Lindström jan.lindstrom@mariadb.com #include "ibuf0ibuf.h" #include "lock0lock.h" #include "srv0start.h" -#include "srv0srv.h" -#include "ut0timer.h" #include @@ -100,8 +98,7 @@ Initialize defragmentation. */ void btr_defragment_init() { - srv_defragment_interval = ut_microseconds_to_timer( - 1000000.0 / srv_defragment_frequency); + srv_defragment_interval = 1000000000ULL / srv_defragment_frequency; mutex_create(btr_defragment_mutex_key, &btr_defragment_mutex, SYNC_ANY_LATCH); } @@ -729,7 +726,7 @@ DECLARE_THREAD(btr_defragment_thread)(void*) } pcur = item->pcur; - ulonglong now = ut_timer_now(); + ulonglong now = my_interval_timer(); ulonglong elapsed = now - item->last_processed; if (elapsed < srv_defragment_interval) { @@ -739,11 +736,12 @@ DECLARE_THREAD(btr_defragment_thread)(void*) defragmentation of all indices queue up on a single thread, it's likely other indices that follow this one don't need to sleep again. */ - os_thread_sleep(((ulint)ut_timer_to_microseconds( - srv_defragment_interval - elapsed))); + os_thread_sleep(static_cast + ((srv_defragment_interval - elapsed) + / 1000)); } - now = ut_timer_now(); + now = my_interval_timer(); mtr_start(&mtr); btr_pcur_restore_position(BTR_MODIFY_TREE, pcur, &mtr); cursor = btr_pcur_get_btr_cur(pcur); diff --git a/storage/xtradb/handler/ha_innodb.cc b/storage/xtradb/handler/ha_innodb.cc index 4a39a0a9c4d..5e7482ff6bf 100644 --- a/storage/xtradb/handler/ha_innodb.cc +++ b/storage/xtradb/handler/ha_innodb.cc @@ -92,7 +92,6 @@ this program; if not, write to the Free Software Foundation, Inc., #include "dict0stats_bg.h" #include "ha_prototypes.h" #include "ut0mem.h" -#include "ut0timer.h" #include "ibuf0ibuf.h" #include "dict0dict.h" #include "srv0mon.h" @@ -18772,8 +18771,7 @@ innodb_defragment_frequency_update( from check function */ { srv_defragment_frequency = (*static_cast(save)); - srv_defragment_interval = ut_microseconds_to_timer( - 1000000.0 / srv_defragment_frequency); + srv_defragment_interval = 1000000000ULL / srv_defragment_frequency; } /****************************************************************//** diff --git a/storage/xtradb/include/ut0timer.h b/storage/xtradb/include/ut0timer.h deleted file mode 100644 index 405648fe3a2..00000000000 --- a/storage/xtradb/include/ut0timer.h +++ /dev/null @@ -1,69 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/ut0timer.h -Timer routines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ -#ifndef ut0timer_h -#define ut0timer_h - -#include "univ.i" - -/* Current timer stats */ -extern struct my_timer_unit_info ut_timer; - -/**************************************************************//** -Function pointer to point selected timer function. -@return timer current value */ -extern ulonglong (*ut_timer_now)(void); - -/**************************************************************//** -Sets up the data required for use of my_timer_* functions. -Selects the best timer by high frequency, and tight resolution. -Points my_timer_now() to the selected timer function. -Initializes my_timer struct to contain the info for selected timer.*/ -UNIV_INTERN -void ut_init_timer(void); - -/**************************************************************//** -Convert native timer units in a ulonglong into microseconds in a double -@return time in microseconds */ -UNIV_INLINE -double -ut_timer_to_microseconds( -/*=====================*/ - ulonglong when); /*!< in: time where to calculate */ -/**************************************************************//** -Convert microseconds in a double to native timer units in a ulonglong -@return time in microseconds */ -UNIV_INLINE -ulonglong -ut_microseconds_to_timer( -/*=====================*/ - ulonglong when); /*!< in: time where to calculate */ - -#ifndef UNIV_NONINL -#include "ut0timer.ic" -#endif - -#endif diff --git a/storage/xtradb/include/ut0timer.ic b/storage/xtradb/include/ut0timer.ic deleted file mode 100644 index cfd39675b7c..00000000000 --- a/storage/xtradb/include/ut0timer.ic +++ /dev/null @@ -1,56 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, 2018, MariaDB Corporation. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file include/ut0timer.ic -Timer routines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ - -/**************************************************************//** -Convert native timer units in a ulonglong into microseconds in a double -@return time in microseconds */ -UNIV_INLINE -double -ut_timer_to_microseconds( -/*=====================*/ - ulonglong when) /*!< in: time where to calculate */ -{ - double ret = (double)(when); - ret *= 1000000.0; - ret /= (double)(ut_timer.frequency); - return ret; -} - -/**************************************************************//** -Convert microseconds in a double to native timer units in a ulonglong -@return time in microseconds */ -UNIV_INLINE -ulonglong -ut_microseconds_to_timer( -/*=====================*/ - ulonglong when) /*!< in: time where to calculate */ -{ - double ret = (double)when; - ret *= (double)(ut_timer.frequency); - ret /= 1000000.0; - return (ulonglong)ret; -} diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index 3d18593fb0f..153599391dc 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -71,7 +71,6 @@ Created 2/16/1996 Heikki Tuuri #include "srv0srv.h" #include "buf0flu.h" #include "btr0defragment.h" -#include "ut0timer.h" #include "btr0scrub.h" #include "mysql/service_wsrep.h" /* wsrep_recovery */ @@ -1743,9 +1742,6 @@ innobase_start_or_create_for_mysql() os_fast_mutex_free(&srv_os_test_mutex); - /* This should be initialized early */ - ut_init_timer(); - if (srv_force_recovery == SRV_FORCE_NO_LOG_REDO) { srv_read_only_mode = 1; } diff --git a/storage/xtradb/ut/ut0timer.cc b/storage/xtradb/ut/ut0timer.cc deleted file mode 100644 index 7d458040d15..00000000000 --- a/storage/xtradb/ut/ut0timer.cc +++ /dev/null @@ -1,91 +0,0 @@ -/***************************************************************************** - -Copyright (c) 2013, 2014, Facebook, Inc. All Rights Reserved. -Copyright (c) 2014, SkySQL Ab. All Rights Reserved. - -This program is free software; you can redistribute it and/or modify it under -the terms of the GNU General Public License as published by the Free Software -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/********************************************************************//** -@file ut/ut0timer.cc -Timer rountines - -Created 30/07/2014 Jan Lindström jan.lindstrom@skysql.com -modified from https://github.com/facebook/mysql-5.6/commit/c75a413edeb96eb99bf11d7269bdfea06f96d6b6 -*************************************************************************/ - -#include "data0type.h" -#include -#include - -/**************************************************************//** -Initial timer definition -@return 0 */ -static -ulonglong -ut_timer_none(void) -/*===============*/ -{ - return 0; -} - -/**************************************************************//** -Function pointer to point selected timer function. -@return timer current value */ -ulonglong (*ut_timer_now)(void) = &ut_timer_none; - -struct my_timer_unit_info ut_timer; - -extern MYSQL_PLUGIN_IMPORT MY_TIMER_INFO sys_timer_info; - -/**************************************************************//** -Sets up the data required for use of my_timer_* functions. -Selects the best timer by high frequency, and tight resolution. -Points my_timer_now() to the selected timer function. -Initializes my_timer struct to contain the info for selected timer.*/ -UNIV_INTERN -void -ut_init_timer(void) -/*===============*/ -{ - if (sys_timer_info.cycles.frequency > 1000000 && - sys_timer_info.cycles.resolution == 1) { - ut_timer = sys_timer_info.cycles; - ut_timer_now = &my_timer_cycles; - } else if (sys_timer_info.nanoseconds.frequency > 1000000 && - sys_timer_info.nanoseconds.resolution == 1) { - ut_timer = sys_timer_info.nanoseconds; - ut_timer_now = &my_timer_nanoseconds; - } else if (sys_timer_info.microseconds.frequency >= 1000000 && - sys_timer_info.microseconds.resolution == 1) { - ut_timer = sys_timer_info.microseconds; - ut_timer_now = &my_timer_microseconds; - - } else if (sys_timer_info.milliseconds.frequency >= 1000 && - sys_timer_info.milliseconds.resolution == 1) { - ut_timer = sys_timer_info.milliseconds; - ut_timer_now = &my_timer_milliseconds; - } else if (sys_timer_info.ticks.frequency >= 1000 && - /* Will probably be false */ - sys_timer_info.ticks.resolution == 1) { - ut_timer = sys_timer_info.ticks; - ut_timer_now = &my_timer_ticks; - } else { - /* None are acceptable, so leave it as "None", and fill in struct */ - ut_timer.frequency = 1; /* Avoid div-by-zero */ - ut_timer.overhead = 0; /* Since it doesn't do anything */ - ut_timer.resolution = 10; /* Another sign it's bad */ - ut_timer.routine = 0; /* None */ - } -} From 8d0dabc56b09c6b40db15aac7da0da43d988759d Mon Sep 17 00:00:00 2001 From: Sujatha Date: Thu, 25 Jul 2019 14:23:47 +0530 Subject: [PATCH 13/13] MDEV-20091 DROP TEMPORARY table is logged despite no CREATE was logged Fixing post push test issues. Recorded the result files for following: rpl_stm_drop_create_temp_table.result rpl_mixed_drop_create_temp_table.result. --- .../r/rpl_mixed_drop_create_temp_table.result | 31 +++++-------------- .../r/rpl_stm_drop_create_temp_table.result | 31 +++++-------------- 2 files changed, 14 insertions(+), 48 deletions(-) diff --git a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result index da807748cee..d79b246c8d6 100644 --- a/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_mixed_drop_create_temp_table.result @@ -89,9 +89,6 @@ Warnings: Note 1051 Unknown table 'test.tt_xx_1' -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TXe-Temp'; @@ -112,7 +109,7 @@ Note 1051 Unknown table 'test.tt_1' include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-NXe-Temp'; @@ -134,8 +131,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TN-Temp'; @@ -291,7 +286,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -314,8 +308,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -368,7 +360,7 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -391,8 +383,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -454,7 +446,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -483,8 +474,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -801,7 +790,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -826,8 +814,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -882,7 +868,7 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -907,8 +893,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -972,7 +958,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -1003,8 +988,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- diff --git a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result index 9dc86c0bfa7..0cad8f122de 100644 --- a/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result +++ b/mysql-test/suite/rpl/r/rpl_stm_drop_create_temp_table.result @@ -89,9 +89,6 @@ Warnings: Note 1051 Unknown table 'test.tt_xx_1' -b-b-b-b-b-b-b-b-b-b-b- >> Drop-Temp-If-Xe-Temp << -b-b-b-b-b-b-b-b-b-b-b- include/show_binlog_events.inc -Log_name Pos Event_type Server_id End_log_pos Info -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-Xe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TXe-Temp'; @@ -112,7 +109,7 @@ Note 1051 Unknown table 'test.tt_1' include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-TXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-NXe-Temp'; @@ -134,8 +131,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -e-e-e-e-e-e-e-e-e-e-e- >> Drop-Temp-If-NXe-Temp << -e-e-e-e-e-e-e-e-e-e-e- SET @commands= 'Drop-Temp-TN-Temp'; @@ -291,7 +286,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -314,8 +308,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -368,7 +360,7 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -391,8 +383,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -454,7 +446,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -483,8 +474,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Xid # # COMMIT /* XID */ -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp C << -e-e-e-e-e-e-e-e-e-e-e- @@ -801,7 +790,6 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -826,8 +814,6 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_xx_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-Xe-Temp N Drop-Temp-If-Xe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -882,7 +868,7 @@ include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -907,8 +893,8 @@ master-bin.000001 # Query # # use `test`; INSERT INTO nt_xx_1() VALUES (1) master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2`,`test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1`,`test`.`tt_1` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_2` /* generated by server */ +master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_tmp_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-TXe-Temp N Drop-Temp-If-TXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -972,7 +958,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_2` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e- @@ -1003,8 +988,6 @@ master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`nt_tmp_1` / master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; INSERT INTO tt_xx_1() VALUES (1) -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ -master-bin.000001 # Query # # DROP TEMPORARY TABLE IF EXISTS `test`.`tt_1` /* generated by server */ master-bin.000001 # Query # # ROLLBACK -e-e-e-e-e-e-e-e-e-e-e- >> B T Drop-Temp-If-NXe-Temp N Drop-Temp-If-NXe-Temp R << -e-e-e-e-e-e-e-e-e-e-e-